/* ==========================================================================
   xdshine.com
   Tokens follow VISUAL_DESIGN_GUIDE.md. Change colours and type here only.
   ========================================================================== */

:root,
:root[data-theme="dark"] {
  --bg: #151515;
  --surface: #212121;
  --surface-raised: #2C2C2C;
  --border: #3D3D3D;
  --border-strong: #808080;
  --text: #F5F5F5;
  --text-muted: #BDBDBD;
  --text-subtle: #9E9E9E;
  --accent: #FF914D;
  --accent-hover: #FFA870;
  --accent-soft: rgba(255, 145, 77, 0.12);
  --on-accent: #151515;
  --accent-fill: #FF914D;
  --accent-fill-hover: #E68345;
  --on-accent-fill: #151515;
  --header-bg: rgba(21, 21, 21, 0.85);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --surface-raised: #F0F0F0;
  --border: #E0E0E0;
  --border-strong: #808080;
  --text: #151515;
  --text-muted: #595959;
  --text-subtle: #595959;
  --accent: #A64000;
  --accent-hover: #7A2F00;
  --accent-soft: rgba(255, 145, 77, 0.14);
  --on-accent: #FFFFFF;
  --accent-fill: #FF914D;
  --accent-fill-hover: #E68345;
  --on-accent-fill: #151515;
  --header-bg: rgba(250, 250, 250, 0.85);
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #FAFAFA;
    --surface: #FFFFFF;
    --surface-raised: #F0F0F0;
    --border: #E0E0E0;
    --border-strong: #808080;
    --text: #151515;
    --text-muted: #595959;
    --text-subtle: #595959;
    --accent: #A64000;
    --accent-hover: #7A2F00;
    --accent-soft: rgba(255, 145, 77, 0.14);
    --on-accent: #FFFFFF;
    --accent-fill: #FF914D;
    --accent-fill-hover: #E68345;
    --on-accent-fill: #151515;
    --header-bg: rgba(250, 250, 250, 0.85);
    color-scheme: light;
  }
}

:root {
  /* Inter for all text. Playfair Display italic only for highlight words (.accent-phrase). */
  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-heading: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  /* Small uppercase labels, numbers and dates. Inter with open tracking and even-width numbers. */
  --font-label: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Fluid type scale (typescale.com): Minor Third 1.2 from 16px at 375px wide,
     growing to Major Third 1.25 from 18px at 1280px wide. Every size is a step. */
  --step--1: clamp(0.8333rem, 0.8057rem + 0.1179vw, 0.9000rem); /* 13.3 → 14.4px */
  --step-0:  clamp(1.0000rem, 0.9482rem + 0.2210vw, 1.1250rem); /* 16.0 → 18.0px */
  --step-1:  clamp(1.2000rem, 1.1145rem + 0.3646vw, 1.4062rem); /* 19.2 → 22.5px */
  --step-2:  clamp(1.4400rem, 1.3083rem + 0.5619vw, 1.7578rem); /* 23.0 → 28.1px */
  --step-3:  clamp(1.7280rem, 1.5336rem + 0.8296vw, 2.1973rem); /* 27.6 → 35.2px */
  --step-4:  clamp(2.0736rem, 1.7947rem + 1.1898vw, 2.7466rem); /* 33.2 → 43.9px */
  --step-5:  clamp(2.4883rem, 2.0968rem + 1.6706vw, 3.4332rem); /* 39.8 → 54.9px */
  --step-6:  clamp(2.9860rem, 2.4450rem + 2.3082vw, 4.2915rem); /* 47.8 → 68.7px */

  --fs-hero: var(--step-6);
  --fs-h1: var(--step-5);
  --fs-h2: var(--step-3);
  --fs-h3: var(--step-1);
  --fs-lead: var(--step-1);
  --fs-body: var(--step-0);
  --fs-small: var(--step--1);
  --fs-label: var(--step--1);
  --fs-caption: var(--step-0);

  --space-1: 4px;  --space-2: 8px;   --space-3: 12px;  --space-4: 16px;
  --space-5: 24px; --space-6: 32px;  --space-7: 48px;  --space-8: 64px;
  --space-9: 96px; --space-10: 128px; --space-11: 160px;

  /* 12-column grid. 4 columns on phones, 8 on tablets, 12 from 1024px. */
  --w-page: 1200px;
  --gutter: 16px;     /* space at the screen edges */
  --cols: 4;
  --col-gap: 16px;    /* space between columns */

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --dur-fast: 150ms;
  --dur-base: 250ms;
  --dur-slow: 400ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);

  --section-gap: var(--space-9);
}

@media (min-width: 768px) { :root { --gutter: 32px; --cols: 8; --col-gap: 24px; } }
@media (min-width: 1024px) { :root { --gutter: 48px; --cols: 12; --col-gap: 24px; --section-gap: var(--space-10); } }

/* ---------- Base ---------- */

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }

body {
  font-feature-settings: "cv11", "ss01";
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--dur-base) var(--ease), color var(--dur-base) var(--ease);
}

img { display: block; max-width: 100%; height: auto; }

h1, h2, h3, h4 { margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }

a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; transition: color var(--dur-fast) var(--ease), text-decoration-thickness var(--dur-fast) var(--ease); }
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
main:focus { outline: none; }

