/* WalkingPDF design system - light, trustworthy, utility-first. */

:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --ink: #17233b;
  --ink-soft: #43506a;
  --muted: #6b7790;
  --line: #dbe3ee;
  --brand: #1d4ed8;
  --brand-dark: #1e40af;
  --brand-soft: #eaf0ff;
  --accent: #c0392b;
  --ok: #15803d;
  --focus: #2563eb;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 1px 2px rgba(23, 35, 59, 0.06), 0 8px 24px rgba(23, 35, 59, 0.08);
  --container: 1080px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
p { margin: 0 0 1rem; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); margin: 0 0 0.75rem; }
h2 { font-size: 1.45rem; margin: 0 0 0.9rem; }
h3 { font-size: 1.05rem; margin: 0 0 0.35rem; }
img { max-width: 100%; }
code { background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 6px; font-size: 0.9em; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--brand); color: #fff;
  padding: 10px 14px; border-radius: 0 0 8px 0; z-index: 100;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

/* ---------------------------------------------------------------- header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 800; font-size: 1.1rem; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--brand);
  display: inline-block; position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; left: 6px; right: 6px; top: 6px; height: 14px;
  border: 2px solid #fff; border-top: none; border-radius: 0 0 4px 4px;
  opacity: 0.9; transform: rotate(-12deg);
}
/* Header nav (Phase 6): ONE list at every viewport. Desktop = inline row;
   <=720px the row hides behind a checkbox-toggled Menu label - pure CSS, no
   JS, no duplicated markup. The checkbox is visually hidden but focusable
   (keyboard toggles it; focus ring is drawn on the label). */
.site-nav { position: relative; }
.site-nav .nav-toggle-input {
  position: absolute; top: 0; left: 0; width: 1px; height: 1px;
  opacity: 0; pointer-events: none;
}
.site-nav .nav-toggle-label { display: none; }
.site-nav .nav-list {
  list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; flex-wrap: wrap;
}
.site-nav a {
  display: block; padding: 8px 12px; border-radius: 9px; color: var(--ink-soft);
  font-weight: 600; font-size: 0.95rem;
}
.site-nav a:hover { background: var(--surface-2); text-decoration: none; }
.site-nav a.active { background: var(--brand-soft); color: var(--brand-dark); }

@media (max-width: 720px) {
  .site-nav .nav-toggle-label {
    display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
    padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px;
    color: var(--ink-soft); font-weight: 600; font-size: 0.95rem;
    user-select: none;
  }
  .site-nav .nav-toggle-label::after { content: "\2630"; font-size: 0.9em; }
  .site-nav .nav-list { display: none; }
  .site-nav .nav-toggle-input:checked ~ .nav-list {
    display: flex; flex-direction: column; gap: 2px;
    position: absolute; right: 0; top: calc(100% + 8px); min-width: 190px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: 12px; padding: 8px;
    box-shadow: 0 14px 32px rgba(15, 26, 51, 0.18);
    z-index: 30;
  }
  .site-nav .nav-toggle-input:focus-visible + .nav-toggle-label {
    outline: 3px solid var(--focus); outline-offset: 2px;
  }
}

