/* ==========================================================================
   Pdflify — core stylesheet
   Design tokens -> layout -> components -> utilities -> responsive
   ========================================================================== */

:root {
  --ink: #0d1424;
  --ink-2: #2b3547;
  --muted: #626d80;
  --bg: #ffffff;
  --bg-soft: #f6f8fc;
  --bg-elev: #ffffff;
  --line: #e5eaf3;
  --brand: #1b4dff;
  --brand-2: #00b39a;
  --brand-ink: #0b2ea8;
  --ring: rgba(27, 77, 255, 0.35);
  --grad: linear-gradient(135deg, #1b4dff 0%, #00b39a 100%);
  --grad-soft: linear-gradient(135deg, rgba(27, 77, 255, 0.08), rgba(0, 179, 154, 0.08));
  --shadow-sm: 0 1px 2px rgba(13, 20, 36, 0.05);
  --shadow: 0 10px 30px -12px rgba(13, 20, 36, 0.18);
  --shadow-lg: 0 28px 60px -28px rgba(13, 20, 36, 0.32);
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 24px;
  --maxw: 1180px;
  --header-h: 72px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Poppins", var(--font);
}

html[data-theme="dark"] {
  --ink: #eef2fa;
  --ink-2: #c6cede;
  --muted: #96a1b5;
  --bg: #0b0f1a;
  --bg-soft: #101726;
  --bg-elev: #121a2b;
  --line: #212b40;
  --brand: #6f8cff;
  --brand-2: #2ad4b8;
  --ring: rgba(111, 140, 255, 0.4);
  --grad: linear-gradient(135deg, #5c7cff 0%, #17c4a8 100%);
  --grad-soft: linear-gradient(135deg, rgba(92, 124, 255, 0.14), rgba(23, 196, 168, 0.12));
  --shadow: 0 12px 36px -16px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, 0.8);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; color: var(--ink); margin: 0 0 .5em; letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 4.6vw, 3.35rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 2.8vw, 2.1rem); font-weight: 650; }
h3 { font-size: 1.15rem; font-weight: 600; }
p { margin: 0 0 1rem; color: var(--ink-2); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
ul, ol { color: var(--ink-2); }

:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
  border-radius: 6px;
}

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.section { padding: 72px 0; }
.section--soft { background: var(--bg-soft); }
.eyebrow { font-size: .78rem; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; color: var(--brand); margin-bottom: .6rem; }
.lede { font-size: 1.08rem; color: var(--muted); max-width: 62ch; }
.center { text-align: center; }
.center .lede { margin-inline: auto; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 18px; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; flex: 0 0 34px; }
.brand-dot { color: var(--brand); }

