/* ============================================================
   PDFLite — shared stylesheet
   Light theme by default, dark theme under [data-theme="dark"].
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --success: #15803d;
  --success-hover: #166534;
  --success-soft: #f0fdf4;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warning-soft: #fffbeb;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 12px rgba(15, 23, 42, .05);
}

[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #131c33;
  --surface-2: #0e1526;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: #24304d;
  --primary: #818cf8;
  --primary-hover: #a5b4fc;
  --primary-soft: #1e1b4b;
  --success: #4ade80;
  --success-hover: #86efac;
  --success-soft: #052e16;
  --danger: #f87171;
  --danger-soft: #3f1d1d;
  --warning-soft: #3a2c10;
  --shadow: 0 1px 3px rgba(0, 0, 0, .5);
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

h1 { font-size: 2rem; line-height: 1.25; letter-spacing: -0.02em; margin: 0 0 .5rem; }
h2 { font-size: 1.4rem; letter-spacing: -0.01em; margin: 2.5rem 0 1rem; }
h3 { font-size: 1.1rem; margin: 1.5rem 0 .5rem; }
p { margin: 0 0 1rem; }
a { color: var(--primary); }

.subhead { color: var(--muted); font-size: 1.1rem; max-width: 640px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 1.5rem; height: 64px; }
.logo { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; color: var(--text); text-decoration: none; }
.logo span { color: var(--primary); }
.main-nav { display: flex; gap: 1.25rem; margin-left: auto; }
.main-nav a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: .95rem; }
.main-nav a:hover { color: var(--primary); }
.theme-toggle {
  margin-left: auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); cursor: pointer;
}
.main-nav + .theme-toggle { margin-left: 0; }
.theme-toggle:hover { border-color: var(--primary); }
.theme-toggle svg { width: 20px; height: 20px; }

/* ---------- hero ---------- */
.hero { text-align: center; padding: 3.5rem 0 2rem; }
.hero h1 { font-size: 2.5rem; }
.tool-search {
  max-width: 480px; margin: 1.5rem auto 0; position: relative;
}
.tool-search input {
  width: 100%; padding: .9rem 1.1rem .9rem 2.8rem;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); font-size: 1rem;
}
.tool-search input:focus { outline: 2px solid var(--primary); border-color: var(--primary); }
.tool-search .search-icon { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--muted); }

/* ---------- tool grid ---------- */
.tool-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  margin: 2rem 0;
}
.tool-card {
  display: block; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.4rem 1.25rem; text-decoration: none; color: var(--text);
  box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease;
}
.tool-card:hover { transform: translateY(-3px); border-color: var(--primary); }
.tool-card .card-icon { font-size: 2rem; display: block; margin-bottom: .6rem; }
.tool-card h3, .tool-card .card-title { margin: 0 0 .35rem; font-size: 1.05rem; font-weight: 700; }
.tool-card p { margin: 0; color: var(--muted); font-size: .9rem; }

/* ---------- trust / features ---------- */
.trust-row { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.25rem 0; }
.trust-chips { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0 0; padding: 0; list-style: none; }
.trust-chips li, .chip {
  background: var(--primary-soft); color: var(--primary);
  border-radius: 999px; padding: .35rem .9rem; font-size: .85rem; font-weight: 600;
}
[data-theme="dark"] .trust-chips li, [data-theme="dark"] .chip { color: var(--primary-hover); }

.steps { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin: 1.5rem 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; position: relative; }
.steps li strong { display: block; margin-bottom: .25rem; }
.steps li p { margin: 0; color: var(--muted); font-size: .92rem; }

.feature-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin: 1.5rem 0; }
.feature-grid article { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.feature-grid h3 { margin-top: 0; }
.feature-grid p { margin: 0; color: var(--muted); font-size: .92rem; }

/* ---------- FAQ ---------- */
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: .6rem; }
.faq summary { cursor: pointer; padding: 1rem 1.25rem; font-weight: 600; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; float: right; color: var(--primary); font-weight: 800; }
.faq details[open] summary::after { content: "–"; }
.faq details p { padding: 0 1.25rem 1.1rem; margin: 0; color: var(--muted); }

/* ---------- tool work area ---------- */
.tool-area {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow);
  padding: 1.5rem; margin: 1.75rem 0;
}
.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  background: var(--surface-2);
  padding: 2.5rem 1.5rem; text-align: center; cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--primary); outline: none; }
.dropzone.dragging { border-color: var(--primary); background: var(--primary-soft); }
.dz-icon { font-size: 2.75rem; }
.dz-title { font-size: 1.15rem; font-weight: 700; margin: .75rem 0 .25rem; }
.dz-sub { color: var(--muted); margin: 0 0 1rem; font-size: .9rem; }
.micro-trust { text-align: center; color: var(--muted); font-size: .85rem; margin: .9rem 0 0; }