.skip {
  position: absolute; left: var(--space-4); top: -100px; z-index: 100;
  background: var(--surface); color: var(--text); padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.skip:focus { top: var(--space-4); }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Grid ----------
   .page, .wide and .read are all the same 12-column container.
   They only differ in which columns their children sit in (desktop):
     .page  columns 1–12  (full width)
     .wide  columns 3–10  (8 columns, centred on the page, for images and diagrams)
     .read  columns 3–9   (7 columns, about 70 characters; starts on the image's left edge)
   Section number and label sit above each heading.
   Internal grids use --col-gap and 2, 3, 4 or 6 columns, so they land on grid lines.
   Text wraps naturally inside its columns. No hard line breaks. */

.page, .wide, .read, .grid {
  width: 100%;
  max-width: calc(var(--w-page) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  column-gap: var(--col-gap);
  align-content: start;
}
.page > *, .wide > *, .read > *, .grid > * { grid-column: 1 / -1; min-width: 0; }
/* A block inside the grid that shares its columns */
.subgrid { display: grid; grid-template-columns: subgrid; grid-column: 1 / -1; column-gap: var(--col-gap); }
.subgrid > * { grid-column: 1 / -1; min-width: 0; }
@media (min-width: 768px) {
  .read > * { grid-column: 1 / 8; }
}
@media (min-width: 1024px) {
  .wide > * { grid-column: 3 / 11; }
  .read > * { grid-column: 3 / 10; }
}

/* ---------- Type helpers ---------- */

.label {
  font-family: var(--font-label);
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-feature-settings: "tnum" 1, "cpsp" 1;
  color: var(--text-subtle);
}
.label__num, .label--accent { color: var(--accent); }

.accent-phrase { font-family: var(--font-display); font-style: italic; font-weight: 400; letter-spacing: -0.01em; color: var(--accent); }

.lead { font-size: var(--fs-lead); line-height: 1.5; color: var(--text-muted); }
h1, h2, h3, .card__title, .next__title { text-wrap: balance; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 48px; padding: 0 var(--space-5);
  border-radius: var(--radius-pill);
  font: 500 1rem/1 var(--font-body);
  text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.btn--primary { background: var(--accent-fill); color: var(--on-accent-fill); }
.btn--primary:hover { background: var(--accent-fill-hover); color: var(--on-accent-fill); }
.btn--secondary { border: 1px solid var(--border-strong); color: var(--text); background: transparent; }
.btn--secondary:hover { border-color: var(--text-muted); color: var(--text); }
/* Main action that isn't Resume: solid, in the text colour, so Resume stays the only accent-filled button */
.btn--strong { background: var(--text); color: var(--bg); font-weight: 600; border: 1px solid var(--text); }
.btn--strong:hover { background: var(--text-muted); border-color: var(--text-muted); color: var(--bg); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; padding: 0;
  border: 1px solid transparent; border-radius: var(--radius-pill);
  background: transparent; color: var(--text); cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.icon-btn:hover { background: var(--surface-raised); }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* Theme toggle shows the icon for the mode you'd switch to */
.theme-toggle .icon--moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon--sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon--moon { display: block; }

/* ---------- Header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-base) var(--ease), background-color var(--dur-base) var(--ease);
}
.site-header.is-scrolled { border-bottom-color: var(--border); }
.site-header__inner {
  max-width: calc(var(--w-page) + var(--gutter) * 2);
  margin-inline: auto; padding: var(--space-3) var(--gutter);
  display: flex; align-items: center; gap: var(--space-5);
}
.site-header__name { font-weight: 600; color: var(--text); text-decoration: none; font-size: var(--step-1); letter-spacing: -0.02em; line-height: 1.2; margin-right: auto; padding-block: var(--space-2); }
.site-header__name:hover { color: var(--text); }
.site-nav { display: none; gap: var(--space-2); }
.site-nav a {
  color: var(--text-muted); text-decoration: none; font-weight: 500;
  padding: var(--space-3) var(--space-3); border-radius: var(--radius-pill);
}
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--accent); }
.site-header__actions { display: flex; align-items: center; gap: var(--space-2); }
.site-header__resume { display: none; }

@media (min-width: 768px) {
  .site-nav { display: flex; }
  .site-header__resume { display: inline-flex; margin-left: var(--space-2); }
  .menu-toggle { display: none; }
}

/* Mobile menu panel */
.menu {
  position: fixed; inset: 0; z-index: 60;
  background: var(--bg);
  padding: var(--space-3) var(--gutter) var(--space-7);
  display: flex; flex-direction: column; gap: var(--space-6);
  overflow-y: auto;
}
.menu[hidden] { display: none; }
.menu__top { display: flex; align-items: center; justify-content: space-between; }
.menu__nav { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.menu__nav a {
  font-family: var(--font-heading); font-weight: 600; font-size: var(--step-4); line-height: 1.2;
  color: var(--text); text-decoration: none; padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
}
.menu__resume { align-self: flex-start; }
.menu__contact { color: var(--text-muted); font-size: var(--fs-small); }
body.menu-open { overflow: hidden; }

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--border); margin-top: var(--section-gap); color: var(--text-subtle); font-size: var(--fs-small); }
.site-footer__inner {
  max-width: calc(var(--w-page) + var(--gutter) * 2); margin-inline: auto;
  padding: var(--space-6) var(--gutter);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3) var(--space-6);
}
.site-footer__links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-5); }
.site-footer__links a { color: var(--text-muted); text-decoration: none; display: inline-block; padding-block: var(--space-2); }
.site-footer__links a:hover { color: var(--accent); }

/* ---------- Home ---------- */

.home-hero { padding-top: var(--space-7); padding-bottom: var(--space-8); }
.home-hero__label { margin-bottom: var(--space-5); }
.home-hero__title {
  font-family: var(--font-heading); font-weight: 600;
  font-size: var(--fs-hero); line-height: 1.08; letter-spacing: -0.035em;
}
.home-hero__lead { margin-top: var(--space-6); }
.home-hero__actions { margin-top: var(--space-6); display: flex; flex-wrap: wrap; gap: var(--space-3); }
@media (min-width: 768px) {
  .home-hero__title { grid-column: 1 / -1; }
  .home-hero__lead { grid-column: 1 / 7; }
}
@media (min-width: 1024px) {
  .home-hero { padding-top: var(--space-8); padding-bottom: var(--space-8); }
  .home-hero__title { grid-column: 1 / 11; }
  .home-hero__lead { grid-column: 1 / 9; }
}

.proof { border-block: 1px solid var(--border); }
.proof__list { list-style: none; margin: 0; padding: 0; display: grid; column-gap: var(--col-gap); }
.proof__item { padding: var(--space-6) 0; border-bottom: 1px solid var(--border); }
.proof__item:last-child { border-bottom: 0; }
.proof__num { display: block; font-family: var(--font-heading); font-weight: 600; font-size: var(--step-5); line-height: 1.1; letter-spacing: -0.02em; color: var(--text); }
.proof__text { display: block; margin-top: var(--space-2); color: var(--text-muted); }
@media (min-width: 768px) {
  .proof__list { grid-template-columns: repeat(2, 1fr); }
  .proof__item { border-bottom: 0; }
}
@media (min-width: 1024px) { .proof__list { grid-template-columns: repeat(3, 1fr); } }

.section-head { margin-bottom: var(--space-7); row-gap: var(--space-3); }
.section-head__title { font-family: var(--font-heading); font-weight: 600; font-size: var(--fs-h1); line-height: 1.1; letter-spacing: -0.025em; }
.section-head__intro { color: var(--text-muted); }
@media (min-width: 768px) { .section-head__intro { grid-column: 1 / 7; } }
@media (min-width: 1024px) { .section-head__title { grid-column: 1 / 9; } .section-head__intro { grid-column: 1 / 7; } }

.work { padding-top: var(--space-8); }
@media (min-width: 1024px) { .work { padding-top: var(--space-7); } }
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-8) var(--col-gap); }
@media (min-width: 768px) { .cards { grid-template-columns: repeat(2, 1fr); } }

