/* ==========================================================================
   OZ Data Solutions — shared stylesheet
   Editorial / premium consulting design system.
   Single source of truth for every page.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */

:root {
  /* Surfaces — warm off-white, not pure white */
  --paper: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f4f2ed;

  /* Ink */
  --ink: #15171b;
  --ink-2: #3a404a;
  --muted: #626873;

  /* Rules — the primary structural device in this design */
  --rule: #e2ded5;
  --rule-strong: #cfcabe;

  /* One accent, used sparingly */
  --accent: #14487f;
  --accent-hover: #0e3560;
  --accent-wash: rgba(20, 72, 127, 0.06);
  --on-accent: #ffffff;

  /* Feedback */
  --ok: #17693f;
  --err: #a3231d;

  /* Semantic colours used inline inside article content */
  --green: #1a7a4a;
  --orange: #a85f10;
  --red: #b32d24;
  --purple: #63459c;

  --shadow-sm: 0 1px 2px rgba(21, 23, 27, 0.04);
  --shadow-md: 0 8px 28px -12px rgba(21, 23, 27, 0.16);

  --font-display: 'Source Serif 4', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* 4px spacing scale */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4rem;
  --sp-9: 6rem;
  --sp-10: 8rem;

  /* Fluid type scale */
  --fs-display: clamp(2.6rem, 5.6vw, 4.6rem);
  --fs-h1: clamp(2.1rem, 4.2vw, 3.4rem);
  --fs-h2: clamp(1.7rem, 2.9vw, 2.45rem);
  --fs-h3: clamp(1.12rem, 1.5vw, 1.32rem);
  --fs-lead: clamp(1.05rem, 1.4vw, 1.22rem);
  --fs-body: 1rem;
  --fs-sm: 0.9rem;
  --fs-xs: 0.8rem;
  --fs-label: 0.7rem;

  --wrap: 1200px;
  --wrap-narrow: 760px;
  --measure: 68ch;
  --nav-h: 68px;
  --radius: 3px;
}

/* Dark theme. The [data-theme] attribute must win in both directions, so the
   media query is scoped to :not([data-theme="light"]) and the explicit
   selector is repeated below it. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #0e1014;
    --surface: #14171c;
    --surface-2: #1a1e24;
    --ink: #f2f0eb;
    --ink-2: #c8cbd1;
    --muted: #949aa5;
    --rule: rgba(242, 240, 235, 0.11);
    --rule-strong: rgba(242, 240, 235, 0.2);
    --accent: #7faee3;
    --accent-hover: #a3c6ee;
    --accent-wash: rgba(127, 174, 227, 0.1);
    --on-accent: #0e1014;
    --ok: #5cc98d;
    --err: #f08b86;
    --green: #5cc98d;
    --orange: #e0a253;
    --red: #f08b86;
    --purple: #b39ae8;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 28px -12px rgba(0, 0, 0, 0.6);
  }
}

:root[data-theme='dark'] {
  --paper: #0e1014;
  --surface: #14171c;
  --surface-2: #1a1e24;
  --ink: #f2f0eb;
  --ink-2: #c8cbd1;
  --muted: #949aa5;
  --rule: rgba(242, 240, 235, 0.11);
  --rule-strong: rgba(242, 240, 235, 0.2);
  --accent: #7faee3;
  --accent-hover: #a3c6ee;
  --accent-wash: rgba(127, 174, 227, 0.1);
  --on-accent: #0e1014;
  --ok: #5cc98d;
  --err: #f08b86;
  --green: #5cc98d;
  --orange: #e0a253;
  --red: #f08b86;
  --purple: #b39ae8;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 28px -12px rgba(0, 0, 0, 0.6);
}

/* --------------------------------------------------------------------------
   2. Reset and base
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + var(--sp-5));
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.65;
  font-weight: 400;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'kern' 1, 'liga' 1;
}

img,
svg {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

/* --------------------------------------------------------------------------
   3. Typography
   -------------------------------------------------------------------------- */

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.018em;
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-h1);
  line-height: 1.08;
}
h2 {
  font-size: var(--fs-h2);
  line-height: 1.14;
}
h3 {
  font-size: var(--fs-h3);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.display {
  font-size: var(--fs-display);
  line-height: 1.03;
  letter-spacing: -0.028em;
}

.lead {
  font-size: var(--fs-lead);
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 58ch;
  text-wrap: pretty;
}

.prose p {
  color: var(--ink-2);
  max-width: var(--measure);
  margin-bottom: var(--sp-4);
  text-wrap: pretty;
}

.prose p:last-child {
  margin-bottom: 0;
}

.prose strong {
  color: var(--ink);
  font-weight: 600;
}

/* Small mono label — the recurring editorial device */
.label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.label-accent {
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   4. Layout primitives
   -------------------------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 3.5rem);
}

