/* ============================================================
   PDF Reader marketing site styles
   Follows modern-web-guidance: color-scheme / light-dark() + fallbacks,
   clamp() fluid type, dvh viewport units, aspect-ratio to limit CLS,
   @container queries, scroll reveal (feature detect + reduced-motion).
   ============================================================ */

/* ---------- Design tokens: light/dark bases, then composed ---------- */
:root {
  /* Brand & accent (perceptually uniform oklch) */
  --brand-light: oklch(52% 0.19 264);
  --brand-dark: oklch(72% 0.16 258);
  --brand-2-light: oklch(62% 0.17 320);
  --brand-2-dark: oklch(80% 0.13 320);

  /* Neutrals */
  --bg-light: oklch(99% 0.004 260);
  --bg-dark: oklch(17% 0.018 260);
  --surface-light: oklch(100% 0 0);
  --surface-dark: oklch(22% 0.02 260);
  --tint-light: oklch(96.5% 0.012 260);
  --tint-dark: oklch(20% 0.02 260);
  --text-light: oklch(24% 0.02 260);
  --text-dark: oklch(95% 0.008 260);
  --muted-light: oklch(48% 0.02 260);
  --muted-dark: oklch(72% 0.018 260);
  --border-light: oklch(90% 0.012 260);
  --border-dark: oklch(32% 0.02 260);

  --brand-text-light: oklch(99% 0 0);
  --brand-text-dark: oklch(16% 0.02 260);

  /* Fallback: light tokens when light-dark() is unsupported */
  --brand: var(--brand-light);
  --brand-2: var(--brand-2-light);
  --bg: var(--bg-light);
  --surface: var(--surface-light);
  --tint: var(--tint-light);
  --text: var(--text-light);
  --muted: var(--muted-light);
  --border: var(--border-light);
  --brand-text: var(--brand-text-light);

  color-scheme: light dark;
  accent-color: var(--brand);
  --scrollbar-track: light-dark(#eee, #222);
  --scrollbar-thumb: light-dark(#c2c2c2, #555);
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);

  --radius: 16px;
  --radius-lg: 22px;
  --shadow: 0 12px 40px oklch(30% 0.05 260 / 0.10);
  --maxw: 1140px;
}

/* Fallback: media-query token switch for browsers without light-dark() */
@media (prefers-color-scheme: dark) {
  :root {
    --brand: var(--brand-dark);
    --brand-2: var(--brand-2-dark);
    --bg: var(--bg-dark);
    --surface: var(--surface-dark);
    --tint: var(--tint-dark);
    --text: var(--text-dark);
    --muted: var(--muted-dark);
    --border: var(--border-dark);
    --brand-text: var(--brand-text-dark);
  }
}

/* With light-dark(): derive from color-scheme (incl. future manual overrides) */
@supports (color: light-dark(white, black)) {
  :root {
    --brand: light-dark(var(--brand-light), var(--brand-dark));
    --brand-2: light-dark(var(--brand-2-light), var(--brand-2-dark));
    --bg: light-dark(var(--bg-light), var(--bg-dark));
    --surface: light-dark(var(--surface-light), var(--surface-dark));
    --tint: light-dark(var(--tint-light), var(--tint-dark));
    --text: light-dark(var(--text-light), var(--text-dark));
    --muted: light-dark(var(--muted-light), var(--muted-dark));
    --border: light-dark(var(--border-light), var(--border-dark));
    --brand-text: light-dark(var(--brand-text-light), var(--brand-text-dark));
  }
}

/* ---------- Base reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

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

h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }

.wrap { width: min(var(--maxw), calc(100% - 2.5rem)); margin-inline: auto; }

/* Keyboard focus ring: CanvasText keeps contrast in light/dark/forced-colors */
:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid CanvasText;
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 100;
  background: var(--surface); color: var(--text);
  padding: .6rem 1rem; border-radius: 8px; box-shadow: var(--shadow);
  transition: top .2s ease;
}
.skip-link:focus { top: 1rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; border-radius: 999px;
  padding: .8rem 1.5rem; line-height: 1.1;
  transition: transform 150ms ease-out, box-shadow 150ms ease-out, background-color 150ms ease-out;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 22px oklch(40% 0.12 264 / .22); }
