/* OpenPDFLab — Warm Paper Editorial + Forest Emerald Studio Theme */
:root {
  --bg: #f6f3ec;
  --bg-tint: #ede8dc;
  --surface: #ffffff;
  --surface-alt: #fbf9f4;
  --text: #1c1b18;
  --text-muted: #58544c;
  --border: #ddd6c7;
  --emerald: #1d5a47;
  --emerald-hover: #154536;
  --emerald-soft: #e5f1ec;
  --gold: #9a6920;
  --gold-soft: #f8eedb;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --shadow: 0 8px 24px rgba(28, 27, 24, 0.06);
  --radius: 14px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
}

html[data-theme="dark"] {
  --bg: #131210;
  --bg-tint: #1b1916;
  --surface: #1e1c19;
  --surface-alt: #25231f;
  --text: #f2ede3;
  --text-muted: #b1a99c;
  --border: #332f28;
  --emerald: #369e7d;
  --emerald-hover: #42b591;
  --emerald-soft: rgba(54, 158, 125, 0.16);
  --gold: #e0a74f;
  --gold-soft: rgba(224, 167, 79, 0.15);
  --danger: #f97066;
  --danger-soft: rgba(249, 112, 102, 0.14);
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--emerald); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* Header — locked single-line controls, zero wrapping bugs */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding-top: 8px;
  padding-bottom: 8px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none !important;
  flex-shrink: 0;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--emerald);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  font-family: var(--font-serif);
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 16px; letter-spacing: -0.01em; }
.brand-text small { font-size: 11px; color: var(--text-muted); }

.main-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}
.main-nav a {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.main-nav a:hover { color: var(--emerald); text-decoration: none; }

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.lang-switch {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
}
.lang-switch a {
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  text-decoration: none !important;
}
.lang-switch a.active {
  background: var(--emerald);
  color: #fff;
}
.icon-btn {
  height: 34px;
  width: 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.icon-btn:hover { border-color: var(--emerald); }

/* Hero */
.hero {
  padding: 58px 0 48px;
  border-bottom: 1px solid var(--border);
  background: radial-gradient(circle at 80% 0%, var(--emerald-soft), transparent 55%);
}
.hero-inner { max-width: 820px; text-align: center; }
.privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--emerald-soft);
  color: var(--emerald);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 18px;
}
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  display: inline-block;
}
.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(30px, 4.5vw, 48px);
  line-height: 1.15;
  margin: 0 0 16px;
  letter-spacing: -0.02em;
}
.hero-sub {
  font-size: clamp(16px, 2vw, 19px);
  color: var(--text-muted);
  margin: 0 auto 26px;
  max-width: 680px;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 26px;
}
.hero-trust-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 22px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Buttons */
.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none !important;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn-primary {
  background: var(--emerald);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--emerald-hover); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--emerald); color: var(--emerald); }
.btn-secondary.sm { padding: 7px 12px; font-size: 13px; }

/* Sections & Cards */
.section { padding: 52px 0; }
.section-tint { background: var(--bg-tint); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-bottom: 24px;
}
.section-head h2 {
  font-family: var(--font-serif);
  font-size: clamp(22px, 3vw, 30px);
  margin: 0;
}
.section-head p { margin: 4px 0 0; color: var(--text-muted); width: 100%; }
.text-link { font-weight: 700; font-size: 14px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.card-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.trust-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.tool-card, .guide-card, .trust-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--text);
  text-decoration: none !important;
  box-shadow: var(--shadow);
  transition: transform 0.14s ease, border-color 0.14s ease;
}
.tool-card:hover, .guide-card:hover {
  transform: translateY(-2px);
  border-color: var(--emerald);
}
.tool-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tool-ico { font-size: 24px; line-height: 1; }
.tool-card h3, .guide-card h3, .trust-box h3 { margin: 2px 0 0; font-size: 17px; line-height: 1.3; }
.tool-card p, .guide-card p, .trust-box p { margin: 0; font-size: 14px; color: var(--text-muted); flex: 1; }
.card-cta { font-size: 13px; font-weight: 700; color: var(--emerald); margin-top: 4px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--bg-tint);
  color: var(--text-muted);
  width: fit-content;
}
.badge.emerald { background: var(--emerald-soft); color: var(--emerald); }
.badge.gold { background: var(--gold-soft); color: var(--gold); }

/* Tool & Guide Detail Layout */
.page-wrap { padding: 30px 20px 64px; }
.article-wrap { max-width: 820px; padding: 30px 20px 64px; }
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
}
.tool-header, .article-header { margin-bottom: 24px; }
.tool-header h1, .article-header h1 {
  font-family: var(--font-serif);
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.18;
  margin: 10px 0 10px;
}
.lead { font-size: 16px; color: var(--text-muted); margin: 0; max-width: 780px; }

