/* ==========================================================================
   Bookworm — Quiet Object UI (Web)
   Derived from docs/design/STYLE_GUIDE.md, QuietDesign.swift, and OnboardingView.swift
   ========================================================================== */

:root {
  color-scheme: light dark;

  /* Light appearance tokens */
  --canvas: #EEF0F1;
  --surface: #FCFCFD;
  --inset: #E5E7E9;
  --inset-soft: rgba(229, 231, 233, 0.72);
  --ink: #101213;
  --secondary: #63686D;
  --decoration: #A8ADB2;
  --border: #D8DCDF;
  --hairline: rgba(16, 18, 19, 0.08);
  --hairline-strong: rgba(16, 18, 19, 0.14);

  /* Content-only pastel accents */
  --lavender: #D7C4E8;
  --sage: #DDE9BD;
  --rose: #E7C7CD;
  --amber: #EAB16A;

  /* Highlight semantic accents (for content objects) */
  --hl-yellow: rgba(245, 217, 107, 0.56);
  --hl-red: rgba(235, 134, 134, 0.42);
  --hl-green: rgba(148, 214, 152, 0.46);
  --hl-blue: rgba(138, 192, 245, 0.46);
  --hl-purple: rgba(196, 158, 232, 0.48);

  /* Geometry */
  --radius-paper: 12px;
  --radius-inset: 20px;
  --radius-panel: 24px;
  --radius-sheet: 34px;
  --radius-pill: 999px;

  /* Elevation — reserved primarily for focal tactile objects */
  --shadow-object: 0 6px 14px rgba(0, 0, 0, 0.11), 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-sheet: 0 10px 28px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-chip: 0 2px 6px rgba(0, 0, 0, 0.08);

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Layout */
  --container-wide: 940px;
  --container-focus: 640px;
  --container-prose: 720px;
  --page-inset: 24px;

  /* Motion */
  --ease-quiet: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #17191B;
    --surface: #24272A;
    --inset: #303438;
    --inset-soft: rgba(48, 52, 56, 0.78);
    --ink: #F5F6F7;
    --secondary: #ADB3B9;
    --decoration: #6E747A;
    --border: #32363A;
    --hairline: rgba(255, 255, 255, 0.11);
    --hairline-strong: rgba(255, 255, 255, 0.18);
    --lavender: #554461;
    --sage: #414B32;
    --rose: #5A3B42;
    --amber: #77552E;
    --shadow-object: 0 10px 24px rgba(0, 0, 0, 0.42);
    --shadow-sheet: 0 12px 32px rgba(0, 0, 0, 0.36);
    --shadow-chip: 0 3px 10px rgba(0, 0, 0, 0.32);
  }
}

:root[data-theme="dark"] {
  --canvas: #17191B;
  --surface: #24272A;
  --inset: #303438;
  --inset-soft: rgba(48, 52, 56, 0.78);
  --ink: #F5F6F7;
  --secondary: #ADB3B9;
  --decoration: #6E747A;
  --border: #32363A;
  --hairline: rgba(255, 255, 255, 0.11);
  --hairline-strong: rgba(255, 255, 255, 0.18);
  --lavender: #554461;
  --sage: #414B32;
  --rose: #5A3B42;
  --amber: #77552E;
  --shadow-object: 0 10px 24px rgba(0, 0, 0, 0.42);
  --shadow-sheet: 0 12px 32px rgba(0, 0, 0, 0.36);
  --shadow-chip: 0 3px 10px rgba(0, 0, 0, 0.32);
}

/* Reset & Base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background-color: var(--canvas);
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 12px;
  z-index: 200;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--canvas);
  font-size: 14px;
  font-weight: 500;
}

.skip-link:focus {
  left: 16px;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

/* Containers */
.container {
  width: 100%;
  max-width: var(--container-wide);
  margin: 0 auto;
  padding-inline: var(--page-inset);
}

.container--focus {
  max-width: var(--container-focus);
}

.container--prose {
  max-width: var(--container-prose);
}