/* ----------------------------------------------------------------- footer */
.site-footer { background: #0f1a33; color: #cdd7ea; margin-top: 64px; }
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 28px;
  padding: 36px 0 20px;
}
.footer-about { padding-right: 20px; }
.footer-brand { font-weight: 800; color: #fff; margin: 0 0 8px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 8px; }
.footer-grid a { color: #cdd7ea; }
.footer-grid a:hover { color: #fff; }
.footer-heading { color: #93a5c4; text-transform: uppercase; font-size: 0.78rem; letter-spacing: 0.06em; margin: 0 0 10px; }
.footer-meta { border-top: 1px solid rgba(255,255,255,0.1); padding: 16px 0 28px; font-size: 0.85rem; color: #93a5c4; margin: 0; }

/* <=720px: the desktop 4-column footer grid overflows a 360px viewport
   (Phase 6 DoD) - stack it: full-width intro, then 2-column link blocks. */
@media (max-width: 720px) {
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
  .footer-about { padding-right: 0; grid-column: 1 / -1; }
}

/* ----------------------------------------------------------------- buttons */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 700; font-size: 0.98rem; cursor: pointer;
  font-family: inherit; transition: background 0.15s, transform 0.05s;
}
.button:hover { text-decoration: none; filter: brightness(1.02); }
.button:active { transform: translateY(1px); }
.button-primary { background: var(--brand); color: #fff; }
.button-primary:hover { background: var(--brand-dark); color: #fff; }
.button-secondary { background: var(--surface); color: var(--brand-dark); border-color: var(--line); }
.button-ghost { background: transparent; color: var(--ink-soft); }
.button-ghost:hover { background: var(--surface-2); }
.button[disabled] { opacity: 0.5; cursor: not-allowed; }

/* --------------------------------------------------------------- articles */
.article { padding-top: 32px; }
.article-narrow { max-width: 780px; }
.article-header { margin-bottom: 18px; }
.eyebrow {
  text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.78rem;
  color: var(--muted); font-weight: 700; margin-bottom: 8px;
}
.lede { font-size: 1.18rem; color: var(--ink-soft); max-width: 72ch; }
.experience-note {
  background: var(--brand-soft); border-left: 4px solid var(--brand);
  padding: 12px 16px; border-radius: 0 10px 10px 0; margin: 12px 0 16px;
  color: var(--brand-dark); font-size: 0.97rem;
}
.experience-note strong { display: block; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }

.breadcrumb ol { list-style: none; display: flex; gap: 8px; padding: 0; margin: 0 0 18px; flex-wrap: wrap; font-size: 0.9rem; }
.breadcrumb li { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.breadcrumb li + li::before { content: "/"; color: var(--line-strong, var(--line)); }
.breadcrumb a { color: var(--brand); }

.content-section { margin: 36px 0; scroll-margin-top: 72px; }
.content-section > p { max-width: 70ch; }
.bullets { padding-left: 6px; list-style: none; }
.bullets li { padding-left: 26px; position: relative; margin-bottom: 10px; max-width: 72ch; }
.bullets li::before {
  content: "✓"; position: absolute; left: 0; top: 0; color: var(--ok); font-weight: 800;
}
.steps { list-style: none; counter-reset: step; padding: 0; margin: 16px 0; }
.steps > li { counter-increment: step; position: relative; padding: 14px 16px 14px 64px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; }
.steps > li::before {
  content: counter(step); position: absolute; left: 16px; top: 16px;
  width: 32px; height: 32px; border-radius: 50%; background: var(--brand);
  color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.steps p { margin: 0; color: var(--ink-soft); }

.callout {
  background: #fff8e6; border: 1px solid #f2d98c; border-radius: var(--radius);
  padding: 14px 16px; margin: 16px 0; color: #5a4815;
}
.table-wrap { margin: 18px 0; }
.table-wrap figcaption { font-weight: 700; margin-bottom: 8px; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--brand-soft); color: var(--brand-dark); }
tr:last-child td { border-bottom: 0; }
.table-note { color: var(--muted); font-size: 0.85rem; margin-top: 8px; }
.table-inline { max-width: 640px; }
.table-inline th { background: transparent; border-bottom: 1px solid var(--line); }

.faq-list { display: grid; gap: 10px; }
.faq-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 16px; }
.faq-item summary { font-weight: 700; cursor: pointer; padding: 13px 0; }
.faq-item p { color: var(--ink-soft); padding-bottom: 12px; }

/* ------------------------------------------------------------------ demo */
.demo { margin: 20px 0; }
.demo-page {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  aspect-ratio: 4 / 3; overflow: hidden; display: flex; align-items: center; justify-content: center;
  padding: 8%;
}
.demo-lines { position: absolute; inset: 12% 8%; display: flex; flex-direction: column; gap: 9px; }
.demo-line { height: 5px; background: #c8d3e4; border-radius: 3px; }
.demo-wm { font-weight: 800; letter-spacing: 0.14em; color: var(--accent); user-select: none; }
.demo-caption { color: var(--muted); font-size: 0.9rem; margin: 8px 0 0; text-align: center; }

.demo-bottom .demo-page { align-items: flex-end; }
.demo-top .demo-page { align-items: flex-start; }
.demo-footer .demo-wm { font-size: 0.8rem; letter-spacing: 0.04em; opacity: 0.75; text-align: center; width: 90%; }

/* -------------------------------------------------------------- tool widget */
.wm-app { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 24px; margin: 20px 0 44px; }
.wm-step { margin: 22px 0; scroll-margin-top: 80px; }
.wm-step h2 { display: flex; align-items: center; gap: 12px; font-size: 1.2rem; }
.step-no {
  width: 30px; height: 30px; border-radius: 50%; background: var(--brand);
  color: #fff; font-size: 0.9rem; display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.dropzone {
  border: 2px dashed #b5c4dd; border-radius: var(--radius); background: var(--bg);
  padding: 34px 20px; text-align: center; cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.link-like { color: var(--brand); font-weight: 700; }
.dropzone p { margin: 0; }
.drop-hint { color: var(--muted); font-size: 0.88rem; margin-top: 8px !important; }

.wm-file-info { margin-top: 12px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius); font-size: 0.95rem; }
.wm-file-info strong { color: var(--ink); }
.wm-limits { margin-top: 10px; color: var(--muted); font-size: 0.9rem; }
.wm-password { margin-top: 12px; }
.wm-password label { font-weight: 700; display: block; margin-bottom: 6px; }
.wm-password input, .admin-login input {
  width: 100%; max-width: 420px; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 1rem; background: var(--surface);
}
.wm-password-note { color: var(--muted); font-size: 0.85rem; }

.style-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.style-card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
  cursor: pointer; display: flex; flex-direction: column; gap: 6px; background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.style-card:hover { border-color: var(--brand); }
.style-card input { position: absolute; opacity: 0; }
.style-card.active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.style-demo {
  aspect-ratio: 4 / 2.6; border-radius: 8px; background: var(--bg);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  font-size: 0.78rem; color: var(--accent); font-weight: 800;
}
.behind-swatch { color: #8a9cc0; font-size: 0.95rem; }
.footer-swatch { font-weight: 600; font-size: 0.62rem; color: #5a6b8a; width: 100%; text-align: center; }
.image-swatch { color: var(--brand); }
.tiled-swatch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; font-size: 0.42rem; color: #b5c4dd; text-align: center; }
.style-name { font-weight: 800; }
.style-desc { color: var(--muted); font-size: 0.82rem; }

.wm-presets { margin-top: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wm-presets-label { color: var(--muted); font-size: 0.9rem; }
.preset-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 6px 12px; font-size: 0.82rem; font-weight: 700; color: var(--brand-dark); cursor: pointer;
}
.chip:hover { background: var(--brand-soft); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.wm-controls { display: grid; gap: 14px; margin-top: 10px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 700; font-size: 0.92rem; }
.field .hint { color: var(--muted); font-size: 0.82rem; }
.field-row { display: flex; flex-wrap: wrap; gap: 16px; }
.field-row .field { flex: 1 1 200px; }
.field input[type="text"], .field input[type="url"], .field input[type="email"], .field select {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 0.98rem;
  width: 100%; background: var(--surface);
}
.field input[type="range"] { width: 100%; accent-color: var(--brand); }
.field input[type="color"] { width: 48px; height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--surface); }
.field-value { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.9rem; }
.field .selects { display: flex; gap: 10px; flex-wrap: wrap; }
.seg {
  border: 1px solid var(--line); background: var(--surface); border-radius: 9px;
  padding: 7px 12px; font-size: 0.9rem; cursor: pointer; font-weight: 600; color: var(--ink-soft);
}
.seg.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.wm-actions { display: flex; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.wm-image-upload { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.wm-image-meta { color: var(--muted); font-size: 0.9rem; }

.wm-result-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(240px, 1fr); gap: 20px; align-items: start; }
@media (max-width: 720px) { .wm-result-grid { grid-template-columns: 1fr; } }
.wm-preview { margin: 0; }
.wm-preview img { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; height: auto; }
.wm-preview figcaption { color: var(--muted); font-size: 0.88rem; margin-top: 8px; }
.wm-result-panel { display: grid; gap: 14px; }
.progress-bar { height: 12px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress-bar span { display: block; height: 100%; width: 0; background: var(--brand); transition: width 0.3s; }
.wm-progress-text { font-size: 0.9rem; color: var(--ink-soft); margin: 8px 0 0; }
.wm-success { font-weight: 700; color: var(--ok); }
.wm-privacy-note { color: var(--muted); font-size: 0.85rem; }

.wm-error {
  background: #fef2f2; border: 1px solid #fecaca; color: #991b1b;
  border-radius: var(--radius); padding: 14px 16px; margin-top: 14px;
}
.wm-error h3 { margin: 0 0 6px; }
.wm-error p { margin: 0 0 8px; }
.wm-error .error-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.wm-error button { border: 1px solid #fca5a5; background: #fff; color: #991b1b; border-radius: 8px; padding: 7px 12px; font-weight: 700; cursor: pointer; }
.wm-error button:hover { background: #fee2e2; }

.noscript-note { color: var(--muted); font-size: 0.9rem; }

.tool-article .content-section:first-of-type { margin-top: 12px; }

/* ------------------------------------------------------------ error page */
.error-page { padding: 48px 0 20px; max-width: 720px; }
.error-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 32px; }
.error-card h1 { margin-top: 0; }
.error-message { font-size: 1.05rem; color: var(--ink-soft); }
.error-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0; }
.error-meta { color: var(--muted); font-size: 0.88rem; margin-top: 16px; }
.error-help { margin-top: 8px; }

/* ---------------------------------------------------------------- admin */
.admin-dashboard { max-width: 760px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 14px 0 26px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat-value { display: block; font-size: 1.5rem; font-weight: 800; }
.stat-label { color: var(--muted); font-size: 0.8rem; }
.admin-login { display: grid; gap: 12px; max-width: 420px; }
.muted { color: var(--muted); font-weight: 400; }