/* ==========================================================================
   wnpdf — Design System
   Palette: "Ink & Paper" — warm paper surfaces, deep ink text, teal accent
   Type: Fraunces (display) + Inter (body/UI) + JetBrains Mono (data/files)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Paper & ink */
  --paper: #FAF7F1;
  --paper-raised: #FFFFFF;
  --paper-sunken: #F1ECE1;
  --ink: #1C1B17;
  --ink-soft: #55534A;
  --ink-faint: #8B8878;
  --line: #E3DDCC;

  /* Accent — deep teal "digital ink" */
  --accent: #0F6E63;
  --accent-strong: #0A4F47;
  --accent-soft: #DCEEEA;
  --accent-contrast: #FFFFFF;

  /* Secondary — warm amber for highlights/warnings */
  --amber: #B8722E;
  --amber-soft: #F6E6D3;

  /* Status */
  --danger: #B3412C;
  --danger-soft: #F7E1DA;
  --success: #2E7D4F;

  /* Shape & elevation */
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(28, 27, 23, 0.08);
  --shadow: 0 6px 20px -4px rgba(28, 27, 23, 0.14), 0 2px 6px -2px rgba(28, 27, 23, 0.08);
  --shadow-lg: 0 20px 45px -12px rgba(28, 27, 23, 0.28);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Menlo, monospace;

  --container: 1160px;

  color-scheme: light;
}

[data-theme="dark"] {
  --paper: #14181A;
  --paper-raised: #1B2124;
  --paper-sunken: #0F1315;
  --ink: #F2EFE6;
  --ink-soft: #B7B2A2;
  --ink-faint: #7C7869;
  --line: #2B3235;

  --accent: #45C4B0;
  --accent-strong: #6ADCC8;
  --accent-soft: #17302C;
  --accent-contrast: #0A1211;

  --amber: #E0A662;
  --amber-soft: #2E2517;

  --danger: #E28571;
  --danger-soft: #331B16;
  --success: #6FCB93;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 6px 20px -4px rgba(0, 0, 0, 0.45), 0 2px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 24px 50px -12px rgba(0, 0, 0, 0.55);

  color-scheme: dark;
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
  overflow-x: hidden;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0 0 .5em; color: var(--ink); }
p { margin: 0 0 1em; color: var(--ink-soft); }
ul { padding: 0; margin: 0; list-style: none; }
button { font-family: inherit; }
code, .mono { font-family: var(--font-mono); }

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

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--accent); color: var(--accent-contrast);
  padding: 10px 16px; border-radius: 0 0 8px 0; font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 72px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 700; font-size: 1.35rem;
  text-decoration: none; color: var(--ink);
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--accent); color: var(--accent-contrast);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 700; font-size: .85rem;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.brand-mark::after {
  content: ""; position: absolute; top: -3px; right: -3px;
  width: 10px; height: 10px; background: var(--amber);
  border-radius: 2px; transform: rotate(12deg);
}

.main-nav { display: flex; align-items: center; gap: 4px; }
.main-nav a {
  text-decoration: none; color: var(--ink-soft); font-weight: 600;
  font-size: .95rem; padding: 10px 14px; border-radius: 8px;
  transition: background .15s ease, color .15s ease;
}
.main-nav a:hover, .main-nav a[aria-current="page"] {
  color: var(--ink); background: var(--paper-sunken);
}

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

.theme-toggle {
  width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--paper-raised);
  color: var(--ink); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s ease, transform .1s ease;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle:active { transform: scale(.94); }
.theme-toggle svg { width: 18px; height: 18px; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
.icon-sun { display: none; }
.icon-moon { display: block; }

.hamburger {
  display: none; width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--paper-raised);
  cursor: pointer; align-items: center; justify-content: center;
  flex-direction: column; gap: 4px;
}
.hamburger span { width: 18px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .2s, opacity .2s; }
.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 24px; border-radius: 10px; font-weight: 700; font-size: .95rem;
  text-decoration: none; border: 1px solid transparent; cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
  line-height: 1.2;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-contrast); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-strong); box-shadow: var(--shadow); }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--ink-soft); padding: 10px 14px; }