.wrap-narrow {
  max-width: var(--wrap-narrow);
}

.section {
  padding-block: clamp(var(--sp-8), 9vw, var(--sp-10));
}

.section-tight {
  padding-block: clamp(var(--sp-7), 6vw, var(--sp-9));
}

.section-alt {
  background: var(--surface-2);
}

.rule {
  border: 0;
  border-top: 1px solid var(--rule);
  width: 100%;
}

/* Section heading block: mono label, serif heading, optional lead */
.section-head {
  max-width: 46ch;
  margin-bottom: clamp(var(--sp-6), 5vw, var(--sp-8));
}

.section-head .label {
  margin-bottom: var(--sp-4);
}

.section-head .lead {
  margin-top: var(--sp-4);
}

.section-head-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-7);
  align-items: end;
  max-width: none;
}

@media (max-width: 800px) {
  .section-head-split {
    grid-template-columns: 1fr;
    gap: var(--sp-5);
  }
}

/* --------------------------------------------------------------------------
   5. Skip link and focus
   -------------------------------------------------------------------------- */

.skip-link {
  position: absolute;
  top: -200%;
  left: var(--sp-4);
  z-index: 300;
  background: var(--accent);
  color: var(--on-accent);
  padding: var(--sp-3) var(--sp-5);
  font-size: var(--fs-sm);
  font-weight: 600;
  border-radius: var(--radius);
  text-decoration: none;
}

.skip-link:focus {
  top: var(--sp-3);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* --------------------------------------------------------------------------
   6. Navigation
   -------------------------------------------------------------------------- */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease, background 0.25s ease;
}

.nav.is-scrolled {
  border-bottom-color: var(--rule);
}

.nav-inner {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 3.5rem);
  display: flex;
  align-items: center;
  gap: var(--sp-5);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  text-decoration: none;
  margin-right: auto;
  flex-shrink: 0;
}

/* The mark is painted as a mask rather than an <img> so it takes its colour from
   --accent and therefore follows the theme. Navy on paper, pale blue on dark;
   an <img> would stay navy and go muddy against the dark background.

   The mark is an OZ monogram cut from Source Serif 4 Semibold, so it is sized by
   cap height to sit level with .brand-name rather than by a square box. Width
   follows the glyph pair's own ratio. */
.brand-mark {
  height: 21px;
  aspect-ratio: 1237 / 696;
  flex-shrink: 0;
  background-color: var(--accent);
  -webkit-mask: url('/images/oz-mark.svg') center / contain no-repeat;
  mask: url('/images/oz-mark.svg') center / contain no-repeat;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.2vw, 2rem);
  list-style: none;
}

.nav-links a {
  font-size: var(--fs-sm);
  font-weight: 450;
  color: var(--muted);
  text-decoration: none;
  padding-block: var(--sp-2);
  border-bottom: 1px solid transparent;
  transition: color 0.18s ease, border-color 0.18s ease;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.is-active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.nav-tools {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   7. Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 550;
  line-height: 1;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: transparent;
  border-color: var(--rule-strong);
  color: var(--ink);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-sm {
  padding: 0.55rem 1.1rem;
  font-size: var(--fs-xs);
}

/* Text link with a trailing arrow */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: 550;
  color: var(--accent);
  text-decoration: none;
}

.link-arrow svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease;
}

.link-arrow:hover svg {
  transform: translateX(3px);
}

/* Icon button — theme toggle, hamburger */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease;
}

