/* Shared styles for allyouneedisattention.com */

:root {
  --bg: #0b0d12;
  --fg: #e8ebf2;
  --muted: #8b93a7;
  --accent: #8ab4ff;
  --line: #1c2030;
  --panel: #11141c;
  --measure: 40rem;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 50% 0%, rgba(138,180,255,.07), transparent 70%),
    var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: border-color .2s, color .2s;
}
a:hover { color: var(--accent); border-color: var(--accent); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Site header & footer ---------- */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  max-width: 60rem;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  font-size: .9rem;
}
.site-header .brand {
  border: 0;
  font-weight: 600;
  letter-spacing: -.01em;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
}
.site-header .brand svg { width: 1.4rem; height: 1.4rem; }
.site-header nav { display: flex; gap: 1.25rem; }
.site-header nav a { border: 0; color: var(--muted); }
.site-header nav a:hover,
.site-header nav a[aria-current="page"] { color: var(--fg); }

main { flex: 1; width: 100%; }

.site-footer {
  padding: 2rem 1.5rem;
  text-align: center;
  font-size: .8rem;
  color: var(--muted);
}

/* ---------- Home: hero ---------- */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 3rem 1.5rem 1rem;
}
.eyebrow {
  font-size: .8rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 2rem;
}
.stage { position: relative; display: inline-block; padding-bottom: 5rem; }
.hero h1 {
  margin: 0;
  font-weight: 600;
  /* Kept on one line so the arcs never cross a line break. The title is
     ~10.6em wide, so size it to fit the viewport minus the hero padding. */
  font-size: clamp(1.4rem, calc((100vw - 3rem) / 11), 5rem);
  letter-spacing: -.03em;
  line-height: 1.05;
  display: flex;
  flex-wrap: nowrap;
  white-space: nowrap;
  justify-content: center;
  gap: 0 .28em;
}
.tok {
  cursor: default;
  transition: color .25s ease;
  outline: none;
  border-radius: .15em;
}
.tok.active { color: var(--accent); }
.tok:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
svg.arcs {
  position: absolute; left: 0; top: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  overflow: visible;
}
svg.arcs path {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  transition: opacity .35s ease;
}
.hero .sub {
  max-width: 34rem;
  margin: 1rem auto 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.6;
}

/* ---------- Home: essay list ---------- */

.essays {
  max-width: var(--measure);
  margin: 3rem auto 0;
  padding: 0 1.5rem;
}
.section-label {
  font-size: .75rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--line);
}
.essay-list { list-style: none; margin: 0; padding: 0; }
.essay-list li { border-bottom: 1px solid var(--line); }
.essay-list a {
  display: block;
  border: 0;
  padding: 1.25rem 0;
}
.essay-list h3 {
  margin: 0 0 .35rem;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -.01em;
  transition: color .2s;
}
.essay-list a:hover h3 { color: var(--accent); }
.essay-list p { margin: 0; color: var(--muted); line-height: 1.55; }
.meta { font-size: .8rem; color: var(--muted); margin-top: .5rem; }

/* ---------- Article (essays & pages) ---------- */

.article {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 3rem 1.5rem 2rem;
}
.article header { margin-bottom: 2.5rem; }
.article h1 {
  font-size: clamp(2rem, 5vw, 2.8rem);
  line-height: 1.15;
  letter-spacing: -.025em;
  font-weight: 600;
  margin: 0 0 1rem;
}
.article .dek {
  font-size: 1.15rem;
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}
.article header .meta { margin-top: 1.25rem; }

.prose {
  font-family: var(--serif);
  font-size: 1.2rem;
  line-height: 1.7;
  color: #d9dde7;
}
.prose p { margin: 0 0 1.35em; }
.prose h2, .prose h3 {
  font-family: var(--sans);
  color: var(--fg);
  letter-spacing: -.015em;
  line-height: 1.25;
}
.prose h2 { font-size: 1.5rem; margin: 2.5em 0 .75em; }
.prose h3 { font-size: 1.2rem; margin: 2em 0 .6em; }
.prose blockquote {
  margin: 1.75em 0;
  padding-left: 1.25em;
  border-left: 2px solid var(--accent);
  color: var(--muted);
  font-style: italic;
}
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1.35em; }
.prose li { margin-bottom: .4em; }
.prose code {
  font-family: var(--mono);
  font-size: .85em;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: .1em .35em;
}
.prose pre {
  font-family: var(--mono);
  font-size: .85rem;
  line-height: 1.55;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 3em 0; }
