:root {
  color-scheme: dark;
  --bg: #12100f;
  --panel: #1a1614;
  --panel-2: #221c1a;
  --text: #e6ded9;
  --muted: #8f817b;
  --line: #2c2421;
  --accent: #e0453a;
  --accent-2: #c98a5e;
  --accent-3: #e0a89f;
  --danger: #b0a49f;
  --code: #0a0807;
  --shadow: 0 18px 50px rgba(0, 0, 0, .28);
  --mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", Consolas, monospace;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(18, 16, 15, .88), #12100f 36rem),
    repeating-linear-gradient(90deg, rgba(255,255,255,.035) 0 1px, transparent 1px 96px),
    repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 96px);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

code,
pre {
  font-family: "IosevkaTerm NF", "Cascadia Mono", Consolas, monospace;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: .9rem clamp(1rem, 3vw, 2.5rem);
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: rgba(18, 16, 15, .88);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  min-width: 14rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.1rem;
  aspect-ratio: 1;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-weight: 800;
  font-size: 1.25rem;
  background: #0d0b0a;
}

.brand-copy {
  display: grid;
  line-height: 1.1;
}

.brand-copy span {
  margin-top: .18rem;
  color: var(--muted);
  font-size: .76rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .35rem;
}

.nav a {
  padding: .45rem .65rem;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: .9rem;
}

.nav a:hover,
.nav a.active {
  border-color: var(--line);
  color: var(--text);
  background: rgba(255,255,255,.04);
}

main {
  /* Not overflow:hidden -- that would clip .hero-code out of its sticky
     context and pin it to nothing. Only the horizontal axis is constrained. */
  overflow-x: clip;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(24rem, 1fr);
  align-items: start;
  gap: clamp(2rem, 5vw, 4.5rem);
  padding: clamp(3rem, 7vw, 5.5rem) clamp(1rem, 5vw, 5rem) clamp(3rem, 6vw, 5rem);
}

.hero-code {
  position: sticky;
  top: 5.5rem;
  display: grid;
  gap: .75rem;
}

.points {
  margin: 1.6rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: .85rem;
  max-width: 40rem;
}

.points li {
  padding-left: 1rem;
  border-left: 2px solid var(--line);
  color: var(--muted);
  line-height: 1.6;
}

.points li strong {
  color: var(--text);
  font-weight: 700;
}

.next {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem clamp(2rem, 5vw, 4rem);
  padding: clamp(2.5rem, 5vw, 4rem) clamp(1rem, 5vw, 5rem);
  border-top: 1px solid rgba(255,255,255,.07);
  background: rgba(255,255,255,.025);
}

.next-copy {
  max-width: 38rem;
}

.next-copy p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.next-copy h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.hero-copy {
  max-width: 45rem;
}

.eyebrow {
  margin: 0 0 .75rem;
  color: var(--accent);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 1rem;
  font-family: var(--mono);
  font-size: clamp(3.5rem, 9vw, 6rem);
  font-weight: 600;
  line-height: .9;
  letter-spacing: -.04em;
}

h2 {
  margin-bottom: .8rem;
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 1;
  letter-spacing: 0;
}

h3 {
  margin-bottom: .5rem;
  font-size: 1.05rem;
}

/* The punctuation of the language, sat under the wordmark: declaration,
   attributes, generics, params, return, body. Same face as the h1 so it reads
   as part of the mark rather than as prose. */
.sig {
  margin: -.35rem 0 1.1rem;
  color: var(--accent);
  font-family: var(--mono);
  font-size: clamp(1.05rem, 2.6vw, 1.5rem);
  letter-spacing: .18em;
  white-space: nowrap;
}

.lede {
  max-width: 40rem;
  color: var(--muted);
  font-size: 1.18rem;
  line-height: 1.65;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1.6rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0 1rem;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  font-weight: 700;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #17100e;
}

pre {
  margin: 0;
  overflow: auto;
  background: var(--code);
  border: 1px solid rgba(255,255,255,.08);
  padding: 1rem;
  color: #ddd2cc;
  line-height: 1.55;
  tab-size: 4;
}

code {
  color: #e6ded9;
}

p code,
li code {
  padding: .08rem .25rem;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin: 0;
}