.icon-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .icon-sun {
  display: none;
}
:root[data-theme='dark'] .theme-toggle .icon-sun {
  display: block;
}
:root[data-theme='dark'] .theme-toggle .icon-moon {
  display: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme-toggle .icon-sun {
    display: block;
  }
  :root:not([data-theme='light']) .theme-toggle .icon-moon {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   8. Mobile navigation
   -------------------------------------------------------------------------- */

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 0;
}

.hamburger span {
  display: block;
  width: 17px;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.hamburger.is-open span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}
.hamburger.is-open span:nth-child(2) {
  opacity: 0;
}
.hamburger.is-open span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

.mobile-menu {
  position: fixed;
  inset: var(--nav-h) 0 0 0;
  z-index: 99;
  background: var(--paper);
  padding: var(--sp-7) clamp(1.25rem, 5vw, 3.5rem);
  display: none;
  flex-direction: column;
  gap: var(--sp-2);
  overflow-y: auto;
}

.mobile-menu.is-open {
  display: flex;
}

/* :not(.btn) so the trailing call to action keeps its button styling rather
   than inheriting the large serif treatment used for the menu links. */
.mobile-menu a:not(.btn) {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  padding-block: var(--sp-3);
  border-bottom: 1px solid var(--rule);
}

.mobile-menu .btn {
  margin-top: var(--sp-5);
  align-self: flex-start;
}

@media (max-width: 900px) {
  .nav-links {
    display: none;
  }
  .nav-tools .btn-primary {
    display: none;
  }
  .hamburger {
    display: flex;
  }
}

@media (min-width: 901px) {
  .mobile-menu {
    display: none !important;
  }
}

/* --------------------------------------------------------------------------
   9. Hero
   -------------------------------------------------------------------------- */

.hero {
  padding-top: calc(var(--nav-h) + clamp(3.5rem, 9vw, 7rem));
  padding-bottom: clamp(var(--sp-7), 6vw, var(--sp-9));
  position: relative;
  overflow: hidden;
}

/* Faint engineering grid. Decorative only, costs nothing. */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--rule) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: 72px 72px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 70% 15%, #000, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 70% 15%, #000, transparent 75%);
  opacity: 0.6;
  pointer-events: none;
}

.hero > * {
  position: relative;
}

.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.hero-eyebrow::after {
  content: '';
  height: 1px;
  width: clamp(2rem, 8vw, 6rem);
  background: var(--rule-strong);
}

/* The line breaks in the markup set the rag on wide screens. Below that the
   headline should reflow on its own, so the manual breaks are dropped. */
.hero h1 {
  max-width: 26ch;
}

@media (max-width: 640px) {
  .hero h1 br {
    display: none;
  }
  .hero h1 {
    max-width: 18ch;
  }
}

.hero .lead {
  margin-top: var(--sp-5);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-7);
}

/* Credential strip under the hero */
.hero-strip {
  margin-top: clamp(var(--sp-8), 8vw, var(--sp-9));
  padding-top: var(--sp-5);
  border-top: 1px solid var(--rule);
}

.hero-strip .label {
  display: block;
  margin-bottom: var(--sp-4);
}

.strip-items {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3) clamp(1.25rem, 4vw, 3rem);
  align-items: baseline;
  list-style: none;
}

.strip-items li {
  font-family: var(--font-display);
  font-size: clamp(0.98rem, 1.5vw, 1.18rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink-2);
}

/* --------------------------------------------------------------------------
   10. Stats
   -------------------------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--rule);
  border-block: 1px solid var(--rule);
}

.stat {
  background: var(--paper);
  padding: var(--sp-6) var(--sp-5);
}

.section-alt .stat {
  background: var(--surface-2);
}

/* Fixed box height, bottom aligned, so a tile with a smaller number still
   drops its label onto the same baseline as the rest of the row. */
.stat-num {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.4vw, 2.9rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
  display: flex;
  align-items: flex-end;
  min-height: clamp(2rem, 3.4vw, 2.9rem);
}

/* Tiles whose "number" is a multi-word phrase rather than a figure. Held to one
   line so every label in the row keeps the same baseline. */
.stat-num-phrase {
  font-size: clamp(1.4rem, 2.1vw, 1.9rem);
  white-space: nowrap;
}

.stat-label {
  margin-top: var(--sp-3);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   11. Practices — numbered editorial rows, not icon cards
   -------------------------------------------------------------------------- */

.practices {
  border-top: 1px solid var(--rule);
}

.practice {
  display: grid;
  grid-template-columns: 4rem minmax(0, 20rem) minmax(0, 1fr);
  gap: var(--sp-6);
  align-items: start;
  padding-block: clamp(var(--sp-6), 4vw, var(--sp-7));
  border-bottom: 1px solid var(--rule);
}

.practice-num {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.1em;
  color: var(--muted);
  padding-top: 0.45rem;
}

.practice-body p {
  color: var(--ink-2);
  max-width: 58ch;
}

.practice-list {
  list-style: none;
  margin-top: var(--sp-5);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-2) var(--sp-5);
}

