/* ==========================================================================
   Lloan Alas — portfolio
   1. Tokens & themes      5. Hero
   2. Base & type          6. Work / about / writing
   3. Layout primitives    7. Newsletter / footer
   4. Header / search      8. Article & case study
   ========================================================================== */

/* 1. Tokens & themes ------------------------------------------------------ */

:root {
  /* dark is the default theme */
  --ink: #07090c;
  --ink-raise: #0b0e13;
  --ink-raise-2: #10141a;
  --line: #1b2028;
  --line-soft: #14181f;
  --bone: #ede6db;
  --text: #c3c9d2;
  --muted: #868d98;
  --red: #c20d18;
  --red-hi: #e0141f;
  --red-text: #ff4b55;
  --on-red: #fff6f5;
  --shade: rgba(0, 0, 0, 0.5);
  --glass: rgba(7, 9, 12, 0.82);

  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --brand: "Avenir", "Helvetica Neue", Arial, sans-serif;
  --body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --wrap: 1320px;
  --gutter: clamp(20px, 4vw, 48px);
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;
  --header-h: 74px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: dark;
}

@font-face {
  font-family: "Avenir";
  src: url("../assets/Avenir/Avenir Medium/Avenir Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* 2. Base & type ---------------------------------------------------------- */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img,
svg,
picture { display: block; max-width: 100%; }

a { color: inherit; }

button,
input,
textarea { font: inherit; color: inherit; }

h1, h2, h3, h4 { margin: 0; color: var(--bone); }

.display,
h1.display,
h2.display,
h3.display {
  font-family: var(--display);
  font-weight: 900;
  font-stretch: 88%;
  text-transform: uppercase;
  line-height: 0.9;
  letter-spacing: -0.005em;
  color: var(--bone);
}

.d-xl { font-size: clamp(2.9rem, 6.6vw, 5.1rem); }
.d-lg { font-size: clamp(2.2rem, 4.6vw, 3.5rem); }
.d-md { font-size: clamp(1.5rem, 2.6vw, 2rem); }
.d-sm { font-size: clamp(1.1rem, 1.6vw, 1.3rem); line-height: 1.05; }

/* the red full stop that closes every headline in the brand */
.stop { color: var(--red-text); }

.kicker {
  display: flex;
  align-items: center;
  gap: 0.55em;
  margin: 0 0 1.4rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.kicker::before {
  content: "//";
  color: var(--red-text);
  letter-spacing: 0;
}

.kicker--plain::before { content: none; }
.kicker--red { color: var(--red-text); }

.lede {
  max-width: 46ch;
  font-size: 1.0625rem;
  color: var(--text);
}

.muted { color: var(--muted); }

::selection { background: var(--red); color: var(--on-red); }

:focus-visible {
  outline: 2px solid var(--red-text);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--red);
  color: var(--on-red);
  font-size: 0.85rem;
  text-decoration: none;
  transition: top 0.15s var(--ease);
}

.skip:focus { top: 12px; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* 3. Layout primitives ---------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: clamp(56px, 7vw, 104px); }
.section--tight { padding-block: clamp(40px, 4.5vw, 64px); }
.section--top { border-top: 1px solid var(--line-soft); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 2rem;
}

.rule { height: 1px; background: var(--line-soft); border: 0; margin: 0; }

/* buttons */
.btn {
  --btn-bg: transparent;
  --btn-fg: var(--bone);
  --btn-bd: var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  padding: 0.85em 1.4em;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1px solid var(--btn-bd);
  border-radius: var(--r-sm);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease),
    color 0.18s var(--ease), transform 0.18s var(--ease);
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--primary {
  --btn-bg: var(--red);
  --btn-fg: var(--on-red);
  --btn-bd: var(--red);
}

.btn--primary:hover { --btn-bg: var(--red-hi); --btn-bd: var(--red-hi); }

.btn--ghost:hover { --btn-bd: var(--bone); background: var(--ink-raise); }

.btn--wide { width: 100%; }

.btn svg { width: 15px; height: 15px; flex: none; }

/* inline text link with a rule that draws on hover */
.tlink {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  color: var(--bone);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  padding-bottom: 2px;
  background-image: linear-gradient(var(--red-text), var(--red-text));
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.25s var(--ease), color 0.18s var(--ease);
}

.tlink:hover { background-size: 100% 1px; color: var(--red-text); }
.tlink svg { width: 14px; height: 14px; }

/* 4. Header / search ------------------------------------------------------ */

.header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line-soft);
}

