:root {
  --bg: #0c0e15;
  --surface: #141722;
  --surface-2: #1b1f2d;
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .14);
  --text: #f3f4f8;
  --dim: #9ba1b5;
  --faint: #6b7187;
  --amber: #ffb35c;
  --cyan: #6fe6e0;
  --rose: #ff6f9c;
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --u: 8px;
  --pad: 32px;
  --gap-section: 140px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--bg); overflow-x: clip; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  position: relative;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 900px;
  max-width: 100%;
  height: 560px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(255, 179, 92, .07), transparent);
  pointer-events: none;
}

img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
h2 { font-size: clamp(32px, 4vw, 48px); font-weight: 600; letter-spacing: -.03em; line-height: 1.08; }
h3 { font-size: 20px; font-weight: 600; line-height: 1.3; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; }

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

.wrap { max-width: 1200px; margin-inline: auto; padding-inline: var(--pad); position: relative; }
.dim { color: var(--dim); }

/* Buttons and links */
.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 500;
  font-size: 16px;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { background: #fff; }
.btn-secondary { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover { background: rgba(255, 255, 255, .04); }
.btn-sm { padding: 6px 12px; font-size: 14px; }

.link { color: var(--text); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.link:hover { color: var(--amber); text-decoration-color: var(--amber); }
.mono-link { font-family: var(--mono); font-size: 15px; }

/* Header */
.hdr {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 60px;
  background: rgba(12, 14, 21, .75);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.hdr.scrolled { border-bottom-color: var(--border); }
.hdr-in { height: 100%; display: flex; align-items: center; justify-content: space-between; }
.brand { font-weight: 600; font-size: 17px; text-decoration: none; letter-spacing: -.01em; }
.nav { display: flex; align-items: center; gap: 28px; }
.nav-link { color: var(--dim); font-size: 15px; text-decoration: none; }
.nav-link:hover { color: var(--text); }

/* Hero */
.hero { padding-top: 96px; }
.pill {
  display: inline-block;
  margin-bottom: 28px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--dim);
  font-size: 14px;
  line-height: 1.4;
}
h1 {
  max-width: 980px;
  font-size: clamp(44px, 7.2vw, 92px);
  font-weight: 600;
  letter-spacing: -.045em;
  line-height: .98;
}
.lead { margin-top: 28px; max-width: 620px; color: var(--dim); font-size: 20px; line-height: 1.55; }
.actions { margin-top: 36px; display: flex; flex-wrap: wrap; gap: 12px; }

/* Showcase */
.showcase-sec { margin-top: 64px; scroll-margin-top: 80px; }
.stage-wrap { position: relative; }
.glow {
  position: absolute;
  inset: 0;
  transform: scale(1.06);
  filter: blur(80px);
  opacity: .45;
  pointer-events: none;
}
.glow img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .5s; }
.glow img.on { opacity: 1; }
.stage {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--surface);
}
.slide { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .5s; }
.slide.on { opacity: 1; }

.tabs { margin-top: 20px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tab {
  position: relative;
  overflow: hidden;
  display: block;
  padding: 16px 18px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
  transition: border-color .2s, background-color .2s;
}
.tab:hover { border-color: var(--border-strong); }
.tab[aria-selected="true"] { background: var(--surface-2); border-color: var(--border-strong); }
.tab-title { display: block; font-size: 17px; font-weight: 500; color: var(--text); line-height: 1.35; }
.tab-desc { display: block; margin-top: 4px; font-size: 14px; line-height: 1.45; color: var(--dim); }
.tab::before { content: ""; position: absolute; top: 0; left: 0; height: 2px; width: 0; background: var(--amber); }
.showcase.auto .tab[aria-selected="true"]::before { animation: fill 6s linear forwards; }
@keyframes fill { to { width: 100%; } }
@media (prefers-reduced-motion: reduce) { .tab::before { display: none; } }

.showcase-note { margin-top: 28px; max-width: 760px; color: var(--dim); }

/* Sections */
.section { margin-top: var(--gap-section); scroll-margin-top: 80px; }
.sec-head { max-width: 640px; margin-bottom: 56px; }
.intro { margin-top: 20px; color: var(--dim); font-size: 20px; line-height: 1.55; }
.note { margin-top: 32px; max-width: 760px; color: var(--dim); }

/* Code */
.code, .mini {
  margin: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font: 400 13.5px/1.65 var(--mono);
  overflow-x: auto;
  color: var(--text);
}
.code { padding: 20px 22px; }
.code code, .mini code { display: block; width: max-content; min-width: 100%; font: inherit; white-space: normal; }
.ln { display: block; white-space: pre; min-height: 1.65em; }
.del, .err { color: var(--rose); }
.add, .help, .help-s, .hash { color: var(--cyan); }
.str { color: var(--amber); }
.ln.dim, .ln .dim { color: var(--dim); }
.js .ln { opacity: 0; transform: translateY(4px); transition: opacity .25s ease, transform .25s ease; }
.js .ln.in, .js .mini .ln, .js .run-code .ln { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .js .ln { transition: none; } }

/* Loop player */
.player {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}
.steps { display: flex; flex-direction: column; gap: 4px; padding: 16px; border-right: 1px solid var(--border); }
.step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 12px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
}
.step:hover { background: rgba(255, 255, 255, .03); }
.step[aria-selected="true"] { background: var(--surface-2); border-color: var(--border); }
.num {
  flex: none;
  width: 24px;
  height: 24px;
  margin-top: 2px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  color: var(--dim);
}
.step[aria-selected="true"] .num { border-color: var(--amber); color: var(--amber); }
.step-txt { min-width: 0; }
.step-name { display: block; font-size: 17px; font-weight: 500; line-height: 1.35; }
.step-desc { display: block; margin-top: 2px; font-size: 14px; line-height: 1.45; color: var(--dim); }
.panels { padding: 32px; min-width: 0; }
.panel-p { margin-bottom: 20px; max-width: 640px; }
.panel-h { display: none; margin-bottom: 12px; }
html:not(.js) .steps { display: none; }
html:not(.js) .player { grid-template-columns: minmax(0, 1fr); }
html:not(.js) .panel + .panel { margin-top: 40px; }
html:not(.js) .panel-h { display: block; }
html:not(.js) .ln { opacity: 1; transform: none; }

/* Bento */
.bento { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
  min-width: 0;
}
.card p { margin-top: 12px; font-size: 16px; line-height: 1.55; color: var(--dim); }
.bento .card { display: flex; flex-direction: column; overflow: hidden; }
.card-a { grid-column: span 4; }
.card-b { grid-column: span 2; }
.card-c { grid-column: span 2; }
.card-d { grid-column: span 4; }
.card-e { grid-column: span 3; }
.card-f { grid-column: span 3; }
.mini { margin-top: auto; padding: 16px 18px; font-size: 13px; }
.card p { margin-bottom: 24px; }
.card-f p { margin-bottom: 28px; }

.diagram { margin-top: auto; display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 520px; margin-inline: auto; }
.dg-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; width: 100%; gap: 12px; }
.dg-cell { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.dg-pill {
  display: block;
  padding: 7px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 14px;
  line-height: 1.3;
  text-align: center;
}
.dg-cell { justify-content: flex-start; }
.dg-cell .dg-pill { width: 100%; flex: 1; display: flex; align-items: center; justify-content: center; }
.dg-wide { width: 100%; border-color: var(--amber); }
.dg-line { display: block; width: 1px; height: 22px; background: var(--border-strong); }

.hashes { margin-top: auto; font-size: 13.5px; }
.hrow { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; line-height: 1.5; }
.heq { display: flex; align-items: center; gap: 10px; padding: 6px 0; color: var(--faint); }
.heq span { flex: 1; height: 1px; background: var(--border-strong); }
.heq b { font-weight: 500; color: var(--dim); }
.mono { font-family: var(--mono); }

.card-img { margin: auto -28px -28px; width: calc(100% + 56px); max-width: none; height: 200px; object-fit: cover; border-top: 1px solid var(--border); }

/* Decisions */
.dec-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dec { padding: 24px; display: flex; flex-direction: column; }
.dec h3 { font-size: 18px; }
.dec .cost { margin-top: auto; padding-top: 16px; font-size: 15px; line-height: 1.5; color: var(--text); }
.dec p:not(.cost) { margin-bottom: 16px; }
.dec .cost { position: relative; margin-top: auto; border-top: 1px solid var(--border); }
.dec .cost { margin-bottom: 0; }
.dec .cost span { color: var(--amber); font-weight: 500; margin-right: 6px; }

/* Mosaic */
.mosaic {
  --cols: 4;
  container-type: inline-size;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-auto-flow: dense;
  grid-auto-rows: calc((100cqw - (var(--cols) - 1) * 12px) / var(--cols) * .5625);
  gap: 12px;
}
.mosaic img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.mosaic .m-big { grid-column: span 2; grid-row: span 2; }
.caption { margin-top: 20px; font-size: 14px; color: var(--dim); }

/* Status */
.status-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 48px; }
.status-grid h3 { margin-bottom: 20px; }
.status-grid .amber { color: var(--amber); }
.list { display: flex; flex-direction: column; gap: 14px; font-size: 16px; line-height: 1.5; }