.practice-list li {
  font-size: var(--fs-sm);
  color: var(--muted);
  padding-left: var(--sp-4);
  position: relative;
}

.practice-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 5px;
  height: 1px;
  background: var(--accent);
}

@media (max-width: 900px) {
  .practice {
    grid-template-columns: 3rem minmax(0, 1fr);
    gap: var(--sp-4);
  }
  .practice-body {
    grid-column: 2;
  }
}

@media (max-width: 560px) {
  .practice {
    grid-template-columns: 1fr;
    gap: var(--sp-3);
  }
  .practice-body {
    grid-column: 1;
  }
}

/* --------------------------------------------------------------------------
   12. Engagement models
   -------------------------------------------------------------------------- */

.models {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--sp-5);
}

.model {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: clamp(var(--sp-5), 3vw, var(--sp-7));
  display: flex;
  flex-direction: column;
}

.model .label {
  margin-bottom: var(--sp-4);
}

.model h3 {
  margin-bottom: var(--sp-3);
}

.model p {
  color: var(--ink-2);
  font-size: var(--fs-sm);
}

.model-meta {
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--rule);
  list-style: none;
  display: grid;
  gap: var(--sp-2);
}

/* Fixed key column, so the values line up no matter how long a key gets.
   Widen the track if a key ever outgrows it rather than going back to flex. */
.model-meta li {
  font-size: var(--fs-xs);
  color: var(--muted);
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: var(--sp-3);
}

.model-meta dt,
.model-meta .k {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.model-meta .v {
  color: var(--ink-2);
}

/* --------------------------------------------------------------------------
   13. Case studies
   -------------------------------------------------------------------------- */

.cases {
  display: grid;
  gap: var(--sp-5);
}

.case {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: clamp(var(--sp-5), 4vw, var(--sp-8));
  padding: clamp(var(--sp-5), 3vw, var(--sp-7));
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.case-aside .label {
  display: block;
  margin-bottom: var(--sp-3);
}

.case-sector {
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: var(--sp-4);
}

.case-result {
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--rule);
}

.case-result-num {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--accent);
}

.case-result-label {
  margin-top: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--muted);
}

.case-block {
  margin-bottom: var(--sp-5);
}

.case-block:last-child {
  margin-bottom: 0;
}

.case-block .label {
  display: block;
  margin-bottom: var(--sp-2);
}

.case-block p {
  color: var(--ink-2);
  font-size: var(--fs-sm);
  max-width: 62ch;
}

.case-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-5);
}

@media (max-width: 800px) {
  .case {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   14. Tags
   -------------------------------------------------------------------------- */

.tag {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.3rem 0.6rem;
  white-space: nowrap;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

/* --------------------------------------------------------------------------
   15. Approach steps
   -------------------------------------------------------------------------- */

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}

.step {
  background: var(--paper);
  padding: clamp(var(--sp-5), 3vw, var(--sp-6));
}

.section-alt .step {
  background: var(--surface-2);
}

.step-num {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.14em;
  color: var(--accent);
  display: block;
  margin-bottom: var(--sp-4);
}

.step h3 {
  margin-bottom: var(--sp-2);
}

.step p {
  font-size: var(--fs-sm);
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   16. Principal
   -------------------------------------------------------------------------- */

.principal {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  gap: clamp(var(--sp-6), 5vw, var(--sp-8));
  align-items: start;
  padding-top: var(--sp-6);
  border-top: 1px solid var(--rule-strong);
}

/* Anonymous build: no portrait, so the body owns the full width. The two bio
   paragraphs run side by side the way .section-head-split above them does,
   which keeps a readable measure without leaving the right half empty. The
   heading and the facts row span both columns. */
.principal--anon {
  grid-template-columns: minmax(0, 1fr);
}

.principal--anon .principal-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--sp-7);
  align-content: start;
}

.principal--anon .principal-body > h3,
.principal--anon .principal-facts {
  grid-column: 1 / -1;
}

.principal--anon .principal-body p:not(.principal-role) {
  max-width: none;
}

@media (max-width: 800px) {
  .principal--anon .principal-body {
    grid-template-columns: 1fr;
  }
}

.principal-portrait {
  margin: 0;
  position: relative;
}

.principal-portrait img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  /* Warm the photo's grey studio wall into the paper palette */
  background: var(--surface-2);
}

