/* bylta.app. Structure after getlunta.app; colours from the app: night navy (the app's
   background), ice blue (snow), teal (rain), wool cream and an amber accent from the beanie logo.
   Light and dark themes follow the system, with a toggle. Fonts self-hosted (SIL OFL, fonts/OFL.txt).
   Motion is decoration only; prefers-reduced-motion turns it off. */

@font-face { font-family: "Libre Franklin"; src: url(fonts/libre-franklin.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url(fonts/dm-sans.woff2) format("woff2"); font-weight: 100 1000; font-display: swap; }

:root {
  color-scheme: light dark;
  --ice: #5873a8;
  --ice-soft: #9db4e0;
  --teal: #3f8a84;
  --teal-soft: #88c4bb;
  --wool: #f1eade;
  --amber: #e0a868;

  --bg: #f8f7f3;
  --bg-alt: #f0ede5;
  --surface: #ffffff;
  --ink: #141b26;
  --muted: #535d6c;
  --hairline: #e3dfd5;
  --kicker: #3f8a84;
  --chip: #efece4;
  --shadow-1: 0 1px 2px rgba(20, 27, 38, .06), 0 4px 14px rgba(20, 27, 38, .06);
  --shadow-2: 0 2px 6px rgba(20, 27, 38, .08), 0 30px 60px -20px rgba(20, 27, 38, .35);

  --band: #121826;
  --band-2: #0d121c;
  --band-ink: #f3f1ea;
  --band-muted: #aeb8c7;
  --band-hairline: rgba(243, 241, 234, .14);

  --font-display: "Libre Franklin", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-body: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --radius: .75rem;
  --radius-lg: 1.5rem;
  --wrap: 74rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --section: clamp(4.5rem, 9vw, 7.5rem);
  --ease: cubic-bezier(.2, .7, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-color-scheme="light"]) {
    --bg: #0e131c; --bg-alt: #121925; --surface: #172030; --ink: #ece9e1; --muted: #a7b1c0;
    --hairline: #243044; --kicker: #88c4bb; --chip: #1f2a3c;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .35), 0 4px 14px rgba(0, 0, 0, .3);
    --shadow-2: 0 2px 6px rgba(0, 0, 0, .4), 0 30px 60px -20px rgba(0, 0, 0, .7);
    --band: #0b1019; --band-2: #080c13;
  }
}
:root[data-color-scheme="dark"] {
  --bg: #0e131c; --bg-alt: #121925; --surface: #172030; --ink: #ece9e1; --muted: #a7b1c0;
  --hairline: #243044; --kicker: #88c4bb; --chip: #1f2a3c;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .35), 0 4px 14px rgba(0, 0, 0, .3);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, .4), 0 30px 60px -20px rgba(0, 0, 0, .7);
  --band: #0b1019; --band-2: #080c13;
}
:root[data-color-scheme="light"] { color-scheme: light; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1.0625rem/1.6 var(--font-body); -webkit-font-smoothing: antialiased; transition: background .3s, color .3s; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 750; line-height: 1.07; margin: 0; text-wrap: balance; letter-spacing: -.015em; }
p { margin: 0; text-wrap: pretty; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
svg.i { width: 1.25em; height: 1.25em; flex: none; }
.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: .5rem; background: var(--surface); padding: .5rem 1rem; border-radius: var(--radius); z-index: 99; }
.skip:focus { left: .5rem; }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--band-2) 82%, transparent); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid var(--band-hairline); color: var(--band-ink); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 4rem; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .55rem; font: 750 1.25rem var(--font-display); text-decoration: none; }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.nav { display: flex; align-items: center; gap: clamp(.75rem, 2vw, 1.5rem); font-size: .95rem; }
.nav a:not(.btn) { text-decoration: none; color: var(--band-muted); }
.nav a:not(.btn):hover { color: var(--band-ink); }
.theme-toggle { background: none; border: 1px solid var(--band-hairline); color: var(--band-ink); width: 2.1rem; height: 2.1rem; border-radius: 50%; cursor: pointer; font-size: 1rem; }
@media (max-width: 800px) { .nav .wide { display: none; } }
.read-progress { position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%; transform-origin: 0 50%; transform: scaleX(var(--p, 0)); background: linear-gradient(90deg, var(--ice-soft), var(--teal-soft)); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: .65rem; padding: .75rem 1.2rem; border-radius: 999px; font-weight: 650; text-decoration: none; line-height: 1.2; transition: transform .2s var(--ease), box-shadow .2s; border: 1px solid transparent; }
.btn:hover { transform: translateY(-1px); }
.btn small { display: block; font-weight: 450; font-size: .78rem; opacity: .75; }
.btn-wool { background: var(--wool); color: #141b26; box-shadow: 0 10px 30px -12px rgba(241, 234, 222, .55); }
.btn-ghost { border-color: var(--band-hairline); color: var(--band-ink); }
.btn-small { padding: .45rem .9rem; font-size: .9rem; background: var(--wool); color: #141b26; }

/* ---------- hero ---------- */
.band { background: var(--band); color: var(--band-ink); position: relative; overflow: hidden; }
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero::before { content: ""; position: absolute; inset: 0; background:
    radial-gradient(45% 60% at 18% 25%, rgba(88, 115, 168, .45), transparent 70%),
    radial-gradient(40% 55% at 85% 30%, rgba(63, 138, 132, .42), transparent 70%),
    radial-gradient(35% 40% at 55% 105%, rgba(224, 168, 104, .16), transparent 70%); }
.hero-grid { position: relative; display: grid; grid-template-columns: 1.08fr .92fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; padding-block: clamp(3.5rem, 8vw, 6rem); }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }
.pill { display: inline-flex; gap: .55rem; align-items: center; padding: .35rem .85rem; border-radius: 999px; border: 1px solid var(--band-hairline); font-size: .86rem; color: var(--band-muted); text-decoration: none; background: rgba(255, 255, 255, .05); }
.pill b { color: var(--teal-soft); }
h1 { font-size: clamp(2.7rem, 6.3vw, 4.7rem); margin-top: 1.2rem; }
h1 .snow { color: var(--ice-soft); } h1 .rain { color: var(--teal-soft); }
.lead { font-size: clamp(1.1rem, 1.8vw, 1.28rem); color: var(--muted); margin-top: 1.2rem; max-width: 38rem; }
.band .lead { color: var(--band-muted); }
.cta-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }
.hero-meta { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin-top: 1.8rem; font-size: .92rem; color: var(--band-muted); }
.hero-meta span::before { content: "✓ "; color: var(--teal-soft); }
.hero-art { position: relative; display: grid; place-items: center; }
.phone { width: min(300px, 74vw); border-radius: 2.6rem; padding: .5rem; background: linear-gradient(160deg, #2c3446, #0a0e16); box-shadow: var(--shadow-2), inset 0 0 0 1px rgba(255, 255, 255, .08); }
.phone img { border-radius: 2.15rem; width: 100%; }
.phone.tilt { transform: rotate(-3deg); }
.phone.back { position: absolute; width: min(250px, 60vw); transform: translate(46%, 8%) rotate(5deg); opacity: .9; z-index: -0; filter: saturate(.9); }
@media (max-width: 900px) { .phone.back { display: none; } }
.float { position: absolute; z-index: 2; padding: .55rem .85rem; border-radius: 1rem; font-size: .84rem; background: rgba(18, 24, 38, .78); border: 1px solid var(--band-hairline); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--shadow-2); color: var(--band-ink); }
.float b { color: var(--teal-soft); }
.float-a { left: -.5rem; top: 14%; } .float-b { right: -.5rem; bottom: 18%; }
@media (max-width: 900px) { .float { display: none; } }

/* ---------- works-with strip ---------- */
.works { background: var(--band-2); color: var(--band-muted); border-top: 1px solid var(--band-hairline); }
.works .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.8rem; padding-block: 1.2rem; font-size: .93rem; }
.works p { text-transform: uppercase; letter-spacing: .14em; font-size: .74rem; }
.works ul { display: flex; flex-wrap: wrap; gap: .5rem 1.6rem; list-style: none; margin: 0; padding: 0; }
.works li { color: var(--band-ink); font-weight: 600; }