.header__in {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: var(--header-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  flex: none;
}

.brand__mark {
  width: 34px;
  height: 34px;
  color: var(--bone);
}

.brand__name {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 16px;
  border-left: 1px solid var(--line);
  font-family: var(--brand);
  font-weight: 500;
  font-size: 1.0625rem;
  letter-spacing: 0;
  color: var(--bone);
  white-space: nowrap;
}

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

.nav {
  display: flex;
  gap: 4px;
  margin-inline: auto;
}

.nav a {
  position: relative;
  padding: 8px 14px;
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.16s var(--ease);
}

.nav a:hover { color: var(--bone); }

.nav a[aria-current="page"] { color: var(--bone); }

.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 2px;
  background: var(--red);
}

.header__tools { display: flex; align-items: center; gap: 10px; flex: none; }

.searchbtn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 12px;
  background: var(--ink-raise);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.16s var(--ease), color 0.16s var(--ease);
}

.searchbtn:hover { border-color: var(--bone); color: var(--bone); }
.searchbtn svg { width: 15px; height: 15px; }

kbd {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.iconbtn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: var(--ink-raise);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.16s var(--ease), color 0.16s var(--ease);
}

.iconbtn:hover { border-color: var(--bone); color: var(--bone); }
.iconbtn svg { width: 17px; height: 17px; }

.menubtn { display: none; }

/* mobile drawer */
.drawer {
  display: none;
  border-top: 1px solid var(--line-soft);
  background: var(--ink);
}

.drawer[data-open="true"] { display: block; }

.drawer a {
  display: block;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 800;
  font-stretch: 88%;
  text-transform: uppercase;
  color: var(--bone);
  text-decoration: none;
}

/* search dialog */
.dialog {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  padding: clamp(16px, 8vh, 100px) 16px;
  background: var(--shade);
  backdrop-filter: blur(4px);
}

.dialog[data-open="true"] { display: block; }

.dialog__panel {
  max-width: 620px;
  margin-inline: auto;
  background: var(--ink-raise);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.dialog__field {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.dialog__field svg { width: 18px; height: 18px; color: var(--muted); flex: none; }

.dialog__field input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  font-size: 1.0625rem;
  color: var(--bone);
}

.dialog__field input:focus { outline: none; }

.results { max-height: min(58vh, 460px); overflow-y: auto; padding: 8px; margin: 0; list-style: none; }

.results a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--r-sm);
  text-decoration: none;
}

.results li[data-active="true"] a,
.results a:hover { background: var(--ink-raise-2); }

.results strong { color: var(--bone); font-weight: 500; font-size: 0.95rem; }
.results span { margin-left: auto; font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.results__empty { padding: 28px 20px; color: var(--muted); font-size: 0.9rem; }

/* 5. Hero ----------------------------------------------------------------- */

.hero { position: relative; overflow: hidden; }

.hero__in {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 32px;
  min-height: min(760px, calc(100vh - var(--header-h)));
  padding-block: clamp(48px, 6vw, 72px);
}

.hero__copy { position: relative; z-index: 2; max-width: 620px; }
.hero__copy .kicker { color: var(--red-text); letter-spacing: 0.22em; }
.hero__copy .kicker::before { content: none; }
.hero h1 { margin-bottom: 1.5rem; }
.hero .lede { margin: 0 0 2.2rem; }

.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; }

.hero__art {
  position: absolute;
  inset: 0 calc(var(--gutter) * -1) 0 38%;
  z-index: 1;
}

.hero__art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 62% 30%;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 26%, #000 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 26%, #000 100%);
}