.btn:active { transform: translateY(0) scale(.97); }
.btn-sm { padding: .55rem 1.05rem; font-size: .9rem; }
.btn-lg { padding: 1rem 1.7rem; font-size: 1.02rem; }
.btn-primary { background: var(--brand); color: var(--brand-text); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-play { background: var(--text); color: var(--bg); gap: .8rem; }
.btn-play small { display: block; font-size: .68rem; font-weight: 500; opacity: .8; }
.btn-play span { display: block; text-align: left; font-size: 1.15rem; line-height: 1.15; }
.play-icon { width: 1.5rem; height: 1.5rem; flex: none; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid color-mix(in oklab, var(--border) 60%, transparent);
}
@supports not (background: color-mix(in oklab, white 50%, black)) {
  .site-header { background: var(--bg); }
}
.header-inner { display: flex; align-items: center; gap: 1.5rem; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; font-weight: 700; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: var(--brand-text); }
.brand-mark svg { width: 22px; height: 22px; }
.brand-name { font-size: 1.1rem; }
.site-nav { display: flex; gap: 1.6rem; margin-inline: auto; }
.site-nav a { text-decoration: none; color: var(--muted); font-size: .92rem; font-weight: 500; transition: color 150ms ease; }
.site-nav a:hover { color: var(--brand); }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding-block: clamp(3.5rem, 2rem + 6vw, 6.5rem) clamp(3rem, 2rem + 5vw, 5rem); min-height: min(88dvh, 820px); display: flex; align-items: center; }
.hero-inner { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(2rem, 1rem + 5vw, 5rem); align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: .5rem; font-size: .85rem; font-weight: 600; color: var(--brand); text-transform: uppercase; letter-spacing: .08em; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-2); box-shadow: 0 0 0 4px color-mix(in oklab, var(--brand-2) 22%, transparent); }
.hero h1 { font-size: clamp(2.2rem, 1.2rem + 4.6vw, 4rem); font-weight: 800; margin-top: 1rem; }
.hero-line1 { white-space: nowrap; font-size: clamp(1.9rem, 1rem + 3.9vw, 3.35rem); }
.grad-text { background: linear-gradient(100deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { color: var(--muted); font-size: clamp(1rem, .9rem + .5vw, 1.15rem); margin-top: 1.3rem; max-width: 34ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2rem; }
.hero-note { color: var(--muted); font-size: .85rem; margin-top: 1.2rem; }

/* Phone mock (pure CSS illustration) */
.hero-art { display: grid; place-items: center; position: relative; min-height: 460px; }
.glow { position: absolute; width: 130%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, color-mix(in oklab, var(--brand) 20%, transparent), transparent 62%); filter: blur(10px); }
@supports not (background: color-mix(in oklab, white 50%, black)) { .glow { display: none; } }
.phone {
  position: relative; width: min(280px, 70vw); aspect-ratio: 9 / 18.5;
  background: var(--surface); border: 10px solid oklch(28% 0.02 260); border-radius: 3rem;
  box-shadow: var(--shadow), inset 0 0 0 2px oklch(45% 0.02 260 / .4);
  padding: 1.4rem .9rem .9rem; z-index: 1;
}
.phone-notch { position: absolute; top: .7rem; left: 50%; translate: -50% 0; width: 38%; height: 14px; border-radius: 999px; background: oklch(20% 0.02 260); }
.phone-screen { display: flex; flex-direction: column; height: 100%; gap: .7rem; }
.app-topbar { display: flex; justify-content: space-between; align-items: center; font-size: .62rem; font-weight: 700; color: var(--muted); padding: 0 .2rem; }
.doc-page { flex: 1; background: oklch(99% 0.003 90); border-radius: 8px; padding: 1rem .8rem; display: flex; flex-direction: column; gap: .5rem; box-shadow: inset 0 0 0 1px oklch(90% 0.01 90 / .6); }
.doc-title { height: 8px; width: 55%; border-radius: 3px; background: oklch(40% 0.06 260); margin-bottom: .2rem; }
.doc-line { height: 5px; border-radius: 3px; background: oklch(82% 0.01 260); }
.doc-line.w-full { width: 100%; } .doc-line.w-90 { width: 90%; } .doc-line.w-80 { width: 80%; } .doc-line.w-70 { width: 70%; } .doc-line.w-60 { width: 60%; }
.doc-line.hl-yellow { background: linear-gradient(90deg, oklch(88% 0.13 95) 100%, transparent 0); box-shadow: 0 0 0 3px oklch(88% 0.13 95 / .45); }
.doc-line.hl-green { background: oklch(85% 0.11 150); box-shadow: 0 0 0 3px oklch(85% 0.11 150 / .4); }
.doc-figure { height: 26%; border-radius: 6px; background: oklch(94% 0.01 260); display: grid; place-items: center; margin-block: .2rem; }
.figure-bars { display: flex; align-items: flex-end; gap: 4px; height: 60%; }
.figure-bars i { width: 9px; background: var(--brand); opacity: .75; border-radius: 2px 2px 0 0; }
.figure-bars i:nth-child(1){height:40%} .figure-bars i:nth-child(2){height:70%} .figure-bars i:nth-child(3){height:50%} .figure-bars i:nth-child(4){height:90%} .figure-bars i:nth-child(5){height:60%}
.app-toolbar { display: flex; justify-content: space-around; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: .45rem; }
.tool { font-size: .9rem; color: var(--muted); width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: 50%; }
.tool.active { background: var(--brand); color: var(--brand-text); }
.floating-chip { position: absolute; z-index: 2; display: flex; align-items: center; gap: .45rem; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 999px; padding: .55rem .9rem; font-size: .8rem; font-weight: 600; box-shadow: var(--shadow); }
.floating-chip span { color: var(--brand); font-size: 1rem; }
.chip-scan { top: 24%; left: -6%; }
.chip-sign { bottom: 22%; right: -8%; }

/* ---------- Highlights strip ---------- */
.highlights { border-block: 1px solid var(--border); background: var(--surface); }
.highlights-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.highlight { display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: 2rem 1rem; text-align: center; }
.highlight + .highlight { border-left: 1px solid var(--border); }
.highlight strong { font-size: clamp(1.8rem, 1.2rem + 2vw, 2.6rem); font-weight: 800; color: var(--brand); letter-spacing: -.03em; }
.highlight span { color: var(--muted); font-size: .9rem; }

/* ---------- Shared sections ---------- */
.section { padding-block: clamp(4rem, 2.5rem + 6vw, 7rem); }
.section-tint { background: var(--tint); border-block: 1px solid var(--border); }
.section-head { max-width: 660px; margin-inline: auto; text-align: center; margin-bottom: 3rem; }
.kicker { color: var(--brand); font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; margin-bottom: .8rem; }
.section-head h2, .toolbox-copy h2, .download h2 { font-size: clamp(1.7rem, 1.2rem + 2.4vw, 2.7rem); font-weight: 800; }
.section-lead { color: var(--muted); margin-top: 1rem; font-size: 1.02rem; }

/* ---------- Feature cards ---------- */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 1.2rem; }
.feature-card {
  container-type: inline-size;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.8rem;
  transition: transform 180ms ease-out, box-shadow 180ms ease-out, border-color 180ms ease-out;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: color-mix(in oklab, var(--brand) 40%, var(--border)); }