.principal-body h3 {
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  letter-spacing: -0.015em;
  margin-bottom: var(--sp-2);
}

.principal-role {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--sp-5);
}

.principal-body p:not(.principal-role) {
  color: var(--ink-2);
  max-width: var(--measure);
  margin-bottom: var(--sp-4);
}

.principal-facts {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--sp-3) var(--sp-5);
  margin: var(--sp-6) 0 var(--sp-6);
}

.principal-facts li {
  font-size: var(--fs-sm);
  color: var(--ink);
  padding-left: var(--sp-4);
  border-left: 2px solid var(--rule-strong);
  line-height: 1.45;
}

.principal-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--accent);
}

.principal-link svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex: none;
}

@media (max-width: 820px) {
  .principal {
    grid-template-columns: 1fr;
  }

  .principal-portrait {
    max-width: 240px;
  }
}

/* --------------------------------------------------------------------------
   17. Credentials
   -------------------------------------------------------------------------- */

/* Six credentials, so the track is sized to land three per row and fill both
   rows. minmax(240px) gave four then a half-empty second row. */
.creds {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: var(--sp-6) var(--sp-5);
  list-style: none;
}

.cred {
  padding-top: var(--sp-4);
  border-top: 1px solid var(--rule-strong);
}

.cred dt,
.cred .k {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--sp-3);
}

.cred dd,
.cred .v {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.4;
}

.cred .v-sub {
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 400;
  color: var(--muted);
  margin-top: var(--sp-2);
  line-height: 1.55;
}

/* --------------------------------------------------------------------------
   18. Technology strip
   -------------------------------------------------------------------------- */

/* Static row. It wraps rather than scrolling, so the whole stack is readable
   at a glance and nothing moves at the reader. */
.techstrip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--sp-4) clamp(1rem, 2.5vw, 2rem);
}

@media (max-width: 900px) {
  .techstrip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .techstrip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.tech-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.tech-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.75;
}

/* --------------------------------------------------------------------------
   19. Contact form
   -------------------------------------------------------------------------- */

.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr);
  gap: clamp(var(--sp-6), 6vw, var(--sp-9));
  align-items: start;
}

@media (max-width: 860px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }
}

.contact-aside dl {
  margin-top: var(--sp-7);
  display: grid;
  gap: var(--sp-5);
}

.contact-aside dt {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--sp-2);
}

.contact-aside dd {
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

.contact-aside a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-wash);
}

.contact-aside a:hover {
  border-bottom-color: currentColor;
}

.form {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: clamp(var(--sp-5), 4vw, var(--sp-7));
}

.field {
  margin-bottom: var(--sp-5);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}

@media (max-width: 520px) {
  .field-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--sp-2);
}

.field .optional {
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
  opacity: 0.75;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: 0.8rem 0.9rem;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  -webkit-appearance: none;
  appearance: none;
}

.field textarea {
  min-height: 130px;
  resize: vertical;
  line-height: 1.6;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted);
  opacity: 0.65;
}

.field select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23626873' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.4rem;
}

:root[data-theme='dark'] .field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23949aa5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23949aa5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  }
}

.field select option {
  background: var(--surface);
  color: var(--ink);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

.field input.is-invalid,
.field textarea.is-invalid {
  border-color: var(--err);
}

.field input.is-invalid:focus,
.field textarea.is-invalid:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--err) 14%, transparent);
}

.field-error {
  display: block;
  font-size: var(--fs-xs);
  color: var(--err);
  margin-top: var(--sp-2);
  min-height: 0;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.field-error.is-visible {
  opacity: 1;
  min-height: 1.2em;
}

.form-submit {
  width: 100%;
  margin-top: var(--sp-2);
  padding-block: 0.95rem;
}

.form-status {
  margin-top: var(--sp-4);
  font-size: var(--fs-sm);
  min-height: 1.4em;
}

.form-status.is-ok {
  color: var(--ok);
}
.form-status.is-err {
  color: var(--err);
}

.form-note {
  margin-top: var(--sp-4);
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.55;
}

.form-note a {
  color: var(--muted);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   20. Callout / CTA band
   -------------------------------------------------------------------------- */

.cta-band {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
  padding: clamp(var(--sp-6), 4vw, var(--sp-8));
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.cta-band h2 {
  max-width: 20ch;
}

/* --------------------------------------------------------------------------
   21. Footer
   -------------------------------------------------------------------------- */

.footer {
  border-top: 1px solid var(--rule);
  padding-block: var(--sp-8) var(--sp-6);
  background: var(--paper);
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr));
  gap: var(--sp-6);
  padding-bottom: var(--sp-7);
}

@media (max-width: 860px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-6) var(--sp-5);
  }
  .footer-brand {
    grid-column: 1 / -1;
  }
}

