/* Earendel site. One field of light (js/cosmos.js) sits behind the whole page and changes
   shape per chapter; the text stays quiet around it. Palette from assets/brand/final
   (Night, Ice, Paper) plus one signal: amber marks anything that leaves the Mac. */
:root {
  --void: #040a13;
  --night: #081321;
  --ice: #c7e6f3;
  --paper: #f2f5f7;
  --soft: #c9d6e1;
  --muted: #93a8bb;
  --line: rgba(199, 230, 243, 0.13);
  --line-2: rgba(199, 230, 243, 0.26);
  --glass: rgba(8, 19, 33, 0.58);
  --amber: #f0b45e;
  --ok: #9fe0c6;
  --err: #f3a59a;

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --gut: clamp(16px, 6vw, 104px);
  --ease: cubic-bezier(.16, .8, .2, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 800px at 75% 30%, rgba(40, 70, 120, .22), transparent 70%),
    radial-gradient(900px 700px at 10% 90%, rgba(30, 50, 90, .18), transparent 70%),
    var(--void);
  background-attachment: fixed;
  color: var(--paper);
  font: 400 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, p, dl, dd, ul, ol { margin: 0; }
a { color: inherit; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--ice); outline-offset: 3px; border-radius: 6px; }
::selection { background: rgba(199, 230, 243, .3); }

.skip { position: absolute; left: 16px; top: -60px; z-index: 50; background: var(--paper); color: var(--night); padding: 8px 14px; border-radius: 8px; }
.skip:focus { top: 16px; }

