/* Reset, type, and the parts every page shares: header, buttons, links, plates, footer. */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scrollbar-color: var(--ink-soft) var(--paper-deep); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--step-body)/1.6 var(--font-text);
  font-optical-sizing: auto;
  font-variant-numeric: oldstyle-nums proportional-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  overflow-x: clip;
}
img, svg { display: block; max-width: 100%; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
h1, h2, h3, h4 { font-weight: 400; line-height: 1.05; text-wrap: balance; }
p { text-wrap: pretty; }
::selection { background: var(--cobalt); color: var(--paper); }

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

.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-link {
  position: fixed; left: var(--gutter); top: 8px; z-index: 100;
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; background: var(--ink); color: var(--paper);
  font: 500 var(--step-meta)/1 var(--font-mono); text-decoration: none;
  transform: translateY(-160%);
}
.skip-link:focus-visible { transform: none; }

/* Layout primitives */
.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); column-gap: var(--col-gap); }
.rule { border: 0; border-top: 1px solid var(--ink); }
.rule-double { border: 0; border-top: 3px double var(--ink); height: 0; }

.meta {
  font: 400 var(--step-meta)/1.4 var(--font-mono);
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.meta-ink { color: var(--ink); }

/* Links: an underline that draws from the left */
.link {
  color: inherit; text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat;
  transition: background-size var(--dur) var(--ease-out), color var(--dur-fast) ease;
  padding-bottom: 1px;
}
.link:hover { color: var(--cobalt); }
@media (hover: hover) and (pointer: fine) {
  .link { background-size: 0% 1px; }
  .link:hover { background-size: 100% 1px; }
  .link.link-rest { background-size: 100% 1px; }
}

/* Buttons: one primary, one quiet */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  font: 500 var(--step-meta)/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase;
  text-decoration: none; border: 1px solid var(--ink);
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease, scale var(--dur-fast) var(--ease-out);
  user-select: none;
}
.btn-primary { background: var(--cobalt); border-color: var(--cobalt); color: var(--paper); }
.btn-quiet { background: transparent; color: var(--ink); }
.btn .arrow { display: inline-block; transition: transform var(--dur) var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: var(--ink); border-color: var(--ink); }
  .btn-quiet:hover { background: var(--ink); color: var(--paper); }
  .btn:hover .arrow { transform: translateX(4px); }
}
.btn:active { scale: 0.97; } /* the individual scale property composes with the magnetic translate */

/* Header */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 50; height: var(--header-h);
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.site-header .wrap { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); }
.wordmark {
  font: 400 1.125rem/1 var(--font-text); color: var(--ink); text-decoration: none;
  display: inline-flex; align-items: center; min-height: 44px;
}
.wordmark b { font-weight: 500; }
.site-nav ul { display: flex; gap: var(--s-1); }
.site-nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px;
  font: 400 var(--step-meta)/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink); text-decoration: none; position: relative;
}
.site-nav a::after {
  content: ''; position: absolute; left: 10px; right: 10px; bottom: 12px; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: left; transition: transform var(--dur) var(--ease-out);
}
.site-nav a:hover { color: var(--cobalt); }
.site-nav a:hover::after, .site-nav a[aria-current]::after { transform: scaleX(1); }
.site-nav .nav-wide { display: none; }
@media (min-width: 768px) { .site-nav .nav-wide { display: list-item; } }

/* The phone section marker in the header. The travelling dots land in its slot. */
.header-marker { display: none; align-items: center; gap: 8px; }
.header-marker .meta { color: var(--ink); }

/* Dot slots: where the ë dots sit. Visible as real dots until motion takes them over. */
.dot-pair { display: inline-flex; gap: var(--dot-gap, 0.5em); align-items: center; }
.dot-slot { display: block; width: var(--dot-size, 8px); height: var(--dot-size, 8px); border-radius: 50%; background: currentColor; }
.dot-pair.is-target .dot-slot { background: transparent; }

/* Code plates */
.plate { background: var(--paper-deep); border-top: 3px solid var(--ink); position: relative; }
.plate-bar {
  display: flex; justify-content: space-between; gap: var(--s-4); padding: 12px var(--s-4);
  border-bottom: 1px solid var(--rule);
}
.plate-bar .meta:first-child { color: var(--ink); }
.plate-code {
  margin: 0; padding: var(--s-4) var(--s-4) var(--s-5) 0;
  font: 400 var(--step-code)/1.6 var(--font-mono); color: var(--ink);
  font-variant-ligatures: none; tab-size: 4;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.plate-code code { display: block; font: inherit; counter-reset: none; }
.ln { display: block; position: relative; padding-left: calc(3.5ch + var(--s-4) + var(--s-3)); text-indent: 0; }
.ln::before {
  content: attr(data-n); position: absolute; left: 0; width: calc(3.5ch + var(--s-4)); text-align: right;
  color: var(--ink-soft); opacity: 0.7; font-variant-numeric: tabular-nums;
}
.ln-gap { color: var(--ink-soft); }
.ln.is-key::after {
  content: ''; position: absolute; inset: 0 calc(-1 * var(--s-4)) 0 calc(3.5ch + var(--s-4) + var(--s-1));
  background: var(--cobalt-wash); z-index: -1;
  transform: scaleX(0); transform-origin: left; transition: transform 500ms var(--ease-out);
}
.ln.is-key { isolation: isolate; }
.is-lit .ln.is-key::after, .plate-static .ln.is-key::after { transform: scaleX(1); }
.t-k { font-weight: 500; }
.t-s, .t-n { color: var(--cobalt); }
.t-v { color: var(--ink); }
.t-c { color: var(--ink-soft); }
.plate-scroll .plate-code { white-space: pre; overflow-x: auto; }

/* Section heads */
.section { padding-block: var(--section-pad); }
.section-head { display: grid; gap: var(--s-4); margin-bottom: var(--s-7); }
.section-head .meta { display: flex; gap: var(--s-4); align-items: baseline; }
.section-title { font: 400 var(--step-h2)/1 var(--font-display); letter-spacing: -0.025em; }
.section-title em { font-family: var(--font-text); font-style: italic; letter-spacing: -0.01em; }

/* Footer */
.colophon { border-top: 1px solid var(--ink); padding-block: var(--s-6) var(--s-7); }
.colophon .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-3) var(--s-6); }

@media (max-width: 767.98px) {
  .plate-code { --step-code: 0.75rem; padding-right: var(--s-3); }
  .ln { padding-left: calc(3ch + var(--s-4)); }
  .ln::before { width: 3ch; }
  .ln.is-key::after { left: calc(3ch + var(--s-2)); }
  .plate-bar { padding-inline: var(--s-3); }
}

/* Targets of programmatic focus (in-page jumps) don't need a ring */
[tabindex='-1']:focus { outline: none; }

/* Section-label dot targets sit in the left margin, so the label text never shifts */
.section-head .meta { position: relative; }
.section-head .dot-pair { --dot-size: 7px; --dot-gap: 5px; position: absolute; right: 100%; top: 50%; margin-right: 12px; translate: 0 -50%; }
.colophon-links { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); }
.colophon-links a { display: inline-flex; align-items: center; min-height: 44px; font: 400 0.9375rem/1 var(--font-text); }
.colophon-note { font: italic 400 0.9375rem/1.4 var(--font-text); color: var(--ink-soft); }