/* ---------- ad slots (policy-safe: static, labeled, separated) ---------- */
.ad-slot {
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface-2);
  margin: 1.5rem 0; padding: .5rem;
  min-height: 96px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .25rem;
}
.ad-label {
  font-size: .68rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.ad-note { font-size: .75rem; color: var(--muted); text-align: center; max-width: 560px; }

/* ---------- file list ---------- */
.file-list { list-style: none; margin: 1.25rem 0 0; padding: 0; display: grid; gap: .6rem; }
.file-card {
  display: flex; align-items: center; gap: .9rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: .7rem .9rem;
}
.file-card.draggable { cursor: grab; }
.file-card.drag-src { opacity: .4; }
.file-card.drag-over { border-color: var(--primary); }
.file-icon { font-size: 1.5rem; }
.file-meta { min-width: 0; flex: 1; }
.file-name { display: block; font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size { font-size: .8rem; color: var(--muted); }
.file-remove {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: 8px; padding: .35rem .7rem; font-size: .8rem; cursor: pointer;
}
.file-remove:hover { color: var(--danger); border-color: var(--danger); }
.drag-hint { font-size: .8rem; color: var(--muted); margin: .5rem 0 0; }

/* ---------- options / forms ---------- */
.options-panel {
  display: grid; gap: 1rem; margin: 1.25rem 0;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.field label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .35rem; }
.field .hint { font-size: .78rem; color: var(--muted); margin-top: .3rem; }
.field input[type="text"], .field input[type="password"], .field input[type="number"], .field select {
  width: 100%; padding: .65rem .8rem; font-size: .95rem;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text);
}
.field input:focus, .field select:focus { outline: 2px solid var(--primary); border-color: var(--primary); }
.notice {
  background: var(--warning-soft); border: 1px solid var(--border);
  border-radius: 10px; padding: .7rem .9rem; font-size: .85rem; color: var(--muted);
  margin: 0 0 1rem;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-block; border: none; cursor: pointer;
  font-size: 1rem; font-weight: 700; text-decoration: none; text-align: center;
  padding: .8rem 1.6rem; border-radius: 12px;
  transition: background .15s ease, transform .1s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: var(--success-hover); }
[data-theme="dark"] .btn-success { color: #052e16; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }
.btn-large { width: 100%; padding: 1rem; font-size: 1.1rem; margin-top: 1rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.dz-btn { pointer-events: none; }

/* ---------- progress / result / error ---------- */
.progress-wrap { margin-top: 1.25rem; }
.progress-track { height: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; width: 0%; background: var(--primary); border-radius: 999px; transition: width .25s ease; }
.progress-label { font-size: .85rem; color: var(--muted); margin: .4rem 0 0; }

.error-box {
  margin-top: 1.25rem; padding: .85rem 1rem;
  background: var(--danger-soft); color: var(--danger);
  border: 1px solid var(--danger); border-radius: 12px; font-size: .92rem;
}
.result-panel {
  margin-top: 1.25rem; padding: 1.4rem;
  background: var(--success-soft); border: 1px solid var(--success);
  border-radius: var(--radius); text-align: center;
}
.result-title { font-size: 1.15rem; font-weight: 800; margin: 0 0 .4rem; color: var(--success); }
[data-theme="dark"] .result-title { color: var(--success); }
.result-info { color: var(--muted); margin: 0 0 .5rem; }
.result-info strong { color: var(--text); }
.result-panel .btn-large { max-width: 420px; }

/* ---------- breadcrumbs ---------- */
.breadcrumbs ol { display: flex; gap: .5rem; list-style: none; padding: 0; margin: 1.5rem 0 0; font-size: .85rem; color: var(--muted); }
.breadcrumbs li + li::before { content: "›"; margin-right: .5rem; color: var(--muted); }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--primary); }

/* ---------- SEO content ---------- */
.seo-content { max-width: 780px; }
.seo-content ol.steps, .seo-content .feature-grid { max-width: none; }
.related-grid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin: 1.25rem 0 3rem; }
.related-grid a {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: .9rem 1rem; text-decoration: none; color: var(--text);
  font-weight: 600; font-size: .92rem;
}
.related-grid a:hover { border-color: var(--primary); }
.related-grid a small { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 3rem; padding: 2.5rem 0 2rem; background: var(--surface); }
.footer-grid { display: grid; gap: 2rem; grid-template-columns: 1.2fr 1fr; }
.footer-grid h4 { margin: 0 0 .7rem; font-size: .95rem; }
.footer-links { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; }
.footer-links a { color: var(--muted); text-decoration: none; font-size: .9rem; }
.footer-links a:hover { color: var(--primary); }
.footer-bottom { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .82rem; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .main-nav { display: none; }
  .header-inner { gap: 1rem; }
  .hero { padding: 2.25rem 0 1.25rem; }
  .hero h1 { font-size: 1.9rem; }
  h1 { font-size: 1.6rem; }
  .tool-area { padding: 1rem; }
  .dropzone { padding: 1.75rem 1rem; }
  .footer-grid { grid-template-columns: 1fr; }
}