/* ==========================================================================
   Utility Header (Quiet top bar)
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--canvas) 86%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 180ms ease;
}

.site-header.is-scrolled {
  border-bottom-color: var(--hairline);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding-right: 6px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.brand__icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14);
  border: 1px solid var(--hairline);
  object-fit: cover;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav__link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 400;
  color: var(--secondary);
  transition: color 140ms ease, background-color 140ms ease;
}

.site-nav__link:hover {
  color: var(--ink);
  background: var(--inset-soft);
}

.site-nav__link[aria-current="page"] {
  color: var(--ink);
  font-weight: 500;
  background: var(--inset);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--inset);
  color: var(--ink);
  transition: opacity 120ms ease, transform 120ms ease, background-color 140ms ease;
}

.icon-btn:hover {
  opacity: 0.86;
}

.icon-btn:active {
  transform: scale(0.95);
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-menu-btn {
  display: none;
}

/* ==========================================================================
   Quiet Typography & Section Rhythm
   ========================================================================== */

.task-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}

.task-header__title {
  margin: 0;
  font-size: clamp(24px, 3.2vw, 30px);
  line-height: 1.2;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.task-header__context {
  margin: 0;
  font-size: clamp(24px, 3.2vw, 30px);
  line-height: 1.22;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--secondary);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--secondary);
}

.section {
  padding-block: clamp(44px, 6vw, 76px);
}

.section--hero {
  padding-top: clamp(28px, 4.5vw, 52px);
  padding-bottom: clamp(44px, 6vw, 72px);
}

.section__header {
  margin-bottom: 28px;
}

/* ==========================================================================
   Primary & Secondary Capsule Actions
   ========================================================================== */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 52px;
  padding: 13px 26px;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--canvas);
  font-size: 16px;
  line-height: 1.25;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: opacity 120ms ease, transform 120ms ease;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-primary:active {
  opacity: 0.82;
  transform: scale(0.98);
}

.btn-primary svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 11px 22px;
  border-radius: var(--radius-pill);
  background: var(--inset);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
  font-weight: 500;
  transition: opacity 120ms ease, transform 120ms ease, background-color 140ms ease;
}

.btn-secondary:hover {
  opacity: 0.86;
}

.btn-secondary:active {
  transform: scale(0.98);
}

.btn-block {
  width: 100%;
}

.action-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

/* ==========================================================================
   Progress Chips (Style Guide Signature Control)
   ========================================================================== */

.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
}

.progress-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.progress-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--secondary);
  border: 1px solid var(--hairline);
  font-size: 13.5px;
  font-weight: 500;
  transition: background-color 240ms var(--ease-quiet),
              color 240ms var(--ease-quiet),
              padding 240ms var(--ease-quiet),
              border-color 240ms var(--ease-quiet),
              transform 120ms ease;
}

.progress-chip:hover {
  color: var(--ink);
  border-color: var(--hairline-strong);
}

.progress-chip:active {
  transform: scale(0.97);
}

.progress-chip svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.progress-chip__label {
  display: none;
  white-space: nowrap;
}

.progress-chip.is-active {
  padding: 0 16px;
  background: var(--ink);
  color: var(--canvas);
  border-color: transparent;
  box-shadow: var(--shadow-chip);
}

.progress-chip.is-active .progress-chip__label {
  display: inline;
}

.progress-chip.is-done {
  background: var(--surface);
  color: var(--ink);
}

.progress-chip__check {
  display: none;
  position: absolute;
  top: -3px;
  right: -3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--canvas);
  align-items: center;
  justify-content: center;
  font-size: 9px;
  line-height: 1;
}

.progress-chip.is-done:not(.is-active) .progress-chip__check {
  display: inline-flex;
}

