/* LD Coda home: hero, statement, the work (index + chapters), interlude, plug-ins, principles, contact.
   Sections are transparent so the world (one fixed canvas, motion.css) shows through; each stage's .art box is
   where the world draws that section's figure. */

/* ── Hero: the icosahedron sits behind the name ───────── */
.hero {
  position: relative; z-index: 1; margin-top: calc(-1 * var(--nav-h)); padding-top: var(--nav-h);
  min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; justify-content: center;
  touch-action: pan-y;
}
.hero .art { position: absolute; left: 0; right: 0; top: var(--nav-h); bottom: 0; pointer-events: none; }
/* The hero is the world plus the mark and name: the waves ripple and "Coda" shimmers. */
.hero-brand { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; pointer-events: none; }
.hero-brand::before {
  content: ""; position: absolute; z-index: -1; left: 50%; top: 50%; width: min(620px, 100%); height: 260%;
  transform: translate(-50%, -62%); background: radial-gradient(closest-side, rgba(9, 9, 11, .7), transparent);
}
/* the name is the only thing in flow, so it sits at the icosahedron's centre; the mark hangs just above it.
   The mark's drawing spans y 62–138 of its 200 box, so pulling it down ~26% of its width trims the empty band. */
.hero .hero-brand h1 { margin-top: 0; }
.hero-mark {
  --mark-w: clamp(150px, 22vw, 240px);
  position: absolute; left: 50%; bottom: calc(100% - var(--mark-w) * .26); transform: translateX(-50%);
  width: var(--mark-w); height: auto; filter: drop-shadow(0 0 30px rgba(124, 108, 246, .45));
}
.hero-mark .w1 { opacity: .35; }
.hero-mark .w2 { opacity: .7; }
.hero h1 { margin-top: 6px; font-size: clamp(3rem, 9vw, 6rem); letter-spacing: .12em; line-height: 1; text-shadow: none; }
.hero h1 .ld { font-weight: 250; color: var(--text); }
.hero h1 .coda {
  font-weight: 800; background: linear-gradient(110deg, #3b82f6, #8b5cf6, #22d3ee, #8b5cf6, #3b82f6) 0 0 / 300% 100%;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
}
html.motion .hero h1 .coda { animation: coda-flow 6s linear infinite; }
html.motion .hero-mark .w1 { animation: wave-sway 4.2s ease-in-out infinite; transform-origin: 100px 100px; }
html.motion .hero-mark .w2 { animation: wave-sway 3.1s ease-in-out -1.2s infinite reverse; transform-origin: 100px 100px; }
html.motion .hero-brand { animation: brand-in 1.6s ease-out both; }
@keyframes coda-flow { to { background-position: 300% 0; } }
@keyframes wave-sway { 0%, 100% { transform: scaleY(1) translateX(0); } 50% { transform: scaleY(-1) translateX(4px); } }
@keyframes brand-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.hero-copy { position: relative; text-align: center; padding-top: 6vh; padding-bottom: 12vh; }
/* a soft dark pool behind the words, so the icosahedron's lines don't cut through them */
.hero-copy::before {
  content: ""; position: absolute; z-index: -1; left: 50%; top: 50%; width: min(860px, 100%); height: 78%;
  transform: translate(-50%, -54%); pointer-events: none;
  background: radial-gradient(closest-side, rgba(9, 9, 11, .78), rgba(9, 9, 11, .5) 55%, transparent);
}
.hero h1 {
  margin-top: 26px; font-size: clamp(4.2rem, 13.5vw, 10.5rem); font-weight: 650; letter-spacing: -.06em; line-height: .88;
  text-shadow: 0 0 60px rgba(9, 9, 11, .9);
}
.hero h1 .ld { font-weight: 250; }
.hero h1 .coda { padding-right: .04em; }
.hero-sub { margin-top: 22px; font-size: clamp(1.3rem, 2.6vw, 1.9rem); font-weight: 500; letter-spacing: -.025em; line-height: 1.2; color: var(--text); text-shadow: 0 0 30px var(--bg); }
.hero-lead { max-width: 560px; margin: 14px auto 0; font-size: 1.04rem; text-shadow: 0 0 24px var(--bg); }
.cta-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 30px; }
.hero-foot {
  position: absolute; left: 0; right: 0; bottom: 26px; display: flex; justify-content: space-between; align-items: flex-end;
  font-family: var(--mono); font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
}
.hero-foot .hint { display: none; align-items: center; gap: 10px; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); white-space: nowrap; }
html.gl .hero-foot .hint { display: inline-flex; }
.hero-foot .hint svg { width: 18px; height: 18px; }
.scroll-cue { display: inline-flex; align-items: center; gap: 12px; margin-left: auto; color: var(--muted); }
.scroll-cue:hover { color: var(--text); }
.scroll-cue i { width: 1px; height: 42px; background: linear-gradient(var(--accent-2), transparent); transform-origin: top; }
html.motion .scroll-cue i { animation: cue 2.4s var(--ease) infinite; }
@keyframes cue { 0% { transform: scaleY(0); opacity: 1; } 60% { transform: scaleY(1); opacity: 1; } 100% { opacity: 0; } }