.btn-ghost:hover { color: var(--ink); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 8px 14px; font-size: .85rem; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

/* ---------- Hero ---------- */
.hero {
  padding: 76px 0 60px;
  position: relative;
}
.hero-inner {
  display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: .78rem; font-weight: 600;
  letter-spacing: .04em; color: var(--accent); background: var(--accent-soft);
  padding: 6px 12px; border-radius: 999px; margin-bottom: 18px;
}
.eyebrow::before { content: "●"; font-size: .6rem; }
.hero h1 {
  font-size: clamp(2.3rem, 4.6vw, 3.5rem);
  letter-spacing: -0.02em;
  max-width: 15ch;
}
.hero .lede { font-size: 1.15rem; max-width: 46ch; }
.hero-actions { display: flex; gap: 14px; margin-top: 30px; flex-wrap: wrap; }

.paper-stack { position: relative; height: 380px; }
.paper-sheet {
  position: absolute; width: 240px; height: 300px; border-radius: var(--radius);
  background: var(--paper-raised); box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 22px;
}
.paper-sheet .line { height: 8px; border-radius: 4px; background: var(--paper-sunken); margin-bottom: 10px; }
.paper-sheet .line.w60 { width: 60%; }
.paper-sheet .line.w80 { width: 80%; }
.paper-sheet .line.w40 { width: 40%; }
.sheet-1 { top: 0; left: 40px; transform: rotate(-7deg); z-index: 1; }
.sheet-2 { top: 30px; left: 130px; transform: rotate(4deg); z-index: 2; }
.sheet-3 {
  top: 70px; left: 80px; transform: rotate(-2deg); z-index: 3;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 10px;
}
.sheet-3 .badge-stamp {
  width: 62px; height: 62px; border-radius: 50%;
  border: 2px dashed var(--accent); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: .68rem; font-weight: 700;
  transform: rotate(-8deg);
}
.corner-fold {
  position: absolute; top: 0; right: 0; width: 26px; height: 26px;
  background: linear-gradient(135deg, transparent 50%, var(--paper-sunken) 50%);
  border-bottom-left-radius: 4px;
}

/* ---------- Sections ---------- */
.section { padding: 64px 0; }
.section-head { max-width: 640px; margin: 0 auto 40px; text-align: center; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.section-tight { padding-top: 24px; padding-bottom: 24px; }
.bg-sunken { background: var(--paper-sunken); }

.feature-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}
.feature-card {
  background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow-sm);
}
.feature-card .icon-tile {
  width: 42px; height: 42px; border-radius: 10px; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; margin-bottom: 16px;
}
.feature-card h3 { font-size: 1.05rem; margin-bottom: 6px; }
.feature-card p { font-size: .92rem; margin: 0; }

/* ---------- Tool cards ---------- */
.tool-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px;
}
.tool-card {
  position: relative;
  background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 24px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 12px;
  text-decoration: none; color: inherit;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  overflow: hidden;
}
.tool-card::before {
  content: ""; position: absolute; top: 0; right: 0; width: 22px; height: 22px;
  background: linear-gradient(135deg, transparent 50%, var(--paper-sunken) 50%);
}
.tool-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--accent); }
.tool-icon {
  width: 46px; height: 46px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.tool-card h3 { font-size: 1.08rem; margin-bottom: 2px; }
.tool-card p { font-size: .88rem; flex-grow: 1; }
.tool-card .tool-open {
  font-weight: 700; font-size: .85rem; color: var(--accent);
  display: inline-flex; align-items: center; gap: 6px;
}

/* ---------- Tool workspace ---------- */
.tool-hero {
  padding: 40px 0 8px;
}
.breadcrumb {
  font-size: .85rem; color: var(--ink-faint); margin-bottom: 14px;
  display: flex; gap: 6px; align-items: center;
}
.breadcrumb a { color: var(--ink-faint); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.tool-workspace { padding: 24px 0 80px; }
.workspace-card {
  background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); padding: 32px; max-width: 780px; margin: 0 auto;
}

.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 44px 24px; text-align: center; cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  background: var(--paper-sunken);
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .dz-icon {
  width: 52px; height: 52px; margin: 0 auto 14px; color: var(--accent);
}
.dropzone strong { display: block; font-size: 1rem; color: var(--ink); margin-bottom: 4px; }
.dropzone .dz-sub { font-size: .85rem; color: var(--ink-faint); }
.dropzone input[type="file"] { display: none; }

.file-list { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.file-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--paper-sunken); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 12px;
}
.file-item .file-glyph {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: .7rem;
}
.file-item .file-meta { flex-grow: 1; min-width: 0; }
.file-item .file-name { font-family: var(--font-mono); font-size: .85rem; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item .file-size { font-size: .76rem; color: var(--ink-faint); }
.file-item .file-actions { display: flex; gap: 4px; flex-shrink: 0; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--paper-raised); color: var(--ink-soft); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn svg { width: 15px; height: 15px; }

.field { margin-top: 20px; }
.field label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 8px; color: var(--ink); }
.field .hint { font-size: .8rem; color: var(--ink-faint); margin-top: 6px; }
.field input[type="text"], .field input[type="number"], .field input[type="email"], .field input[type="tel"], .field select, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); font-family: inherit; font-size: .95rem;
}
.field textarea { resize: vertical; min-height: 90px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field input[type="color"] { width: 100%; height: 44px; padding: 4px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); }
.radio-group { display: flex; gap: 16px; flex-wrap: wrap; }
.radio-group label { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: .9rem; color: var(--ink); }