.progress-count {
  font-size: 13px;
  color: var(--secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ==========================================================================
   Hero Object Stage (Quiet Desk + Miniature Tactile Paper Objects)
   ========================================================================== */

.hero-stage-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 20px;
}

.object-stage {
  position: relative;
  width: 100%;
  min-height: 312px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px 12px;
  overflow: visible;
}

.object-stage__aura {
  position: absolute;
  width: 264px;
  height: 264px;
  border-radius: 50%;
  background: var(--inset-soft);
  pointer-events: none;
  z-index: 0;
}

.stage-panel {
  position: relative;
  z-index: 1;
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 256px;
  animation: stageIn 340ms var(--ease-quiet);
}

.stage-panel.is-active {
  display: flex;
}

@keyframes stageIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Tactile paper sheet primitive (always clean archival white like OnboardingView.swift) */
.paper-sheet {
  position: relative;
  background: #FFFFFF;
  color: #161819;
  border-radius: var(--radius-paper);
  border: 0.75px solid rgba(0, 0, 0, 0.08);
  box-shadow: var(--shadow-object);
  overflow: hidden;
  user-select: none;
}

.paper-line {
  height: 3.5px;
  border-radius: 2px;
  background: rgba(16, 18, 19, 0.09);
}

.paper-line--strong {
  height: 5px;
  background: rgba(16, 18, 19, 0.15);
}

.paper-line--short {
  width: 64%;
}

.paper-line--mid {
  width: 82%;
}

/* Stage 0: Library Stack */
.scene-library {
  position: relative;
  width: 260px;
  height: 230px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scene-library__back {
  position: absolute;
  width: 148px;
  height: 198px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 420ms var(--ease-quiet);
}

.scene-library__back--left {
  transform: translate(-38px, 8px) rotate(-6.5deg);
}

.scene-library__back--right {
  transform: translate(38px, 6px) rotate(7deg);
}

.scene-library:hover .scene-library__back--left {
  transform: translate(-46px, 8px) rotate(-8.5deg);
}

.scene-library:hover .scene-library__back--right {
  transform: translate(46px, 6px) rotate(9deg);
}

.scene-library__front {
  position: relative;
  z-index: 2;
  width: 164px;
  height: 218px;
  padding: 17px;
  display: flex;
  flex-direction: column;
}

.book-meta-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  color: rgba(16, 18, 19, 0.42);
  margin-bottom: 16px;
}

.book-title-serif {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.22;
  font-weight: 600;
  color: rgba(16, 18, 19, 0.88);
}

.book-rule {
  width: 28px;
  height: 1px;
  background: rgba(16, 18, 19, 0.14);
  margin: 13px 0;
}

.book-footer-row {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.book-status-pill {
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: #DDE9BD;
  color: #1A2312;
  font-size: 8.5px;
  font-weight: 600;
}

.book-page-num {
  font-size: 9.5px;
  font-weight: 500;
  color: rgba(16, 18, 19, 0.45);
  font-variant-numeric: tabular-nums;
}

/* Stage 1: OCR Scan-to-Text */
.scene-ocr {
  position: relative;
  width: 224px;
  height: 238px;
}

.scene-ocr__sheet {
  width: 212px;
  height: 236px;
  position: relative;
}

.scene-ocr__scan-layer {
  position: absolute;
  inset: 0;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transform: rotate(-0.8deg);
  background: #F6F5F1;
}

.scene-ocr__clean-layer {
  position: absolute;
  inset: 0;
  padding: 18px;
  background: #FFFFFF;
  clip-path: inset(0 0 0% 0);
  transition: clip-path 880ms var(--ease-quiet);
}

.scene-ocr[data-mode="scan"] .scene-ocr__clean-layer {
  clip-path: inset(0 0 100% 0);
}

.scene-ocr.is-sweeping .scene-ocr__clean-layer {
  animation: ocrSweep 1150ms var(--ease-quiet) forwards;
}

@keyframes ocrSweep {
  from { clip-path: inset(0 0 100% 0); }
  to { clip-path: inset(0 0 0% 0); }
}

.scene-ocr__beam {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  top: 0;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(16, 18, 19, 0.55), transparent);
  pointer-events: none;
}

.scene-ocr.is-sweeping .scene-ocr__beam {
  animation: ocrBeam 1150ms var(--ease-quiet) forwards;
}

@keyframes ocrBeam {
  0% { top: 0; opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

.ocr-kicker {
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(16, 18, 19, 0.42);
  margin-bottom: 8px;
}

.ocr-serif-body {
  margin: 0 0 9px;
  font-family: var(--font-serif);
  font-size: 12.2px;
  line-height: 1.5;
  color: rgba(16, 18, 19, 0.88);
}

.ocr-serif-sub {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 11px;
  line-height: 1.48;
  color: rgba(16, 18, 19, 0.64);
}

.ocr-pill {
  position: absolute;
  top: -10px;
  right: -6px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--canvas);
  font-size: 11px;
  font-weight: 600;
  box-shadow: var(--shadow-chip);
}

.ocr-pill svg {
  width: 12px;
  height: 12px;
}

/* Stage 2: Notes & Search */
.scene-notes {
  position: relative;
  width: 288px;
  height: 244px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scene-notes__page {
  width: 204px;
  height: 222px;
  padding: 17px;
  transform: translate(-22px, 6px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.highlight-passage {
  margin: 4px 0;
  font-family: var(--font-serif);
  font-size: 12px;
  line-height: 1.62;
  color: rgba(16, 18, 19, 0.9);
}

.highlight-passage mark {
  background: var(--hl-yellow);
  color: inherit;
  padding: 1px 4px;
  border-radius: 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition: background-color 200ms ease;
}

.scene-notes[data-hl="yellow"] .highlight-passage mark { background: var(--hl-yellow); }
.scene-notes[data-hl="red"] .highlight-passage mark { background: var(--hl-red); }
.scene-notes[data-hl="green"] .highlight-passage mark { background: var(--hl-green); }
.scene-notes[data-hl="blue"] .highlight-passage mark { background: var(--hl-blue); }
.scene-notes[data-hl="purple"] .highlight-passage mark { background: var(--hl-purple); }

.floating-search-pill {
  position: absolute;
  top: -2px;
  right: 6px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-chip);
  font-size: 11.5px;
}

.floating-search-pill span {
  color: var(--secondary);
}

.floating-note-card {
  position: absolute;
  right: 0;
  bottom: 4px;
  z-index: 3;
  width: 164px;
  padding: 12px;
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-object);
}

.floating-note-card__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--secondary);
  margin-bottom: 5px;
}

.hl-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #EAB308;
  flex-shrink: 0;
}