.prose sup a { border: 0; color: var(--accent); font-family: var(--sans); font-size: .75em; }

.footnotes {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-family: var(--sans);
  font-size: .9rem;
  line-height: 1.6;
  color: var(--muted);
}
.footnotes ol { padding-left: 1.3em; }
.footnotes li { margin-bottom: .6em; }

.back { display: inline-block; margin-top: 2rem; font-size: .9rem; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Go deeper boxes ---------- */
/* <details class="deeper"><summary>Go deeper: …</summary> … </details> */

.deeper {
  margin: 1.75em 0;
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 6px;
  background: var(--panel);
  font-size: 1.05rem;
}
.deeper > summary {
  cursor: pointer;
  list-style: none;
  padding: .8rem 1.1rem;
  font-family: var(--sans);
  font-size: .95rem;
  font-weight: 600;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: .6rem;
}
.deeper > summary::-webkit-details-marker { display: none; }
.deeper > summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 1.2rem; height: 1.2rem;
  border: 1px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  font-size: .9rem;
  line-height: 1;
  flex: none;
}
.deeper[open] > summary::before { content: "−"; }
.deeper > summary:hover { color: var(--accent); }
.deeper > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.deeper > :not(summary) { margin-left: 1.1rem; margin-right: 1.1rem; }
.deeper > :last-child { margin-bottom: 1.1rem; }
.deeper .math {
  font-family: var(--serif);
  font-size: 1.15em;
  text-align: center;
  margin: 1em 1.1rem;
  white-space: nowrap;
  overflow-x: auto;
}

/* ---------- Glossary terms ---------- */
/* <span class="term" data-term="token">tokens</span> */

.term {
  text-decoration: underline dotted var(--muted);
  text-underline-offset: .2em;
  cursor: help;
}
.term:hover, .term:focus-visible, .term.is-open {
  text-decoration-color: var(--accent);
  outline: none;
}
.term-tip {
  position: absolute;
  z-index: 10;
  max-width: min(20rem, calc(100vw - 2rem));
  padding: .75rem .9rem;
  background: #161a25;
  border: 1px solid #2a3046;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0,0,0,.45);
  font-family: var(--sans);
  font-size: .88rem;
  line-height: 1.5;
  color: var(--fg);
  font-style: normal;
}
.term-tip strong { display: block; margin-bottom: .2rem; color: var(--accent); font-weight: 600; }
.term-tip a { font-size: .8rem; color: var(--muted); }
.term-tip[hidden] { display: none; }

.glossary-list { margin: 0; }
.glossary-list dt {
  font-family: var(--sans);
  font-weight: 600;
  color: var(--fg);
  margin-top: 1.6em;
  scroll-margin-top: 1rem;
}
.glossary-list dt:target { color: var(--accent); }
.glossary-list dd { margin: .3em 0 0; }

/* ---------- Figures ---------- */

.fig {
  margin: 2.25em 0;
  padding: 1.5rem 1rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(17,20,28,.6);
}
.fig figcaption {
  font-family: var(--sans);
  font-size: .85rem;
  line-height: 1.5;
  color: var(--muted);
  margin-top: .5rem;
  text-align: center;
}
.arcs-scroll { overflow-x: auto; text-align: center; }
.arcs-stage {
  position: relative;
  display: inline-flex;
  gap: .55em;
  padding: .25rem .5rem 6.5rem;
  font-family: var(--sans);
  font-size: 1.15rem;
  font-weight: 500;
  white-space: nowrap;
}
.arcs-stage .tok {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: .1em .15em;
  cursor: pointer;
}
.arcs-stage .tok:hover { color: var(--accent); }
@media (max-width: 560px) {
  .fig { padding-left: .25rem; padding-right: .25rem; }
  .arcs-stage { font-size: .92rem; gap: .3em; padding-left: .25rem; padding-right: .25rem; }
  .arcs-stage .tok { padding: .1em .1em; }
}
@media (max-width: 480px) {
  .site-header .brand-name { display: none; }
}

/* ---------- 404 ---------- */
.notfound { padding-top: 6rem; text-align: center; }
.notfound .eyebrow { margin-bottom: 1rem; }
.notfound .dek a { color: var(--fg); }
@media (max-width: 400px) {
  .arcs-stage { font-size: .8rem; gap: .22em; }
}

/* ---------- BPE explorer figure ---------- */