.feature-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; margin-bottom: 1.2rem; }
.feature-icon svg { width: 26px; height: 26px; }
.icon-blue { background: oklch(93% 0.05 250); color: oklch(50% 0.16 255); }
.icon-violet { background: oklch(93% 0.04 300); color: oklch(52% 0.16 300); }
.icon-teal { background: oklch(93% 0.05 185); color: oklch(50% 0.12 185); }
.icon-amber { background: oklch(94% 0.06 80); color: oklch(55% 0.14 70); }
.icon-rose { background: oklch(94% 0.04 15); color: oklch(55% 0.16 15); }
@media (prefers-color-scheme: dark) {
  .icon-blue { background: oklch(30% 0.06 255); color: oklch(78% 0.12 255); }
  .icon-violet { background: oklch(30% 0.06 300); color: oklch(80% 0.11 300); }
  .icon-teal { background: oklch(28% 0.05 185); color: oklch(80% 0.10 185); }
  .icon-amber { background: oklch(32% 0.06 80); color: oklch(84% 0.11 80); }
  .icon-rose { background: oklch(32% 0.05 15); color: oklch(84% 0.10 15); }
}
.feature-card h3 { font-size: 1.2rem; font-weight: 700; }
.feature-card p { color: var(--muted); margin-top: .6rem; font-size: .95rem; }