.scene-notes[data-hl="yellow"] .hl-dot { background: #EAB308; }
.scene-notes[data-hl="red"] .hl-dot { background: #EF4444; }
.scene-notes[data-hl="green"] .hl-dot { background: #22C55E; }
.scene-notes[data-hl="blue"] .hl-dot { background: #3B82F6; }
.scene-notes[data-hl="purple"] .hl-dot { background: #A855F7; }

.floating-note-card__text {
  margin: 0;
  font-size: 11px;
  line-height: 1.42;
  font-weight: 500;
  color: var(--ink);
}

/* Stage 3: Export & Excerpt Cards */
.scene-export {
  position: relative;
  width: 274px;
  height: 236px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.excerpt-card {
  width: 224px;
  padding: 16px;
  border-radius: 18px;
  box-shadow: var(--shadow-object);
  border: 1px solid rgba(0, 0, 0, 0.08);
  transition: background-color 220ms ease, color 220ms ease, border-color 220ms ease;
}

.excerpt-card[data-paper="paper"] {
  background: #F5F0E6;
  color: #211F1C;
}

.excerpt-card[data-paper="paper"] .excerpt-card__inner {
  background: #FCF9F2;
  border-color: rgba(46, 38, 28, 0.12);
}

.excerpt-card[data-paper="paper"] .excerpt-card__rule {
  background: #B88F3D;
}

.excerpt-card[data-paper="neutral"] {
  background: #F3F3F1;
  color: #1A1A1C;
}

.excerpt-card[data-paper="neutral"] .excerpt-card__inner {
  background: #FFFFFF;
  border-color: rgba(0, 0, 0, 0.09);
}

.excerpt-card[data-paper="neutral"] .excerpt-card__rule {
  background: #3D3D42;
}

.excerpt-card[data-paper="night"] {
  background: #16181C;
  color: #EDEAE3;
  border-color: rgba(255, 255, 255, 0.12);
}

.excerpt-card[data-paper="night"] .excerpt-card__inner {
  background: #1E2126;
  border-color: rgba(255, 255, 255, 0.12);
}

.excerpt-card[data-paper="night"] .excerpt-card__rule {
  background: #D1B06B;
}

.excerpt-card__inner {
  padding: 15px;
  border-radius: 12px;
  border: 1px solid transparent;
}

.excerpt-card__rule {
  width: 24px;
  height: 2px;
  border-radius: 2px;
  margin-bottom: 10px;
}

.excerpt-card__quote {
  margin: 0 0 12px;
  font-family: var(--font-serif);
  font-size: 12.5px;
  line-height: 1.5;
}

.excerpt-card__cite {
  margin: 0;
  font-size: 9.5px;
  opacity: 0.68;
}

.export-badge-stack {
  position: absolute;
  bottom: 4px;
  right: 0;
  display: flex;
  gap: 6px;
}

.export-pill {
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-chip);
  font-size: 10.5px;
  font-weight: 600;
  font-family: var(--font-mono);
}

/* Interactive miniature object controls below stage */
.stage-subcontrol {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
}

.micro-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  background: var(--inset);
  color: var(--secondary);
  font-size: 12.5px;
  font-weight: 500;
  transition: background-color 160ms ease, color 160ms ease;
}

.micro-chip:hover {
  color: var(--ink);
}

.micro-chip[aria-pressed="true"] {
  background: var(--ink);
  color: var(--canvas);
}

.swatch-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Object Explanation + Metadata Group (Style Guide: centered description + leading-aligned metadata group) */
.stage-caption {
  max-width: 480px;
  text-align: center;
  margin-top: 16px;
}

.stage-caption__title {
  margin: 0 0 6px;
  font-size: 19px;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.stage-caption__body {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--secondary);
}

.metadata-group {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  margin: 18px auto 0;
  text-align: left;
}

.metadata-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  line-height: 1.35;
  color: var(--secondary);
}

.metadata-row svg {
  width: 15px;
  height: 15px;
  color: var(--secondary);
  flex-shrink: 0;
}

.hero-cta-wrap {
  width: 100%;
  max-width: 360px;
  margin-top: 28px;
}

.hero-footnote {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--secondary);
  text-align: center;
}

/* ==========================================================================
   Feature Grid (Restrained Quiet Panels)
   ========================================================================== */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.quiet-card {
  background: var(--surface);
  border-radius: var(--radius-panel);
  padding: 24px;
  border: 1px solid var(--hairline);
}

.quiet-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--inset);
  color: var(--ink);
  margin-bottom: 16px;
}