.card { display: flex; }
.card__link { display: flex; flex-direction: column; width: 100%; color: inherit; text-decoration: none; }
.card__link:hover { color: inherit; }
.card__media {
  aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: var(--radius-md); border: 1px solid var(--border);
  background: var(--surface);
}
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-base) var(--ease); }
.card__link:hover .card__media img { transform: scale(1.02); }
.card__text { flex: 1 0 auto; margin-top: var(--space-5); }
.card__meta { margin-top: 0; }
.card .tags { margin-top: var(--space-4); }
.card__status { margin-top: var(--space-3); display: flex; align-items: flex-start; gap: var(--space-2); font-size: var(--step--1); font-weight: 600; color: var(--text); }
.card__dot { flex: none; margin-top: 0.5em; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.card__title { margin-top: var(--space-2); font-size: var(--step-2); line-height: 1.25; letter-spacing: -0.015em; font-weight: 600; }
.card__title .arrow { display: inline-block; color: var(--accent); opacity: 0; transform: translateX(-4px); transition: opacity var(--dur-fast) var(--ease), transform var(--dur-base) var(--ease); }
.card__link:hover .card__title .arrow, .card__link:focus-visible .card__title .arrow { opacity: 1; transform: translateX(4px); }
.card__summary { margin-top: var(--space-2); color: var(--text-muted); }

/* Other case studies: smaller versions of the featured cards */
.more-work__title { margin-top: var(--space-9); padding-top: var(--space-6); border-top: 1px solid var(--border); font-size: var(--step-1); font-weight: 600; letter-spacing: -0.01em; }
.more-work { list-style: none; margin: var(--space-5) 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-6) var(--space-4); }
@media (min-width: 1024px) { .more-work { grid-template-columns: repeat(4, 1fr); gap: var(--space-6) var(--col-gap); } }
.mini__link { display: block; color: inherit; text-decoration: none; }
.mini__link:hover { color: inherit; }
.mini__media {
  aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: var(--radius-md); border: 1px solid var(--border);
  background: var(--surface);
}
.mini__media img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-base) var(--ease); }
.mini__link:hover .mini__media img { transform: scale(1.02); }
.mini__media .placeholder { height: 100%; aspect-ratio: auto; border: 0; border-radius: 0; padding: 0; }
.mini__text { margin-top: var(--space-3); }
.mini__text .label { font-size: 0.875rem; letter-spacing: 0.06em; }
@media (max-width: 599px) {
  .more-work { grid-template-columns: 1fr; gap: var(--space-4); }
  .mini__link { display: grid; grid-template-columns: 112px 1fr; gap: var(--space-4); align-items: center; }
  .mini__text { margin-top: 0; }
}
.mini__status { margin-top: var(--space-1, 4px); font-size: var(--step--1); color: var(--text-muted); }
.mini__title { margin-top: var(--space-1, 4px); font-size: var(--step-0); line-height: 1.3; font-weight: 600; text-wrap: balance; }
.mini__title .arrow { display: inline-block; color: var(--accent); opacity: 0; transform: translateX(-4px); transition: opacity var(--dur-fast) var(--ease), transform var(--dur-base) var(--ease); }
.mini__link:hover .mini__title .arrow, .mini__link:focus-visible .mini__title .arrow { opacity: 1; transform: translateX(4px); }
@media (prefers-reduced-motion: reduce) { .mini__link:hover .mini__media img { transform: none; } }

/* Topic tags, for quick scanning */
.tags { list-style: none; margin: var(--space-4) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.tags li {
  font-size: var(--fs-small); line-height: 1; color: var(--text-muted);
  padding: var(--space-2) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-pill);
}