/* one orchestrated entrance, only on the hero */
.hero__copy > * { animation: rise 0.7s var(--ease) both; }
.hero__copy > *:nth-child(2) { animation-delay: 0.06s; }
.hero__copy > *:nth-child(3) { animation-delay: 0.12s; }
.hero__copy > *:nth-child(4) { animation-delay: 0.18s; }
.hero__art { animation: fade 1s var(--ease) 0.1s both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* teams strip (text, no third-party marks) */
.teams { border-top: 1px solid var(--line-soft); padding-block: 26px; }
.teams__in { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 34px; }

.teams__label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.teams__list { display: flex; flex-wrap: wrap; gap: 12px 30px; margin: 0; padding: 0; list-style: none; }

.teams__list li {
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 88%;
  font-size: 1.0625rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--bone);
  opacity: 0.62;
}

/* 6. Work / about / writing ----------------------------------------------- */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr);
  gap: clamp(32px, 4vw, 60px);
  align-items: start;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--ink-raise);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color 0.2s var(--ease);
}

.card:hover { border-color: color-mix(in srgb, var(--red) 55%, var(--line)); }

.card__media { aspect-ratio: 16 / 10; background: #06080b; border-bottom: 1px solid var(--line-soft); overflow: hidden; }
.card__media img { width: 100%; height: 100%; object-fit: cover; }

.card__body { display: flex; flex-direction: column; gap: 0.5rem; padding: 20px; flex: 1; }

.card__kicker {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--red-text);
}

.card__body h3 { font-size: 1.125rem; letter-spacing: -0.01em; }
.card__body h3 a { text-decoration: none; }
.card__body h3 a:hover { color: var(--red-text); }
.card__body p { margin: 0; font-size: 0.9375rem; color: var(--muted); }
.card__body .tlink { margin-top: auto; padding-top: 0.75rem; align-self: flex-start; }

/* about panel */
.about h2 { margin-bottom: 1rem; }
.about p { margin: 0 0 1rem; font-size: 0.9688rem; }
.about__sig { margin: 1.5rem 0 1.25rem; }

.about__sig span {
  font-family: "Archivo", cursive;
  font-size: 1.6rem;
  font-style: italic;
  font-weight: 500;
  font-stretch: 100%;
  color: var(--bone);
  letter-spacing: 0.01em;
}

.stats { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }

.stats li {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}

.stats li:last-child { border-bottom: 0; }

.stats__icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--muted);
}

.stats__icon svg { width: 19px; height: 19px; }

.stats b {
  display: block;
  font-family: var(--display);
  font-size: 1.75rem;
  font-weight: 900;
  font-stretch: 88%;
  line-height: 1;
  color: var(--red-text);
}

.stats small {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* article rows */
.rows { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line-soft); }

.rows > li { border-bottom: 1px solid var(--line-soft); }

.row {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 22px 4px;
  text-decoration: none;
  transition: padding 0.25s var(--ease), background 0.2s var(--ease);
}

.row:hover { background: var(--ink-raise); padding-inline: 14px; }

.row__meta { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.row h3 { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.01em; font-family: var(--body); text-transform: none; }
.row p { margin: 0.25rem 0 0; font-size: 0.9rem; color: var(--muted); }
.row__go { color: var(--muted); transition: color 0.2s var(--ease), transform 0.2s var(--ease); }
.row:hover .row__go { color: var(--red-text); transform: translateX(4px); }
.row__go svg { width: 18px; height: 18px; }

/* generic prose blocks used on about / contact */
.panel {
  background: var(--ink-raise);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: clamp(20px, 3vw, 30px);
}

.panel h3 { font-size: 1.0625rem; margin-bottom: 0.6rem; }
.panel p { margin: 0 0 1rem; font-size: 0.9375rem; color: var(--muted); }
.panel p:last-child { margin-bottom: 0; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }

.tags li,
.tag {
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--text);
}

/* timeline (about / résumé) */
.timeline { list-style: none; margin: 0; padding: 0; }

.timeline > li {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 24px;
  padding: 26px 0;
  border-top: 1px solid var(--line-soft);
}

