/* Shared styles: fonts, tokens, editor shell, sections, status bar. */

@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url('/fonts/archivo-latin-wdth.woff2') format('woff2');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url('/fonts/jetbrains-mono-latin-wght.woff2') format('woff2');
}

:root {
  --bg: #0f1211;
  --panel: #141918;
  --raised: #1c2321;
  --line: #28312e;
  --text: #ece7dc;
  --muted: #a9b2ae;
  --dim: #808c88;
  --accent: #f0703f;
  --str: #65d3bd;
  --key: var(--accent);
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --sans: 'Archivo', system-ui, sans-serif;
  --top: 52px;
  color-scheme: dark;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

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

[id] {
  scroll-margin-top: calc(var(--top) + 16px);
}

.mono {
  font-family: var(--mono);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--mono);
  font-weight: 700;
}

.skip:focus {
  top: 8px;
}

.site {
  container: site / inline-size;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* The main column is its own container, so headings scale with the column, not the window. */
main {
  container: main / inline-size;
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: stretch;
  height: var(--top);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.logo {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 22px;
  width: 248px;
  flex: none;
  border-right: 1px solid var(--line);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.logo b {
  color: var(--accent);
}

.tabs {
  display: flex;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}

.tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-right: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.tab:hover {
  color: var(--text);
}

.tab.on {
  background: var(--bg);
  color: var(--text);
  box-shadow: inset 0 2px 0 var(--accent);
}

.tab i {
  font-style: normal;
  color: var(--dim);
}

.top-cta {
  display: flex;
  align-items: center;
  padding: 0 16px;
  flex: none;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--line);
  color: var(--text);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  font-weight: 700;
}

.btn.primary:hover {
  filter: brightness(1.08);
}

.btn.ghost:hover {
  border-color: var(--muted);
}

.btn.sm {
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
}

.ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 40px;
}

/* Shell: explorer sidebar and main column */
.shell {
  flex: 1;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.explorer {
  background: var(--panel);
  border-right: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 13px;
}

.explorer-in {
  position: sticky;
  top: var(--top);
  max-height: calc(100vh - var(--top));
  overflow-y: auto;
  padding: 18px 0 40px;
}

.ex-label {
  padding: 0 22px 12px;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--dim);
}

.ex {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 22px;
  color: var(--muted);
}

.ex:hover {
  color: var(--text);
}

.ex.in1 {
  padding-left: 40px;
}

.ex.in2 {
  padding-left: 58px;
}

.ex.on,
.ex[aria-current='page'] {
  background: var(--raised);
  color: var(--text);
}

.ex .ext {
  margin-left: auto;
  font-size: 11px;
  color: var(--dim);
}

.ex-sep {
  height: 1px;
  background: var(--line);
  margin: 16px 22px;
}

.ex-meta {
  margin: 0;
  padding: 0 22px;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.9;
}

.ex-meta span {
  color: var(--str);
}

/* Sections */
.sec {
  padding: 112px 72px;
  border-bottom: 1px solid var(--line);
}

.sec-head {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--dim);
  margin-bottom: 28px;
}

.sec-head .n {
  color: var(--accent);
  font-weight: 700;
}

.sec-head .rule {
  flex: 1;
  height: 1px;
  background: var(--line);
}

.h2 {
  margin: 0;
  font-size: clamp(36px, 5.5cqi, 72px);
  line-height: 0.98;
  font-weight: 800;
  font-stretch: 112%;
  letter-spacing: -0.03em;
  max-width: 15ch;
}

.lede {
  font-size: 20px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 60ch;
  margin: 24px 0 0;
}

.kick {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}

.two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 64px;
  align-items: start;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.ph {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.85em;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Numbered rules list */
.rules {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rules li {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 8px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.rules li:first-child {
  padding-top: 0;
}

.rules .rn {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  font-weight: 700;
  padding-top: 4px;
}

.rules b {
  display: block;
  font-size: 20px;
  font-weight: 700;
  font-stretch: 108%;
  margin-bottom: 4px;
}

.rules span {
  font-size: 16px;
  line-height: 1.55;
  color: var(--muted);
}

/* Terminal block */
.term {
  margin: 0;
  background: #0a0c0b;
  color: #e4e1d8;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px 30px;
  font-family: var(--mono);
  font-size: 14.5px;
  line-height: 2;
}

.term .p {
  color: var(--dim);
}

.term .ok {
  color: var(--str);
}

.term .lbl {
  display: inline-block;
  width: 170px;
}

.term .det {
  color: #9aa5a1;
}

/* Status bar */
.status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  min-height: 32px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.status > * {
  padding: 7px 16px;
  border-right: 1px solid var(--line);
}

.status .acc {
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
  border-right: 0;
}

.status .r {
  margin-left: auto;
  border-left: 1px solid var(--line);
}

.status a:hover {
  color: var(--text);
}

@container site (max-width: 980px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .explorer,
  .tabs {
    display: none;
  }

  .logo {
    width: auto;
    border-right: 0;
  }

  .top-cta {
    margin-left: auto;
  }

  .sec {
    padding: 72px 24px;
  }

  .two {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  .lede {
    font-size: 18px;
  }

  .term {
    font-size: 12.5px;
    padding: 22px 18px;
    overflow-x: auto;
  }

  .term .lbl {
    width: 140px;
  }

  .status .r {
    margin-left: 0;
  }
}