.pages-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; margin-top: 16px; }
.page-chip {
  border: 1px solid var(--line); border-radius: 8px; background: var(--paper-sunken);
  padding: 14px 6px; text-align: center; cursor: pointer; font-family: var(--font-mono); font-size: .8rem;
  transition: border-color .15s ease, background .15s ease;
  position: relative;
}
.page-chip.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; }
.page-chip.marked-delete { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); font-weight: 700; text-decoration: line-through; }
.page-chip canvas { width: 100%; border-radius: 4px; margin-bottom: 6px; }

.status-msg {
  margin-top: 16px; padding: 12px 14px; border-radius: 8px; font-size: .88rem;
  display: none; align-items: flex-start; gap: 8px;
}
.status-msg.show { display: flex; }
.status-msg.info { background: var(--accent-soft); color: var(--accent-strong); }
.status-msg.error { background: var(--danger-soft); color: var(--danger); }
.status-msg.success { background: var(--success); color: #fff; }

.progress-track {
  width: 100%; height: 6px; border-radius: 4px; background: var(--paper-sunken);
  overflow: hidden; margin-top: 16px; display: none;
}
.progress-track.show { display: block; }
.progress-fill { height: 100%; width: 0%; background: var(--accent); transition: width .2s ease; }

.workspace-actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }

.privacy-note {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--accent-soft); color: var(--accent-strong);
  border-radius: 10px; padding: 12px 14px; font-size: .84rem; margin-top: 22px;
}
.privacy-note svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

.limitation-note {
  background: var(--amber-soft); color: var(--amber);
  border-radius: 10px; padding: 12px 14px; font-size: .84rem; margin-top: 16px;
  display: flex; gap: 10px; align-items: flex-start;
}
.limitation-note svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

/* ---------- QR page ---------- */
.qr-layout { display: grid; grid-template-columns: 1fr 380px; gap: 30px; align-items: start; }
.qr-preview-card {
  position: sticky; top: 96px;
  background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); padding: 28px; text-align: center;
}
.qr-canvas-wrap {
  display: flex; align-items: center; justify-content: center;
  background: #fff; border-radius: var(--radius); padding: 20px; margin-bottom: 18px;
  min-height: 220px;
}
.qr-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.qr-tab {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--paper-sunken); font-weight: 600; font-size: .84rem; cursor: pointer; color: var(--ink-soft);
}
.qr-tab.active { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.qr-form-panel { display: none; }
.qr-form-panel.active { display: block; }

/* ---------- Content pages ---------- */
.prose { max-width: 720px; margin: 0 auto; }
.prose h2 { margin-top: 2em; font-size: 1.4rem; }
.prose ul { list-style: disc; padding-left: 1.4em; margin-bottom: 1em; }
.prose ul li { margin-bottom: .5em; color: var(--ink-soft); }

.about-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 30px; }
.about-point {
  background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm);
}
.about-point h3 { font-size: 1rem; margin-bottom: 6px; }
.about-point p { font-size: .9rem; margin: 0; }

.contact-card {
  background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 30px; box-shadow: var(--shadow-sm); max-width: 560px; margin: 0 auto;
}
.contact-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line);
}
.contact-row:last-child { border-bottom: none; }
.contact-row .icon-tile { width: 38px; height: 38px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.contact-row a { text-decoration: none; font-weight: 600; color: var(--accent); }
.contact-row span.label { display: block; font-size: .78rem; color: var(--ink-faint); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 50px 0 30px; margin-top: 40px; background: var(--paper-sunken); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 30px; }
.footer-brand p { font-size: .88rem; max-width: 30ch; }
.footer-col h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); margin-bottom: 14px; }
.footer-col a { display: block; text-decoration: none; color: var(--ink-soft); font-size: .9rem; padding: 5px 0; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom {
  margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
  font-size: .82rem; color: var(--ink-faint);
}

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; gap: 40px; }
  .paper-stack { height: 260px; }
  .feature-grid { grid-template-columns: 1fr; }
  .qr-layout { grid-template-columns: 1fr; }
  .qr-preview-card { position: static; }
  .about-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .main-nav { display: none; }
  .hamburger { display: flex; }
  .main-nav.mobile-open {
    display: flex; flex-direction: column; position: fixed; inset: 72px 0 0 0;
    background: var(--paper); padding: 16px; gap: 4px; z-index: 99; overflow-y: auto;
  }
  .main-nav.mobile-open a { padding: 16px; font-size: 1.05rem; border-bottom: 1px solid var(--line); border-radius: 0; }
  body.nav-open { overflow: hidden; }
  .field-row { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 26px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
  .workspace-card { padding: 22px; }
}

@media (max-width: 480px) {
  .header-inner { height: 64px; }
  .hero { padding: 50px 0 40px; }
  .section { padding: 44px 0; }
}

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