.timeline h3 { font-size: 1.125rem; font-family: var(--body); text-transform: none; letter-spacing: -0.01em; }
.timeline__when { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.timeline__role { color: var(--red-text); font-size: 0.9rem; margin: 0.15rem 0 0.6rem; }
.timeline ul { margin: 0.6rem 0 0; padding-left: 1.1rem; }
.timeline li { font-size: 0.9375rem; }
.timeline p { margin: 0; font-size: 0.9375rem; color: var(--muted); }

/* 7. Newsletter / footer -------------------------------------------------- */

.signup { border-top: 1px solid var(--line-soft); }

.signup__in {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 460px);
  align-items: center;
  gap: 32px;
  padding-block: clamp(40px, 5vw, 64px);
}

.signup h2 { margin-bottom: 0.5rem; }
.signup p { margin: 0; color: var(--muted); font-size: 0.9375rem; max-width: 42ch; }

.form { display: flex; gap: 10px; flex-wrap: wrap; }

.field {
  flex: 1;
  min-width: 200px;
  padding: 0.85em 1em;
  background: var(--ink-raise);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--bone);
  font-size: 0.9375rem;
}

.field::placeholder { color: var(--muted); }
.field:focus { outline: none; border-color: var(--red-text); }

textarea.field { min-height: 140px; resize: vertical; width: 100%; }

.form__note { flex-basis: 100%; margin: 0; font-size: 0.82rem; color: var(--muted); }
.form__note[data-state="error"] { color: var(--red-text); }
.form__note[data-state="ok"] { color: var(--bone); }

.label { display: block; margin-bottom: 6px; font-size: 0.82rem; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-grid > .full { grid-column: 1 / -1; }

.footer { border-top: 1px solid var(--line-soft); background: var(--ink); }

.footer__in {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 0.8fr)) minmax(0, 1.2fr);
  gap: 40px;
  padding-block: clamp(40px, 5vw, 64px);
}

.footer__mark { width: 30px; height: 30px; color: var(--bone); margin-bottom: 14px; }
.footer p { margin: 0 0 18px; font-size: 0.9rem; color: var(--muted); max-width: 34ch; }

.footer h4 {
  margin-bottom: 14px;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.footer ul a { font-size: 0.9rem; color: var(--text); text-decoration: none; }
.footer ul a:hover { color: var(--red-text); }

.social { display: flex; gap: 10px; }

.social a {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease);
}

.social a:hover { color: var(--bone); border-color: var(--bone); }
.social svg { width: 16px; height: 16px; }

.footer__base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  padding-block: 20px;
  border-top: 1px solid var(--line-soft);
  font-size: 0.8rem;
  color: var(--muted);
}

/* 8. Article & case study -------------------------------------------------- */

.progress { position: fixed; top: var(--header-h); left: 0; right: 0; height: 2px; z-index: 55; background: transparent; }
.progress__bar { height: 100%; width: 0; background: var(--red); transition: width 0.1s linear; }

.doc {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr) 268px;
  gap: clamp(28px, 3.4vw, 52px);
  padding-block: clamp(32px, 4vw, 56px);
  align-items: start;
}

.doc__rail { position: sticky; top: calc(var(--header-h) + 28px); }

.toc { list-style: none; margin: 0 0 28px; padding: 0; display: grid; gap: 2px; counter-reset: toc; }

.toc a {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  padding: 7px 8px 7px 0;
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  padding-left: 10px;
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease);
}

.toc a::before {
  counter-increment: toc;
  content: counter(toc, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  opacity: 0.7;
}

.toc a:hover { color: var(--bone); }
.toc a[data-active="true"] { color: var(--bone); border-left-color: var(--red); }
.toc a[data-active="true"]::before { color: var(--red-text); opacity: 1; }

.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.82rem; color: var(--muted); margin-bottom: 1.6rem; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--red-text); }

.doc__meta { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 1.2rem; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.doc__meta .cat { color: var(--red-text); }

.doc h1 { margin-bottom: 1.1rem; }

.doc__lede { font-size: 1.0938rem; color: var(--text); max-width: 62ch; margin: 0 0 2rem; }

.byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 18px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 2.2rem;
}