.praise { padding-top: var(--section-gap); }
.praise__list { display: grid; gap: var(--space-6) var(--col-gap); margin-top: var(--space-6); }
.praise__quote { margin: 0; padding-left: var(--space-5); border-left: 2px solid var(--accent); display: grid; gap: var(--space-3); align-content: start; }
.praise__quote blockquote { margin: 0; }
.praise__quote p { margin: 0; color: var(--text); line-height: 1.55; }
.praise__quote figcaption { font-size: var(--fs-small); line-height: 1.5; color: var(--text-muted); }
@media (min-width: 900px) { .praise__list { grid-template-columns: repeat(2, 1fr); } }
.bring { padding-top: var(--section-gap); }
.bring__list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-6) var(--col-gap); }
.bring__item { border-top: 1px solid var(--border); padding-top: var(--space-5); display: grid; gap: var(--space-3); align-content: start; grid-template-rows: auto auto 1fr auto; }
.bring__num { font-family: var(--font-label); font-feature-settings: "tnum" 1, "cpsp" 1; font-size: var(--fs-label); color: var(--accent); }
.bring__title { font-size: var(--fs-h3); font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.bring__item p { color: var(--text-muted); }
.bring__ref { font-size: var(--fs-small); }
@media (min-width: 768px) { .bring__list { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .bring__list { grid-template-columns: repeat(4, 1fr); } }

.now { padding-top: var(--section-gap); }
.now__inner { border-block: 1px solid var(--border); padding-block: var(--space-7); display: grid; gap: var(--space-5) var(--col-gap); }
.now__title { font-family: var(--font-heading); font-weight: 600; font-size: var(--fs-h2); line-height: 1.15; letter-spacing: -0.02em; margin-top: var(--space-3); }
.now__inner p:not(.label) { color: var(--text-muted); }
@media (min-width: 768px) { .now__inner { grid-template-columns: repeat(2, 1fr); } }

.teaser { padding-top: var(--section-gap); align-items: center; row-gap: var(--space-6); }
.teaser__img { margin: 0; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border); }
.teaser__title { font-family: var(--font-heading); font-weight: 600; font-size: var(--fs-h2); line-height: 1.15; letter-spacing: -0.02em; margin-top: var(--space-3); }
.teaser__text p { margin-top: var(--space-4); color: var(--text-muted); }
@media (min-width: 768px) { .teaser > .teaser__img { grid-column: 1 / 4; } .teaser > .teaser__text { grid-column: 4 / -1; } }
@media (min-width: 1024px) { .teaser > .teaser__img { grid-column: 1 / 5; } .teaser > .teaser__text { grid-column: 6 / 12; } }

/* ---------- Case study ---------- */

.cs-hero { padding-top: var(--space-9); }
.cs-hero__label { margin-bottom: var(--space-4); }
.cs-hero__title { font-family: var(--font-heading); font-weight: 600; font-size: var(--fs-hero); line-height: 1.08; letter-spacing: -0.035em; }
.cs-hero__summary { margin-top: var(--space-5); font-size: var(--fs-lead); line-height: 1.5; color: var(--text-muted); }
/* Hero text starts on the same column as the reading text; the title may run wider */
@media (min-width: 768px) { .cs-hero__summary, .cs-hero .tags { grid-column: 1 / 8; } }
@media (min-width: 1024px) { .cs-hero__title { grid-column: 1 / 11; } .cs-hero__summary, .cs-hero .tags { grid-column: 1 / 9; } }

.meta {
  margin: var(--space-7) 0 0; padding: var(--space-5) 0;
  border-block: 1px solid var(--border);
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5) var(--col-gap);
}
.meta__item { margin: 0; }
.meta dd { margin: var(--space-2) 0 0; line-height: 1.5; color: var(--text); }
@media (min-width: 1024px) { .meta { grid-template-columns: repeat(4, 1fr); } }

.cs-hero__media { margin: var(--space-7) 0 0; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.cs-hero__media img { width: 100%; }

.glance { margin-top: var(--space-8); }
.glance__list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-5) var(--col-gap); }
.glance__item { display: grid; grid-template-columns: 1fr; gap: var(--space-2); align-items: baseline; align-content: start; padding-bottom: var(--space-5); border-bottom: 1px solid var(--border); }
.glance__item:last-child { border-bottom: 0; }
.glance__num { font-family: var(--font-label); font-feature-settings: "tnum" 1, "cpsp" 1; font-size: 0.875rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.glance__item p { font-size: var(--fs-h3); line-height: 1.35; font-weight: 500; }
@media (min-width: 1024px) {
  .glance__list { grid-template-columns: repeat(3, 1fr); }
  .glance__item { grid-template-columns: 1fr; gap: var(--space-3); border-bottom: 0; padding-bottom: 0; }
}

.cs-section { padding-top: var(--section-gap); }
.cs-section__title { margin-top: var(--space-3); margin-bottom: var(--space-6); font-family: var(--font-heading); font-weight: 600; font-size: var(--fs-h2); line-height: 1.15; letter-spacing: -0.025em; }


/* Reading text */
.prose > * + * { margin-top: 1em; }
.prose h3 { font-size: var(--fs-h3); font-weight: 600; line-height: 1.3; margin-top: var(--space-7); }
.prose h3 + * { margin-top: var(--space-3); }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li + li { margin-top: var(--space-2); }
.prose li::marker { color: var(--text-subtle); }
.prose strong { font-weight: 600; }
.prose blockquote { margin: 0; }

.read + .wide, .read + .page, .wide + .read, .page + .read, .wide + .wide, .wide + .page, .page + .wide { margin-top: var(--space-7); }

/* Figures */
.fig { margin: 0; }
.fig img { width: 100%; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--surface); }
/* Captions: Inter, a step smaller and muted, with a short accent line for a calm editorial feel */
.fig figcaption {
  margin-top: var(--space-4); max-width: 62ch;
  padding-left: var(--space-4); border-left: 2px solid var(--accent);
  font-size: var(--fs-small); line-height: 1.55;
  color: var(--text-muted);
}
.pullquote figcaption { margin-top: var(--space-3); font-size: var(--fs-small); line-height: 1.5; color: var(--text-muted); }
.prose .fig { margin-top: var(--space-6); margin-bottom: var(--space-2); }

.gallery__grid { display: grid; gap: var(--col-gap); }
@media (min-width: 768px) { .gallery__grid { grid-template-columns: repeat(2, 1fr); } .gallery__grid:has(> :nth-child(3)) { grid-template-columns: repeat(3, 1fr); } }
.gallery__item img { height: 100%; object-fit: cover; }
/* Four items (such as phone screens): 2 across, then 4 across on desktop */
.gallery__grid:has(> :nth-child(4)):not(:has(> :nth-child(5))) { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 1024px) { .gallery__grid:has(> :nth-child(4)):not(:has(> :nth-child(5))) { grid-template-columns: repeat(4, 1fr); } }

/* Suggested image, still to come */
.placeholder {
  aspect-ratio: 4 / 3; display: grid; place-content: center; gap: var(--space-3); text-align: center;
  padding: var(--space-6); background: var(--surface);
  border: 1px dashed var(--border); border-radius: var(--radius-md);
  font-family: var(--font-label); font-feature-settings: "tnum" 1, "cpsp" 1; font-size: var(--fs-label); color: var(--text-muted);
}
.placeholder__tag { color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; }
.placeholder__note { max-width: 48ch; line-height: 1.6; }