/* ---------- Toolbox ---------- */
.toolbox-inner { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 1rem + 5vw, 5rem); align-items: center; }
.toolbox-copy .btn { margin-top: 1.8rem; }
.tool-list { display: grid; gap: .8rem; }
.tool-list li { display: flex; align-items: center; gap: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 1rem 1.3rem; font-weight: 600; box-shadow: 0 2px 8px oklch(30% 0.03 260 / .04); }
.tool-list li span { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 9px; background: color-mix(in oklab, var(--brand) 14%, transparent); color: var(--brand); font-size: 1.05rem; }

/* ---------- Scanner steps ---------- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.2rem; counter-reset: step; }
.step { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.6rem 1.4rem; }
.step:not(:last-child)::after { content: "→"; position: absolute; right: -1.1rem; top: 2.2rem; z-index: 2; color: var(--brand); font-size: 1.1rem; font-weight: 700; }
.step-num { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--brand); color: var(--brand-text); font-weight: 800; margin-bottom: 1rem; }
.step h3 { font-size: 1.08rem; font-weight: 700; }
.step p { color: var(--muted); font-size: .9rem; margin-top: .5rem; }

/* ---------- Download ---------- */
.download { padding-block: clamp(4.5rem, 3rem + 7vw, 8rem); background: linear-gradient(160deg, var(--brand), var(--brand-2)); color: oklch(99% 0 0); text-align: center; }
.download .kicker { color: oklch(100% 0 0 / .8); }
.download .section-lead { color: oklch(100% 0 0 / .85); max-width: 46ch; margin-inline: auto; }
.download-inner { display: flex; flex-direction: column; align-items: center; }
.download .btn-play { background: oklch(16% 0.02 260); color: oklch(99% 0 0); margin-top: 2rem; }
.download-note { font-size: .85rem; opacity: .8; margin-top: 1rem; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding-block: 2.5rem; background: var(--surface); }
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: .7rem; text-align: center; color: var(--muted); font-size: .9rem; }
.footer-brand { color: var(--text); }
.copyright { font-size: .8rem; opacity: .8; }

/* ============================================================
   Responsive: component + viewport
   ============================================================ */

/* Phone / narrow */
@media (max-width: 820px) {
  html, body { overflow-x: clip; }
  .site-nav { display: none; }
  .header-inner { gap: .75rem; }
  .header-inner > .btn { margin-left: auto; }
  .hero-inner { grid-template-columns: 1fr; }
  .hero-copy { text-align: center; }
  .hero-line1 { font-size: clamp(1.7rem, 6.5vw, 2.4rem); }
  .hero-sub { margin-inline: auto; }
  .hero-actions, .eyebrow { justify-content: center; }
  .hero-art { order: -1; min-height: 380px; width: 100%; }
  .phone { width: min(260px, 66vw); }
  .chip-scan { left: 2%; }
  .chip-sign { right: 2%; }
  .highlights-grid { grid-template-columns: repeat(2, 1fr); }
  .highlight:nth-child(3) { border-left: none; }
  .highlight:nth-child(n+3) { border-top: 1px solid var(--border); }
  .toolbox-inner { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .step:not(:last-child)::after { display: none; }
}

@media (max-width: 480px) {
  .wrap { width: calc(100% - 2rem); }
  .steps { grid-template-columns: 1fr; }
  .btn-lg { padding: .9rem 1.3rem; }
}

/* Component-level: side-by-side icon + text when the card container is wide */
@container (min-width: 460px) {
  .feature-card { display: grid; grid-template-columns: 56px 1fr; column-gap: 1.2rem; align-items: start; }
  .feature-icon { grid-row: span 2; margin-bottom: 0; }
}

/* ============================================================
   Scroll reveal: feature detect + prefers-reduced-motion
   Prefer native scroll-driven animation when available;
   otherwise IntersectionObserver fallback in script.js.
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {
  @supports ((animation-timeline: view()) and (animation-range: entry)) {
    @keyframes rise-in {
      from { opacity: 0; transform: translateY(26px) scale(.98); }
      to { opacity: 1; transform: none; }
    }
    .reveal {
      animation: rise-in linear both;
      animation-timeline: view();
      animation-range: entry 5% cover 30%;
    }
  }
}

/* Initial state for JS fallback (class enabled only when native animation is missing) */
.reveal.js-reveal-fallback { opacity: 0; transform: translateY(26px); transition: opacity .6s ease-out, transform .6s ease-out; }
.reveal.js-reveal-fallback.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal.js-reveal-fallback { opacity: 1; transform: none; transition: none; }
}