.byline img { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); }
.byline__who strong { display: block; color: var(--bone); font-size: 0.9375rem; font-weight: 600; }
.byline__who span { font-size: 0.82rem; color: var(--muted); }
.byline__share { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.byline__share span {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 2px;
}

.figure { margin: 0 0 2.2rem; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: #06080b; }
.figure img { width: 100%; }
.figure figcaption { padding: 12px 16px; border-top: 1px solid var(--line-soft); font-size: 0.82rem; color: var(--muted); }

/* long-form prose */
.prose { max-width: 70ch; }
.prose > * + * { margin-top: 1.15rem; }
.prose p { margin: 0; }

.prose h2 {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: baseline;
  margin-top: 2.8rem;
  font-family: var(--display);
  font-weight: 900;
  font-stretch: 88%;
  text-transform: uppercase;
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  line-height: 1;
  scroll-margin-top: calc(var(--header-h) + 24px);
}

.prose h2 .n { font-family: var(--mono); font-size: 0.8rem; font-weight: 500; color: var(--red-text); letter-spacing: 0.08em; }

.prose h3 { margin-top: 2rem; font-family: var(--body); font-size: 1.0625rem; text-transform: none; letter-spacing: -0.01em; }

.prose ul, .prose ol { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 0.6rem; }

.prose ul > li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  font-size: 0.9688rem;
}

.prose ul > li::before { content: "→"; color: var(--red-text); }

.prose ol { counter-reset: p; }
.prose ol > li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; font-size: 0.9688rem; }
.prose ol > li::before { counter-increment: p; content: counter(p, decimal-leading-zero); font-family: var(--mono); font-size: 0.8rem; color: var(--red-text); }

.prose a:not(.btn):not(.tlink) { color: var(--bone); text-decoration: underline; text-decoration-color: var(--red); text-underline-offset: 3px; }
.prose a:not(.btn):not(.tlink):hover { color: var(--red-text); }

.prose blockquote {
  position: relative;
  margin: 2rem 0;
  padding: 22px 24px 22px 58px;
  background: var(--ink-raise);
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  color: var(--bone);
  font-size: 1.0313rem;
  line-height: 1.5;
}

.prose blockquote::before {
  content: "\201C";
  position: absolute;
  left: 20px;
  top: 14px;
  font-family: var(--display);
  font-size: 3rem;
  line-height: 1;
  color: var(--red);
}

.prose blockquote p { margin: 0; }
.prose blockquote cite { display: block; margin-top: 10px; font-size: 0.82rem; font-style: normal; color: var(--muted); }

.prose figure { margin: 2rem 0; }
.prose hr { margin: 2.4rem 0; border: 0; height: 1px; background: var(--line-soft); }