/* Challenge -> decision */
.decision {
  display: grid; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
}
.decision__col { padding: var(--space-5); display: grid; gap: var(--space-3); align-content: start; }
.decision__col + .decision__col { border-top: 1px solid var(--border); }
@media (min-width: 768px) {
  .decision { grid-template-columns: 1fr 1fr; }
  .decision__col { padding: var(--space-6); }
  .decision__col + .decision__col { border-top: 0; border-left: 1px solid var(--border); }
}

/* Options considered */
.options { display: grid; gap: var(--col-gap); }
.option { border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-5); display: grid; gap: var(--space-2); align-content: start; }
.option.is-chosen { border-color: var(--accent); }
.option__name { font-weight: 600; font-size: var(--fs-h3); line-height: 1.3; }
.option p:last-child { color: var(--text-muted); }
@media (min-width: 768px) { .options { grid-template-columns: repeat(2, 1fr); } }

/* Pull quote */
.pullquote { margin: var(--space-7) 0; padding-left: var(--space-5); border-left: 2px solid var(--accent); }
.pullquote blockquote { margin: 0; }
.pullquote p { font-family: var(--font-heading); font-weight: 500; font-style: normal; font-size: var(--fs-h2); line-height: 1.2; color: var(--text); }

/* Metrics */
.metrics { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-6) var(--col-gap); border-top: 1px solid var(--border); padding-top: var(--space-6); }
.metrics li { display: grid; gap: var(--space-2); align-content: start; }
.metric__num { font-family: var(--font-heading); font-weight: 600; font-size: var(--step-4); line-height: 1.05; color: var(--text); }
.metric__text { color: var(--text-muted); line-height: 1.5; }
@media (min-width: 768px) { .metrics { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .metrics { grid-template-columns: repeat(3, 1fr); } .metrics:has(> li:nth-child(4)) { grid-template-columns: repeat(2, 1fr); } }

/* Next case study: a compact row, not a second hero */
.next { margin-top: var(--section-gap); }
.next__link {
  border-top: 1px solid var(--border); padding-block: var(--space-6);
  color: var(--text); text-decoration: none; display: grid; row-gap: var(--space-3);
}
.next__link:hover { color: var(--text); }
.next__title { font-family: var(--font-heading); font-weight: 600; font-size: var(--step-2); line-height: 1.25; letter-spacing: -0.015em; transition: color var(--dur-fast) var(--ease); }
.next__link:hover .next__title { color: var(--accent); }
@media (min-width: 1024px) {
  .next > .next__link { grid-column: 3 / 10; }
}
.arrow { display: inline-block; transition: transform var(--dur-base) var(--ease); }
.next__link:hover .arrow { transform: translateX(4px); }
.case-study .site-footer { margin-top: 0; }

/* ---------- Diagrams (HTML, so they work in both themes) ---------- */

.diagram { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-5); }
.diagram figcaption { margin-top: var(--space-5); }
@media (min-width: 768px) { .diagram { padding: var(--space-6); } }

.dg-label { font-family: var(--font-label); font-feature-settings: "tnum" 1, "cpsp" 1; font-weight: 600; font-size: 0.875rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-subtle); margin-bottom: var(--space-3); }
.dg-label--accent { color: var(--accent); }
.dg-list { margin: 0; padding-left: 1.2em; color: var(--text-muted); font-size: var(--fs-small); }
.dg-list li + li { margin-top: var(--space-2); }
.dg-list--muted { color: var(--text-muted); }
.dg-list--num { padding-left: 1.4em; }

/* MySpark phases */
.dg-phases { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.dg-phases__item { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-4); font-size: var(--fs-small); color: var(--text-muted); }
.dg-phases__num { font-family: var(--font-label); font-feature-settings: "tnum" 1, "cpsp" 1; color: var(--accent); font-size: var(--fs-label); }
.dg-phases__title { color: var(--text); font-weight: 600; margin: var(--space-2) 0 var(--space-1); }
.dg-phases__base { margin-top: var(--space-3); padding: var(--space-3); border: 1px dashed var(--border); border-radius: var(--radius-sm); text-align: center; font-family: var(--font-label); font-feature-settings: "tnum" 1, "cpsp" 1; font-size: var(--fs-label); color: var(--text-muted); }
@media (min-width: 768px) { .dg-phases { grid-template-columns: repeat(4, 1fr); } }

/* MySpark micro-portals */
.dg-portals__core { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-4); margin-bottom: var(--space-5); font-size: var(--fs-small); color: var(--text-muted); }
.dg-portals__core-title { color: var(--text); font-weight: 600; margin-bottom: var(--space-1); }
.dg-portals__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-2); }
.dg-portals__list li { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-3); font-size: var(--fs-small); color: var(--text); }
@media (min-width: 768px) { .dg-portals__list { grid-template-columns: repeat(3, 1fr); } }
.dg-portals__list li { font-weight: 600; }
.dg-portals__desc { display: block; margin-top: var(--space-1); font-weight: 400; color: var(--text-muted); }
.dg-portals__more { margin-top: var(--space-3); font-size: var(--fs-small); color: var(--text-muted); }

/* Lending data sources */
.dg-lend { display: grid; gap: var(--space-5); }
.dg-lend__head { font-weight: 600; margin-bottom: var(--space-3); }
.dg-lend__arrow { display: grid; place-items: center; color: var(--accent); font-size: 1.5rem; transform: rotate(90deg); }
.dg-map { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.dg-map li { display: grid; grid-template-columns: 1fr; gap: var(--space-1); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-3); background: var(--bg); font-size: var(--fs-small); }
.dg-map__src { color: var(--text); font-weight: 500; }
.dg-map__to { color: var(--text-muted); }
.dg-lend__result { margin-top: var(--space-3); font-size: var(--fs-small); color: var(--text-muted); }
@media (min-width: 768px) {
  .dg-lend { grid-template-columns: 1fr auto 1.3fr; align-items: start; }
  .dg-lend__arrow { transform: none; padding-top: var(--space-7); }
  .dg-map li { grid-template-columns: 1fr 1fr; }
}