.footer-brand p {
  margin-top: var(--sp-4);
  font-size: var(--fs-sm);
  color: var(--muted);
  max-width: 34ch;
}

/* h2 rather than h4 so the document outline never skips a level. Styled as a
   small mono label, which is what it reads as visually. */
.footer-col h2 {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--sp-4);
}

.footer-col ul {
  list-style: none;
  display: grid;
  gap: var(--sp-3);
}

.footer-col a {
  font-size: var(--fs-sm);
  color: var(--ink-2);
  text-decoration: none;
  transition: color 0.18s ease;
}

.footer-col a:hover {
  color: var(--accent);
}

.footer-base {
  border-top: 1px solid var(--rule);
  padding-top: var(--sp-5);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3) var(--sp-5);
  justify-content: space-between;
  align-items: center;
}

.footer-base p,
.footer-base a {
  font-size: var(--fs-xs);
  color: var(--muted);
  text-decoration: none;
}

.footer-base a:hover {
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   22. Back to top
   -------------------------------------------------------------------------- */

.to-top {
  position: fixed;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  z-index: 90;
  width: 40px;
  height: 40px;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-decoration: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s,
    color 0.18s ease, border-color 0.18s ease;
}

.to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.to-top:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.to-top svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --------------------------------------------------------------------------
   23. Page header (interior pages)
   -------------------------------------------------------------------------- */

.page-header {
  padding-top: calc(var(--nav-h) + clamp(3rem, 7vw, 5.5rem));
  padding-bottom: clamp(var(--sp-6), 5vw, var(--sp-8));
  border-bottom: 1px solid var(--rule);
}

.page-header .label {
  margin-bottom: var(--sp-4);
}

.page-header .lead {
  margin-top: var(--sp-5);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-bottom: var(--sp-5);
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   24. Blog index
   -------------------------------------------------------------------------- */

.post-list {
  border-top: 1px solid var(--rule);
}

.post-item {
  display: grid;
  grid-template-columns: minmax(0, 12rem) minmax(0, 1fr);
  gap: var(--sp-5) var(--sp-7);
  padding-block: clamp(var(--sp-5), 4vw, var(--sp-7));
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  transition: background 0.2s ease;
}

.post-item:hover {
  background: var(--accent-wash);
}

.post-meta {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.post-item h2 {
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  margin-bottom: var(--sp-3);
  transition: color 0.18s ease;
}

.post-item:hover h2 {
  color: var(--accent);
}

.post-item p {
  color: var(--ink-2);
  font-size: var(--fs-sm);
  max-width: 62ch;
  margin-bottom: var(--sp-4);
}

@media (max-width: 720px) {
  .post-item {
    grid-template-columns: 1fr;
    gap: var(--sp-3);
  }
  .post-meta {
    flex-direction: row;
    gap: var(--sp-4);
  }
}

/* --------------------------------------------------------------------------
   25. Article (blog post) typography
   -------------------------------------------------------------------------- */

.article {
  padding-block: clamp(var(--sp-7), 6vw, var(--sp-9));
}

.article-body {
  max-width: 68ch;
  margin-inline: auto;
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--ink-2);
}

.article-body > * + * {
  margin-top: var(--sp-5);
}

.article-body h2 {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  margin-top: var(--sp-8);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--rule);
}

.article-body h3 {
  font-size: clamp(1.15rem, 1.8vw, 1.35rem);
  margin-top: var(--sp-6);
  color: var(--ink);
}

.article-body p {
  text-wrap: pretty;
}

/* Tool list that sits directly under a heading, naming the products at that
   tier. Reads as a caption rather than body copy. */
.article-body .rung-tools {
  margin-top: var(--sp-2);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--muted);
}

.article-body strong {
  color: var(--ink);
  font-weight: 600;
}

.article-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.article-body ul,
.article-body ol {
  padding-left: var(--sp-5);
  display: grid;
  gap: var(--sp-3);
}

.article-body li {
  padding-left: var(--sp-2);
}

.article-body li::marker {
  color: var(--accent);
}

