/* ==========================================================================
   Nadiia Steblivets — portfolio
   ========================================================================== */

/* Fixel Text, self-hosted: body, UI and labels. Headings and logo use Libre Bodoni (Google Fonts). */
@font-face { font-family: "Fixel Text"; src: url("../fonts/FixelText-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

:root {
  --bg: #fcfbf8;
  --text-primary: #171714;
  --text-secondary: #4a4a46; /* 8.6:1 on --bg */
  --text-tertiary: #6b6b66; /* 5.2:1 on --bg */
  --line-primary: #80807e;
  --line-secondary: #9a9a98;
  --bg-accent: color-mix(in srgb, var(--accent) 12%, var(--bg)); /* soft teal tint for the contact band */
  --placeholder: #dadada;
  --bg-panel: #efede6; /* warm paper behind case study figures */
  --ring-dark: #8fd6cf; /* lighter teal for hand-drawn notes on dark screens */
  --accent: #337171;
  --accent-hover: #2d5d5d;

  --font-display: "Libre Bodoni", "Didot", "Bodoni 72", Georgia, serif; /* headings and logo */
  --font-body: "Fixel Text", "Helvetica Neue", Arial, sans-serif;

  --container: 1200px;
  --gutter: 40px;
  --header-h: 64px;
  --radius: 2px;

  /* Type scale, stepped per breakpoint: desktop / ≤1080 / ≤860 / ≤560.
     Quotes use H2; all running text uses Body; nav, buttons and links use UI;
     eyebrows, card labels, tags, dates and the footer use Labels. */
  --h1-size: 72px;
  --h2-size: 48px;
  --h3-size: 32px;
  --lede-size: 20px;
  --body-size: 16px;
  --ui-size: 14px;
  --label-size: 12px;
}
@media (max-width: 1080px) { :root { --h1-size: 60px; --h2-size: 40px; --h3-size: 24px; --lede-size: 18px; --body-size: 16px; } }
@media (max-width: 860px)  { :root { --h1-size: 40px; --h2-size: 24px; --h3-size: 21px; --lede-size: 16px; --body-size: 14px; } }
@media (max-width: 560px)  { :root { --h1-size: 32px; --h2-size: 21px; --h3-size: 16px; --lede-size: 14px; --body-size: 14px; } } /* body stays 14px on phones for readability; labels stay 12px everywhere */

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--body-size);
  line-height: 1.5; /* Body line height, used everywhere body text appears */
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
strong, b { font-weight: inherit; } /* no body emphasis style: bold text reads as Body */
a { color: inherit; }
p { margin: 0 0 1em; }

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

.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  background: var(--text-primary); color: var(--bg); padding: 10px 14px; text-decoration: none;
  font-size: var(--ui-size);
}
.skip-link:focus { top: 12px; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }


/* Text for screen readers only */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ---------- Type ---------- */
.display,
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.05;
  margin: 0;
}
h1 { font-size: var(--h1-size); }
h2 { font-size: var(--h2-size); }
h3 { font-size: var(--h3-size); }

.eyebrow {
  font-family: var(--font-body);
  color: var(--text-secondary);
  margin: 0 0 14px;
}

.lede { font-size: var(--lede-size); line-height: 1.35; font-weight: 400; max-width: 40ch; }

/* Labels: one style for every small uppercase text (section eyebrows, card
   labels, credentials strip, footer, dates, tags, numbered markers) */
.eyebrow, .caps, .card-meta span, .proof li, .site-footer, .site-footer a,
.role .years, .achievements > li::before, .cs-summary dt {
  font-family: var(--font-body); font-size: var(--label-size); font-weight: 400;
  line-height: 1.6; text-transform: uppercase;
}
.small { font-size: var(--body-size); color: var(--text-tertiary); }

/* ---------- Buttons ---------- */
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 12px;
  min-height: 40px; padding: 0 16px;
  border: 1px solid var(--text-primary); border-radius: var(--radius);
  font-family: var(--font-body); font-size: var(--ui-size); font-weight: 400;
  text-decoration: none; cursor: pointer; background: transparent; color: var(--text-primary);
  transition: background .2s, color .2s, border-color .2s;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary { border-color: var(--line-primary); }
.btn-secondary:hover { border-color: var(--text-primary); }
.btn .arrow { font-size: var(--ui-size); line-height: 1; }
/* Links that open another site: the site's own → arrow, turned to point up and out */
.arrow-out { display: inline-block; transform: rotate(-45deg); }

.text-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--ui-size); font-weight: 400; text-decoration: none;
  border-bottom: 1px solid transparent;
}
.text-link:hover { color: var(--accent-hover); border-color: currentColor; }
/* The arrow stays visible and nudges in its direction on hover, with the same motion as the card title arrow */
.text-link > span[aria-hidden="true"] { display: inline-block; transition: transform .25s ease; }
.text-link:hover > span[aria-hidden="true"]:last-child,
.text-link:focus-visible > span[aria-hidden="true"]:last-child { transform: translateX(.4em); }
.text-link:hover > span.arrow-out[aria-hidden="true"]:last-child,
.text-link:focus-visible > span.arrow-out[aria-hidden="true"]:last-child { transform: translate(.3em, -.3em) rotate(-45deg); }
.text-link.back:hover > span[aria-hidden="true"]:first-child,
.text-link.back:focus-visible > span[aria-hidden="true"]:first-child { transform: translateX(-.4em); }
@media (prefers-reduced-motion: reduce) { .text-link > span[aria-hidden="true"] { transition: none; transform: none !important; } .text-link > span.arrow-out[aria-hidden="true"] { transform: rotate(-45deg) !important; } }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line-secondary);
}
.site-header .container {
  height: var(--header-h);
  /* One row, centered in the bar; logo, nav and contact links share a text baseline */
  display: grid; grid-template-columns: 1fr auto 1fr; align-content: center; align-items: baseline; gap: 24px;
}
/* Logo: the name in Libre Bodoni, like the headings. The "ii" use dotless ı
   with our own dots, drawn where Libre Bodoni draws them (measured from the
   font), so the second one can pop on hover. */