/* DCS situations */
.dg-dcs { display: grid; gap: var(--space-5); }
.dg-dcs__mid { display: grid; place-items: center; color: var(--accent); font-size: 1.5rem; transform: rotate(90deg); }
.dg-dcs__hub { background: var(--bg); border: 1px solid var(--accent); border-radius: var(--radius-sm); padding: var(--space-4); font-size: var(--fs-small); color: var(--text-muted); }
.dg-dcs__hub-title { color: var(--text); font-weight: 600; margin-bottom: var(--space-2); }
.dg-dcs__out { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-3); font-size: var(--fs-small); color: var(--text-muted); }
.dg-dcs__out + .dg-dcs__out { margin-top: var(--space-2); }
.dg-dcs__out-title { color: var(--text); font-weight: 600; }
.dg-dcs__foot { margin-top: var(--space-5); font-size: var(--fs-small); color: var(--text-muted); }
@media (min-width: 1024px) {
  .dg-dcs { grid-template-columns: 1.4fr auto 1fr auto 1fr; align-items: center; }
  .dg-dcs__mid { transform: none; }
}

/* Broadband funnel */
.dg-funnel { display: grid; gap: var(--space-5); }
.dg-funnel__num { font-family: var(--font-heading); font-weight: 600; font-size: var(--step-4); line-height: 1; }
.dg-funnel__num--accent { color: var(--accent); }
.dg-funnel__label { color: var(--text-muted); font-size: var(--fs-small); margin: var(--space-1) 0 var(--space-3); }
.dg-funnel__bar { height: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-pill); overflow: hidden; }
.dg-funnel__bar span { display: block; height: 100%; background: var(--text-subtle); min-width: 4px; }
.dg-funnel__bar span.is-accent { background: var(--accent); }

/* Broadband flow */
.dg-flow { display: grid; gap: var(--space-6); }
.dg-flow__steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); counter-reset: st; }
.dg-flow__steps li { counter-increment: st; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-3); font-size: var(--fs-small); background: var(--bg); }
.dg-flow__steps li::before { content: counter(st, decimal-leading-zero) "  "; font-family: var(--font-label); font-feature-settings: "tnum" 1, "cpsp" 1; font-size: var(--fs-label); color: var(--text-subtle); }
.dg-flow__steps li.is-problem { border-style: dashed; border-color: var(--text-subtle); color: var(--text-muted); }
.dg-flow__steps li.is-new { border-color: var(--accent); }
.dg-flow__note { margin-top: var(--space-3); font-size: var(--fs-small); color: var(--text-muted); }
@media (min-width: 768px) { .dg-flow__steps { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 768px) { .dg-flow__steps--three { grid-template-columns: repeat(3, 1fr); } }

/* ---------- About ---------- */

.about-hero { padding-top: var(--space-9); }
.about-hero { align-items: end; row-gap: var(--space-7); }
.about-hero__title { font-family: var(--font-heading); font-weight: 600; font-size: var(--fs-hero); line-height: 1.08; letter-spacing: -0.035em; margin-top: var(--space-4); }
.about-hero__lead { margin-top: var(--space-5); }
.about-hero__img { margin: 0; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border); }
@media (min-width: 768px) { .about-hero > .about-hero__text { grid-column: 1 / 6; } .about-hero > .about-hero__img { grid-column: 6 / -1; } }
@media (min-width: 1024px) { .about-hero > .about-hero__text { grid-column: 1 / 8; } .about-hero > .about-hero__img { grid-column: 9 / -1; } }

.about-body { padding-top: var(--space-8); }
.about-body h2 { font-family: var(--font-heading); font-weight: 600; font-size: var(--fs-h2); line-height: 1.15; margin-top: var(--space-8); }
.about-body h2 + * { margin-top: var(--space-5); }

.exp { margin: 0; border-top: 1px solid var(--border); }
.exp__row { padding: var(--space-5) 0; border-bottom: 1px solid var(--border); display: grid; gap: var(--space-2); }
.exp__row dt { font-weight: 600; }
.exp__row dd { margin: 0; color: var(--text-muted); }
.exp__when { display: block; font-family: var(--font-label); font-feature-settings: "tnum" 1, "cpsp" 1; font-size: var(--fs-label); letter-spacing: 0.04em; color: var(--text-subtle); margin-bottom: var(--space-1); }
@media (min-width: 768px) { .exp__row { grid-template-columns: 2fr 5fr; gap: var(--col-gap); } }

/* ---------- Resume ---------- */

.resume { padding-top: var(--space-9); }
@media (min-width: 1024px) { .resume > * { grid-column: 3 / 11; } }
.resume__head { display: grid; gap: var(--space-4); padding-bottom: var(--space-6); border-bottom: 1px solid var(--border); }
.resume__title { font-family: var(--font-heading); font-weight: 600; font-size: var(--fs-h1); line-height: 1.1; }
.resume__contact { color: var(--text-muted); font-size: var(--fs-small); display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); }
.resume__actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.resume h2 { margin-top: var(--space-8); margin-bottom: var(--space-4); }
.resume .job { padding: var(--space-5) 0; border-bottom: 1px solid var(--border); }
.resume .job:first-of-type { border-top: 1px solid var(--border); }
.job__head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-1) var(--space-4); }
.job__title { font-weight: 600; }
.job__when { font-family: var(--font-label); font-feature-settings: "tnum" 1, "cpsp" 1; font-size: var(--fs-label); color: var(--text-subtle); letter-spacing: 0.04em; }
.job ul { margin-top: var(--space-3); color: var(--text-muted); }
.skills { margin: 0; display: grid; gap: var(--space-3); }
.skills div { display: grid; gap: var(--space-1); }
.skills dt { font-weight: 600; }
.skills dd { margin: 0; color: var(--text-muted); }
@media (min-width: 768px) { .skills div { grid-template-columns: 2fr 5fr; gap: var(--col-gap); } }

/* ---------- 404 ---------- */
.notfound { padding-top: var(--space-10); min-height: 50vh; }
@media (min-width: 1024px) { .notfound > * { grid-column: 1 / 9; } }
.notfound h1 { font-family: var(--font-heading); font-weight: 600; font-size: var(--fs-hero); line-height: 1.05; margin-top: var(--space-4); }
.notfound p { margin-top: var(--space-5); color: var(--text-muted); }

/* ---------- Motion ---------- */

