/* NoteLama website on Meridian's NoteLama brand (technical ID nibluma):
   warm paper-grey chrome, blue-black ink, petrol as the one accent, and
   Literata only where a book speaks. The ivory Lama only ever sits on the
   brand ground (--brand); everywhere else the Lama is the single-ink
   signature. Paper and pen colours are content and never invert. */

@font-face {
  font-family: "Literata";
  src: url("assets/fonts/Literata-Display.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --ground: #ECEAE6;
  --ground-hover: #E2DFD9;
  --pane: #FDFCFA;
  --pane-alt: #F6F4F0;
  --pane-hover: #EFECE7;
  --raised: #FFFFFF;
  --canvas: #E2DFD9;
  --scrim: rgba(24, 22, 19, 0.32);
  --ink: #18212D;
  --ink-muted: #555D67;
  --ink-faint: #8C8A86;
  --line: #E1DDD6;
  --line-strong: #CEC9C1;
  --control-edge: #86827B;
  --accent: #0B6477;
  --on-accent: #FFFFFF;
  --accent-soft: #DDEEF0;
  --accent-ink: #0A5A6B;
  --focus: #0B6477;
  --success: #1E7A46;
  --success-soft: #DDF1E4;
  --warning: #8A5A00;
  --warning-soft: #F8ECCF;
  /* The brand ground keeps its light value in both appearances, as the
     app icon does. */
  --brand: #18304F;
  --brand-deep: #10223A;
  --brand-ink: #F5F2EC;
  --brand-muted: #B4C2D2;
  --brand-accent: #5CC0CF;
  --brand-on-accent: #03191E;
  --brand-line: rgba(255, 248, 235, 0.14);
  --ivory: #FFF8EB;
  /* Content colours. */
  --paper: #FFFFFF;
  --paper-cream: #FBF6EA;
  --rule: #C9D6E3;
  --cover-ink: #18304F;
  --shadow-pane: 0 0 0 1px rgba(24, 33, 45, 0.06), 0 1px 2px rgba(24, 33, 45, 0.05);
  --shadow-float: 0 0 0 1px rgba(24, 33, 45, 0.08), 0 18px 44px -14px rgba(24, 33, 45, 0.3);
  --shadow-book: 0 6px 24px -8px rgba(24, 33, 45, 0.28), 0 1px 2px rgba(24, 33, 45, 0.12);
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  --font-display: Literata, "Iowan Old Style", Charter, Georgia, serif;
  --max: 1160px;
  --gutter: clamp(18px, 4vw, 32px);
  --header: 64px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #151412;
    --ground-hover: #211F1C;
    --pane: #1D1C1A;
    --pane-alt: #191816;
    --pane-hover: #282623;
    --raised: #262421;
    --canvas: #24221F;
    --scrim: rgba(0, 0, 0, 0.55);
    --ink: #ECE8E1;
    --ink-muted: #A9A398;
    --ink-faint: #6F6A63;
    --line: #2D2A27;
    --line-strong: #3A3632;
    --control-edge: #7E786F;
    --accent: #5CC0CF;
    --on-accent: #03191E;
    --accent-soft: #17363B;
    --accent-ink: #80D2DE;
    --focus: #80D2DE;
    --success: #6FD39A;
    --success-soft: #16301F;
    --warning: #F0C46A;
    --warning-soft: #352A12;
    --shadow-pane: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-float: 0 0 0 1px rgba(255, 255, 255, 0.07), 0 18px 44px -14px rgba(0, 0, 0, 0.75);
    --shadow-book: 0 6px 24px -8px rgba(0, 0, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header) + 16px); }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 16px/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img { max-width: 100%; }