/* Interactive Workbench */
.workbench {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 36px;
}
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  padding: 34px 20px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--surface-alt);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--emerald);
  background: var(--emerald-soft);
}
.drop-ico { font-size: 32px; }
.dropzone strong { font-size: 15px; }
.dropzone span { font-size: 13px; color: var(--text-muted); }

.file-list { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
}
.file-item-info { display: flex; flex-direction: column; min-width: 0; }
.file-item-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item-info small { color: var(--text-muted); }
.file-item-btns { display: flex; gap: 6px; flex-shrink: 0; }
.mini-btn {
  padding: 5px 8px;
  font-size: 12px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.mini-btn:hover { border-color: var(--emerald); color: var(--emerald); }

.wb-form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.wb-form-row label, .wb-full-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.wb-full-label { margin-top: 14px; }
.workbench input[type="text"],
.workbench input[type="number"],
.workbench input[type="date"],
.workbench select,
.workbench textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
.workbench textarea { resize: vertical; line-height: 1.5; }
.wb-check-row { margin-top: 14px; font-size: 14px; }
.wb-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.wb-status {
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--emerald);
  min-height: 22px;
}
.wb-status.err { color: var(--danger); }

.wb-result {
  margin-top: 18px;
  padding: 18px;
  border-radius: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}
.diag-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.diag-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.diag-cell small { display: block; font-size: 11px; color: var(--text-muted); }
.diag-cell strong { font-size: 15px; }

.pii-alert {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
}
.pii-alert.clean {
  border-color: var(--emerald);
  background: var(--emerald-soft);
  color: var(--emerald);
}

.search-row { display: flex; gap: 10px; }
.search-row input { flex: 1; }
.lib-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.lib-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lib-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lib-card p { margin: 0; font-size: 13px; color: var(--text-muted); flex: 1; }

.cancel-box {
  margin-top: 16px;
  padding: 16px;
  border-radius: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}
.cancel-box h3 { margin: 0 0 8px; font-size: 16px; }
.cancel-box ol { margin: 0 0 10px; padding-left: 20px; font-size: 14px; }
.savings-pill {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--gold-soft);
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
}
.refund-gen {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.refund-gen h3 { margin: 0 0 10px; font-size: 16px; }

.preset-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.chip.active { background: var(--emerald); color: #fff; border-color: var(--emerald); }
.table-wrap { overflow-x: auto; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cmp-table th, .cmp-table td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.cmp-table th { background: var(--surface-alt); font-weight: 700; white-space: nowrap; }

/* Editorial Content Blocks */
.content-block { margin-bottom: 36px; }
.content-block h2 { font-family: var(--font-serif); font-size: 23px; margin: 0 0 14px; }
.step-list { padding-left: 20px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.honest-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.honest-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.honest-card.good { border-left: 4px solid var(--emerald); }
.honest-card.limit { border-left: 4px solid var(--gold); }
.honest-card h3 { margin: 0 0 10px; font-size: 16px; }
.honest-card ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }

.faq-list { display: flex; flex-direction: column; gap: 10px; }
.faq-list details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.faq-list summary { font-weight: 700; cursor: pointer; font-size: 15px; }
.faq-list details p { margin: 10px 0 0; font-size: 14px; color: var(--text-muted); }

.article-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 32px;
}
.article-body h2 { font-family: var(--font-serif); font-size: 22px; margin: 24px 0 10px; }
.article-body section:first-child h2, .article-body > h2:first-child { margin-top: 0; }
.article-body p { margin: 0 0 12px; font-size: 15px; }
.article-body ul, .article-body ol { padding-left: 20px; margin: 0 0 14px; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 42px 0;
  margin-top: 40px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 28px;
}
.footer-brand strong { font-size: 18px; font-family: var(--font-serif); }
.footer-brand p { margin: 8px 0 0; font-size: 13px; color: var(--text-muted); }
.footer-note { font-size: 12px !important; }
.site-footer h4 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.footer-links { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 7px; font-size: 13px; }
.footer-links a { color: var(--text); }
.footer-links a:hover { color: var(--emerald); }

/* Toast */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--emerald);
  color: #fff;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 60;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .card-grid, .card-grid.compact, .trust-grid, .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main-nav { display: none; }
}
@media (max-width: 640px) {
  .card-grid, .card-grid.compact, .guide-grid, .trust-grid, .honest-grid, .wb-form-row, .lib-grid, .footer-grid {
    grid-template-columns: 1fr;
  }
  .diag-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand-text small { display: none; }
  .search-row { flex-direction: column; }
  .workbench { padding: 16px; }
  .article-body { padding: 18px; }
}