.tab,
#copyCode {
  min-height: 2.35rem;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  padding: 0 .85rem;
  font: inherit;
  cursor: pointer;
}

.tab.active,
.tab:hover,
#copyCode:hover {
  color: var(--text);
  border-color: var(--accent);
}

.code-panel {
  border: 1px solid var(--line);
  background: var(--panel);
}

.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3rem;
  padding: .45rem .65rem .45rem 1rem;
  border-bottom: 1px solid var(--line);
}

#exampleTitle {
  font-weight: 800;
}

.code-panel pre {
  border: 0;
  max-height: 31rem;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem clamp(1rem, 5vw, 5rem);
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: #0d0b0a;
}

.tok-keyword,
.tok-conditional,
.tok-repeat {
  color: var(--accent);
  font-weight: 700;
}

.tok-structure,
.tok-interop {
  color: #d98f6a;
}

.tok-type {
  color: var(--accent-3);
}

.tok-storage {
  color: #8f6ad9;
}

.tok-function,
.tok-builtin {
  color: #e8b98c;
}

.tok-string,
.tok-char {
  color: var(--accent-2);
}

.tok-comment {
  color: #877873;
  font-style: italic;
}

.tok-number,
.tok-boolean {
  color: var(--danger);
}

.tok-operator,
.tok-delimiter {
  color: #c9bcb6;
}

.tok-ident {
  color: #e6ded9;
}

@media (max-width: 1050px) {
  /* minmax(0, 1fr), not 1fr: a grid track's automatic minimum is min-content,
     so a single long code line inside .hero-code widens the whole column and
     `main { overflow-x: clip }` then quietly cuts the prose off. */
  .hero {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Stacked, the code panel must scroll with the page rather than pin
     itself over the prose. */
  .hero-code {
    position: static;
  }
}

/* Same reason, for the items themselves: a grid or flex child will not shrink
   below its content unless told it may. */
.hero-copy,
.hero-code,
.code-panel,
.next-copy {
  min-width: 0;
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: .6rem;
  }

  .nav {
    justify-content: flex-start;
  }

  .hero {
    padding-top: 2rem;
  }

  h1 {
    font-size: clamp(2.75rem, 18vw, 4.25rem);
  }

  .footer {
    flex-direction: column;
  }
}

/* Phones. The layout above already stacks; what is left is the things that
   assume a wide viewport -- fixed minimums, side-by-side rows, and a code
   panel whose long lines would otherwise widen the page itself. */
@media (max-width: 560px) {
  .brand {
    /* 14rem is wider than a 320px viewport has to spare once the padding is
       taken out, and a min-width cannot shrink. */
    min-width: 0;
  }

  .brand-mark {
    width: 1.85rem;
    font-size: 1.1rem;
  }

  .nav {
    width: 100%;
  }

  .nav a {
    padding: .4rem .55rem;
    font-size: .85rem;
  }

  .hero {
    gap: 2rem;
    padding-left: 1.15rem;
    padding-right: 1.15rem;
  }

  .sig {
    /* Nine glyphs and wide tracking overflow a narrow screen; let it wrap
       rather than push the page sideways. */
    white-space: normal;
    letter-spacing: .12em;
  }

  .lede {
    font-size: 1.05rem;
  }

  .points {
    gap: .95rem;
  }

  .points li {
    padding-left: .8rem;
    font-size: .96rem;
  }

  /* A tap target that fills the row beats two half-width ones side by side. */
  .actions {
    display: grid;
    gap: .6rem;
  }

  .actions .button {
    width: 100%;
  }

  .tabs {
    gap: .35rem;
  }

  .tab {
    flex: 1 1 auto;
    padding: 0 .6rem;
    font-size: .85rem;
  }

  .code-toolbar {
    min-height: 2.6rem;
    padding-left: .75rem;
  }

  .code-panel pre {
    padding: .8rem;
    font-size: .82rem;
    max-height: 24rem;
  }

  .next {
    padding-left: 1.15rem;
    padding-right: 1.15rem;
  }

  .next .button {
    width: 100%;
  }

  .footer {
    padding-left: 1.15rem;
    padding-right: 1.15rem;
    font-size: .88rem;
  }
}