/* code */
.code {
  margin: 1.6rem 0;
  background: #06080b;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}

.code__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--ink-raise);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.code__bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.code__bar i:first-child { background: #e0514a; }
.code__bar i:nth-child(2) { background: #d8a13a; }
.code__bar i:nth-child(3) { background: #5aa564; }
.code__bar span { margin-left: 8px; }

.code pre { margin: 0; padding: 16px 18px; overflow-x: auto; }
.code code { font-family: var(--mono); font-size: 0.8125rem; line-height: 1.75; color: #cfd6df; }
.code .k { color: #ff8f8f; }
.code .s { color: #9bd39b; }
.code .f { color: #86b7ff; }
.code .c { color: #6f7783; }
.code .n { color: #e2b877; }

/* metric strip / results */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 1px; margin: 1.6rem 0; background: var(--line-soft); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.metrics div { padding: 16px 18px; background: var(--ink-raise); }
.metrics dt { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.metrics dd { margin: 4px 0 0; font-family: var(--display); font-weight: 900; font-stretch: 88%; font-size: 1.5rem; line-height: 1; color: #63c07a; }
.metrics dd.neutral { color: var(--bone); }

/* right rail */
.rail { display: grid; gap: 26px; }
.rail h4 { font-family: var(--mono); font-size: 0.7rem; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.rail dl { margin: 0; display: grid; gap: 14px; }
.rail dt { font-size: 0.8rem; color: var(--muted); }
.rail dd { margin: 2px 0 0; font-size: 0.9rem; color: var(--bone); }

.pips { display: flex; gap: 4px; margin-top: 6px; }
.pips i { width: 12px; height: 8px; background: var(--line); }
.pips i[data-on="true"] { background: var(--red); }

/* stack diagram used in the article */
.stack { display: grid; gap: 8px; margin: 1.6rem 0; padding: 0; list-style: none; }

.stack li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--ink-raise);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}

.stack__icon { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--red-text); }
.stack__icon svg { width: 16px; height: 16px; }
.stack strong { display: block; font-size: 0.9rem; font-weight: 600; color: var(--bone); }
.stack span { font-size: 0.8rem; color: var(--muted); }

/* related */
.related { border-top: 1px solid var(--line-soft); }

/* 9. Responsive ------------------------------------------------------------ */

@media (max-width: 1180px) {
  .doc { grid-template-columns: 200px minmax(0, 1fr); }
  .doc__rail--right { display: none; }
  .footer__in { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1080px) {
  .nav { display: none; }
  .menubtn { display: grid; }
  .searchbtn span { display: none; }
  .searchbtn kbd { display: none; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .signup__in { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .hero__in { grid-template-columns: minmax(0, 1fr); min-height: 0; gap: 0; }
  .hero__copy { max-width: none; }
  .hero__art { position: relative; inset: auto; margin: 32px calc(var(--gutter) * -1) 0; aspect-ratio: 16 / 11; }
  .hero__art img { -webkit-mask-image: linear-gradient(#000 72%, transparent 100%); mask-image: linear-gradient(#000 72%, transparent 100%); object-position: 58% 22%; }
  .doc { grid-template-columns: minmax(0, 1fr); }
  .doc__rail { position: static; }
  .doc__rail--left { padding-bottom: 8px; border-bottom: 1px solid var(--line-soft); }
  .prose { max-width: none; }
}

@media (max-width: 680px) {
  .row { grid-template-columns: minmax(0, 1fr) auto; }
  .row__meta { grid-column: 1 / -1; }
  .timeline > li { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .brand__name { padding-left: 12px; font-size: 1rem; }
  .byline__share { margin-left: 0; flex-basis: 100%; }
  .footer__in { grid-template-columns: minmax(0, 1fr); gap: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.001ms !important;
  }
  .btn:hover { transform: none; }
}

/* 10. Print — the About page doubles as a printable résumé ---------------- */

@media print {
  :root { --ink: #fff; --ink-raise: #fff; --bone: #000; --text: #222; --muted: #555; --line: #ccc; --line-soft: #ddd; --red-text: #a5000d; }
  .header, .footer, .signup, .progress, .dialog, .drawer, .hero__art, .no-print { display: none !important; }
  body { font-size: 11pt; }
  .section { padding-block: 0 12pt; }
  .panel, .card { border: 1px solid #ccc; }
  a { text-decoration: none; }
}

/* 11. Late additions: toast, filter chips, selects --------------------------- */

[hidden] { display: none !important; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 200;
  padding: 11px 18px;
  background: var(--ink-raise);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  color: var(--bone);
  font-size: 0.875rem;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
}

.toast[data-show="true"] { opacity: 1; transform: translate(-50%, 0); }

button.tag {
  background: transparent;
  cursor: pointer;
  transition: border-color 0.16s var(--ease), color 0.16s var(--ease), background 0.16s var(--ease);
}

button.tag:hover { border-color: var(--bone); color: var(--bone); }

button.tag[data-on="true"] {
  border-color: var(--red);
  color: var(--bone);
  background: color-mix(in srgb, var(--red) 16%, transparent);
}

select.field {
  appearance: none;
  padding-right: 2.4em;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23868d98' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9em center;
  background-size: 16px;
}

.doc__rail .panel { margin-top: 10px; }
.doc__rail--left { min-width: 0; }
.prose code { font-family: var(--mono); font-size: 0.875em; color: var(--bone); background: var(--ink-raise-2); padding: 0.1em 0.35em; border-radius: 3px; }
.prose > .metrics + p { margin-top: 1.15rem; }