.logo {
  font-family: var(--font-display); font-weight: 700; font-size: 20px; line-height: 1; color: var(--text-primary); text-decoration: none; white-space: nowrap;
}
.logo-dot { display: inline-block; position: relative; width: 0; height: 0; vertical-align: baseline; } /* zero-size anchor on the baseline, right after its ı */
.logo-dot i {
  position: absolute; left: -0.156em; bottom: 0.647em; /* Libre Bodoni Bold: dot centre .163em from the glyph's left (ı is .319em wide), .647em above the baseline */
  width: 0.165em; height: 0.165em; margin: 0 0 -0.0825em -0.0825em;
  border-radius: 50%; background: currentColor;
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .logo:hover .logo-dot-pop i { animation: logo-dot-pop .7s cubic-bezier(.3, .6, .4, 1); }
}
@keyframes logo-dot-pop {
  0%   { transform: translateY(0) scale(1, 1); }
  14%  { transform: translateY(.05em) scale(1.35, .7); }   /* squash */
  42%  { transform: translateY(-.55em) scale(.85, 1.25); } /* pop up */
  70%  { transform: translateY(0) scale(1.3, .75); }       /* land */
  84%  { transform: translateY(-.08em) scale(.95, 1.05); } /* little bounce */
  100% { transform: translateY(0) scale(1, 1); }
}
/* On desktop the menu wrapper disappears, so nav and links sit in the header grid */
.menu { display: contents; }
.nav { position: relative; display: flex; align-items: baseline; gap: 28px; }
.nav a {
  position: relative; z-index: 1;
  font: 400 var(--ui-size) var(--font-body); color: var(--text-primary); text-decoration: none;
  padding: 6px 0; transition: color .25s;
}
.nav a:hover { color: var(--accent-hover); }
/* The current page is a label, not a link: no hover, no click */
.nav a[aria-current="page"] { pointer-events: none; cursor: default; }
.nav a[aria-current="page"]:hover { color: var(--text-primary); }

/* Current-page indicator (assets/js/nav-indicator.js): ink underline + teal dot */
.nav-indicator { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.nav-indicator-line {
  fill: none; stroke: var(--text-primary); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; opacity: .85;
}
.nav-indicator-dot { fill: var(--accent); }

.header-links { justify-self: end; align-self: center; display: flex; align-items: center; gap: 20px; }
.header-links a {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-primary); text-decoration: none; white-space: nowrap; transition: color .2s;
}
.header-links a:hover { color: var(--accent-hover); }
/* Email, LinkedIn and CV are icons that sit on the nav's text line.
   Padding gives each a 42×46px tap area; the negative margin keeps the visual spacing. */
.header-links .icon-link { align-self: center; padding: 12px 10px; margin: -12px -10px; }

/* Hand-drawn line icons, same pen as the scroll line */
.line-icon {
  width: 22px; height: 22px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round;
}
.line-icon .fill { fill: currentColor; stroke: none; }
.line-icon-wide { width: 30.25px; } /* 33×24 drawing at the same 22px height, so lines match the square icons */

.menu-toggle { display: none; }

/* ---------- Scroll line (assets/js/scroll-line.js) ---------- */
.scroll-line { position: absolute; top: 0; left: 0; width: 100%; overflow: visible; pointer-events: none; z-index: 1; }
.scroll-line-path {
  fill: none; stroke: var(--text-primary); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; opacity: .8;
}
/* Comet tail: accent pieces fading out behind the spark (see TAIL_PARTS) */
.scroll-line-tail path {
  fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: butt; stroke-linejoin: round;
}
.scroll-line-dot {
  fill: var(--accent); transform-box: fill-box; transform-origin: center; transform: scale(0);
  transition: transform .45s cubic-bezier(.34, 1.56, .64, 1);
}
.scroll-line-dot.on { transform: scale(1); }
.scroll-line-spark-core { fill: var(--accent); }
/* Ignition: two rings ripple out from a dot as it lights */
.scroll-line-ring {
  fill: none; stroke: var(--accent); stroke-width: 1.2; opacity: 0; vector-effect: non-scaling-stroke;
  transform-box: fill-box; transform-origin: center;
  animation: dot-ring .7s cubic-bezier(.22, .61, .36, 1) both;
}
@keyframes dot-ring {
  from { opacity: .7; transform: scale(1); }
  to   { opacity: 0;  transform: scale(var(--ring-scale, 6)); }
}
@media (prefers-reduced-motion: reduce) {
  .scroll-line-dot { transition: none; }
  .scroll-line-spark { display: none; }
}
@media print { .scroll-line { display: none; } }

/* ---------- Sections ---------- */
.section { padding-block: 120px; }
.section-head { margin-bottom: 56px; }

/* ---------- Hero ---------- */
/* Hero fills the first screen: content sits in the vertical center,
   the credentials strip at the bottom edge. Equal 1fr rows above and
   below keep the content centered regardless of the strip's height. */
.hero {
  padding-block: 32px;
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100svh - var(--header-h));
  display: grid; grid-template-rows: 1fr auto 1fr;
}
.hero-main { grid-row: 2; }
.hero-bottom { grid-row: 3; align-self: end; }
.hero h1 { max-width: 14ch; }
.hero .lede { margin: 24px 0 0; max-width: 64ch; }
.hero-bottom { padding-top: 48px; }
.hero .btn-row { margin-top: 24px; }

/* All items stay on one row; as the screen narrows their text wraps onto more
   lines. On phones the items stack vertically (see the 560px breakpoint).
   overflow:hidden + negative margins clip the divider at the start of each row/column. */
.proof {
  display: flex; overflow: hidden;
  border-top: 1px solid var(--line-primary); border-bottom: 1px solid var(--line-primary);
  margin: 0; padding: 0; list-style: none;
}
.proof li {
  flex: 1 1 0; min-width: 0; padding: 14px 16px; /* equal-width columns */
  display: flex; align-items: center; justify-content: center; text-align: center;
  border-left: 1px solid var(--line-primary); margin-left: -1px;
  border-top: 1px solid var(--line-primary); margin-top: -1px;
  color: var(--text-secondary);
}