/* The field of light */
.cosmos { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.cosmos-still { display: none; }
.no-webgl .cosmos { display: none; }
.no-webgl .cosmos-still {
  display: block; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(circle at 70% 42%, rgba(255, 240, 215, .9) 0 3px, transparent 6px),
    radial-gradient(ellipse 22% 9% at 66% 46%, rgba(255, 238, 210, .35), transparent 70%),
    radial-gradient(circle at 66% 46%, transparent 0 17%, rgba(199, 230, 243, .22) 18%, transparent 21%),
    radial-gradient(ellipse 34% 14% at 66% 46%, rgba(120, 160, 230, .2), transparent 70%);
}

/* Top bar and chapter rail */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px var(--gut);
  pointer-events: none;
  background: linear-gradient(rgba(4, 10, 19, .85), rgba(4, 10, 19, 0));
}
.top > * { pointer-events: auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 500; letter-spacing: .01em; }
.lang { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; border: 1px solid var(--line); background: rgba(4, 10, 19, .4); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.lang button { background: none; border: 0; padding: 4px 11px; border-radius: 999px; color: var(--muted); cursor: pointer; font-size: 13px; }
.lang button[aria-pressed="true"] { background: var(--paper); color: var(--night); }

.rail { position: fixed; right: clamp(14px, 2.4vw, 36px); top: 50%; transform: translateY(-50%); z-index: 20; }
.rail ol { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.rail a { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 6px 0; text-decoration: none; color: var(--muted); font-size: 13px; }
.rail a::after { content: ""; width: 18px; height: 1px; background: var(--line-2); transition: width .5s var(--ease), background-color .5s; }
.rail span { opacity: 0; transform: translateX(6px); transition: opacity .4s, transform .4s var(--ease); }
.rail:hover span, .rail a:focus-visible span, .rail a[aria-current] span { opacity: 1; transform: none; }
.rail a[aria-current] { color: var(--paper); }
.rail a[aria-current]::after { width: 36px; background: var(--ice); }

/* Chapters */
main { position: relative; z-index: 1; }
.ch { position: relative; min-height: 135vh; display: flex; align-items: center; padding: 22vh calc(var(--gut) + 40px) 22vh var(--gut); }
.ch-text { width: min(600px, 100%); }
.ch-right { justify-content: flex-end; }
.ch-wide { flex-direction: column; align-items: stretch; justify-content: center; gap: 48px; }
.ch-wide .ch-text { width: min(760px, 100%); }
.ch-end { justify-content: center; padding-top: 62vh; min-height: 0; padding-bottom: 14vh; }
.ch-end .ch-text { width: min(980px, 100%); text-align: center; }
.ch-end .lead { margin-left: auto; margin-right: auto; }

h2 {
  font-size: clamp(38px, 5vw, 76px); font-weight: 300; line-height: 1.02; letter-spacing: -0.035em;
  text-wrap: balance;
}
.lead { margin-top: 26px; font-size: clamp(17px, 1.35vw, 20px); line-height: 1.6; color: var(--soft); max-width: 36em; text-wrap: pretty; }
.small { font-size: 13px; color: var(--muted); line-height: 1.5; }
.caption { font-size: 13.5px; color: var(--muted); line-height: 1.5; }

/* Hero */
.ch-hero { min-height: 100vh; min-height: 100svh; align-items: flex-end; padding-top: 18vh; padding-bottom: 15vh; }
.hero-text { width: min(980px, 100%); }
h1 { font-weight: 200; font-size: clamp(46px, 8.6vw, 148px); line-height: .94; letter-spacing: -0.045em; }
h1 > span { display: block; }
.h1b {
  background: linear-gradient(100deg, var(--ice) 0%, var(--paper) 45%, #9cc3e6 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  padding-bottom: .08em;
}
.ch-hero .lead { max-width: 33em; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 24px;
  border-radius: 999px; border: 1px solid var(--line-2); background: rgba(4, 10, 19, .35);
  color: var(--paper); text-decoration: none; font-size: 15.5px; cursor: pointer;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: border-color .3s, background-color .3s, transform .3s var(--ease);
}
.btn:hover { border-color: var(--ice); transform: translateY(-1px); }
.btn-light { background: var(--paper); color: var(--night); border-color: var(--paper); box-shadow: 0 0 40px rgba(199, 230, 243, .25); }
.btn-light:hover { background: #fff; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.facts { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 26px; margin-top: 30px; font-size: 14px; color: var(--muted); }
.facts li { display: inline-flex; align-items: center; gap: 9px; }
.facts li::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--ice); box-shadow: 0 0 8px var(--ice); }
.hero-cap { position: absolute; right: calc(var(--gut) + 40px); bottom: 15vh; width: 290px; text-align: right; }
.cue { position: absolute; left: 50%; bottom: 28px; width: 22px; height: 46px; transform: translateX(-50%); display: block; }
.cue span { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: linear-gradient(var(--ice), transparent); overflow: hidden; }
.cue span::after { content: ""; position: absolute; left: -1px; width: 3px; height: 12px; border-radius: 2px; background: var(--paper); animation: fall 2.2s var(--ease) infinite; }
@keyframes fall { from { top: -12px; opacity: 0; } 30% { opacity: 1; } to { top: 46px; opacity: 0; } }

/* Text arrival: each heading comes into focus like light through a lens. */
.js .split .c {
  display: inline-block; opacity: 0; filter: blur(14px); transform: translateY(.3em) scale(1.12);
  transition: opacity .9s var(--ease), filter 1.3s var(--ease), transform 1.3s var(--ease);
  transition-delay: calc(var(--i) * 24ms);
}
.split .w { display: inline-block; white-space: nowrap; }
.js .in .split .c, .js .split.in .c { opacity: 1; filter: none; transform: none; }
.js .rise { opacity: 0; transform: translateY(14px); transition: opacity 1s var(--ease), transform 1s var(--ease); transition-delay: .9s; }
.js .in .rise { opacity: 1; transform: none; }
.js .ch:not(.ch-hero) .ch-text > :not(.split), .js .ch-wide .session-wrap { opacity: 0; transform: translateY(18px); transition: opacity 1s var(--ease) .35s, transform 1s var(--ease) .35s; }
.js .ch.in:not(.ch-hero) .ch-text > :not(.split), .js .ch-wide.in .session-wrap { opacity: 1; transform: none; }

/* Chapter: Arc */
.count { font-size: clamp(64px, 9vw, 140px); font-weight: 100; letter-spacing: -0.05em; line-height: 1; margin-bottom: 18px; font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, var(--paper), rgba(199, 230, 243, .35)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.count span { font-size: .2em; letter-spacing: 0; font-weight: 300; margin-left: .3em; color: var(--muted); -webkit-text-fill-color: var(--muted); }
.caps { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 32px; margin-top: 44px; }
.caps div { padding-top: 14px; border-top: 1px solid var(--line); }
.caps dt { font-weight: 500; font-size: 15.5px; }
.caps dd { margin-top: 4px; font-size: 14.5px; line-height: 1.5; color: var(--muted); }

/* Panels: glass over the field */
.panel {
  background: var(--glass); border: 1px solid var(--line); border-radius: 22px;
  backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .04);
}
.panel-title { font-weight: 500; }

/* Chapter: models */
.models { list-style: none; padding: 0; margin-top: 36px; }
.models li { display: grid; grid-template-columns: 82px 1fr auto; gap: 2px 14px; padding: 12px 0; border-top: 1px solid var(--line); align-items: baseline; }
.models b { font-weight: 500; }
.models span { color: var(--soft); font-size: 15px; }
.models .num { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.models em { grid-column: 2 / 4; font-style: normal; font-size: 14px; color: var(--muted); }
.fit { margin-top: 32px; padding: 22px 24px; }
.seg-pick { display: inline-flex; padding: 3px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(4, 10, 19, .4); }
.seg-pick button { background: none; border: 0; padding: 6px 16px; border-radius: 999px; color: var(--muted); cursor: pointer; font-size: 14.5px; font-variant-numeric: tabular-nums; transition: background-color .3s, color .3s; white-space: nowrap; }
.seg-pick button[aria-checked="true"] { background: var(--paper); color: var(--night); }
.fit .seg-pick { margin-top: 14px; }
.fit-bar { display: flex; height: 12px; margin-top: 20px; border-radius: 99px; overflow: hidden; background: rgba(199, 230, 243, .06); }
.fit-reserve { flex: 0 0 40%; background: repeating-linear-gradient(135deg, rgba(147, 168, 187, .28) 0 3px, transparent 3px 7px); transition: flex-basis .8s var(--ease); }
.fit-budget { flex: 1; }
.fit-segs { display: flex; height: 100%; }
.seg { height: 100%; width: 0; transition: width .8s var(--ease); border-right: 2px solid var(--night); }
.seg-light { background: var(--ice); box-shadow: 0 0 14px var(--ice); }
.seg-heavy { background: #eef6fb; }
.seg-slot { background: #8fc3da; }
.seg-emb { background: #9fe0d8; }
.fit-text { margin-top: 14px; font-size: 15px; color: var(--soft); min-height: 4.8em; }
.fit .small { margin-top: 10px; }

/* Chapter: verified */
.session-wrap { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 36px; align-items: start; width: min(1060px, 100%); }
.steps { list-style: none; padding: 0; counter-reset: s; position: sticky; top: 120px; }
.steps li { counter-increment: s; position: relative; }
.steps li::before { content: ""; position: absolute; left: 11px; top: 30px; bottom: -6px; width: 1px; background: var(--line); }
.steps li:last-child::before { display: none; }
.steps button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 8px 0; text-align: left; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 15px; }
.steps button::before {
  content: counter(s); flex: none; display: grid; place-items: center; width: 23px; height: 23px;
  border-radius: 50%; border: 1px solid var(--line-2); font-size: 12px; color: var(--muted);
  background: var(--void); transition: background-color .3s, color .3s, border-color .3s, box-shadow .3s;
}
.steps button.done { color: var(--soft); }
.steps button.done::before { border-color: var(--ice); color: var(--night); background: rgba(199, 230, 243, .75); }
.steps button.now { color: var(--paper); }
.steps button.now::before { background: var(--ice); color: var(--night); border-color: var(--ice); box-shadow: 0 0 18px var(--ice); }
.session { overflow: hidden; }
.session-bar { display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line); font-size: 13px; }
.session-title { font-family: var(--mono); color: var(--soft); }
.session-title::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); vertical-align: 1px; }
.session-tag { color: var(--muted); margin-right: auto; }
.session-btn { background: none; border: 1px solid var(--line-2); border-radius: 999px; padding: 3px 12px; color: var(--soft); cursor: pointer; font-size: 13px; }
.session-btn:hover { border-color: var(--ice); color: var(--paper); }
.session-body { padding: 22px 22px 26px; height: min(560px, 66vh); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; display: flex; flex-direction: column; gap: 14px; font-size: 15px; }
.ln { opacity: 0; transform: translateY(6px); transition: opacity .45s var(--ease), transform .45s var(--ease); }
.ln.in { opacity: 1; transform: none; }
.ln-user { align-self: flex-end; max-width: 80%; background: rgba(199, 230, 243, .08); border: 1px solid var(--line); padding: 10px 14px; border-radius: 14px 14px 4px 14px; }
.ln-arc { color: var(--soft); }
.ln-arc b { font-weight: 500; color: var(--paper); }
.ln-plan { border-left: 2px solid var(--ice); padding: 2px 0 2px 14px; }
.ln-plan p:first-child { color: var(--paper); margin-bottom: 6px; }
.ln-plan ul { padding-left: 18px; color: var(--soft); }
.ln-files { display: flex; flex-wrap: wrap; gap: 8px; }
.ln-files span { font-family: var(--mono); font-size: 13px; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--line); color: var(--soft); }
.ln-files span::before { content: "+ "; color: var(--ok); }
.ln-term { font-family: var(--mono); font-size: 13px; line-height: 1.55; background: rgba(2, 6, 12, .6); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ln-term .cmd { color: var(--paper); }
.ln-term .cmd::before { content: "$ "; color: var(--muted); }
.ln-term .out { color: var(--muted); }
.ln-term .err { color: var(--err); }
.ln-term .ok { color: var(--ok); }
.caret { display: inline-block; width: .55em; height: 1.05em; vertical-align: text-bottom; background: var(--ice); margin-left: 2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.ln-check p { color: var(--paper); }
.ln-check ul { list-style: none; margin: 6px 0 0; padding: 0; }
.ln-check li { padding-left: 24px; position: relative; color: var(--soft); }
.ln-check li::before { content: ""; position: absolute; left: 2px; top: .55em; width: 10px; height: 5px; border: solid var(--ok); border-width: 0 0 2px 2px; transform: rotate(-45deg); }
.ln-verdict { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.badge { display: inline-flex; align-items: center; gap: 9px; padding: 7px 16px; border-radius: 999px; background: var(--ice); color: var(--night); font-weight: 500; box-shadow: 0 0 30px rgba(199, 230, 243, .45); }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--night); }
.ln-verdict p { color: var(--muted); font-size: 14px; }

/* Chapter: private */
.ctl { margin-top: 32px; padding: 18px 22px; display: grid; gap: 14px; }
.ctl-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; }
.ctl-row > span:first-of-type { margin-right: auto; }
.switch { position: relative; width: 50px; height: 28px; flex: none; border-radius: 99px; border: 1px solid var(--line-2); background: rgba(4, 10, 19, .5); cursor: pointer; padding: 0; transition: background-color .3s, border-color .3s; }
.switch span { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform .35s var(--ease), background-color .3s; }
.switch[aria-checked="true"] { background: rgba(240, 180, 94, .22); border-color: var(--amber); }
.switch[aria-checked="true"] span { transform: translateX(22px); background: var(--amber); box-shadow: 0 0 12px var(--amber); }
.ctl-row:first-child { justify-content: flex-start; }
.ctl-row:first-child > span:first-of-type { margin-right: 0; }
.ctl-state { color: var(--muted); font-size: 14px; margin-left: auto; }
.ctl-text { font-size: 14.5px; color: var(--soft); min-height: 3em; padding-top: 12px; border-top: 1px solid var(--line); }
.ctl-text.out { color: var(--amber); }
.out { list-style: none; padding: 0; margin-top: 28px; display: grid; gap: 0; }
.out li { padding: 13px 0 13px 22px; border-top: 1px solid var(--line); position: relative; display: grid; gap: 2px; }
.out li::before { content: ""; position: absolute; left: 2px; top: 21px; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 12px var(--amber); transition: background-color .5s, box-shadow .5s; }
.out b { font-weight: 500; }
.out span { font-size: 14.5px; line-height: 1.5; color: var(--muted); }
.out .off { display: none; }
.out[data-net="off"] .when { display: none; }
.out[data-net="off"] .off { display: block; }
.out[data-net="off"] li::before, .out li.quiet::before { background: transparent; box-shadow: inset 0 0 0 1px var(--muted); }

/* Chapter: get it */
.get { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 32px; margin-top: 52px; text-align: left; align-items: start; }
.spec div { display: grid; grid-template-columns: 120px 1fr; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.spec dt { color: var(--muted); font-size: 14.5px; }
.spec dd { font-size: 15px; color: var(--soft); }
.dl { padding: 24px; display: grid; gap: 12px; justify-items: start; }
.dl p:not(.panel-title) { color: var(--muted); font-size: 15px; }
.built { margin: 44px auto 0; max-width: 46em; color: var(--muted); font-size: 15px; line-height: 1.65; }

.platforms { list-style: none; padding: 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.platforms li { display: grid; gap: 2px; min-width: 150px; padding: 14px 22px; border-radius: 18px; border: 1px dashed var(--line-2); text-align: center; }
.platforms b { font-weight: 500; font-size: 18px; color: var(--soft); }
.platforms span { font-size: 13px; color: var(--muted); }
.platforms .now { border: 1px solid var(--ice); background: rgba(199, 230, 243, .07); box-shadow: 0 0 40px rgba(199, 230, 243, .12); }
.platforms .now b { color: var(--paper); }

/* Footer */
.foot { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px; padding: 36px var(--gut) 44px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.foot p:first-child { margin-right: auto; }
.foot-tag { color: var(--soft); margin-left: 8px; }
.foot-small { width: 100%; font-size: 12.5px; }

/* Narrow screens: the field fills the back, text sits on a soft scrim. */
@media (max-width: 900px) {
  .rail { display: none; }
  .ch, .ch-right { justify-content: flex-start; padding: 16vh var(--gut); min-height: 0; }
  .ch-text { position: relative; }
  .ch:not(.ch-hero):not(.ch-end) { padding-top: 62vh; }
  .ch:not(.ch-hero) .ch-text::before {
    content: ""; position: absolute; inset: -28px -24px; z-index: -1; border-radius: 28px;
    background: radial-gradient(closest-side, rgba(4, 10, 19, .78), rgba(4, 10, 19, .5) 75%, transparent);
    filter: blur(12px);
  }
  .ch-hero { padding-top: 40vh; padding-bottom: 12vh; align-items: flex-end; }
  .hero-cap { position: static; width: auto; text-align: left; margin-top: 28px; }
  .ch-hero { flex-direction: column; align-items: flex-start; justify-content: flex-end; }
  .cue { display: none; }
  .caps { grid-template-columns: 1fr; gap: 14px; }
  .session-wrap { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .steps { position: static; display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; scroll-behavior: smooth; }
  .steps::-webkit-scrollbar { display: none; }
  .steps li::before { display: none; }
  .steps button { white-space: nowrap; padding: 6px 12px 6px 6px; border: 1px solid var(--line); border-radius: 999px; gap: 8px; font-size: 13.5px; background: rgba(4, 10, 19, .55); }
  .ch-end { padding-top: 52vh; }
  .get { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .top { padding: 14px 16px; }
  h1 { font-size: clamp(42px, 12.4vw, 64px); }
  .session-body { padding: 16px 14px 20px; height: min(520px, 68vh); }
  .session-tag { display: none; }
  .ln-user { max-width: 92%; }
  .spec div { grid-template-columns: 1fr; gap: 2px; }
  .models li { grid-template-columns: 70px 1fr auto; }
  .ctl { padding: 16px; }
  .ctl-row:last-of-type { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .split .c, .js .rise, .js .ch .ch-text > *, .js .ch-wide .session-wrap { opacity: 1 !important; filter: none !important; transform: none !important; transition: none !important; }
  .ln { opacity: 1; transform: none; transition: none; }
  .caret, .cue { display: none; }
  .seg, .fit-reserve, .switch span { transition: none; }
}