.nav { margin-left: auto; }
.nav ul { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav a {
  display: block; padding: 9px 12px; border-radius: 10px;
  color: var(--ink-2); font-size: .93rem; font-weight: 500;
}
.nav a:hover, .nav a[aria-current="page"] { background: var(--bg-soft); color: var(--ink); text-decoration: none; }

.header-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg-elev); color: var(--ink-2);
  cursor: pointer; transition: transform .15s ease, box-shadow .2s ease, color .2s;
}
.icon-btn:hover { color: var(--ink); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.nav-toggle { display: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; font-size: .95rem; cursor: pointer; font-family: var(--font);
  transition: transform .16s ease, box-shadow .22s ease, background .2s, color .2s;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 10px 24px -12px rgba(27, 77, 255, .8); }
.btn-primary:hover { box-shadow: 0 16px 30px -12px rgba(27, 77, 255, .75); }
.btn-ghost { background: var(--bg-elev); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg-soft); }
.btn-lg { padding: 14px 26px; font-size: 1rem; border-radius: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* mobile drawer */
.mobile-nav {
  display: none; border-top: 1px solid var(--line); background: var(--bg);
  padding: 12px 0 20px;
}
.mobile-nav.open { display: block; }
.mobile-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.mobile-nav a { display: block; padding: 12px 14px; border-radius: 12px; color: var(--ink); font-weight: 500; }
.mobile-nav a:hover { background: var(--bg-soft); text-decoration: none; }

/* ---------- Search overlay ---------- */
.search-overlay {
  position: fixed; inset: 0; z-index: 90; display: none;
  background: rgba(10, 14, 24, .5); backdrop-filter: blur(6px);
  padding: 10vh 16px;
}
.search-overlay.open { display: block; }
.search-panel {
  max-width: 640px; margin: 0 auto; background: var(--bg-elev);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.search-field { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.search-field input {
  flex: 1; border: 0; background: transparent; color: var(--ink);
  font-size: 1.05rem; font-family: var(--font); padding: 6px 0;
}
.search-field input:focus { outline: none; }
.search-results { list-style: none; margin: 0; padding: 8px; max-height: 52vh; overflow-y: auto; }
.search-results li a { display: block; padding: 10px 12px; border-radius: 12px; color: var(--ink); }
.search-results li a:hover, .search-results li a:focus { background: var(--bg-soft); text-decoration: none; }
.search-results .sr-name { font-weight: 600; }
.search-results .sr-desc { display: block; font-size: .85rem; color: var(--muted); }
.search-empty { padding: 22px; color: var(--muted); text-align: center; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 84px 0 72px; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -30% -20% auto -20%; height: 620px;
  background: radial-gradient(60% 60% at 30% 30%, rgba(27, 77, 255, .16), transparent 70%),
              radial-gradient(50% 50% at 80% 20%, rgba(0, 179, 154, .16), transparent 70%);
  pointer-events: none;
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(70% 60% at 50% 0%, #000 20%, transparent 75%);
}
.hero .container { position: relative; z-index: 1; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px;
  background: var(--grad-soft); border: 1px solid var(--line); color: var(--ink-2);
  font-size: .82rem; font-weight: 600; margin-bottom: 18px;
}
.hero-visual {
  position: relative; border-radius: var(--r-lg); border: 1px solid var(--line);
  background: var(--bg-elev); box-shadow: var(--shadow-lg); padding: 26px;
}

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 22px; box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .25s ease, border-color .25s ease;
}
.tool-card { display: flex; flex-direction: column; gap: 10px; color: inherit; position: relative; }
.tool-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); text-decoration: none; }
.tool-card h3 { margin: 0; font-size: 1.02rem; }
.tool-card p { margin: 0; font-size: .9rem; color: var(--muted); }
.tool-ico {
  width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
  background: var(--grad-soft); color: var(--brand); border: 1px solid var(--line);
}
.tool-card .arrow { margin-top: auto; padding-top: 8px; color: var(--brand); font-weight: 600; font-size: .85rem; display: inline-flex; align-items: center; gap: 6px; }
.tool-card:hover .arrow svg { transform: translateX(4px); }
.tool-card .arrow svg { transition: transform .18s ease; }

.cat-card h3 { display: flex; align-items: center; gap: 10px; }
.cat-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.cat-card ul a { color: var(--ink-2); font-size: .92rem; }

.benefit { display: flex; gap: 14px; }
.benefit .tool-ico { flex: 0 0 44px; }
.benefit h3 { margin-bottom: .25rem; }
.benefit p { margin: 0; font-size: .92rem; color: var(--muted); }

.step { position: relative; padding-top: 8px; }
.step-num {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; color: #fff; background: var(--grad); margin-bottom: 12px;
}

/* ---------- FAQ ---------- */
.faq { display: grid; gap: 10px; max-width: 820px; margin: 0 auto; }
.faq details {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r);
  padding: 4px 18px; transition: border-color .2s;
}
.faq details[open] { border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); }
.faq summary {
  cursor: pointer; padding: 14px 0; font-weight: 600; color: var(--ink);
  list-style: none; display: flex; justify-content: space-between; gap: 16px; align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.3rem; color: var(--brand); line-height: 1; }
.faq details[open] summary::after { content: "\2013"; }
.faq p { margin: 0 0 14px; font-size: .95rem; }

/* ---------- CTA band ---------- */
.cta-band {
  border-radius: var(--r-lg); padding: 52px 40px; text-align: center; color: #fff;
  background: var(--grad); box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
}
.cta-band h2, .cta-band p { color: #fff; }
.cta-band p { opacity: .92; }
.cta-band .btn-ghost { background: #fff; color: #0b2ea8; border-color: transparent; }

/* ---------- Breadcrumbs ---------- */
.crumbs { padding: 18px 0 0; font-size: .85rem; color: var(--muted); }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.crumbs li + li::before { content: "/"; margin-right: 8px; color: var(--line); }
.crumbs a { color: var(--muted); }

/* ---------- Tool page ---------- */
.tool-head { padding: 20px 0 8px; }
.tool-head .tool-ico { width: 54px; height: 54px; border-radius: 16px; margin-bottom: 14px; }
.workspace {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 26px; margin-top: 22px;
}
.dropzone {
  border: 2px dashed color-mix(in srgb, var(--brand) 35%, var(--line));
  border-radius: var(--r); background: var(--grad-soft);
  padding: 46px 24px; text-align: center; cursor: pointer;
  transition: background .2s, border-color .2s, transform .15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--brand); transform: translateY(-2px); }
.dropzone h3 { margin-bottom: .35rem; }
.dropzone p { margin: 0; color: var(--muted); font-size: .9rem; }
.dz-icon { color: var(--brand); margin-bottom: 10px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.file-list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 8px; }
.file-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg-soft); font-size: .92rem;
}
.file-row .fname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .fsize { color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }
.file-row button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 8px; }
.file-row button:hover { color: var(--ink); background: var(--bg); }