.bpe { font-family: var(--sans); font-size: .95rem; text-align: left; }
.bpe-label { display: block; font-size: .8rem; color: var(--muted); margin: 0 0 .4rem; }
.bpe-label output { color: var(--fg); }
.bpe-input {
  width: 100%;
  resize: vertical;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid #2a3046;
  border-radius: 6px;
  padding: .6rem .75rem;
  font: inherit;
  font-size: 1rem;
}
.bpe-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.bpe-examples { display: flex; flex-wrap: wrap; gap: .4rem; margin: .6rem 0 1rem; }
.bpe-examples button {
  font: inherit; font-size: .8rem;
  color: var(--muted);
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .2rem .7rem;
  cursor: pointer;
}
.bpe-examples button:hover { color: var(--fg); border-color: var(--accent); }
.bpe-out {
  display: flex; flex-wrap: wrap; gap: .3rem;
  min-height: 2.4rem;
  padding: .6rem;
  background: var(--bg);
  border-radius: 6px;
}
.bpe-tok {
  display: inline-block;
  font-family: var(--mono);
  font-size: .9rem;
  white-space: pre;
  padding: .1rem .35rem;
  border-radius: 4px;
  border: 1px solid;
}
.bpe-tok.c0 { background: rgba(138,180,255,.14); border-color: rgba(138,180,255,.45); }
.bpe-tok.c1 { background: rgba(120,220,180,.12); border-color: rgba(120,220,180,.4); }
.bpe-tok.c2 { background: rgba(255,190,110,.12); border-color: rgba(255,190,110,.4); }
.bpe-tok.c3 { background: rgba(240,140,190,.12); border-color: rgba(240,140,190,.4); }
.bpe-tok.c4 { background: rgba(180,150,255,.13); border-color: rgba(180,150,255,.42); }
.bpe-ws { color: var(--muted); }
.bpe-stats { font-size: .8rem; color: var(--muted); margin: .5rem 0 1.25rem; }
.bpe-slider { width: 100%; accent-color: var(--accent); }
.bpe-merges { margin-top: .75rem; font-size: .85rem; color: var(--muted); }
.bpe-merges-head { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; margin-bottom: .4rem; }
.bpe-merge { display: flex; align-items: center; gap: .35rem; margin: .25rem 0; flex-wrap: wrap; }
.bpe-num { min-width: 2.5rem; font-variant-numeric: tabular-nums; }
@media (max-width: 340px) {
  .arcs-stage { font-size: .7rem; gap: .12em; }
}

/* ---------- Attention steps figure ---------- */

.steps { font-family: var(--sans); font-size: .9rem; text-align: left; padding: 0 .5rem; }
.steps-label { font-size: .8rem; color: var(--muted); margin: 0 0 .4rem; }
.steps-words, .steps-stages { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: 1rem; }
.steps-words button, .steps-stages button {
  font: inherit;
  color: var(--fg);
  background: none;
  border: 1px solid #2a3046;
  border-radius: 6px;
  padding: .25rem .6rem;
  cursor: pointer;
}
.steps-words button:hover, .steps-stages button:hover { border-color: var(--accent); }
.steps-words button[aria-pressed="true"], .steps-stages button[aria-pressed="true"] {
  background: rgba(138,180,255,.16);
  border-color: var(--accent);
  color: var(--accent);
}
.steps button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.prose .steps-note { font-size: .85rem; line-height: 1.5; color: var(--muted); margin: 0 0 .9rem; min-height: 3em; }
.steps-row { display: grid; grid-template-columns: 4.2rem 1fr 3.6rem; align-items: center; gap: .6rem; padding: .12rem 0; }
.steps-word { text-align: right; }
.steps-row.is-self .steps-word { color: var(--accent); }
.steps-track { height: .7rem; background: var(--bg); border-radius: 3px; overflow: hidden; }
.steps-bar { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s ease; }
.steps-num { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .8rem; text-align: right; }
.steps-row.is-masked { opacity: .4; }

/* ---------- Previous/next links ---------- */