p { color: var(--ink-muted); }
a { color: var(--accent-ink); text-underline-offset: 4px; }
a:hover { text-decoration-thickness: 2px; }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.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: 16px; top: -48px; z-index: 30;
  padding: 8px 14px; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--on-accent); text-decoration: none;
}
.skip-link:focus { top: 12px; }
.tabular { font-variant-numeric: tabular-nums; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  height: var(--header);
  background: color-mix(in srgb, var(--ground) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.site-header.scrolled { border-bottom-color: var(--line); }
.site-nav {
  max-width: var(--max); height: 100%; margin: 0 auto; padding: 0 var(--gutter);
  display: flex; align-items: center; gap: 20px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 650; letter-spacing: -0.01em; }
.brand-mark { border-radius: 7px; }
.nav-links { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav-links a {
  padding: 7px 12px; border-radius: 999px; color: var(--ink-muted);
  text-decoration: none; font-size: 15px; font-weight: 500;
}
.nav-links a:hover { color: var(--ink); background: var(--ground-hover); }
.nav-links a.nav-cta { color: var(--accent-ink); }
.language {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink-muted); padding-left: 10px; border-left: 1px solid var(--line-strong);
}
.language select {
  min-height: 36px; padding: 4px 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--pane); color: var(--ink);
}

/* Buttons and small controls */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--pane); color: var(--ink);
  font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background 0.15s, transform 0.15s var(--ease), border-color 0.15s;
}
.button:hover { background: var(--pane-hover); }
.button:active { transform: translateY(1px); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.button.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.button.small { min-height: 40px; padding: 0 14px; font-size: 14px; }
.button.small .icon { width: 16px; height: 16px; }
.button.quiet { background: transparent; }
.button.quiet:hover { background: var(--pane-hover); }
.button:disabled { opacity: 0.45; cursor: default; transform: none; }
.seg {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px;
  background: var(--pane-alt); box-shadow: inset 0 0 0 1px var(--line);
}
.seg button {
  min-height: 34px; padding: 0 14px; border: 0; border-radius: 999px;
  background: transparent; color: var(--ink-muted); font-size: 14px; font-weight: 550; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--raised); color: var(--ink); box-shadow: var(--shadow-pane); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--pane-alt); color: var(--ink-muted); box-shadow: inset 0 0 0 1px var(--line);
}
.chip .icon { width: 15px; height: 15px; }
.chip.accent { background: var(--accent-soft); color: var(--accent-ink); box-shadow: none; }