/* ---------- Case cards ---------- */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 14px;
  padding: 16px 16px 22px; border: 1px solid var(--line-secondary); border-radius: var(--radius);
  text-decoration: none; color: inherit; background: var(--bg);
  transition: border-color .2s;
}
.card:hover { border-color: var(--line-primary); }
.card:hover h3 { color: var(--accent); }
/* Every label gets a divider before it; the negative margin + overflow clip the one
   that starts each line, so wrapped labels never begin with a stray divider */
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; margin-left: -25px; clip-path: inset(0 0 0 25px); }
.card-meta span { color: var(--text-secondary); }
.card-meta span::before {
  content: ""; display: inline-block; width: 1px; height: 10px; margin: 0 12px;
  background: var(--line-primary); vertical-align: -1px;
}
.card-media {
  background: var(--placeholder); aspect-ratio: 16 / 7.5; width: 100%;
  display: grid; place-items: center; color: #9a9a9a; font-size: 12px;
}
.card h3 { transition: color .2s; padding-right: 1em; } /* room for the hover arrow, so it never wraps onto a line of its own */
/* Arrow slides in after the title on hover/focus, inviting a click */
.card h3::after {
  content: "→"; display: inline-block; margin-left: .3em; margin-right: -1em; /* takes no width; sits in the h3's right padding */
  font-family: var(--font-body); font-weight: 400;
  opacity: 0; transform: translateX(-.4em);
  transition: opacity .25s ease, transform .25s ease;
}
.card:hover h3::after,
.card:focus-visible h3::after { opacity: 1; transform: translateX(0); }
@media (hover: none) { .card h3::after { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .card h3::after { transition: opacity .2s; transform: none; } }
.card p { font-size: var(--body-size); color: var(--text-secondary); margin: 0; max-width: 62ch; }

/* The two top cards share rows, so their labels, titles and descriptions line up
   even when one title wraps onto more lines */
.cards > .card:not(.card-wide) { display: grid; grid-row: span 4; grid-template-rows: subgrid; align-content: start; }

.card-wide { grid-column: 1 / -1; display: grid; grid-template-columns: 300px 1fr; gap: 24px; align-items: start; }
.card-wide .card-media { aspect-ratio: 4 / 3; }
.card-wide .card-body { display: flex; flex-direction: column; gap: 14px; }
/* Home: the wide card's cover matches the two cards above it (same width, ratio and framing) */
@media (min-width: 861px) { .cards > .card-wide { grid-template-columns: calc(50% - 25px) 1fr; } } /* half the row, minus the gap and one card's padding and border */
.cards > .card-wide .card-media { aspect-ratio: 16 / 7.5; }
.cards > .card-wide .fig-cover img { left: 6%; top: 16%; width: 88%; }

.section-foot { margin-top: 32px; display: flex; justify-content: flex-end; }

/* ---------- Pillars ---------- */
.pillars { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line-primary); border-bottom: 1px solid var(--line-primary); }
.pillar {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start;
  padding: 32px 0; border-top: 1px solid var(--line-secondary);
}
.pillar:first-child { border-top: 0; }
.pillar-icon { /* hand-drawn, same pen as the header icons and scroll line */
  width: 36px; height: 36px; color: var(--text-primary);
  fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round;
}
.pillar-icon .fill { fill: currentColor; stroke: none; }
.pillar p { font-size: var(--body-size); color: var(--text-secondary); margin-bottom: 14px; max-width: 52ch; }
.pillar:target { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 8%, transparent), transparent 70%); }

/* ---------- Quote ---------- */
.quote blockquote { margin: 0; }
.quote .display { font-size: var(--h2-size); max-width: 30ch; } /* same as H2 */
.quote figcaption { margin-top: 20px; font-size: var(--ui-size); color: var(--text-secondary); }
.quote figcaption .small { color: inherit; font-size: inherit; }
.quote-more { margin-top: 24px; }

/* ---------- Contact band: the closing block on every page ---------- */
.contact-band { background: var(--bg-accent); padding-block: 96px; }
.contact-inner { display: flex; justify-content: space-between; align-items: center; gap: 48px; }
.contact-main { max-width: 640px; }
.contact-intro { margin: 16px 0 24px; color: var(--text-secondary); max-width: 52ch; }
.contact-email-row { margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.contact-email {
  font-family: var(--font-display); font-weight: 700; font-size: var(--h3-size); line-height: 1.2;
  color: var(--text-primary); text-decoration: none; border-bottom: 2px solid var(--accent); overflow-wrap: anywhere;
  transition: color .2s;
}
.contact-email:hover { color: var(--accent-hover); }
[data-link="email"][role="button"] { cursor: pointer; }
/* Back-to-top button (assets/js/main.js): a quiet outlined circle in the bottom-right corner */
.to-top {
  position: fixed; right: 32px; bottom: 32px; z-index: 60;
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg); color: var(--text-primary); border: 1px solid var(--line-primary);
  font: 400 18px/1 var(--font-body); cursor: pointer;
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .25s ease, transform .25s ease, visibility .25s, border-color .2s;
}
.to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { border-color: var(--text-primary); }
.to-top span { display: inline-block; transform: rotate(-90deg); transition: transform .25s ease; }
.to-top:hover span { transform: rotate(-90deg) translateX(.2em); } /* nudges up, like the link arrows */
@media (max-width: 640px) { .to-top { right: 16px; bottom: 16px; width: 44px; height: 44px; font-size: 16px; } }
@media (prefers-reduced-motion: reduce) { .to-top, .to-top span { transition: opacity .2s, visibility .2s; transform: none; } .to-top span { transform: rotate(-90deg); } }
/* "Email copied" note that appears under an email link after a click */
.copy-toast { position: fixed; z-index: 200; left: 0; top: 0; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; background: var(--bg); color: var(--text-primary); border: 1px solid var(--line-primary); font: 400 var(--ui-size)/1.2 var(--font-body); border-radius: var(--radius); white-space: nowrap; pointer-events: none; opacity: 0; transform: translate(-50%, 6px); transition: opacity .18s ease, transform .18s ease; }
.copy-toast.show { opacity: 1; transform: translate(-50%, 0); }
.copy-toast svg { width: 14px; height: 14px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (prefers-reduced-motion: reduce) { .copy-toast { transition: none; transform: translate(-50%, 0); } }
.contact-band .btn-row { margin-top: 24px; }
.contact-envelope {
  flex: none; width: 180px; height: auto;
  fill: none; stroke: var(--text-primary); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round;
}
.contact-envelope .dot { fill: var(--accent); stroke: none; }
/* The band sits right above the footer, so the footer drops its top gap */
main:has(> .contact-band:last-child) + .site-footer { margin-top: 0; border-top: 0; }


/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line-secondary); padding: 28px 0 36px; margin-top: 80px; }
.site-footer .container { display: grid; grid-template-columns: auto minmax(0, auto); justify-content: space-between; gap: 16px 32px; align-items: center; }
.site-footer, .site-footer a { color: var(--text-secondary); text-decoration: none; }
.site-footer a:hover { color: var(--accent-hover); }
.site-footer .right { justify-self: end; text-align: right; }