.js .reveal { opacity: 0; transform: translateY(12px); transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .js .reveal { transform: none; }
  .card__link:hover .card__media img { transform: none; }
}

/* ---------- Print (used for the resume PDF) ---------- */

@media print {
  :root, :root[data-theme] {
    --bg: #fff; --surface: #fff; --surface-raised: #fff; --border: #ccc;
    --text: #111; --text-muted: #333; --text-subtle: #555; --accent: #8F3D0A;
  }
  .site-header, .site-footer, .skip, .resume__actions, .next { display: none !important; }
  body { font-size: 11pt; line-height: 1.45; }
  .resume { padding-top: 0; }
  .resume h2 { margin-top: 18pt; }
  .js .reveal { opacity: 1; transform: none; }
  a { color: inherit; text-decoration: none; }
  .job { break-inside: avoid; }
  /* Keep the downloadable resume to two pages */
  .resume-page body, body.resume-page { font-size: 9.5pt; line-height: 1.38; }
  .resume-page .resume__head { gap: 3pt; padding-bottom: 8pt; }
  .resume-page .resume__head .label { display: none; }
  .resume-page .resume__title { font-size: 20pt; }
  .resume-page .lead { font-size: 11pt; }
  .resume-page .resume__contact { font-size: 9pt; gap: 2pt 12pt; }
  .resume-page .resume h2 { margin-top: 10pt; margin-bottom: 4pt; font-size: 9pt; }
  .resume-page .resume .job { padding: 5pt 0; }
  .resume-page .job ul { margin-top: 3pt; padding-left: 1.1em; }
  .resume-page .job li + li { margin-top: 1pt; }
  .resume-page .skills { gap: 3pt; }
  .resume-page .skills div { grid-template-columns: 1fr 6fr; }
  .resume-page .prose p { font-size: 9.5pt; }
  .resume-page .job__when { font-size: 8.5pt; }
  .resume-page main, .resume-page .resume { padding: 0 !important; }
}
@media (min-width: 768px) { .placeholder { aspect-ratio: 21 / 9; } }

/* Company links in running text: quieter than normal links */
.home-hero__lead a { color: var(--text); text-decoration-color: var(--border); }
.home-hero__lead a:hover { color: var(--accent); text-decoration-color: currentColor; }
.home-hero__lead strong, .now strong { color: var(--text); font-weight: 600; }

/* RED two parts */
.dg-red { display: grid; gap: var(--space-5) var(--col-gap); }
.dg-red__col { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-4); }
.dg-red__list { margin: 0; padding-left: 1.2em; color: var(--text-muted); font-size: var(--fs-small); }
.dg-red__list li + li { margin-top: var(--space-2); }
.dg-red__link { font-size: var(--fs-small); color: var(--text-muted); text-align: center; padding-inline: var(--space-4); }
.dg-red__out { border: 1px solid var(--accent); border-radius: var(--radius-sm); padding: var(--space-4); text-align: center; font-weight: 600; }
@media (min-width: 768px) {
  .dg-red { grid-template-columns: 1fr 1fr; }
  .dg-red__link, .dg-red__out { grid-column: 1 / -1; }
}

/* RED review flow */
.dg-review { display: grid; gap: var(--space-5); }
.dg-review__check { border-top: 1px solid var(--border); padding-top: var(--space-4); }

/* Card with no image yet */
.card__media .placeholder { height: 100%; aspect-ratio: auto; border: 0; border-radius: 0; }