.article-body blockquote {
  border-left: 2px solid var(--accent);
  padding: var(--sp-2) 0 var(--sp-2) var(--sp-5);
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-style: italic;
  color: var(--ink);
}

.article-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.1em 0.35em;
}

.article-body pre {
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--sp-5);
  overflow-x: auto;
  font-size: var(--fs-sm);
  line-height: 1.6;
}

.article-body pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
}

.article-body img {
  border-radius: var(--radius);
  border: 1px solid var(--rule);
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.article-body th,
.article-body td {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--rule);
}

.article-body th {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

/* Wide content must scroll inside its own container, never the page */
.scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* --------------------------------------------------------------------------
   24b. Article components (callouts, diagrams, step flows, tables)
   -------------------------------------------------------------------------- */

.article-header {
  padding-top: calc(var(--nav-h) + clamp(3rem, 7vw, 5.5rem));
  padding-bottom: clamp(var(--sp-6), 5vw, var(--sp-8));
  border-bottom: 1px solid var(--rule);
}

.article-header-inner {
  max-width: 72ch;
  margin-inline: auto;
}

.article-back {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--muted);
  text-decoration: none;
  margin-bottom: var(--sp-5);
}

.article-back:hover {
  color: var(--accent);
}

.article-back svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-5);
}

/* Byline sits in .article-meta, styled like a .label but as a live link */
.article-byline {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--rule-strong);
  padding-bottom: 2px;
}

.article-byline:hover,
.article-byline:focus-visible {
  color: var(--accent);
  border-bottom-color: currentColor;
}

.article-header h1 {
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.08;
}

.article-header h1 em {
  font-style: italic;
  color: var(--accent);
}

.article-subtitle {
  margin-top: var(--sp-5);
  font-size: var(--fs-lead);
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 62ch;
  text-wrap: pretty;
}

/* Callouts */
.callout {
  border: 1px solid var(--rule);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: var(--sp-5);
}

.callout p {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

.callout-label {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--sp-3);
}

.callout-insight {
  border-left-color: var(--accent);
}
.callout-insight .callout-label {
  color: var(--accent);
}

.callout-warning {
  border-left-color: var(--orange);
}
.callout-warning .callout-label {
  color: var(--orange);
}

.callout-pitfall {
  border-left-color: var(--red);
}
.callout-pitfall .callout-label {
  color: var(--red);
}

/* Diagrams. The inline SVGs in the articles were drawn against a dark
   background, so the panel stays dark in both themes and reads as a
   deliberate figure rather than a mismatch. */
/* The diagrams are inline SVG with hard-coded hex attributes. Rather than
   editing every shape, the palette is remapped here by attribute selector,
   which CSS wins over a presentation attribute. Change a colour by editing
   the variables below, never the SVG. */
.diagram-container {
  --dg-bg: var(--surface);
  --dg-border: var(--rule);
  --dg-surface: var(--paper);
  --dg-surface-2: var(--paper);
  --dg-surface-3: #f1eee7;
  --dg-ink: var(--ink);
  --dg-muted: var(--muted);
  --dg-muted-2: #7c828d;
  --dg-rule: var(--rule-strong);
  --dg-rule-2: var(--rule);
  --dg-blue: var(--accent);
  --dg-green: var(--green);
  --dg-amber: var(--orange);
  --dg-red: var(--red);
  --dg-purple: var(--purple);

  background: var(--dg-bg);
  border: 1px solid var(--dg-border);
  border-radius: var(--radius);
  padding: var(--sp-5);
  overflow-x: auto;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .diagram-container {
    --dg-bg: #12161f;
    --dg-border: rgba(242, 240, 235, 0.1);
    --dg-surface: #1e293b;
    --dg-surface-2: #1a2235;
    --dg-surface-3: #0d1321;
    --dg-ink: #e8ecf4;
    --dg-muted: #64748b;
    --dg-muted-2: #94a3b8;
    --dg-rule: #2d3748;
    --dg-rule-2: #1e293b;
    --dg-blue: #3b82f6;
    --dg-green: #10b981;
    --dg-amber: #f59e0b;
    --dg-red: #ef4444;
    --dg-purple: #a78bfa;
  }
}