/* ---------- Page header (inner pages) ---------- */
.page-head { padding-block: 96px 56px; }
.page-head .lede { margin-top: 20px; }

/* ---------- Work page ---------- */
.work-grid { display: grid; gap: 16px; }
.work-grid .card-wide { grid-template-columns: 420px 1fr; }

/* ---------- About ---------- */
.about-intro { display: grid; grid-template-columns: 360px 1fr; gap: 64px; align-items: start; }
/* About intro starts at the top on every screen (no full-screen height) */
.about-hero { display: block; min-height: 0; padding-block: 64px 0; }
.portrait { width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 30%; border-radius: var(--radius); background: var(--placeholder); }
.about-intro .bio { font-size: var(--body-size); font-weight: 400; margin-top: 24px; max-width: 58ch; }
.about-intro .personal { color: var(--text-secondary); max-width: 58ch; }



/* Experience accordion */
.experience { border-top: 1px solid var(--line-primary); }
.role { border-bottom: 1px solid var(--line-primary); }
.role > summary {
  list-style: none; cursor: pointer;
  display: grid; grid-template-columns: minmax(0, 1fr) auto 32px; gap: 24px; align-items: start;
  padding: 32px 0;
}
.role > summary::-webkit-details-marker { display: none; }
.role > summary:hover h3 { color: var(--accent); }
.role h3 { transition: color .2s; }
.role .title { font-size: var(--body-size); margin: 8px 0 10px; }
.role .headline { font-size: var(--body-size); color: var(--text-secondary); margin: 0; max-width: 70ch; }
.role .years { color: var(--text-secondary); white-space: nowrap; padding-top: 10px; text-align: right; } /* dates, then work location */
.role .chev { width: 32px; height: 32px; border: 1px solid var(--line-primary); border-radius: 50%; display: grid; place-items: center; margin-top: 4px; transition: transform .25s; }
.role[open] .chev { transform: rotate(45deg); }
.role-body { padding: 0 0 48px; max-width: 880px; }
.role-subhead { margin: 8px 0 12px; } /* labels style, same as "What colleagues say" */
.achievements { margin: 24px 0 0; padding-left: 0; list-style: none; counter-reset: ach; }
.achievements > li { position: relative; padding: 16px max(0px, calc(100% - 34em - 40px)) 16px 40px; border-top: 1px solid var(--line-secondary); font-size: var(--body-size); color: var(--text-secondary); } /* right padding keeps lines near 70 characters while the divider stays full width */
.achievements > li::before { counter-increment: ach; content: counter(ach, decimal-leading-zero); position: absolute; left: 0; top: 18px; color: var(--text-secondary); }
.achievements strong { font-weight: inherit; color: var(--text-primary); } /* lead-ins: emphasis by colour, not weight */
.achievement-beat { display: block; margin-top: 12px; } /* a second short paragraph inside one achievement */
.achievements .text-link { display: flex; width: fit-content; margin-top: 10px; } /* own line under the text, like the Home pillar links */


.testimonials { margin-top: 40px; }
.testimonials h4 { margin: 0 0 16px; }
.testimonial-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.testimonial { margin: 0; padding: 24px; border: 1px solid var(--line-secondary); border-radius: var(--radius); display: flex; flex-direction: column; gap: 16px; }
.testimonial blockquote { margin: 0; font-size: var(--body-size); color: var(--text-secondary); }
.testimonial blockquote p:last-child { margin: 0; }
.testimonial figcaption { font-size: var(--ui-size); margin-top: auto; }
.testimonial figcaption a { text-decoration: none; border-bottom: 1px solid var(--line-primary); }
.testimonial figcaption a:hover { color: var(--accent-hover); }
.testimonial figcaption span { display: block; color: var(--text-tertiary); }
.testimonial figcaption .t-name { font-weight: 400; }
.testimonials-more { margin: 20px 0 0; }

/* Mentorship */
.mentor { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; } /* lines up with the other sections */
/* "I can help with" list: teal dots like the nav and scroll-line dots, no dividers */
.mentor ul { margin: 16px 0 32px; padding: 0; list-style: none; display: grid; gap: 12px; }
.mentor li { position: relative; padding-left: 22px; font-size: var(--body-size); }
.mentor li::before {
  content: ""; position: absolute; left: 2px; top: calc(.75em - 3px); /* centred on the first line */
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}

/* Photo wall */
/* Photo wall: 14 photos, two of them two cells wide, so they fill 4 columns x 4 rows
   on desktop and 2 columns x 8 rows on smaller screens with no gaps. */