/* STREAMS diagrams */
.dg-method__who { display: block; font-family: var(--font-label); font-feature-settings: "tnum" 1, "cpsp" 1; font-weight: 600; font-size: 0.875rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-subtle); margin: var(--space-1) 0 var(--space-2); }
.dg-method__who--me { color: var(--accent); }
.dg-method li::before { display: block; }
@media (min-width: 768px) { .dg-split { grid-template-columns: repeat(3, 1fr); } }
.dg-split__me { border-color: var(--accent); }
.dg-entry__title { font-weight: 600; font-size: var(--step-1); margin-bottom: var(--space-4); }
.dg-entry__steps { list-style: none; margin: 0 0 var(--space-5); padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.dg-entry__steps li { border: 1px solid var(--border); border-radius: var(--radius-pill); padding: var(--space-1) var(--space-3); font-size: var(--fs-small); background: var(--bg); }
.dg-entry__steps li + li::before { content: "→ "; color: var(--accent); }
.dg-entry__fields { margin: 0; display: grid; gap: var(--space-2); }
.dg-entry__fields div { display: grid; gap: var(--space-1); border-top: 1px solid var(--border); padding-top: var(--space-2); font-size: var(--fs-small); }
.dg-entry__fields dt { color: var(--text); font-weight: 500; }
.dg-entry__fields dd { margin: 0; color: var(--text-muted); }
@media (min-width: 768px) { .dg-entry__fields div { grid-template-columns: 1fr 2fr; } }
.dg-tax { display: grid; gap: var(--space-3); }
.dg-tax__row, .dg-tax__cap { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-4); }
.dg-tax__row--dashed { border-style: dashed; }
.dg-tax__row--accent { border-color: var(--accent); }
.dg-tax__row--accent .dg-entry__steps { margin-bottom: 0; }
.dg-tax__q { font-size: var(--fs-small); color: var(--text); }
.dg-tax__caps { display: grid; gap: var(--space-3); }
@media (min-width: 768px) { .dg-tax__caps { grid-template-columns: repeat(3, 1fr); } }
.dg-tax__feats { list-style: none; margin: var(--space-3) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.dg-tax__feats li { font-size: var(--fs-label); font-family: var(--font-label); font-feature-settings: "tnum" 1, "cpsp" 1; color: var(--text-muted); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 2px var(--space-2); }
.dg-problem__q { font-size: var(--step-3); line-height: 1.2; font-weight: 600; color: var(--text); margin: var(--space-3) 0 var(--space-4); max-width: 24ch; }
.dg-problem__sub { color: var(--text-muted); max-width: 52ch; }
.dg-approach { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.dg-approach > li { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-4); display: grid; gap: var(--space-3); align-items: center; }
.dg-approach > li.is-key { border-color: var(--accent); }
.dg-approach > li.is-later { border-style: dashed; }
.dg-approach__num { font-family: var(--font-label); font-feature-settings: "tnum" 1, "cpsp" 1; font-size: var(--fs-label); color: var(--accent); margin: 0; }
.dg-approach__title { font-weight: 600; margin: var(--space-1) 0 0; }
.dg-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.dg-chips li { font-size: var(--fs-small); color: var(--text-muted); border: 1px solid var(--border); border-radius: 999px; padding: 0.2em 0.75em; }
@media (min-width: 768px) { .dg-approach > li { grid-template-columns: 11rem 1fr; } }
@media (min-width: 768px) { .dg-phases--two { grid-template-columns: repeat(2, 1fr); } }
.dg-phases:has(> :nth-child(3)):not(:has(> :nth-child(4))) { }
@media (min-width: 768px) { .dg-phases:has(> :nth-child(3)):not(:has(> :nth-child(4))) { grid-template-columns: repeat(3, 1fr); } }

/* RED reconstructed illustrations */
.dg-rx { display: grid; gap: var(--space-5); }
.dg-rx-two { display: grid; gap: var(--space-3); }
@media (min-width: 768px) { .dg-rx-two { grid-template-columns: 1fr 1fr; } .dg-rx-colour, .dg-rx-comp { grid-template-columns: 1fr 1fr; } .dg-rx-colour > .dg-chips { grid-column: 1 / -1; } }
.dg-rx-box { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-4); display: grid; gap: var(--space-3); align-content: start; }
.dg-rx-box--dashed { border-style: dashed; }
.dg-rx-note { color: var(--text-muted); font-size: var(--fs-small); margin: 0; }
.dg-rx-code { font-family: var(--font-mono); font-size: var(--fs-label); color: var(--text); margin: 0; }
.dg-rx-layers { list-style: none; margin: var(--space-3) 0 0; padding: 0; display: grid; gap: var(--space-3); }
.dg-rx-layers li { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-4); display: grid; gap: var(--space-1); }
.dg-rx-layers__name { font-weight: 600; margin: 0; }
@media (min-width: 768px) { .dg-rx-layers { grid-template-columns: repeat(3, 1fr); } .dg-rx-layers li + li { position: relative; } .dg-rx-layers li + li::before { content: "→"; position: absolute; left: calc(-1 * var(--space-3) + 0.1em); top: 50%; transform: translate(-50%, -50%); color: var(--accent); font-size: var(--fs-small); } }
.dg-rx-row { display: flex; gap: var(--space-2); align-items: baseline; flex-wrap: wrap; margin: 0; font-size: var(--fs-small); color: var(--text-muted); }
.dg-rx-bad { color: var(--text-muted); font-weight: 700; }
.dg-rx-good { color: var(--accent); font-weight: 700; }
.dg-rx-modes { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.dg-rx-mode { border-radius: var(--radius-sm); padding: var(--space-3); display: flex; justify-content: space-between; align-items: center; font-size: var(--fs-label); font-family: var(--font-label); font-feature-settings: "tnum" 1, "cpsp" 1; border: 1px solid var(--border); }
.dg-rx-mode--light { background: #fff; color: #333; }
.dg-rx-mode--dark { background: #16181d; color: #ddd; }
.dg-rx-chip { display: inline-block; border: 1.5px solid var(--border); border-radius: 999px; padding: 0.15em 0.7em; font-size: var(--fs-label); font-family: var(--font-body); color: var(--text-muted); }
.dg-rx-pipe { margin: 0; }
.dg-rx-scale { display: grid; grid-template-columns: 7.5rem 1fr 1.5rem; gap: var(--space-2); align-items: center; margin: var(--space-2) 0; }
.dg-rx-scale__name { font-size: var(--fs-small); color: var(--text-muted); }
.dg-rx-scale__sw { display: flex; height: 1.25rem; border-radius: 4px; overflow: hidden; border: 1px solid var(--border); }
.dg-sw { flex: 1; }
.dg-rx-scale__n { font-family: var(--font-label); font-feature-settings: "tnum" 1, "cpsp" 1; font-size: var(--fs-label); color: var(--text-muted); text-align: right; }
.dg-rx-stack { display: grid; gap: var(--space-2); margin: var(--space-3) 0; }
.dg-rx-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-3); display: flex; gap: var(--space-3); align-items: flex-start; }
.dg-rx-card.is-new { border-color: var(--accent); }
.dg-rx-card__icon { flex: none; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--border); }
.dg-rx-card__t { font-weight: 600; font-size: var(--fs-small); margin: 0; }
.dg-rx-card__b { color: var(--text-muted); font-size: var(--fs-small); margin: 0 0 var(--space-2); }
.dg-rx-pages { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); counter-reset: pg; }
.dg-rx-pages li { counter-increment: pg; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); font-size: var(--fs-small); color: var(--text-muted); }
.dg-rx-pages li::before { content: counter(pg, decimal-leading-zero) "  "; font-family: var(--font-label); font-feature-settings: "tnum" 1, "cpsp" 1; font-size: var(--fs-label); color: var(--text-muted); }
.dg-rx-pages li.is-key { border-color: var(--accent); color: var(--text); font-weight: 600; }
.dg-rx-check { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); font-size: var(--fs-small); color: var(--text-muted); }
.dg-rx-check li::before { content: "☐  "; color: var(--accent); }
.dg-rx-row { flex-wrap: nowrap; }
.dg-rx-row .dg-rx-code { display: inline; }
@media (min-width: 768px) { .dg-rx-pipe.dg-flow__steps { grid-template-columns: repeat(3, 1fr); } }

/* Contact: visible email with copy button */
.contact { margin-top: var(--space-5); }
.contact__row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin: var(--space-2) 0 0; }
.contact__email { font-size: var(--step-1); font-weight: 600; overflow-wrap: anywhere; }
.contact__copy { font: inherit; font-size: var(--fs-small); color: var(--text); background: transparent; border: 1px solid var(--border); border-radius: 999px; padding: 0.35em 1em; min-height: 44px; min-width: 44px; cursor: pointer; transition: border-color 150ms ease; }
.contact__copy:hover { border-color: var(--accent); }
.contact__copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