.quiet-card__icon--lavender { background: var(--lavender); }
.quiet-card__icon--sage { background: var(--sage); }
.quiet-card__icon--amber { background: var(--amber); }
.quiet-card__icon--rose { background: var(--rose); }

.quiet-card__icon svg {
  width: 18px;
  height: 18px;
}

.quiet-card__title {
  margin: 0 0 6px;
  font-size: 17px;
  line-height: 1.32;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.quiet-card__body {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--secondary);
}

/* ==========================================================================
   Quiet Task Sheet (OCR Credits Showcase)
   ========================================================================== */

.task-sheet {
  background: var(--surface);
  border-radius: var(--radius-sheet);
  padding: 14px 24px 26px;
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-sheet);
}

.task-sheet__grab {
  width: 36px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--decoration);
  opacity: 0.45;
  margin: 0 auto 14px;
}

.task-sheet__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.context-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: var(--inset);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
}

.context-pill svg {
  width: 14px;
  height: 14px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--sage);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 500;
}

.credit-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.credit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 16px 18px;
  border-radius: var(--radius-inset);
  background: transparent;
  border: 1px solid var(--hairline);
  text-align: left;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.credit-row:hover {
  background: var(--inset-soft);
}

.credit-row.is-selected {
  background: var(--inset);
  border-color: transparent;
}

.credit-row__left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.credit-row__eyebrow {
  font-size: 12.5px;
  color: var(--secondary);
}

.credit-row__title {
  font-size: 20px;
  line-height: 1.25;
  font-weight: 400;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.credit-row__right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.credit-row__price {
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.credit-row__check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--canvas);
  transition: background-color 160ms ease, border-color 160ms ease;
}

.credit-row.is-selected .credit-row__check {
  background: var(--ink);
  border-color: var(--ink);
}

.inset-panel {
  margin-top: 16px;
  padding: 15px 18px;
  border-radius: var(--radius-inset);
  background: var(--inset-soft);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.inset-panel svg {
  width: 18px;
  height: 18px;
  color: var(--ink);
  flex-shrink: 0;
  margin-top: 2px;
}

.inset-panel__title {
  margin: 0 0 2px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
}

.inset-panel__body {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--secondary);
}

.task-sheet__footer {
  margin-top: 18px;
}

.task-sheet__note {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--secondary);
  text-align: center;
}

/* ==========================================================================
   Privacy Highlight Strip
   ========================================================================== */

.privacy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.privacy-item {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-inset);
  padding: 20px;
}

.privacy-item__title {
  margin: 0 0 6px;
  font-size: 15.5px;
  font-weight: 500;
  color: var(--ink);
}

.privacy-item__body {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--secondary);
}

/* ==========================================================================
   Prose / Legal / Support Pages
   ========================================================================== */