.photo-wall { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.photo-wall li { margin: 0; aspect-ratio: 3 / 4; overflow: hidden; border-radius: var(--radius); background: var(--bg-panel); }
.photo-wall li.wide { grid-column: span 2; aspect-ratio: auto; position: relative; }
.photo-wall li.wide img { position: absolute; inset: 0; }
.photo-wall img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ---------- Case study ---------- */
.cs-hero { padding-block: 80px 48px; }
.cs-hero .back { display: inline-flex; margin-bottom: 40px; }
.cs-hero h1 { max-width: 16ch; }
.cs-summary { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line-primary); border-bottom: 1px solid var(--line-primary); margin-top: 48px; }
.cs-summary div { padding: 18px 18px 18px 0; }
.cs-summary div + div { padding-left: 18px; border-left: 1px solid var(--line-secondary); }
.cs-summary dt { color: var(--text-tertiary); margin-bottom: 6px; }
.cs-summary dd { margin: 0; font-size: var(--body-size); font-weight: 400; }
.nda { font-size: var(--body-size); color: var(--text-tertiary); margin-top: 14px; max-width: 70ch; }
.cs-cover { background: var(--placeholder); aspect-ratio: 16 / 7; display: grid; place-items: center; color: #8d8d8d; font-size: 13px; }

.cs-body { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 64px; padding-block: 80px; }
.toc { position: sticky; top: calc(var(--header-h) + 32px); align-self: start; list-style: none; margin: 0; padding: 0; }
.toc a { position: relative; display: block; padding: 7px 0 7px 18px; font-size: var(--ui-size); text-decoration: none; color: var(--text-tertiary); transition: color .2s; }
.toc a:hover { color: var(--accent-hover); }
.toc a.active { color: var(--text-primary); }
/* Current section: the shared teal dot (assets/js/nav-indicator.js), drawn in this overlay */
.toc-indicator { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.cs-section { padding-bottom: 56px; margin-bottom: 56px; border-bottom: 1px solid var(--line-secondary); max-width: 720px; }
.cs-section:last-child { border-bottom: 0; }
.cs-section h2 { font-size: var(--h2-size); margin-bottom: 20px; }
.cs-section p:not(.eyebrow), .cs-section li { font-size: var(--body-size); color: var(--text-secondary); } /* section labels keep the Labels size */
.cs-section ul { padding-left: 20px; }
/* Reading measure: running text stops near 70 characters; headings, figures and result tiles keep the full column */
.cs-section > p:not(.eyebrow):not(.proto-note), .cs-section > ul:not(.cs-results), .cs-section > ol { max-width: 34em; } /* ~70 characters in Fixel (its "0" is wide, so ch units overshoot) */
.cs-section strong { font-weight: inherit; color: var(--text-primary); } /* lead-ins: emphasis by colour, not weight */
/* A point that follows a figure starts a new beat: give it room from the caption above */
.cs-section .cs-visual + ul { margin-top: 56px; }
.cs-section h3 { font-size: var(--h3-size); margin: 32px 0 12px; }
.cs-section h2 + h3 { margin-top: 8px; }

/* Summary card with longer answers: two columns, two rows */
.cs-summary-wide { grid-template-columns: 1fr 1fr; }
.cs-summary-wide div:nth-child(odd) { padding-left: 0; border-left: 0; }
.cs-summary-wide div:nth-child(n+3) { border-top: 1px solid var(--line-secondary); }
.cs-hero-compact { padding-block: 32px; }
.cs-hero-compact .back { margin-bottom: 24px; }
.cs-hero-compact h1 { max-width: none; }
.cs-summary-row { grid-template-columns: repeat(3, 1fr); margin-top: 32px; }
.cs-summary-row.cs-summary-4 { grid-template-columns: repeat(4, 1fr); }

/* Case study visuals: placeholder until the real image is added, with its caption */
.cs-links { display: flex; flex-wrap: wrap; gap: 8px 32px; }
.cs-section .cs-result-links { margin: 16px 0 0; }
.cs-hero-links { margin: 24px 0 0; }
.cs-visual { margin: 32px 0 0; }
.container > .cs-visual { margin: 0; }
.cs-visual + p { margin-top: 24px; }
.cs-visual-ph {
  width: 100%; background: var(--placeholder); border-radius: var(--radius);
  display: grid; place-items: center; padding: 24px; text-align: center;
  font-size: var(--ui-size); color: #6b6b6b;
}
.cs-visual-img { display: block; width: 100%; height: auto; border-radius: var(--radius); }
.cs-visual figcaption { margin-top: 10px; font-size: var(--ui-size); color: var(--text-secondary); }

/* Result cards under the outcome teaser */
.cs-section .cs-results { list-style: none; padding: 0; margin: 32px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
/* An image on warm paper with a heading below. --l --t --w place the image inside its frame */
.cs-section .cs-results li { margin: 0; }
.cs-results-media { position: relative; overflow: hidden; aspect-ratio: 4 / 3; background: var(--bg-panel); border-radius: var(--radius); }
.cs-results-media .cs-results-sketch { position: absolute; inset: 0; margin: auto; width: 84%; height: auto; }
.cs-results-media img { position: absolute; left: var(--l); top: var(--t); width: var(--w); height: auto; max-width: none; border-radius: 4px; box-shadow: 0 8px 24px rgba(23, 23, 20, .22), 0 1px 4px rgba(23, 23, 20, .14); }
.cs-section .cs-results h3 { margin: 12px 0 0; font-size: 22px; line-height: 1.1; }
.cs-section .cs-results p { margin: 8px 0 0; font-size: var(--ui-size); line-height: 1.45; }
@media (min-width: 861px) { /* keeps each image, title and line of proof level across the columns */
  .cs-section .cs-results { row-gap: 0; }
  .cs-section .cs-results li { display: grid; grid-row: span 3; grid-template-rows: subgrid; }
}
.pillar-icon .accent { fill: var(--accent); stroke: none; }

.todo {
  border: 1px dashed var(--line-primary); padding: 20px 24px; font-size: var(--body-size) !important; color: var(--text-tertiary) !important; background: #fafafa;
}
.cs-next { border-top: 1px solid var(--line-primary); padding-block: 48px 96px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px clamp(64px, 12vw, 200px); }
.cs-next h3 { font-size: max(18px, calc(var(--h3-size) * .75)); max-width: 26ch; }
.cs-next .cs-next-link h3 { margin-left: auto; }
.cs-next .cs-next-link { text-align: right; }
@media (max-width: 640px) { .cs-next { grid-template-columns: 1fr; gap: 32px; } .cs-next .cs-next-link { text-align: left; } .cs-next .cs-next-link h3 { margin-left: 0; } }
.cs-next a { text-decoration: none; display: block; }
.cs-next a:hover h3 { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .about-intro { grid-template-columns: 280px 1fr; gap: 40px; }
  .work-grid .card-wide { grid-template-columns: 320px 1fr; }
}

@media (max-width: 860px) {
  :root { --gutter: 24px; }
  .site-header .container { grid-template-columns: 1fr auto; align-items: center; }
  .menu-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border: 1px solid var(--line-primary); background: var(--bg); cursor: pointer; border-radius: var(--radius);
  }
  /* Mobile: page links stacked, contact links in a row beneath */
  .menu {
    position: absolute; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; gap: 20px;
    background: var(--bg); border-bottom: 1px solid var(--line-secondary); padding: 8px var(--gutter) 24px;
    display: none;
  }
  .menu.open { display: flex; }
  .nav { flex-direction: column; align-items: stretch; gap: 0; }
  .nav > a { padding: 14px 0; border-bottom: 1px solid var(--line-secondary); font-size: var(--ui-size); }
  .nav a[aria-current="page"] { color: var(--accent-hover); }
  .nav-indicator { display: none; }
  .header-links { justify-self: auto; }

  .section { padding-block: 80px; }

  .cards { grid-template-columns: 1fr; }
  .card-wide, .work-grid .card-wide { grid-template-columns: 1fr; }
  .card-wide .card-media { aspect-ratio: 16 / 7.5; }

  .pillar { grid-template-columns: 40px 1fr; gap: 16px 20px; }
  .pillar > div:last-child { grid-column: 2; }

  .about-intro { grid-template-columns: 1fr; }
  .portrait { max-width: 320px; }
  .testimonial-grid { grid-template-columns: 1fr; }
  .mentor { grid-template-columns: 1fr; gap: 24px; }
  .photo-wall { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .photo-wall li.wide { aspect-ratio: 3 / 2; }

  .cs-summary { grid-template-columns: 1fr 1fr; }
  .cs-summary div:nth-child(3) { padding-left: 0; border-left: 0; }
  .cs-summary div:nth-child(n+3) { border-top: 1px solid var(--line-secondary); }
  .cs-summary-row, .cs-summary-row.cs-summary-4 { grid-template-columns: 1fr; }
  .cs-summary-row div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--line-secondary); }
  .cs-body { grid-template-columns: 1fr; gap: 32px; padding-block: 48px; }
  .cs-section .cs-results { grid-template-columns: 1fr; }
  .toc { display: none; }

  .site-footer .container { grid-template-columns: 1fr; text-align: left; }
  .site-footer .right { justify-self: start; text-align: left; }
}

@media (max-width: 560px) {
  :root { --gutter: 16px; }
  .contact-band { padding-block: 56px; }
  .contact-inner { flex-direction: column; align-items: flex-start; gap: 24px; }
  .contact-envelope { order: -1; width: 88px; }
  /* Phones: hero content starts near the top instead of floating in the middle;
     the credentials list follows right after */
  .hero { display: block; min-height: 0; padding-block: 40px 24px; }
  .hero-bottom { padding-top: 40px; }
  .proof { flex-direction: column; }
  .proof li { flex: none; justify-content: flex-start; text-align: left; padding: 12px 0; }
  .role > summary { grid-template-columns: 1fr 32px; }
  .role .years { grid-column: 1; grid-row: 2; padding-top: 0; text-align: left; }
  .role .chev { grid-column: 2; grid-row: 1; }
}

/* Case study figures: warm panel, hand-drawn circles for what matters, numbered dots and a legend for how it works */
.fig-panel { background: var(--bg-panel); padding: clamp(16px, 4.5vw, 32px); border-radius: var(--radius); }
.container > .cs-visual .fig-panel { padding: clamp(16px, 4.5vw, 48px); }
.fig-split { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 32px; align-items: center; }
.fig-rel { position: relative; }
.fig-title, .cs-section p.fig-title { font: 700 21px/1.1 var(--font-display); color: var(--text-primary); margin: 12px 0 4px; }
.fig-note, .cs-section p.fig-note { font: 400 var(--ui-size)/1.45 var(--font-body); color: var(--text-secondary); margin: 0; }

/* Crop any region of a source image: --iw is the image width, --x --y --w --h are in its pixels */
.fig-crop { position: relative; overflow: hidden; aspect-ratio: var(--w) / var(--h); border-radius: var(--radius); }
.fig-crop img { position: absolute; max-width: none; height: auto; width: calc(var(--iw, 2000) / var(--w) * 100%); left: calc(var(--x) / var(--w) * -100%); top: calc(var(--y) / var(--h) * -100%); }

.fig-dot, .fig-legend b { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; font: 400 13px/24px var(--font-body); text-align: center; }
.fig-dot { position: absolute; transform: translate(-50%, -50%); box-shadow: 0 0 0 2px var(--bg); }
.fig-legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.fig-legend li, .cs-section .fig-legend li { display: flex; gap: 10px; font: 400 var(--ui-size)/1.45 var(--font-body); color: var(--text-primary); }
.fig-legend b { flex: none; }
.fig-legend-below { margin-top: 20px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 24px; }

.fig-ink { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; fill: none; stroke: var(--accent); stroke-linecap: round; stroke-linejoin: round; }
.fig-ink path { stroke-width: 2; vector-effect: non-scaling-stroke; }
.fig-ink .thin { stroke-width: 1.4; }
.fig-ink-dark { stroke: var(--ring-dark); }

.fig-zoom { position: relative; aspect-ratio: 1000 / 180; }
.fig-zoom > * { position: absolute; }
.fig-zoom-small { left: 0; top: 0; width: 30%; }
.fig-zoom-big { left: 34%; top: 0; width: 66%; }
.fig-zoom-frame { left: .69%; top: 39.6%; width: 18.66%; height: 28.2%; border: 1.5px solid var(--ring-dark); }

.fig-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.fig-pair-open { gap: 40px; } /* drawn straight on the page, with no panel behind it */
.fig-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.fig-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.fig-steps { display: grid; grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr) 28px minmax(0, 1fr); align-items: start; }
.fig-steps svg.fig-sketch { display: block; width: 100%; height: auto; }
.fig-arrow { position: relative; aspect-ratio: 28 / 90; }