.essay-nav { display: flex; gap: 1rem; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.essay-nav a { border: 0; flex: 1; min-width: 0; font-weight: 600; line-height: 1.35; }
.essay-nav a span { display: block; font-size: .8rem; font-weight: 400; color: var(--muted); margin-bottom: .25rem; }
.essay-nav .next { text-align: right; }

/* ---------- Scale chart figure ---------- */

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.scale { font-family: var(--sans); font-size: .85rem; text-align: left; padding: 0 .25rem; }
.scale-controls { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .9rem; }
.scale-controls button {
  font: inherit;
  color: var(--fg);
  background: none;
  border: 1px solid #2a3046;
  border-radius: 6px;
  padding: .25rem .7rem;
  cursor: pointer;
}
.scale-controls button:hover { border-color: var(--accent); }
.scale-controls button[aria-pressed="true"] { background: rgba(138,180,255,.16); border-color: var(--accent); color: var(--accent); }
.scale-controls button:focus-visible, .scale-plot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.scale-legend { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; margin-bottom: .5rem; color: var(--fg); }
.scale-key { display: inline-flex; align-items: center; gap: .45rem; }
.scale-key i, .scale-tip-row i { display: inline-block; width: 16px; height: 3px; border-radius: 2px; flex: none; }
.scale-plot { position: relative; touch-action: pan-y; border-radius: 4px; }
.scale-plot svg { display: block; }
.scale-plot text { fill: var(--muted); font-size: 12px; }
.scale-grid { stroke: var(--line); stroke-width: 1; }
.scale-cross { stroke: var(--muted); stroke-width: 1; }
.scale-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.scale-dot { stroke: #0e1118; stroke-width: 2; }
.scale-tip {
  position: absolute; top: 8px;
  pointer-events: none;
  background: #161a25;
  border: 1px solid #2a3046;
  border-radius: 8px;
  padding: .5rem .65rem;
  font-size: .8rem;
  line-height: 1.5;
  white-space: nowrap;
}
.scale-tip[hidden] { display: none; }
.scale-tip-head { color: var(--muted); margin-bottom: .15rem; }
.scale-tip-row { display: flex; align-items: center; gap: .45rem; color: var(--muted); }
.scale-tip-row strong { color: var(--fg); min-width: 3.2rem; font-variant-numeric: tabular-nums; }
.scale-table { margin-top: .5rem; color: var(--muted); }
.scale-table summary { cursor: pointer; font-size: .8rem; }
.scale-table-scroll { overflow-x: auto; }
.scale-table table { border-collapse: collapse; width: 100%; margin-top: .5rem; font-size: .8rem; }
.scale-table th, .scale-table td { padding: .25rem .5rem; text-align: right; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; font-weight: 400; }
.scale-table th:first-child { text-align: left; }
.scale-table td { color: var(--fg); }

/* ---------- Reward lab figure ---------- */

.lab { font-family: var(--sans); font-size: .92rem; line-height: 1.5; text-align: left; padding: 0 .5rem; }
.lab > div:focus { outline: none; }
.lab-step { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.lab-gap { margin-top: 1.5rem; }
.prose .lab-q { font-weight: 600; color: var(--fg); margin: .35rem 0 .8rem; }
.prose .lab-hint, .prose .lab-note { font-size: .85rem; color: var(--muted); margin: .7rem 0; }
.lab-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.lab-answer, .lab-again {
  font: inherit; color: var(--fg); text-align: left;
  background: var(--bg); border: 1px solid #2a3046; border-radius: 8px;
  padding: .7rem .85rem; cursor: pointer;
}
.lab-answer { min-height: 7.5rem; display: flex; align-items: flex-start; }
.lab-again { padding: .3rem .8rem; background: none; }
.lab-answer:hover, .lab-again:hover { border-color: var(--accent); }
.lab button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lab-weight { display: grid; grid-template-columns: 9rem 1fr 3.2rem; align-items: center; gap: .6rem; padding: .15rem 0; }
.lab-track { position: relative; height: .7rem; background: linear-gradient(var(--muted), var(--muted)) 50% / 1px 100% no-repeat, var(--bg); border-radius: 3px; }
.lab-bar { position: absolute; top: 0; height: 100%; }
.lab-bar.is-pos { background: #3987e5; border-radius: 0 3px 3px 0; }
.lab-bar.is-neg { background: #d95926; border-radius: 3px 0 0 3px; }
.lab-num { text-align: right; font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.prose .lab-ranked { padding-left: 1.4rem; margin: 0; }
.prose .lab-ranked li { margin-bottom: .7rem; }
.lab-tags { display: flex; gap: 1rem; font-size: .8rem; color: var(--muted); }
.lab-tags .is-right, .lab-tags .is-wrong { color: var(--fg); }
@media (max-width: 560px) {
  .lab { padding: 0 .4rem; }
  .lab-pair { grid-template-columns: 1fr; }
  .lab-answer { min-height: 0; }
  .lab-weight { grid-template-columns: 7rem 1fr 2.8rem; gap: .4rem; }
}