:root[data-theme='dark'] .diagram-container {
  --dg-bg: #12161f;
  --dg-border: rgba(242, 240, 235, 0.1);
  --dg-surface: #1e293b;
  --dg-surface-2: #1a2235;
  --dg-surface-3: #0d1321;
  --dg-ink: #e8ecf4;
  --dg-muted: #64748b;
  --dg-muted-2: #94a3b8;
  --dg-rule: #2d3748;
  --dg-rule-2: #1e293b;
  --dg-blue: #3b82f6;
  --dg-green: #10b981;
  --dg-amber: #f59e0b;
  --dg-red: #ef4444;
  --dg-purple: #a78bfa;
}

.diagram-container [fill='#1e293b'] { fill: var(--dg-surface); }
.diagram-container [fill='#1a2235'] { fill: var(--dg-surface-2); }
.diagram-container [fill='#0d1321'] { fill: var(--dg-surface-3); }
.diagram-container [fill='#e8ecf4'] { fill: var(--dg-ink); }
.diagram-container [fill='#64748b'] { fill: var(--dg-muted); }
.diagram-container [fill='#94a3b8'] { fill: var(--dg-muted-2); }
.diagram-container [fill='#3b82f6'],
.diagram-container [fill='#60a5fa'] { fill: var(--dg-blue); }
.diagram-container [fill='#10b981'] { fill: var(--dg-green); }
.diagram-container [fill='#f59e0b'] { fill: var(--dg-amber); }
.diagram-container [fill='#ef4444'] { fill: var(--dg-red); }
.diagram-container [fill='#a78bfa'] { fill: var(--dg-purple); }

.diagram-container [stop-color='#10b981'] { stop-color: var(--dg-green); }
.diagram-container [stop-color='#ef4444'] { stop-color: var(--dg-red); }

.diagram-container [stroke='#2d3748'] { stroke: var(--dg-rule); }
.diagram-container [stroke='#1e293b'] { stroke: var(--dg-rule-2); }
.diagram-container [stroke='#64748b'] { stroke: var(--dg-muted); }
.diagram-container [stroke='#3b82f6'] { stroke: var(--dg-blue); }
.diagram-container [stroke='#10b981'] { stroke: var(--dg-green); }
.diagram-container [stroke='#f59e0b'] { stroke: var(--dg-amber); }
.diagram-container [stroke='#ef4444'] { stroke: var(--dg-red); }
.diagram-container [stroke='#a78bfa'] { stroke: var(--dg-purple); }

.diagram-container svg {
  min-width: 520px;
  margin-inline: auto;
}

.diagram-container .caption {
  margin-top: var(--sp-4);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--dg-border);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dg-muted);
  text-align: center;
  min-width: 0;
}

/* Comparison tables scroll inside their own container */
.comparison-table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

/* Cells wrap normally at width; below the min-width the table scrolls inside
   its own box rather than squashing or pushing the page sideways. */
.comparison-table thead,
.comparison-table tbody,
.comparison-table tr {
  display: table;
  width: 100%;
  min-width: 34rem;
  table-layout: fixed;
}

.comparison-table th,
.comparison-table td {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

.comparison-table th {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--muted);
  border-bottom-color: var(--rule-strong);
}

.comparison-table td {
  color: var(--ink-2);
}

.comparison-table tbody tr:last-child td {
  border-bottom: 0;
}

/* Numbered step flow */
.step-flow {
  display: grid;
  gap: 0;
}

.step-item {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  gap: var(--sp-4);
}

.step-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.step-number {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--accent);
  border: 1px solid var(--rule-strong);
  border-radius: 50%;
  background: var(--paper);
}

.step-line {
  flex: 1;
  width: 1px;
  background: var(--rule);
  margin-block: var(--sp-2);
  min-height: var(--sp-3);
}

.step-item:last-child .step-line {
  display: none;
}

.step-content {
  padding-bottom: var(--sp-5);
}

.step-content h4 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--sp-2);
}

.step-content p {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin: 0;
}

/* Author card */
.author-card {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin-top: var(--sp-8);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--rule);
}

/* Scoped to .author-card so it outranks .article-body img, which would
   otherwise square off the portrait. */
.author-card .author-avatar {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--rule-strong);
  object-fit: cover;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-wash);
}

.author-info h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.15rem;
}

.author-info p {
  font-size: var(--fs-xs);
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   26. Scroll reveal
   -------------------------------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------------------
   27. Reduced motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   28. Print
   -------------------------------------------------------------------------- */

@media print {
  .nav,
  .mobile-menu,
  .to-top,
  .techstrip,
  .hero::before {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  a[href^='http']::after {
    content: ' (' attr(href) ')';
    font-size: 0.85em;
    color: #555;
  }
}