/* ── Sections ────────────────────────────────────────── */
.section { position: relative; z-index: 1; padding-top: clamp(96px, 12vw, 150px); }
.section-head { max-width: 760px; margin-bottom: clamp(36px, 5vw, 56px); }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
/* Stoic sources under the headlines: quiet, mono, after an em dash */
.section-head .cite, .interlude > .wrap > p.cite:not(.label) {
  margin-top: 14px; font-family: var(--mono); font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); text-shadow: none;
}
.section-head .cite::before, .interlude > .wrap > p.cite:not(.label)::before { content: "— "; }
.section h2 { margin-top: 16px; font-size: clamp(2.3rem, 5.2vw, 3.9rem); letter-spacing: -.045em; line-height: 1.02; }
.section-head p { margin-top: 18px; font-size: 1.1rem; text-shadow: 0 0 24px var(--bg); }

/* statement: the words light up as it scrolls through (--p from site.js) */
.statement { position: relative; z-index: 1; padding: clamp(120px, 20vh, 220px) 0 clamp(64px, 10vh, 120px); }
.statement .big {
  max-width: 1040px; font-size: clamp(1.75rem, 4.3vw, 3.5rem); font-weight: 550; letter-spacing: -.038em; line-height: 1.14;
  color: var(--text); text-shadow: 0 0 40px var(--bg);
}
.statement .big .w { opacity: clamp(.18, calc(var(--p, 1) * (var(--n) + 6) - var(--i)), 1); }
.statement .big em { font-style: normal; }
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); margin-top: clamp(48px, 7vw, 88px); list-style: none;
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .01)), rgba(9, 9, 11, .5);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.stats li { padding: 24px 26px; border-left: 1px solid var(--line); }
.stats li:first-child { border-left: 0; }
.stats .v { font-family: var(--mono); font-size: clamp(2rem, 3.6vw, 2.8rem); font-weight: 500; letter-spacing: -.04em; line-height: 1.1; color: var(--text); }
.stats .k { margin-top: 6px; font-size: .9rem; line-height: 1.4; }