/* Hero stage */
.hero { max-width: calc(var(--max) + 2 * var(--gutter)); margin: 0 auto; padding: 8px var(--gutter) 0; }
.stage {
  position: relative; overflow: hidden; isolation: isolate;
  min-height: min(640px, 82vh);
  display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr); align-items: center;
  padding: clamp(36px, 6vw, 72px);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(120% 90% at 85% 100%, rgba(92, 192, 207, 0.16), transparent 60%),
    linear-gradient(160deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: var(--brand-ink);
}
.ink-field { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.stage-veil {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(90deg, rgba(16, 34, 58, 0.78) 0%, rgba(16, 34, 58, 0.35) 52%, transparent 75%);
}
.hero-copy { position: relative; min-width: 0; max-width: 560px; }
.eyebrow {
  margin: 0 0 14px; font-size: 13px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent-ink);
}
.eyebrow b { font-variant-numeric: tabular-nums; }
.eyebrow.on-brand { color: var(--brand-accent); }
.eyebrow-maker { color: var(--brand-muted); font-weight: 500; letter-spacing: 0.02em; text-transform: none; }
h1, h2, .story-title, .cover-title, .study-head {
  font-family: var(--font-display); font-weight: 500; letter-spacing: -0.015em;
}
h1 { margin: 0; font-size: clamp(42px, 6.4vw, 76px); line-height: 1.02; color: var(--ivory); }
h1 .soft { display: block; color: var(--brand-accent); }
.lede { margin: 22px 0 0; font-size: clamp(17px, 1.6vw, 19px); line-height: 1.6; color: var(--brand-muted); max-width: 520px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.stage .button.primary { background: var(--brand-accent); border-color: var(--brand-accent); color: var(--brand-on-accent); }
.stage .button.primary:hover { background: #7ED0DC; }
.stage .button.ghost { background: rgba(255, 248, 235, 0.06); border-color: var(--brand-line); color: var(--brand-ink); }
.stage .button.ghost:hover { background: rgba(255, 248, 235, 0.12); }
.stage :focus-visible { outline-color: var(--brand-accent); }
.hero-facts {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 32px 0 0; padding: 0; list-style: none;
}
.hero-facts li {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px; border-radius: 999px; font-size: 13.5px;
  color: var(--brand-ink); background: rgba(255, 248, 235, 0.06); box-shadow: inset 0 0 0 1px var(--brand-line);
}
.hero-facts .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-accent); box-shadow: 0 0 0 4px rgba(92, 192, 207, 0.2); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(92, 192, 207, 0); } }
.hero-scene { position: relative; justify-self: center; width: min(100%, 440px); }
.hero-scene svg { display: block; width: 100%; height: auto; overflow: visible; }
.book { fill: #CFEFF3; }
.book-rule { fill: none; stroke: #0B6477; stroke-opacity: 0.55; stroke-width: 2.4; stroke-linecap: round; }
.book-spine { stroke: #0B6477; stroke-width: 3.5; stroke-linecap: round; }
.book-shadow { fill: none; stroke: rgba(0, 0, 0, 0.28); stroke-width: 4; stroke-linecap: round; filter: blur(1.5px); }
/* The book keeps the handwriting from the stage (site.js). Its right page
   turns over the spine when the spread is full. */
.book-ink path { fill: none; stroke: #0B6477; stroke-width: 0.95; stroke-linecap: round; stroke-linejoin: round; }
.book-page { opacity: 0; transform-box: view-box; transform-origin: 60px 94px; }
.book-drops circle { fill: #5CC0CF; }
.hero-lama { transform-box: view-box; transform-origin: 60px 80px; }
.hero-lama .pose { transition: opacity 0.28s var(--ease); }
.hero-lama .pose.hello { opacity: 0; }
.hero-lama.is-hello .pose.hello { opacity: 1; }
.hero-lama.is-hello .pose.proud { opacity: 0; }
.hero-lama.is-hopping { animation: hop 0.62s var(--ease); }
@keyframes hop {
  0% { transform: translateY(0) scaleY(1); }
  22% { transform: translateY(0) scale(1.03, 0.95); }
  50% { transform: translateY(-5px) scale(0.98, 1.03); }
  78% { transform: translateY(0) scale(1.02, 0.97); }
  100% { transform: translateY(0) scale(1); }
}

/* Sections */
.section { max-width: var(--max); margin: 0 auto; padding: clamp(72px, 10vw, 120px) var(--gutter) 0; }
.section-head { max-width: 760px; margin-bottom: 40px; }
.section-head h2 { margin: 0; font-size: clamp(32px, 4.4vw, 50px); line-height: 1.1; }
.section-head h2 .soft, .soft { color: var(--ink-faint); }
.section-lede { margin: 18px 0 0; font-size: 18px; max-width: 640px; }
.island { background: var(--pane); border-radius: var(--radius-lg); box-shadow: var(--shadow-pane); }

/* Reveal on scroll (only when scripts run) */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); transition-delay: calc(var(--i, 0) * 80ms); }
.js .reveal.is-visible { opacity: 1; transform: none; }

/* 01 · The tablet sketch. Mirrors the app's book screen with Meridian's
   nibluma tokens at touch density: 56px app bar on ground, 44px icon
   buttons with radius-md corners, the raised tool dock (radius-xl,
   shadow-float, 4px padding, 2px gaps, 24px line-strong dividers) and a
   vertical page feed on canvas, each page under its PageHeader. */
.tablet-figure { margin: 0; }
.tablet {
  padding: clamp(8px, 1.4vw, 14px); border-radius: calc(var(--radius-xl) + 10px);
  background: linear-gradient(145deg, #2A2D33, #16181C);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 40px 80px -30px rgba(24, 33, 45, 0.55);
}
.app {
  /* The sketch has its own appearance, switched by the caption buttons. */
  --s-ground: #ECEAE6; --s-ground-hover: #E2DFD9; --s-pane: #FDFCFA; --s-pane-hover: #EFECE7; --s-raised: #FFFFFF;
  --s-canvas: #E2DFD9; --s-ink: #18212D; --s-muted: #555D67; --s-faint: #8C8A86; --s-line: #E1DDD6; --s-line-strong: #CEC9C1;
  --s-accent: #0B6477; --s-accent-soft: #DDEEF0; --s-accent-ink: #0A5A6B; --s-on-accent: #FFFFFF; --s-scrim: rgba(24, 22, 19, 0.32);
  --s-shadow-pane: 0 0 0 1px rgba(15, 27, 33, 0.07), 0 1px 2px rgba(15, 27, 33, 0.05);
  --s-shadow-float: 0 0 0 1px rgba(15, 27, 33, 0.09), 0 16px 40px -12px rgba(15, 27, 33, 0.28);
  position: relative; overflow: hidden;
  border-radius: var(--radius-xl); background: var(--s-ground); color: var(--s-ink);
  transition: background 0.3s, color 0.3s;
}
.app.dark {
  --s-ground: #151412; --s-ground-hover: #211F1C; --s-pane: #1D1C1A; --s-pane-hover: #282623; --s-raised: #262421;
  --s-canvas: #24221F; --s-ink: #ECE8E1; --s-muted: #A9A398; --s-faint: #6F6A63; --s-line: #2D2A27; --s-line-strong: #3A3632;
  --s-accent: #5CC0CF; --s-accent-soft: #17363B; --s-accent-ink: #80D2DE; --s-on-accent: #03191E; --s-scrim: rgba(0, 0, 0, 0.55);
  --s-shadow-pane: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 1px 2px rgba(0, 0, 0, 0.35);
  --s-shadow-float: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 16px 40px -12px rgba(0, 0, 0, 0.7);
}
.app .icon { width: 20px; height: 20px; }
.icon-button {
  display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; margin: 2px; padding: 0;
  border: 0; border-radius: var(--radius-md); background: transparent; color: var(--s-muted, var(--ink-muted));
}
button.icon-button { cursor: pointer; transition: background 0.15s, color 0.15s; }
.app-bar {
  display: flex; align-items: center; gap: 0; height: 56px; padding: 0 4px;
  background: var(--s-ground);
}
.app-bar button.icon-button:hover { background: var(--s-ground-hover); color: var(--s-ink); }
.app-title { display: grid; flex: 1; min-width: 0; padding: 0 8px; line-height: 1.3; }
.book-title { font-size: 17px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.save-state { font-size: 13px; font-weight: 500; color: var(--s-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-actions { display: flex; align-items: center; }
.signature {
  display: inline-block; width: 17.23px; height: 16px; background: currentColor;
  -webkit-mask: url("assets/lama/lama-signature.svg") center / contain no-repeat;
  mask: url("assets/lama/lama-signature.svg") center / contain no-repeat;
}
.app-bar .signature-button { color: var(--s-faint); }
.app-bar .signature-button:hover, .app-bar .signature-button:focus-visible { color: var(--s-muted); background: transparent; }
.desk { position: relative; height: clamp(540px, 76vh, 880px); background: var(--s-canvas); }
.feed {
  height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  padding: calc(var(--dock-h, 56px) + 28px) clamp(8px, 2vw, 24px) 24px;
}
.feed-page { padding-bottom: 20px; }
.page-header { display: flex; align-items: center; gap: 4px; min-height: 48px; color: var(--s-muted); font-size: 13px; font-weight: 500; }
.page-position, .page-zoom { padding: 0 6px; white-space: nowrap; }
.page-actions { display: flex; margin-left: auto; }
.paper-wrap { position: relative; width: min(100%, 620px); margin: 0 auto; }
.paper {
  display: block; width: 100%; aspect-ratio: 210 / 297; border-radius: 2px;
  background: var(--paper); touch-action: none; cursor: crosshair; box-shadow: var(--s-shadow-pane);
}
.paper.pan { touch-action: pan-y; }
.paper.erasing { cursor: none; }
.eraser-ring {
  position: absolute; left: 0; top: 0; width: 28px; height: 28px; margin: -14px 0 0 -14px;
  border-radius: 50%; border: 1.5px solid #246BCE; background: rgba(36, 107, 206, 0.1);
  pointer-events: none; opacity: 0; transition: opacity 0.12s;
}
.eraser-ring.on { opacity: 1; }
.dock {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 3;
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px; padding: 4px; max-width: calc(100% - 16px); width: max-content;
  border-radius: var(--radius-xl); background: var(--s-raised); box-shadow: var(--s-shadow-float);
}
.dock-group, .dock-lane { display: flex; align-items: center; gap: 2px; }
.dock-divider { flex: none; width: 1px; height: 24px; margin: 0 4px; background: var(--s-line-strong); }
.tool {
  position: relative; display: grid; place-items: center; flex: none; width: 44px; height: 44px; margin: 2px; padding: 0;
  border: 0; border-radius: var(--radius-md); background: transparent; color: var(--s-muted); transition: background 0.15s, color 0.15s;
}
button.tool { cursor: pointer; }
button.tool:hover:not(:disabled) { background: var(--s-pane-hover); color: var(--s-ink); }
.tool[aria-pressed="true"] { background: var(--s-accent-soft); color: var(--s-accent-ink); }
.tool[aria-pressed="true"]:hover { background: color-mix(in srgb, var(--s-accent-soft) 92%, var(--s-ink)); color: var(--s-accent-ink); }
.tool:disabled { color: var(--s-faint); cursor: default; }
.pen-settings { position: relative; display: grid; }
.pen-dot {
  position: absolute; top: 10px; right: 10px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--pen, #18304F); box-shadow: 0 0 0 1px var(--s-raised); pointer-events: none;
}
.presets { position: relative; display: flex; align-items: center; gap: 2px; }
.preset-scroll {
  display: flex; align-items: center; gap: 2px; width: 148px; overflow-x: auto; scrollbar-width: none;
}
.preset-scroll::-webkit-scrollbar { display: none; }
.preset-scroll.more-after { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent); }
.preset-scroll.more-before { -webkit-mask-image: linear-gradient(90deg, transparent, #000 24px); mask-image: linear-gradient(90deg, transparent, #000 24px); }
.preset-scroll.more-before.more-after { -webkit-mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent); }
.preset-scroll .tool { margin: 2px; }
.preset-more { position: absolute; right: -2px; top: 50%; transform: translateY(-50%); display: none; color: var(--s-muted); pointer-events: none; }
.preset-more .icon { width: 18px; height: 18px; }
.presets.more-after .preset-more { display: block; }
.preset {
  display: grid; place-items: center; flex: none; width: 48px; height: 48px; padding: 0; cursor: pointer;
  border: 2px solid transparent; border-radius: var(--radius-md); background: transparent; color: var(--s-muted); transition: background 0.15s;
}
.preset:hover { background: var(--s-pane-hover); }
.preset[aria-checked="true"] { background: var(--s-accent-soft); border-color: var(--s-accent); }
.preset svg { width: 24px; height: 24px; }
.dock-text {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 98px; height: 44px; margin: 2px; padding: 0 12px;
  border: 0; border-radius: var(--radius-md); background: transparent; color: var(--s-ink); font-size: 15px; font-weight: 600; cursor: pointer;
}
.dock-text:hover { background: var(--s-pane-hover); }
.dock-text .icon { width: 18px; height: 18px; color: var(--s-muted); }
.compact-only { display: none; }
.popover {
  position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); z-index: 4;
  padding: 12px; border-radius: var(--radius-lg); background: var(--s-raised); box-shadow: var(--s-shadow-float);
}
.swatches { display: flex; gap: 8px; }
.swatch {
  width: 32px; height: 32px; padding: 0; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--ink); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--s-raised), 0 0 0 4px var(--s-accent); }
/* Meridian menus: raised, radius-xl, shadow-float, 48px rows that take the
   accent while highlighted. */
.menu {
  position: absolute; z-index: 6; min-width: 200px; max-width: 320px; padding: 4px;
  border-radius: var(--radius-xl); background: var(--m-raised, var(--raised)); box-shadow: var(--m-float, var(--shadow-float));
  animation: rise 0.18s var(--ease);
}
.app .menu { --m-raised: var(--s-raised); --m-float: var(--s-shadow-float); }
.menu button {
  display: flex; align-items: center; gap: 8px; width: 100%; height: 48px; padding: 0 8px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--m-ink, var(--ink)); font-size: 15px; text-align: left; cursor: pointer; white-space: nowrap;
}
.app .menu button { --m-ink: var(--s-ink); }
.menu button .icon { width: 20px; height: 20px; color: var(--m-muted, var(--ink-muted)); }
.menu .menu-check { display: grid; place-items: center; width: 20px; height: 20px; flex: none; }
.menu button:hover, .menu button:focus-visible { outline: none; background: var(--m-accent, var(--accent)); color: var(--m-on-accent, var(--on-accent)); }
.app .menu button:hover, .app .menu button:focus-visible { background: var(--s-accent); color: var(--s-on-accent); }
.menu button:hover .icon, .menu button:focus-visible .icon { color: inherit; }
.about-scrim {
  position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; padding: 16px;
  background: var(--s-scrim); animation: fade 0.2s var(--ease);
}
.about-dialog {
  width: min(400px, 100%); padding: 24px; border-radius: var(--radius-xl);
  background: var(--s-raised); color: var(--s-ink); box-shadow: var(--s-shadow-float); animation: rise 0.28s var(--ease);
}
.about-dialog h3 { margin: 0 0 12px; font: 650 22px/1.25 var(--font-sans); letter-spacing: -0.01em; }
.about-icon { display: block; width: 96px; height: 96px; border-radius: 22.5%; }
.about-dialog p { margin: 0; color: var(--s-ink); font-size: 15px; }
.about-dialog .about-name { margin-top: 12px; font-size: 22px; font-weight: 650; }
.about-dialog .about-family { margin-top: 16px; font-size: 13px; font-weight: 500; color: var(--s-muted); }
.about-actions { display: flex; justify-content: flex-end; margin-top: 20px; }
.about-dialog .button { min-height: 44px; border-radius: var(--radius-md); background: var(--s-raised); color: var(--s-ink); border-color: var(--s-line-strong); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
.figure-caption {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
  margin-top: 18px; font-size: 14px; color: var(--ink-muted);
}
.figure-note { margin: 8px 0 0; font-size: 14px; color: var(--ink-faint); }

/* 02 · Features */
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.feature-grid article { padding: 24px; transition: transform 0.25s var(--ease), box-shadow 0.25s; }
.feature-grid article:hover { transform: translateY(-3px); box-shadow: var(--shadow-float); }
.feature-icon {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--accent-ink);
}
.feature-icon .icon { width: 22px; height: 22px; }
.feature-grid h3 { margin: 18px 0 6px; font-size: 17px; }
.feature-grid p { margin: 0; font-size: 15px; }

.story {
  display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(28px, 5vw, 64px);
  align-items: center; margin-top: clamp(72px, 9vw, 112px);
}
.story.flip .story-copy { order: 2; }
.story-copy { min-width: 0; }
.story-title { margin: 0; font-size: clamp(28px, 3.4vw, 38px); line-height: 1.15; }
.story-copy > p { font-size: 17px; }
.ticks { margin: 20px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.ticks li { position: relative; padding-left: 28px; color: var(--ink-muted); }
.ticks li::before {
  content: ""; position: absolute; left: 0; top: 4px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230B6477' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 11px no-repeat;
}
.demo { position: relative; padding: 18px; min-width: 0; }
.demo-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.demo-bar.bottom { margin: 14px 0 0; justify-content: flex-end; }
.demo-note { margin: 14px 2px 0; font-size: 13.5px; color: var(--ink-faint); }

/* Library: BookTile and BookCover. A 4:5 cover with 4px corners, the
   6px spine shade, one wide arc in cover ink at 14% and the title printed
   in Literata; the title and date sit below with the item menu. */
.demo-bar .library-tools { display: flex; margin-left: auto; }
.demo .icon-button { --s-muted: var(--ink-muted); }
.demo button.icon-button:hover { background: var(--ground-hover); color: var(--ink); }
.shelf {
  margin: 0; padding: 18px; list-style: none; border-radius: var(--radius-md); background: var(--ground);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px 18px;
}
.book-item { position: relative; min-width: 0; }
.cover {
  position: relative; overflow: hidden; aspect-ratio: 4 / 5; border-radius: 4px; container-type: inline-size;
  background: var(--cover); color: var(--cover-ink); box-shadow: var(--shadow-book);
}
.cover::before { content: ""; position: absolute; inset: 0 auto 0 0; z-index: 1; width: 6px; background: rgba(0, 0, 0, 0.12); }
.cover::after {
  content: ""; position: absolute; left: 14.5cqw; top: 47cqw; width: 131cqw; height: 131cqw; box-sizing: border-box;
  border: 11cqw solid rgba(24, 48, 79, 0.14); border-radius: 50%;
}
.cover-title {
  position: absolute; left: calc(6px + 8cqw); right: 8cqw; top: 8cqw; z-index: 1;
  font-size: 14cqw; line-height: 1.05; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.book-label { display: flex; align-items: flex-start; margin-top: 8px; }
.book-text { display: grid; flex: 1; min-width: 0; line-height: 1.35; }
.book-name, .book-date { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-name { font-size: 15px; font-weight: 650; color: var(--ink); }
.book-date { font-size: 12.5px; font-weight: 500; color: var(--ink-muted); }
.book-label .icon-button { margin: -2px -10px 0 0; }
.book-item.leaving { animation: leave 0.32s var(--ease) forwards; }
@keyframes leave { to { opacity: 0; transform: translateY(12px) scale(0.92); } }
.empty-state { display: grid; justify-items: start; gap: 8px; padding: 34px 18px; border-radius: var(--radius-md); background: var(--ground); }
.empty-icon { width: 48px; height: 48px; border-radius: 22.5%; }
.empty-state p { margin: 0; color: var(--ink); font-size: 15px; }

/* Study tape: a ruled page (7 mm rules, the first one rule from the top)
   with tape as the app draws it: an 8 mm band with round ends in the tape
   colour, gone while revealed. 34px stand for 7 mm here; the questions
   use every second rule so each strip stands alone. */
.study-page {
  --rule-gap: 34px;
  padding: 0 26px var(--rule-gap); border-radius: 2px; color: #18304F;
  background-color: var(--paper-cream);
  background-image: repeating-linear-gradient(to bottom, transparent 0 calc(var(--rule-gap) - 1px), var(--rule) calc(var(--rule-gap) - 1px) var(--rule-gap));
  box-shadow: var(--shadow-pane);
}
.study-head { margin: 0; height: var(--rule-gap); padding-bottom: 6px; display: flex; align-items: flex-end; font-size: 24px; line-height: 1; color: #0B6477; }
.study-list { margin: 0; padding: 0; list-style: none; }
.study-list li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: end; gap: 16px; height: calc(var(--rule-gap) * 2); padding-bottom: 6px; font-family: var(--font-display); font-size: 18px; line-height: 1; }
.tape {
  position: relative; justify-self: start; min-width: 132px; height: 22px; padding: 0 12px; border: 0; cursor: pointer;
  background: transparent; color: #18304F; font: inherit; line-height: 1; text-align: left;
}
.tape::before {
  /* 8 mm at 34px per 7 mm, centred on the written answer. */
  content: ""; position: absolute; left: -6px; right: -6px; top: 50%; height: calc(var(--rule-gap) * 8 / 7); transform-origin: center;
  translate: 0 -50%; border-radius: 999px; transform: rotate(var(--r, 0deg)); background: #FF5C70;
  transition: opacity 0.2s var(--ease);
}
.tape .answer { position: relative; opacity: 0; transition: opacity 0.2s; }
.tape[aria-pressed="true"]::before { opacity: 0; }
.tape[aria-pressed="true"] .answer { opacity: 1; }
.tape:focus-visible { outline-offset: 12px; }

/* Scan: the crop editor's accent outline over a white edge and 18px white
   handles with a 2px black rim; the selected handle takes the accent. */
.scan-view { display: block; width: 100%; height: auto; border-radius: var(--radius-md); touch-action: none; user-select: none; }
.scan-desk { fill: #3A332C; }
.scan-grain { fill: none; stroke: rgba(255, 255, 255, 0.05); stroke-width: 10; }
.scan-shadow { fill: rgba(0, 0, 0, 0.35); filter: blur(6px); }
.scan-paper { fill: #FAF7F0; }
.scan-lines path { fill: none; stroke: #18304F; stroke-width: 1.4; stroke-linecap: round; opacity: 0.75; }
.scan-lines path.rule { stroke: #C9D6E3; stroke-width: 0.8; opacity: 1; }
.scan-outline-edge { fill: none; stroke: #FFFFFF; stroke-width: 5; stroke-linejoin: round; }
.scan-outline { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; transition: stroke 0.2s; }
.scan-outline.invalid { stroke: #F08A72; stroke-dasharray: 6 5; }
.scan-handle { cursor: grab; outline: none; }
.scan-handle circle.hit { fill: transparent; }
.scan-handle circle.ring { fill: #FFFFFF; stroke: #000000; stroke-width: 2; transition: fill 0.15s; }
.scan-handle:focus-visible circle.ring, .scan-handle.dragging circle.ring { fill: var(--accent); }
.scan-view.accepted .scan-handle, .scan-view.accepted .scan-outline, .scan-view.accepted .scan-outline-edge { opacity: 0; transition: opacity 0.2s; }

/* 03 · Storage */
.sync { padding: clamp(18px, 3vw, 28px); }
.sync-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; color: var(--ink-muted); font-weight: 550; font-size: 14px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 44px; height: 26px; border-radius: 999px; background: var(--line-strong); transition: background 0.2s; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--raised); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.2s var(--ease); }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }
.sync-diagram { display: grid; grid-template-columns: minmax(0, 1fr) minmax(60px, 0.7fr) minmax(0, 1fr); align-items: center; margin-top: 28px; }
.sync-node {
  display: grid; justify-items: center; gap: 10px; padding: 20px 16px; text-align: center;
  border-radius: var(--radius-md); background: var(--pane-alt); box-shadow: inset 0 0 0 1px var(--line);
  transition: opacity 0.3s, box-shadow 0.3s;
}
.node-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); }
.node-icon .icon { width: 24px; height: 24px; }
.node-note { font-size: 14px; color: var(--ink-muted); max-width: 220px; }
.mini-page { width: 100%; max-width: 220px; height: auto; border-radius: 2px; background: var(--paper); box-shadow: 0 0 0 1px rgba(24, 33, 45, 0.08), 0 6px 16px -8px rgba(24, 33, 45, 0.4); }
.sync-node.cloud.off { opacity: 0.55; box-shadow: inset 0 0 0 1px var(--line), inset 0 0 0 1px transparent; border: 1.5px dashed var(--line-strong); }
.sync-node.cloud.pulse { box-shadow: inset 0 0 0 2px var(--accent); }
.sync-link { position: relative; height: 2px; margin: 0 -2px; background: repeating-linear-gradient(90deg, var(--line-strong) 0 6px, transparent 6px 12px); }
.sync-link.live { background: repeating-linear-gradient(90deg, var(--accent) 0 6px, transparent 6px 12px); }
.packet { position: absolute; top: 50%; left: 0; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 25%, transparent); opacity: 0; }
.packet.go { animation: travel 0.9s var(--ease) forwards; }
.packet.hold { left: 8%; opacity: 1; animation: none; }
@keyframes travel { 0% { left: 0; opacity: 1; } 90% { opacity: 1; } 100% { left: 100%; opacity: 0; } }
.sync-status { display: flex; justify-content: center; margin-top: 22px; }
.status-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; font-weight: 600; font-size: 14px;
  background: var(--success-soft); color: var(--success);
}
.status-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-chip.pending { background: var(--warning-soft); color: var(--warning); }
.status-chip.busy { background: var(--accent-soft); color: var(--accent-ink); }
.status-chip.busy .dot { animation: blink 0.8s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.3; } }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 16px 0 0; }
.facts .island { padding: 22px 24px; }
.facts dt { display: flex; align-items: center; gap: 10px; font-weight: 650; }
.facts dt .icon { color: var(--accent-ink); }
.facts dd { margin: 8px 0 0; color: var(--ink-muted); font-size: 15px; }

/* 04 · Status */
.status-stage {
  position: relative; overflow: hidden; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: clamp(20px, 4vw, 48px);
  padding: clamp(28px, 5vw, 56px); border-radius: var(--radius-xl);
  background: radial-gradient(90% 120% at 0% 100%, rgba(92, 192, 207, 0.18), transparent 60%), linear-gradient(160deg, var(--brand), var(--brand-deep));
  color: var(--brand-ink);
}
.status-lama { display: grid; place-items: center; width: clamp(110px, 16vw, 168px); aspect-ratio: 1; border-radius: 50%; background: rgba(255, 248, 235, 0.05); box-shadow: inset 0 0 0 1px var(--brand-line); }
.status-copy { min-width: 0; }
.status-copy h2 { margin: 0; font-size: clamp(28px, 3.6vw, 42px); line-height: 1.12; color: var(--ivory); }
.status-copy p:last-child { margin: 14px 0 0; color: var(--brand-muted); font-size: 17px; max-width: 620px; }
.platform-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.platform { padding: 22px 24px; }
.platform-head { display: flex; align-items: center; gap: 14px; }
.platform-head > div { flex: 1; min-width: 0; }
.platform-head h3 { margin: 0; font-size: 17px; }
.platform-head p { margin: 0; font-size: 14px; color: var(--ink-faint); }
.platform-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius-sm); background: var(--pane-alt); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-muted); }
.platform > p { margin: 14px 0 0; font-size: 15px; }
.language-error { max-width: var(--max); margin: 24px auto 0; padding: 0 var(--gutter); color: var(--ink-muted); }

/* Footer */
.site-footer {
  max-width: var(--max); margin: clamp(72px, 10vw, 112px) auto 0; padding: 32px var(--gutter) 48px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 32px; align-items: center;
  border-top: 1px solid var(--line);
}
.footer-brand { display: flex; align-items: center; gap: 14px; }
.footer-brand .signature { color: var(--ink-faint); }
.footer-brand p { margin: 0; font-size: 14px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 14px; }
.footer-note { grid-column: 1 / -1; margin: 0; font-size: 13px; color: var(--ink-faint); }

/* Responsive */
@media (max-width: 960px) {
  .stage { grid-template-columns: minmax(0, 1fr); padding-bottom: 28px; }
  .stage-veil { background: linear-gradient(180deg, rgba(16, 34, 58, 0.7) 0%, rgba(16, 34, 58, 0.25) 70%); }
  .hero-scene { width: min(78%, 360px); margin-top: 18px; }
  .story { grid-template-columns: minmax(0, 1fr); }
  .story.flip .story-copy { order: 0; }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .nav-links a:not(.nav-cta) { display: none; }
  .facts, .platform-grid { grid-template-columns: minmax(0, 1fr); }
  .sync-controls .seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; border-radius: var(--radius-md); }
  .sync-controls .seg button { border-radius: var(--radius-sm); white-space: nowrap; }
  .sync-diagram { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .sync-link { width: 2px; height: 44px; margin: 0 auto; background: repeating-linear-gradient(180deg, var(--line-strong) 0 6px, transparent 6px 12px); }
  .sync-link.live { background: repeating-linear-gradient(180deg, var(--accent) 0 6px, transparent 6px 12px); }
  .packet { left: 50% !important; top: 0; }
  .packet.go { animation-name: travel-down; }
  .packet.hold { top: 10%; }
  @keyframes travel-down { 0% { top: 0; opacity: 1; } 90% { opacity: 1; } 100% { top: 100%; opacity: 0; } }
  .status-stage { grid-template-columns: minmax(0, 1fr); justify-items: start; }
  .site-footer { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .feature-grid { grid-template-columns: minmax(0, 1fr); }
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px; }
  .language { padding-left: 0; border-left: 0; }
  .language .icon { display: none; }
  .study-page { padding: 0 16px var(--rule-gap); }
  .study-list li { font-size: 16px; gap: 8px; }
  .tape { min-width: 112px; }
}
/* A phone-sized sketch, as the app lays out compact widths: Add page and
   one menu in the app bar, and the dock at the bottom in two lanes, with
   the pen slots moved into More tools. */
@media (max-width: 640px) {
  .app-actions .wide-only { display: none; }
  .desk { height: min(760px, 82vh); }
  .feed { padding: 8px 8px calc(var(--dock-h, 112px) + 28px); }
  .dock { top: auto; bottom: 12px; left: 0; right: 0; margin: 0 auto; transform: none; flex-direction: column; align-items: stretch; width: max-content; }
  .dock-lane { justify-content: center; }
  .dock .presets { display: none; }
  .dock .lane-break { display: none; }
  .dock .compact-only { display: grid; }
  .popover { top: auto; bottom: calc(100% + 8px); }
  .page-zoom { display: none; }
}

@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; }
  .js .reveal { opacity: 1; transform: none; }
}
