/* yantrik school — International Typographic Style, loud palette.
   Colour is not decoration here: each command family owns one hue, and that
   hue is the only thing you have to remember to know where a verb belongs. */

:root {
  --ink: #0c0c10;
  --paper: #f2efe6;
  --paper-2: #e6e2d6;
  --rule: rgba(12, 12, 16, 0.18);

  --find: #ff3b21;
  --address: #2c4bff;
  --ask: #00b877;
  --drive: #ffcc00;
  --keep: #ff2e93;

  --grid: 12;
  --gutter: clamp(16px, 2.2vw, 32px);
  --margin: clamp(20px, 5vw, 88px);

  --sans: "Helvetica Neue", Helvetica, Inter, "Segoe UI", Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, "Cascadia Mono", Menlo, monospace;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

/* ---- grid ------------------------------------------------------------- */

.sheet {
  display: grid;
  grid-template-columns: repeat(var(--grid), minmax(0, 1fr));
  gap: var(--gutter);
  padding-inline: var(--margin);
}

.rule {
  grid-column: 1 / -1;
  height: 1px;
  background: var(--ink);
  margin: 0;
  border: 0;
}

.hair { background: var(--rule); }

/* ---- masthead --------------------------------------------------------- */

.masthead {
  padding-block: 18px 14px;
  align-items: baseline;
}

.masthead__mark {
  grid-column: 1 / span 4;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.masthead__nav {
  grid-column: 5 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0 22px;
  justify-content: flex-end;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.masthead__nav a { text-decoration: none; padding-block: 2px; }
.masthead__nav a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---- hero ------------------------------------------------------------- */

.hero { padding-block: clamp(28px, 6vw, 76px) 0; }

.hero__word {
  grid-column: 1 / -1;
  font-size: clamp(84px, 23vw, 340px);
  line-height: 0.78;
  letter-spacing: -0.045em;
  font-weight: 700;
  margin: 0;
}

.hero__word em { font-style: normal; color: var(--find); }

.hero__lede {
  grid-column: 1 / span 6;
  font-size: clamp(20px, 2.3vw, 30px);
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: clamp(20px, 3vw, 44px) 0 0;
  text-wrap: balance;
}

.hero__meta {
  grid-column: 9 / -1;
  margin-top: clamp(20px, 3vw, 44px);
  font-size: 13px;
  line-height: 1.5;
}

.hero__meta dt {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.55;
}

.hero__meta dd { margin: 0 0 12px; font-weight: 600; }

/* ---- generic section -------------------------------------------------- */

.section { padding-block: clamp(40px, 7vw, 104px); align-items: start; }

.section__no {
  grid-column: 1 / span 1;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding-top: 10px;
}

.section__title {
  grid-column: 2 / span 5;
  font-size: clamp(30px, 4.6vw, 62px);
  line-height: 0.98;
  letter-spacing: -0.03em;
  font-weight: 700;
  margin: 0;
  text-wrap: balance;
}

.section__body {
  grid-column: 8 / -1;
  font-size: clamp(16px, 1.25vw, 19px);
  max-width: 62ch;
}

.section__body p { margin: 0 0 1em; }
.section__body p:last-child { margin-bottom: 0; }

.lead { font-size: 1.18em; line-height: 1.3; letter-spacing: -0.01em; }

/* ---- vision / mission ------------------------------------------------- */

.creed { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; row-gap: 0; }

.creed__panel {
  grid-column: span 6;
  padding: clamp(22px, 3vw, 40px);
  min-height: clamp(240px, 26vw, 360px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.creed__panel:nth-child(1) { background: var(--address); color: #fff; }
.creed__panel:nth-child(2) { background: var(--find); color: #fff; }

.creed__kicker {
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0;
  opacity: 0.85;
}

.creed__text {
  font-size: clamp(21px, 2.5vw, 34px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 600;
  margin: 18px 0 0;
  text-wrap: balance;
}

.creed__note { font-size: 14px; margin: 22px 0 0; opacity: 0.9; }

/* ---- the five families ------------------------------------------------ */

.families { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; }

.family {
  grid-column: span 12;
  display: grid;
  grid-template-columns: subgrid;
  align-items: start;
  padding-block: clamp(18px, 2.2vw, 30px);
  border-top: 1px solid var(--ink);
}

.family:last-child { border-bottom: 1px solid var(--ink); }

.family__chip {
  grid-column: 1 / span 2;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.family__chip::before {
  content: "";
  width: 14px;
  height: 14px;
  background: var(--hue);
  flex: none;
}

.family__name {
  grid-column: 3 / span 3;
  font-size: clamp(24px, 3vw, 40px);
  line-height: 1;
  letter-spacing: -0.025em;
  font-weight: 700;
  margin: 0;
}

.family__what { grid-column: 6 / span 3; font-size: 15px; margin: 0; }

.family__verbs { grid-column: 9 / -1; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }

.verb {
  font-family: var(--mono);
  font-size: 13px;
  padding: 5px 9px;
  background: var(--hue);
  color: #fff;
  white-space: nowrap;
}

.verb--soft { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--rule); }

/* ---- anatomy ---------------------------------------------------------- */

.anatomy {
  grid-column: 1 / -1;
  background: var(--ink);
  color: var(--paper);
  padding: clamp(24px, 4vw, 56px);
}

.anatomy__line {
  font-family: var(--mono);
  font-size: clamp(18px, 3.4vw, 46px);
  letter-spacing: -0.02em;
  margin: 0;
  white-space: nowrap;
  overflow-x: auto;
}

.tok { padding-bottom: 6px; border-bottom: 4px solid currentColor; }
.tok--address { color: #7d92ff; }
.tok--ask { color: #3ddf9f; }
.tok--drive { color: #ff8fc4; }
.tok--arg { color: #ffd83d; }

.anatomy__key {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 18px;
  margin: clamp(22px, 3vw, 40px) 0 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.anatomy__key b { display: block; font-family: var(--mono); margin-bottom: 4px; }
.anatomy__key li { opacity: 0.82; }

/* ---- steps ------------------------------------------------------------ */

.steps {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(24px, 3vw, 44px) var(--gutter);
  margin: 0;
  padding: 0;
  counter-reset: step;
}

@media (max-width: 1180px) { .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* `minmax(0, 1fr)`, not `1fr` — the two rules above already say so and this one
 * had dropped it. A bare `1fr` is `minmax(auto, 1fr)`, and that `auto` floor is
 * the track's min-content: the widest unbreakable thing in it. Here that is a
 * `<pre>` of terminal output, so on a phone the single column grew to the
 * longest line and pushed the whole page sideways — the `overflow-x: auto` on
 * `pre` never engaged, because the track had already widened to accommodate it. */
@media (max-width: 700px) { .steps { grid-template-columns: minmax(0, 1fr); } }

.step {
  border-top: 3px solid var(--ink);
  padding-top: 14px;
  list-style: none;
}

.step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  display: block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.step h3 { font-size: 19px; letter-spacing: -0.02em; margin: 0 0 8px; }
.step p { font-size: 15px; margin: 0 0 10px; }

pre {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 14px;
  margin: 0;
  overflow-x: auto;
}

/* The signal palette is mixed for paper; these two are its readable cousins
 * on the dark ground a transcript sits on. */
pre .c { color: #8e8e9c; }
pre .k { color: #ffd83d; }
pre .a { color: #7d92ff; }

code { font-family: var(--mono); font-size: 0.92em; }

.section__body code,
.step p code { background: var(--paper-2); padding: 1px 5px; }

/* ---- callout ---------------------------------------------------------- */

.callout {
  grid-column: 1 / -1;
  background: var(--drive);
  padding: clamp(20px, 3vw, 36px);
  display: grid;
  grid-template-columns: subgrid;
  align-items: center;
  row-gap: 14px;
}

.callout__title {
  grid-column: 1 / span 4;
  font-size: clamp(22px, 2.6vw, 34px);
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 0;
  font-weight: 700;
}

.callout__body { grid-column: 5 / -1; margin: 0; font-size: 16px; max-width: 70ch; }

/* The reference card is scanned, not read: same grid, less air. */

.card .section { padding-block: clamp(26px, 3vw, 44px) clamp(14px, 1.5vw, 20px); }
.card .section__title { font-size: clamp(28px, 3.6vw, 46px); }
.card .table { margin-bottom: clamp(8px, 1vw, 16px); }

/* ---- table ------------------------------------------------------------ */

.table { grid-column: 1 / -1; width: 100%; border-collapse: collapse; font-size: 15px; }

.table th, .table td {
  text-align: left;
  padding: 12px 14px 12px 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

.table th {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--ink);
}

.table td:first-child { font-family: var(--mono); white-space: nowrap; padding-right: 24px; }

/* ---- playground ------------------------------------------------------- */

.pad {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gutter);
}

.pad__side { display: flex; flex-direction: column; min-width: 0; }

.pad__label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  border-top: 3px solid var(--ink);
  padding-top: 10px;
  margin-bottom: 12px;
}

#source {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  min-height: 460px;
  flex: 1;
  resize: vertical;
  background: var(--ink);
  color: var(--paper);
  border: 0;
  padding: 16px;
  tab-size: 2;
}

#source:focus-visible { outline: 3px solid var(--drive); outline-offset: 2px; }

.pad__out {
  flex: 1;
  min-height: 460px;
  background: var(--paper-2);
  padding: 16px;
  font-size: 13px;
  overflow-x: auto;
}

.pad__cell { margin-bottom: 20px; }

.pad__head {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
}

.pad__line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 3px 0;
  font-family: var(--mono);
}

.pad__no { opacity: 0.4; min-width: 2.2em; text-align: right; }
.pad__verb { font-weight: 700; }
.pad__target { color: var(--address); }
.pad__spelled { opacity: 0.5; margin-left: auto; text-align: right; }
.pad__msg { color: var(--find); font-weight: 700; }
.pad__line--note { opacity: 0.5; font-style: italic; }
.pad__line--bad { background: rgba(0, 0, 0, 0.04); }
.pad__line .verb { font-size: 11px; padding: 3px 7px; }

/* Same `minmax(0, 1fr)` point as `.steps`: the playground's panes hold the
 * editor and the parse output, both of which contain long unbreakable lines. */
@media (max-width: 860px) {
  .pad { grid-template-columns: minmax(0, 1fr); }
}

/* ---- figure ----------------------------------------------------------- */

.figure {
  grid-column: 1 / -1;
  background: var(--paper-2);
  padding: clamp(18px, 2.4vw, 34px);
}

.figure__empty { margin: 0; opacity: 0.55; font-size: 15px; }

.fig-lane {
  font: 700 13px var(--mono);
  fill: var(--ink);
  letter-spacing: 0.02em;
}

.fig-cell {
  font: 700 12px var(--sans);
  fill: var(--ink);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fig-verb { font: 13px var(--mono); fill: var(--ink); }
.fig-no { font: 11px var(--mono); fill: rgba(12, 12, 16, 0.4); }
.fig-key {
  font: 11px var(--sans);
  fill: var(--ink);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---- colophon --------------------------------------------------------- */

.colophon { padding-block: clamp(30px, 4vw, 60px); font-size: 13px; }
.colophon__left { grid-column: 1 / span 6; }
.colophon__right { grid-column: 9 / -1; text-align: right; opacity: 0.6; }

.bars { grid-column: 1 / -1; display: flex; height: 12px; margin-bottom: 26px; }
.bars span { flex: 1; }

/* ---- narrow ----------------------------------------------------------- */

@media (max-width: 860px) {
  :root { --grid: 6; }

  .masthead__mark { grid-column: 1 / -1; }
  .masthead__nav { grid-column: 1 / -1; justify-content: flex-start; gap: 0 16px; }

  .hero__lede, .hero__meta,
  .section__title, .section__body,
  .creed__panel, .family__chip, .family__name, .family__what, .family__verbs,
  .callout__title, .callout__body,
  .colophon__left, .colophon__right { grid-column: 1 / -1; }

  .section__no { grid-column: 1 / -1; padding-top: 0; }
  .section__title { margin-bottom: 18px; }
  .colophon__right { text-align: left; }
  .family { row-gap: 12px; }
  .family__name { margin-top: 2px; }
}

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