/* Run it */
.run {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.4fr);
  gap: 40px;
  align-items: center;
  padding: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}
.run-l p { margin: 16px 0 28px; color: var(--dim); }

/* Footer */
.footer { margin-top: var(--gap-section); border-top: 1px solid var(--border); padding: 40px 0; font-size: 14px; color: var(--dim); }
.foot-in { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; }
.foot-nav { display: flex; gap: 24px; }
.foot-link { text-decoration: none; }
.foot-link:hover { color: var(--amber); }

/* Responsive */
@media (max-width: 1000px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-a, .card-d { grid-column: span 2; }
  .card-b, .card-c, .card-e, .card-f { grid-column: span 1; }
  .status-grid { grid-template-columns: 1fr; gap: 40px; }
  .run { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  :root { --pad: 20px; --gap-section: 88px; }
  .nav-link { display: none; }
  .hero { padding-top: 64px; }
  .showcase-sec { margin-top: 48px; }
  .tabs { grid-template-columns: repeat(2, 1fr); }
  .tab { padding: 14px; }
  .sec-head { margin-bottom: 40px; }
  .player { grid-template-columns: minmax(0, 1fr); }
  .steps { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .step { flex: none; width: 220px; }
  .panels { padding: 24px 20px; }
  .code { padding: 16px; }
  .bento, .dec-grid { grid-template-columns: 1fr; }
  .card-a, .card-b, .card-c, .card-d, .card-e, .card-f { grid-column: auto; }
  .card { padding: 22px; }
  .card-img { margin: auto -22px -22px; width: calc(100% + 44px); }
  .mosaic { --cols: 2; }
  .run { padding: 24px; }
}

/* Briefs */
.brief-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; margin: 0 0 48px; padding: 0; list-style: none; }
.brief-step { padding-top: 24px; border-top: 1px solid var(--border-strong); }
.brief-step .num { margin: 0 0 16px; }
.brief-step p { margin-top: 10px; font-size: 16px; line-height: 1.55; color: var(--dim); }
.brief {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 40px;
  padding: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}
.brief-label { margin-bottom: 20px; font-size: 14px; color: var(--dim); }
.brief-doc { margin: 0; padding-left: 20px; border-left: 2px solid var(--amber); font: 400 15.5px/1.6 var(--sans); color: rgba(243, 244, 248, .86); }
.brief-doc h4 { margin: 24px 0 8px; font-size: 14px; font-weight: 600; line-height: 1.4; color: var(--dim); }
.brief-doc h4:first-child { margin-top: 0; }
.brief-doc ul { display: flex; flex-direction: column; gap: 10px; }
.brief-doc strong { font-weight: 600; color: var(--text); }
.brief-out img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); }
.facts { margin: 24px 0 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px 24px; align-items: baseline; }
.facts dt { font-size: 14px; color: var(--dim); }
.facts dd { margin: 0; font-size: 17px; font-weight: 500; color: var(--text); }
@media (max-width: 1000px) {
  .brief { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .brief-steps { grid-template-columns: 1fr; gap: 28px; margin-bottom: 40px; }
  .brief { padding: 24px 20px; gap: 28px; }
}