/* ── The work: index of everything ───────────────────── */
.index { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; list-style: none; } /* a short last row sits centred */
.index > li { flex: 0 0 calc((100% - 60px) / 7); min-width: 0; }
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 10px; height: 100%; padding: 20px 10px 16px;
  border-radius: 18px; text-align: center; color: var(--sub);
}
.tile:hover { color: var(--sub); border-color: rgba(var(--c-rgb, var(--accent-rgb)), .55); }
.tile img, .tile .glyph { width: 56px; height: 56px; border-radius: 14px; box-shadow: 0 10px 30px -12px rgba(var(--c-rgb), .9); transition: transform .4s var(--ease); }
.tile:hover img, .tile:hover .glyph { transform: translateY(-3px) scale(1.04); }
.tile b { color: var(--text); font-size: .98rem; font-weight: 600; letter-spacing: -.01em; }
.tile small { font-family: var(--mono); font-size: .64rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* ── Chapters: one per product, its figure drawn in .art ─ */
.chapter { position: relative; z-index: 1; display: flex; align-items: center; min-height: 100vh; padding: clamp(56px, 8vh, 110px) 0; }
.chapter-grid { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); gap: clamp(28px, 5vw, 84px); align-items: center; width: 100%; }
.chapter.flip .stage { order: -1; }
.chapter .label { color: var(--c-text); }
.chapter .label b { font-weight: 500; color: var(--text); }
.chapter h3 { display: flex; align-items: center; gap: 18px; margin-top: 20px; font-size: clamp(2.6rem, 5.4vw, 4.4rem); letter-spacing: -.05em; line-height: .98; }
.chapter h3 img, .chapter h3 .glyph { width: clamp(48px, 5vw, 64px); height: clamp(48px, 5vw, 64px); border-radius: 15px; flex: none; box-shadow: 0 14px 40px -14px rgba(var(--c-rgb), .9); }
.chapter-tag { margin-top: 20px; max-width: 30ch; font-size: clamp(1.2rem, 2vw, 1.5rem); font-weight: 500; line-height: 1.3; letter-spacing: -.02em; color: var(--text); }
.chapter-desc { margin-top: 14px; max-width: 48ch; font-size: 1.02rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; list-style: none; }
.chips li {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2);
  background: rgba(9, 9, 11, .5); font-family: var(--mono); font-size: .74rem; letter-spacing: .03em; color: var(--text);
}
.chips li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.chapter-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin-top: 30px; }
.chapter-cta .btn:hover { box-shadow: inset 0 0 0 1px rgba(var(--c-rgb), .8), 0 0 34px -8px rgba(var(--c-rgb), .8); }
.soon { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.soon::before { content: ""; width: 6px; height: 6px; border-radius: 50%; border: 1px solid var(--c); }

/* the stage: the figure at the inner side, the real app at the outer edge */
.stage { position: relative; aspect-ratio: 1 / .96; touch-action: pan-y; }
.stage .art { position: absolute; top: 6%; left: 0; width: 72%; aspect-ratio: 1; }
.chapter.flip .stage .art { left: auto; right: 0; }
.phone {
  position: absolute; right: 3%; bottom: 0; width: 34%; aspect-ratio: 720 / 1559; padding: 2.3%; border-radius: 15% / 7%;
  background: linear-gradient(150deg, #34343c, #0d0d10 34%, #121216 70%, #2a2a31);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .09), 0 50px 90px -34px #000, 0 34px 90px -40px rgba(var(--c-rgb), .85);
}
.chapter.flip .phone { right: auto; left: 3%; }
.phone img { width: 100%; height: 100%; object-fit: cover; border-radius: 12.5% / 5.8%; background: #000; }
.phone::after { /* glass sheen */
  content: ""; position: absolute; inset: 2.3%; border-radius: 12.5% / 5.8%; pointer-events: none;
  background: linear-gradient(160deg, rgba(255, 255, 255, .1), transparent 30%);
}

/* plug-ins: a wide figure above the interface, overlapping its top edge */
.stage.wide { aspect-ratio: auto; }
.stage.wide .art, .chapter.flip .stage.wide .art { position: relative; top: auto; left: auto; right: auto; width: 100%; aspect-ratio: 2 / 1; margin-bottom: -9%; }
.ui {
  position: relative; overflow: hidden; border-radius: var(--r); border: 1px solid var(--line-2);
  background: var(--bg-well);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 50px 110px -40px #000, 0 30px 80px -46px rgba(var(--c-rgb), .9);
}
.ui img { width: 100%; }

/* ── Interlude: the sound wave, then the plug-ins ────── */
.interlude { position: relative; z-index: 1; padding-top: clamp(110px, 16vh, 180px); }
.interlude > .wrap { max-width: 860px; text-align: center; }
.interlude h2 { margin-top: 16px; font-size: clamp(2.3rem, 5.2vw, 3.9rem); letter-spacing: -.045em; line-height: 1.02; }
.interlude > .wrap > p:not(.label) { margin-top: 18px; font-size: 1.1rem; text-shadow: 0 0 24px var(--bg); }
.wave-band { position: relative; height: clamp(170px, 26vh, 280px); margin-top: clamp(24px, 4vh, 48px); touch-action: pan-y; }
.wave-band canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ── Principles ──────────────────────────────────────── */
.principle-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; list-style: none; }
.principle { padding: 28px 26px 26px; border-radius: var(--r-lg); }
.principle .n { display: flex; align-items: center; justify-content: space-between; font-family: var(--mono); font-size: .78rem; letter-spacing: .1em; color: var(--accent-text); }
.principle .n i { width: 30px; height: 3px; border-radius: 2px; background: var(--grad); box-shadow: 0 0 14px rgba(var(--accent-rgb), .8); }
.principle h3 { margin-top: 22px; min-height: 1.25em; font-size: 1.3rem; letter-spacing: -.02em; }
.principle h3 .caret { display: inline-block; width: 2px; height: 1em; margin-left: 3px; vertical-align: -.12em; background: var(--accent-2); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.principle p { margin-top: 10px; font-size: .98rem; }

/* ── Contact: the coda ───────────────────────────────── */
.coda { position: relative; z-index: 1; padding: clamp(80px, 12vh, 140px) 0 clamp(80px, 12vh, 130px); text-align: center; }
.coda .art { position: relative; width: min(440px, 80vw); aspect-ratio: 1.25; margin: 0 auto clamp(12px, 3vh, 32px); }
.coda .art svg { position: absolute; inset: 8% 12%; width: 76%; height: 84%; opacity: .9; }
html.gl .coda .art svg { display: none; }
.coda .art img { position: absolute; inset: 8% 12%; width: 76%; height: 84%; object-fit: contain; opacity: .9; }
html.gl .coda .art img { display: none; }
.coda h2 { font-size: clamp(3rem, 9vw, 6.6rem); letter-spacing: -.06em; line-height: .92; }
.coda p { max-width: 520px; margin: 20px auto 0; font-size: 1.1rem; }
.mail { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 28px; list-style: none; }
.mail a {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line-2); background: rgba(9, 9, 11, .5); color: var(--text); font-family: var(--mono); font-size: .84rem;
}
.mail a span { color: var(--muted); font-size: .76rem; letter-spacing: .06em; }
.mail a:hover { border-color: rgba(var(--accent-rgb), .6); }

/* ── Small screens ───────────────────────────────────── */
@media (max-width: 1080px) {
  .index > li { flex-basis: calc((100% - 30px) / 4); }
  .principle-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 920px) {
  .chapter { min-height: 0; padding: clamp(48px, 10vh, 90px) 0; }
  .chapter-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .chapter.flip .stage { order: 0; }
  .stage { order: -1; width: 100%; max-width: 560px; margin: 0 auto; aspect-ratio: 1 / .9; }
  .stage .art, .chapter.flip .stage .art { left: -2%; right: auto; top: 4%; width: 74%; }
  .phone, .chapter.flip .phone { left: auto; right: 0; width: 35%; }
  .stage.wide { max-width: 640px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats li:nth-child(3) { border-left: 0; }
  .stats li:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .hero-copy { padding-top: 2vh; padding-bottom: 9vh; }
  .hero-lead { font-size: .98rem; }
  .cta-row { max-width: 420px; margin-left: auto; margin-right: auto; }
  .cta-row .btn { flex: 1 1 100%; }
  .hero-foot { bottom: 18px; justify-content: center; }
  .hero-foot .scroll-cue { display: none; }
  .index { gap: 8px; }
  .index > li { flex-basis: calc((100% - 16px) / 3); }
  .tile { padding: 16px 6px 12px; gap: 8px; border-radius: 16px; }
  .tile img, .tile .glyph { width: 48px; height: 48px; border-radius: 12px; }
  .tile b { font-size: .88rem; }
  .tile small { font-size: .58rem; letter-spacing: .08em; }
  .stats li { padding: 18px; }
  .chapter h3 { gap: 14px; }
  .chips li { font-size: .7rem; }
  .principle-grid { grid-template-columns: minmax(0, 1fr); }
  .mail { flex-direction: column; align-items: center; }
}