.fig-journey { position: relative; aspect-ratio: 1000 / 400; }
.fig-journey svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.fig-journey ol { list-style: none; margin: 0; padding: 0; }
.fig-journey li { position: absolute; width: 26%; }
.fig-journey .fig-title, .cs-section .fig-journey p.fig-title { margin: 0; }
.fig-journey-pain, .cs-section p.fig-journey-pain { position: absolute; left: 70%; top: 74%; width: 30%; margin: 0; font: 400 var(--ui-size)/1.35 var(--font-body); color: var(--accent); }

.fig-schema { display: block; width: 100%; height: auto; overflow: visible; fill: none; stroke: var(--text-primary); stroke-linecap: round; stroke-linejoin: round; }
.fig-schema text { font: 700 24px var(--font-display); fill: var(--text-primary); stroke: none; }

.fig-schema text.fig-schema-sm { font-size: 20px; }
/* Agent loops schema (tracing): descriptions drawn next to each loop */
.fig-schema text.fig-schema-note { font: 400 13px var(--font-body); fill: var(--accent); }
/* Naming convention schema (design system) */
.fig-naming text.fig-name-seg { font: 700 26px var(--font-display); }
.fig-naming text.fig-name-dash { fill: var(--line-primary); }
.fig-naming text.fig-name-opt { font: 400 14px var(--font-body); fill: var(--text-secondary); }
.fig-naming text.fig-name-box { font: 400 15px var(--font-body); }
/* Component documentation template schema (design system) */
.fig-doc text.fig-doc-sec { font: 700 20px var(--font-display); }
.fig-doc text.fig-doc-note { font: 400 15px var(--font-body); fill: var(--text-secondary); }
.fig-doc path.fig-doc-rule { stroke: var(--line-primary); }
.fig-board text.fig-board-item { font: 400 16px var(--font-body); }
.fig-board text.fig-board-note { font-size: 15px; }
.fig-loops text.fig-loop-name { font: 700 17px var(--font-display); fill: var(--text-primary); }
.fig-loops text.fig-loop-meta { font: 400 13px var(--font-body); fill: var(--text-secondary); }
.fig-loops text.fig-loop-trace { font: 400 13px var(--font-body); fill: var(--accent); }