.doc-hero {
  padding-top: clamp(28px, 4.5vw, 48px);
  padding-bottom: 24px;
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--inset);
  color: var(--secondary);
  font-size: 13px;
}

.toc-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.toc-pills a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--hairline);
  font-size: 13.5px;
  color: var(--secondary);
  transition: color 140ms ease, border-color 140ms ease;
}

.toc-pills a:hover {
  color: var(--ink);
  border-color: var(--hairline-strong);
}

.doc-sheet {
  background: var(--surface);
  border-radius: var(--radius-panel);
  border: 1px solid var(--hairline);
  padding: clamp(22px, 4vw, 38px);
  margin-bottom: 20px;
}

.doc-sheet h2 {
  margin: 0 0 12px;
  font-size: 20px;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  scroll-margin-top: 86px;
}

.doc-sheet h3 {
  margin: 22px 0 8px;
  font-size: 16px;
  line-height: 1.35;
  font-weight: 500;
  color: var(--ink);
}

.doc-sheet p {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.68;
  color: var(--secondary);
}

.doc-sheet p:last-child,
.doc-sheet ul:last-child,
.doc-sheet ol:last-child {
  margin-bottom: 0;
}

.doc-sheet ul,
.doc-sheet ol {
  margin: 0 0 14px;
  padding-left: 20px;
  font-size: 15px;
  line-height: 1.66;
  color: var(--secondary);
}

.doc-sheet li + li {
  margin-top: 6px;
}

.doc-sheet strong {
  color: var(--ink);
  font-weight: 500;
}

.doc-sheet a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--decoration);
  text-underline-offset: 3px;
}

.doc-sheet a:hover {
  text-decoration-color: var(--ink);
}

.doc-sheet code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--inset);
  color: var(--ink);
}

/* Data table for App Privacy summary */
.data-table-wrap {
  overflow-x: auto;
  margin-top: 14px;
  border-radius: 16px;
  border: 1px solid var(--hairline);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: left;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table th {
  font-weight: 500;
  color: var(--ink);
  background: var(--inset-soft);
  white-space: nowrap;
}

.data-table td {
  color: var(--secondary);
  line-height: 1.5;
}

.data-table td strong {
  color: var(--ink);
  font-weight: 500;
}

/* FAQ Accordion on Support page */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-inset);
  overflow: hidden;
}

.faq-item summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  min-height: 56px;
  font-size: 15.5px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-size: 18px;
  font-weight: 400;
  color: var(--secondary);
  flex-shrink: 0;
  transition: transform 180ms ease;
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-item__body {
  padding: 0 20px 18px;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--secondary);
}

.faq-item__body p {
  margin: 0 0 10px;
}

.faq-item__body p:last-child {
  margin-bottom: 0;
}

.faq-item__body strong {
  color: var(--ink);
  font-weight: 500;
}

.faq-item__body a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--decoration);
  text-underline-offset: 3px;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  margin-top: 32px;
  padding: 36px 0 48px;
  border-top: 1px solid var(--hairline);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.site-footer__brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.site-footer__name {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
}

.site-footer__meta {
  font-size: 13px;
  color: var(--secondary);
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 14px;
  color: var(--secondary);
}

.site-footer__links a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  transition: color 140ms ease;
}

.site-footer__links a:hover {
  color: var(--ink);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 720px) {
  :root {
    --page-inset: 20px;
  }

  .feature-grid,
  .privacy-grid {
    grid-template-columns: 1fr;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 68px;
    left: var(--page-inset);
    right: var(--page-inset);
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    border-radius: var(--radius-panel);
    background: var(--surface);
    border: 1px solid var(--hairline);
    box-shadow: var(--shadow-sheet);
    gap: 4px;
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav__link {
    min-height: 44px;
    padding: 0 14px;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .task-sheet {
    padding: 14px 18px 22px;
    border-radius: 28px;
  }

  .progress-row {
    align-items: flex-start;
  }
}

/* ==========================================================================
   Accessibility: Reduce Motion & Reduce Transparency & Print
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .scene-ocr__beam {
    display: none !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .site-header {
    background: var(--canvas);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@media print {
  body {
    background: #FFFFFF;
    color: #000000;
  }

  .site-header,
  .site-footer,
  .toc-pills,
  .btn-primary,
  .btn-secondary {
    display: none !important;
  }

  .doc-sheet {
    border: 0;
    padding: 0;
    box-shadow: none;
  }
}