/* ---------- sections ---------- */
.section { padding-block: var(--section); }
.section-alt { background: var(--bg-alt); }
.section-head { max-width: 46rem; margin-bottom: clamp(2.5rem, 5vw, 3.5rem); }
.section-head.center { margin-inline: auto; text-align: center; }
.kicker { text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; font-weight: 700; color: var(--kicker); margin-bottom: .9rem; }
h2 { font-size: clamp(2rem, 4.2vw, 3.1rem); }

/* story */
.story { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
@media (max-width: 820px) { .story { grid-template-columns: 1fr; } }
.story article { background: var(--surface); border-radius: var(--radius-lg); padding: 1.6rem; box-shadow: var(--shadow-1); }
.story .time { font: 750 1.7rem var(--font-display); color: var(--ice); }
:root[data-color-scheme="dark"] .story .time { color: var(--ice-soft); }
.story p { color: var(--muted); margin-top: .45rem; }

/* ---------- showcase (try it) ---------- */
.try { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: center; }
@media (max-width: 880px) { .try { grid-template-columns: 1fr; } }
.controls { background: var(--surface); border-radius: var(--radius-lg); padding: 1.6rem; box-shadow: var(--shadow-1); display: grid; gap: 1.3rem; }
.control label { display: flex; justify-content: space-between; font-weight: 600; font-size: .95rem; }
.control output { font-variant-numeric: tabular-nums; color: var(--kicker); }
.control input[type=range] { width: 100%; accent-color: var(--teal); margin-top: .5rem; }
.control .ends { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); }
.card { border-radius: 1.6rem; padding: 1.3rem; background: linear-gradient(160deg, #1b2335, #121826); color: var(--band-ink); box-shadow: var(--shadow-2); border: 1px solid var(--band-hairline); }
.card-top { display: flex; align-items: center; gap: .85rem; }
.card-icon { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; font-size: 1.5rem; transition: background .4s; }
.card-name { font-size: .78rem; color: var(--band-muted); }
.card-title { font: 750 1.3rem var(--font-display); }
.ring { margin-left: auto; width: 54px; height: 54px; }
.ring circle { fill: none; stroke-width: 5; }
.ring .bg { stroke: rgba(255, 255, 255, .12); }
.ring .fg { stroke: var(--amber); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset .5s var(--ease); }
.ring text { fill: var(--band-ink); font: 700 13px var(--font-body); text-anchor: middle; dominant-baseline: central; }
.posterior { margin-top: 1.1rem; padding: .9rem 1rem; border-radius: .9rem; background: rgba(255, 255, 255, .05); font-size: .85rem; }
.posterior .t { color: var(--band-muted); font-size: .74rem; margin-bottom: .45rem; }
.prow { display: grid; grid-template-columns: 9.5rem 1fr 2.8rem; gap: .6rem; align-items: center; margin-top: .35rem; }
.prow i { height: 7px; border-radius: 4px; background: rgba(255, 255, 255, .1); position: relative; overflow: hidden; }
.prow i b { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: rgba(255, 255, 255, .45); transition: width .45s var(--ease); }
.prow.top i b { background: var(--amber); }
.prow span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.why { margin-top: .9rem; font-size: .86rem; color: var(--band-muted); }
.try-note { margin-top: 1rem; font-size: .85rem; color: var(--muted); }

/* ---------- bento ---------- */
.bento { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1.25rem; }
.cell { grid-column: span 2; background: var(--surface); border-radius: var(--radius-lg); padding: 1.6rem; box-shadow: var(--shadow-1); display: flex; flex-direction: column; gap: .6rem; overflow: hidden; }
.cell.wide { grid-column: span 3; }
.cell.dark { background: var(--band); color: var(--band-ink); }
.cell.dark p { color: var(--band-muted); }
.cell h3 { font-size: 1.3rem; }
.cell p { color: var(--muted); }
.cell .ico { width: 2.6rem; height: 2.6rem; border-radius: .8rem; display: grid; place-items: center; font-size: 1.35rem; background: var(--chip); }
.cell.dark .ico { background: rgba(255, 255, 255, .08); }
@media (max-width: 980px) { .cell, .cell.wide { grid-column: span 3; } }
@media (max-width: 640px) { .cell, .cell.wide { grid-column: span 6; } }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: auto; padding-top: .6rem; }
.chip { font-size: .84rem; padding: .3rem .65rem; border-radius: 999px; background: var(--chip); }
.cell.dark .chip { background: rgba(255, 255, 255, .08); }
.lock { margin-top: auto; border-radius: 1.2rem; padding: .85rem 1rem; background: linear-gradient(135deg, #1c2a40, #141c2c); color: var(--band-ink); display: grid; gap: .45rem; font-size: .85rem; }
.lock .row { display: flex; align-items: center; gap: .6rem; }
.tile { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: .95rem; }
.tile.rain { background: linear-gradient(135deg, #3f8a84, #386f8f); }
.tile.snow { background: linear-gradient(135deg, #5873a8, #4e5791); }
.lock .who { color: var(--band-muted); font-size: .75rem; }

/* signals */
.signals { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1.4rem; }
.signal { border-top: 2px solid var(--teal); padding-top: 1rem; }
.signal h3 { font-size: 1.1rem; margin-bottom: .4rem; }
.signal p { color: var(--muted); font-size: .98rem; }

/* bayes */
.bayes-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
@media (max-width: 900px) { .bayes-grid { grid-template-columns: 1fr; } }
.learned { list-style: none; padding: 0; margin: 1.6rem 0 0; display: grid; gap: 1rem; }
.learned li { display: grid; grid-template-columns: 2.1rem 1fr; gap: .7rem; color: var(--band-muted); }
.learned .n { width: 2.1rem; height: 2.1rem; border-radius: 50%; display: grid; place-items: center; background: rgba(136, 196, 187, .16); color: var(--teal-soft); font-weight: 700; font-size: .9rem; }
.learned b { color: var(--band-ink); }

/* privacy */
.split { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; } }
.split article { background: var(--surface); border-radius: var(--radius-lg); padding: 1.6rem; box-shadow: var(--shadow-1); }
.split h3 { font-size: 1.15rem; margin-bottom: .4rem; }
.split p { color: var(--muted); }

/* closing */
.closing { background: var(--band); color: var(--band-ink); padding-block: var(--section) 3rem; position: relative; overflow: hidden; }
.closing h2 { font-size: clamp(2rem, 4vw, 2.8rem); }
.closing .lead { color: var(--band-muted); }
.closing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; margin-top: 3.5rem; padding-top: 2.5rem; border-top: 1px solid var(--band-hairline); }
@media (max-width: 760px) { .closing-grid { grid-template-columns: 1fr; } }
.closing-grid h3 { font-size: 1rem; margin-bottom: .6rem; }
.closing-grid a { display: block; color: var(--band-muted); text-decoration: none; margin-top: .3rem; }
.closing-grid a:hover { color: var(--band-ink); }
.foot { margin-top: 3rem; font-size: .85rem; color: var(--band-muted); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }

/* prose pages */
.prose { max-width: 44rem; padding-block: clamp(3rem, 7vw, 5rem); }
.prose h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); margin: 0 0 1rem; }
.prose h2 { font-size: 1.35rem; margin: 2.25rem 0 .6rem; }
.prose p, .prose li { color: var(--muted); }
.prose p + p { margin-top: .8rem; }
.prose ul { padding-left: 1.2rem; }
.prose a { color: var(--teal); }
.prose strong { color: var(--ink); }

/* reveal */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
  .js .reveal.in { opacity: 1; transform: none; }
}