.fig-num { display: inline-block; position: relative; font: 700 var(--h2-size)/1 var(--font-display); color: var(--text-primary); }
.fig-num svg { position: absolute; left: 0; bottom: -10px; width: 100%; height: 12px; overflow: visible; fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; }
.fig-num + .fig-title, .cs-section .fig-num + p.fig-title { margin-top: 20px; }

/* Steps along a hand-drawn line, with a screen under each label. --w narrows a screen */
.fig-spine { display: grid; gap: 28px; }
.fig-spine-step { position: relative; padding-left: 36px; }
.fig-spine-step::before { content: ""; position: absolute; left: 9px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
.fig-spine-line { position: absolute; left: 12px; top: 12px; width: 6px; height: calc(100% + 28px); }
.cs-section .fig-spine p.fig-title { margin: 0 0 10px; }
.cs-section .fig-spine p.fig-spine-text { margin: 0 0 12px; max-width: 62ch; }
.fig-spine-shot { position: relative; width: var(--w, 100%); }
.fig-spine-shot img { display: block; width: 100%; height: auto; border-radius: 5px; box-shadow: 0 10px 28px rgba(23, 23, 20, .26), 0 2px 6px rgba(23, 23, 20, .16); }

/* A screen with its structure drawn on top: hand-drawn regions and a label for each */
.fig-maps { display: grid; gap: 32px; }
.fig-map { position: relative; }
.fig-map img { display: block; width: 100%; height: auto; border-radius: 5px; box-shadow: 0 10px 28px rgba(23, 23, 20, .26), 0 2px 6px rgba(23, 23, 20, .16); }
.fig-map svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; fill: color-mix(in srgb, var(--ring-dark) 10%, transparent); stroke: var(--ring-dark); stroke-width: 1.6; stroke-linejoin: round; }
.fig-map svg path { vector-effect: non-scaling-stroke; }
.fig-map-label { position: absolute; padding: 2px 6px; border-radius: 2px; background: var(--ring-dark); color: #10201f; font: 400 12px/1.25 var(--font-body); white-space: nowrap; }

/* A wireframe of a screen on a panel, with a quiet description for each outlined area below it */
.fig-wire { padding: 24px; }
.cs-section p.fig-wire-title { margin: 0 0 8px; font: 400 var(--ui-size)/1.3 var(--font-body); color: #5f5f5a; }
/* Progressive-disclosure path drawn over the trace view wireframe */
.fig-wire-shot { position: relative; }
.fig-path-label { position: absolute; padding: 2px 7px; border-radius: 2px; background: var(--ring-dark); color: #10201f; font: 400 12px/1.3 var(--font-body); white-space: nowrap; pointer-events: none; }
@media (max-width: 640px) { .fig-path-label { display: none; } }
.fig-wire img { display: block; width: 100%; height: auto; filter: drop-shadow(0 8px 18px rgba(23, 23, 20, .22)); }
.cs-section .fig-wire-legend { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.cs-section .fig-wire-legend li { margin: 0; font: 400 12.5px/1.45 var(--font-body); color: #5f5f5a; }
.cs-section .fig-wire-legend-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; }
.fig-wire-legend b { display: block; margin-bottom: 3px; font-weight: 400; font-size: 11px; line-height: 1.3; color: var(--c); text-transform: uppercase; }
@media (max-width: 640px) {
  .fig-wire { padding: 16px; }
  .cs-section .fig-wire-legend { grid-template-columns: 1fr; gap: 14px; }
}

/* A timeline drawn straight on the page, with no panel behind it */
.fig-journey-flat { aspect-ratio: 1000 / 240; container-type: inline-size; }
.fig-journey-flat .fig-journey-date { position: absolute; left: 0; right: 0; top: -14.4cqw; } /* sits above the line: 60% of the figure height */
.fig-journey .fig-journey-v, .fig-journey .fig-journey-ring { display: none; }

/* Cover: one dark screen on warm paper, running off the bottom edge */
.fig-cover { position: relative; overflow: hidden; background: var(--bg-panel); border-radius: var(--radius); }
.cs-visual > .fig-cover { aspect-ratio: 16 / 9; }
.fig-cover img { position: absolute; left: 6%; top: 16%; width: 88%; height: auto; max-width: none; border-radius: 6px; box-shadow: 0 14px 40px rgba(23, 23, 20, .26), 0 2px 6px rgba(23, 23, 20, .16); }
.card-wide .fig-cover img { left: 7%; top: 20%; width: 112%; }
/* A cover that is already a composition on a transparent background: the
   shadow follows each card's shape (same shadow as the screenshot covers), and
   it's positioned so its cards start where the screenshots on the other covers start. */
.fig-cover.fig-cover-stack img { box-shadow: none; border-radius: 0; background: none; left: 2%; top: 6%; width: 96%;
  filter: drop-shadow(0 14px 22px rgba(23, 23, 20, .22)) drop-shadow(0 2px 4px rgba(23, 23, 20, .14)); }
.card-wide .fig-cover.fig-cover-stack img { left: 1.4%; top: 10.4%; width: 125%; }

/* A story told in steps: an image, what happened, an arrow to the next one */
.fig-story-next { display: block; width: 40px; height: 44px; margin: 14px auto 10px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; }

@media (max-width: 860px) {
  .fig-split { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 560px) {
  .fig-pair, .fig-trio, .fig-steps { grid-template-columns: 1fr; }
  .fig-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fig-arrow { display: none; }
  .fig-zoom { aspect-ratio: auto; display: grid; gap: 12px; }
  .fig-zoom-small, .fig-zoom-big { position: relative; left: 0; width: 100%; }
  .fig-zoom-frame, .fig-zoom > .fig-ink { display: none; }
  .fig-journey { aspect-ratio: auto; }
  .fig-journey svg { display: none; }
  .fig-journey ol { display: grid; gap: 12px; }
  .fig-journey li { position: static; width: auto !important; text-align: left !important; }
  .fig-journey-pain, .cs-section p.fig-journey-pain { position: static; width: auto; margin-top: 12px; }
  .fig-spine-shot { width: 100%; }
  .fig-map-label { padding: 1px 3px; font-size: 9px; }
  /* The flat timeline turns vertical: the line runs from the first dot to the last */
  .fig-journey-flat ol { padding-left: 36px; gap: 20px; }
  .fig-journey-flat li { position: relative; left: auto !important; right: auto !important; top: auto !important; }
  .fig-journey-flat .fig-journey-date { position: static; }
  .fig-journey-flat li::before { content: ""; position: absolute; left: -27px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
  .fig-journey .fig-journey-v { display: block; inset: 12px auto auto 12px; width: 6px; height: calc(100% - 44px); }
  .fig-journey .fig-journey-ring { display: block; inset: 0 auto auto -36px; width: 30px; height: 24px; }
}

/* ---------- Interactive prototype embed (tracing case study) ----------
   Desktop: the prototype runs in an iframe as wide as the article column,
   rendered at a fixed design width and scaled down to fit (proto-embed.js).
   "Try it full screen" shows it unscaled across the whole screen.
   Below 900px: a sketch and a note instead, and the iframe is never loaded. */
.cs-section p.proto-note { font-size: var(--ui-size); color: var(--text-secondary); padding: 12px 16px; border-left: 2px solid var(--accent); background: var(--bg-panel); max-width: 70ch; }
.proto-embed { position: relative; }
.proto-frame { position: relative; overflow: hidden; border-radius: 6px; background: #0f1110; box-shadow: 0 1px 0 var(--line-secondary), 0 18px 48px rgba(23, 23, 20, .18); }
.proto-frame-scale { transform-origin: 0 0; }
.proto-frame iframe { display: block; border: 0; background: #0f1110; }
.proto-frame::before { content: "Loading prototype…"; position: absolute; inset: 0; display: grid; place-items: center; color: #8f8c84; font-size: var(--ui-size); }
.proto-frame.is-loaded::before { content: none; }
.proto-caption { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.proto-exit[hidden] { display: none; }
.proto-fs { flex: none; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; font: 400 var(--ui-size)/1.2 var(--font-body); color: var(--text-primary); background: var(--bg); border: 1px solid var(--line-primary); border-radius: var(--radius); cursor: pointer; }
.proto-fs:hover { color: var(--accent-hover); border-color: var(--accent); }
.proto-fs svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
/* Full screen: the frame covers the screen and the prototype runs unscaled. */
.proto-frame.is-full { position: fixed; inset: 0; z-index: 1000; height: 100% !important; border-radius: 0; box-shadow: none; }
.proto-frame.is-full .proto-frame-scale { transform: none !important; width: 100%; height: 100%; }
.proto-frame.is-full iframe { width: 100% !important; height: 100% !important; }
.proto-exit { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); z-index: 2; display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; font: 400 13px/1.2 var(--font-body); color: #ecebe6; background: rgba(26, 28, 27, .92); border: 1px solid #353a38; border-radius: 999px; cursor: pointer; }
.proto-exit:hover { border-color: #5fb3a9; }
.proto-exit kbd { font: inherit; font-size: 11px; padding: 1px 5px; border: 1px solid #53585b; border-radius: 4px; color: #8f8c84; }
body.proto-full-open { overflow: hidden; }
.proto-mobile { display: none; background: var(--bg-panel); border-radius: var(--radius); padding: 32px 24px; text-align: center; }
.proto-mobile-art { display: block; width: min(240px, 80%); height: auto; margin: 0 auto 8px; }
.cs-section .proto-mobile p.fig-note { max-width: 36ch; margin: 0 auto; } /* beats ".cs-section p.fig-note { margin: 0 }" so the note centres */
@media (max-width: 899px) {
  .proto-frame, .proto-fs { display: none; }
  .proto-mobile { display: block; }
}

/* Agent-lifecycle loops: on phones the diagram's labels get too small to read,
   so it is swapped for a stacked list with the same content. */
.fig-loops-list { display: none; background: var(--bg-panel); border-radius: var(--radius); padding: 20px 16px; }
.cs-section p.fig-loops-strip { margin: 0 0 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line-secondary); font: 400 var(--ui-size)/1.5 var(--font-body); color: var(--text-secondary); }
.fig-loops-strip b { font-weight: 400; color: var(--accent); }
.cs-section .fig-loops-list ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.cs-section .fig-loops-list li { margin: 0; padding-left: 14px; border-left: 2px solid var(--accent); }
.cs-section .fig-loops-list p.fig-title { margin: 0 0 2px; font-size: 18px; }
.cs-section p.fig-loops-speed, .cs-section p.fig-loops-trace { margin: 0; font: 400 var(--ui-size)/1.45 var(--font-body); }
.cs-section p.fig-loops-speed { color: var(--text-tertiary); }
.cs-section p.fig-loops-trace { color: var(--accent); }
@media (max-width: 640px) {
  .fig-loops { display: none; }
  .fig-loops-list { display: block; }
}