.options { display: grid; gap: 14px; margin-top: 20px; }
.options label { font-weight: 600; font-size: .9rem; display: block; margin-bottom: 6px; color: var(--ink); }
.options input[type="text"], .options input[type="number"], .options input[type="password"], .options select {
  width: 100%; padding: 11px 13px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); font-family: var(--font); font-size: .95rem;
}
.hint { font-size: .82rem; color: var(--muted); margin: 6px 0 0; }

.actions-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.progress { height: 8px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; margin-top: 18px; display: none; }
.progress.show { display: block; }
.progress span { display: block; height: 100%; width: 0; background: var(--grad); transition: width .25s ease; }
.status { margin-top: 14px; font-size: .92rem; min-height: 1.2em; }
.status.error { color: #c02626; }
.status.ok { color: #0a7f5f; }
html[data-theme="dark"] .status.error { color: #ff8f8f; }
html[data-theme="dark"] .status.ok { color: #45d6b4; }

.notice {
  border: 1px solid var(--line); border-left: 4px solid var(--brand);
  background: var(--bg-soft); border-radius: var(--r-sm); padding: 14px 16px; margin-top: 18px; font-size: .92rem;
}
.notice strong { color: var(--ink); }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 36px; align-items: start; padding: 32px 0 72px; }
.sidebar { position: sticky; top: calc(var(--header-h) + 20px); display: grid; gap: 18px; }
.sidebar .card { padding: 18px; }
.sidebar h3 { font-size: .95rem; }
.sidebar ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: .9rem; }

.prose { max-width: 72ch; }
.prose h2 { margin-top: 2em; }
.prose h3 { margin-top: 1.5em; }
.prose ol, .prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: .4rem; }
.prose img { border-radius: var(--r); }
.toc { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 22px; }
.toc h2 { font-size: 1rem; margin: 0 0 .5rem; }
.toc ol { margin: 0; padding-left: 1.1rem; }

.article-meta { color: var(--muted); font-size: .88rem; display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.featured {
  aspect-ratio: 16 / 7; border-radius: var(--r-lg); background: var(--grad-soft);
  border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted);
  font-size: .9rem; margin-bottom: 28px;
}

/* ---------- Filters (tools directory) ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 26px; }
.chip {
  padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg-elev); color: var(--ink-2); font-weight: 600; font-size: .88rem; cursor: pointer;
  transition: all .18s ease;
}
.chip:hover { color: var(--ink); border-color: var(--brand); }
.chip[aria-pressed="true"] { background: var(--grad); color: #fff; border-color: transparent; }
.inline-search {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-elev); max-width: 480px;
}
.inline-search input { flex: 1; border: 0; background: transparent; color: var(--ink); font-size: 1rem; font-family: var(--font); }
.inline-search input:focus { outline: none; }
.no-results { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- Ads ---------- */
.ad-slot {
  margin: 48px auto; max-width: 970px; min-height: 100px;
  border: 1px dashed var(--line); border-radius: var(--r); background: var(--bg-soft);
  display: grid; place-items: center; color: var(--muted); font-size: .78rem;
  letter-spacing: .08em; text-transform: uppercase;
}

/* ---------- Footer ---------- */
.site-footer { background: var(--bg-soft); border-top: 1px solid var(--line); padding: 56px 0 28px; margin-top: 20px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 32px; }
.footer-grid h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 14px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-grid a { color: var(--ink-2); font-size: .92rem; }
.footer-bottom {
  margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between;
  color: var(--muted); font-size: .86rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .footer-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 860px) {
  .nav, .header-actions .btn { display: none; }
  .nav-toggle { display: inline-flex; }
  .header-actions { margin-left: auto; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero { padding: 56px 0 48px; }
  .section { padding: 56px 0; }
}

@media (max-width: 640px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .workspace { padding: 18px; }
  .cta-band { padding: 36px 22px; }
  .dropzone { padding: 34px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
