/* Fonts load from Google Fonts in index.template.html: Newsreader, IBM Plex Sans, IBM Plex Mono, Readex Pro, IBM Plex Sans Arabic. */

/* Tokens (theme v2) */
:root {
  color-scheme: dark;
  --bg: #0B1A20;
  --surface: #10242B;
  --line: #1F4148;
  --teal: #3F8C90;
  --teal-light: #7FC4C7;
  --brass: #BFAE62;
  --text: #E3E6E1;
  --text-2: #A9B4B0;
  --text-3: #8FA19D;
  --grid: rgba(63, 140, 144, 0.2);

  --font-head: 'Newsreader', 'Times New Roman', serif;
  --font-body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'IBM Plex Sans Arabic', ui-monospace, monospace;
  --font-arabic: 'IBM Plex Sans Arabic', Tahoma, sans-serif;
  --head-weight: 500;
  --lh-body: 1.65;
  --lh-head: 1.18;
  --hero-size: clamp(2rem, 1.35rem + 2.9vw, 3.6rem);
  --h2-size: clamp(1.7rem, 1.4rem + 1.3vw, 2.5rem);
  --h3-size: 1.3rem;

  --gutter: 1rem;
  --rail-gap: 1.75rem;
  --node: 12px;
  --header-h: 3.5rem;
  --radius: 10px;
}

/* Arabic: Readex Pro runs wide, so headings sit about 8% smaller than English */
html[lang='ar'] {
  --font-head: 'Readex Pro', 'IBM Plex Sans Arabic', Tahoma, sans-serif;
  --font-body: 'IBM Plex Sans Arabic', 'IBM Plex Sans', Tahoma, sans-serif;
  --lh-body: 1.8;
  --lh-head: 1.5;
  --hero-size: clamp(1.84rem, 1.24rem + 2.67vw, 3.3rem);
  --h2-size: clamp(1.56rem, 1.29rem + 1.2vw, 2.3rem);
  --h3-size: 1.2rem;
}

@media (min-width: 720px) {
  :root { --gutter: 2rem; --rail-gap: 4rem; }
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; scroll-padding-block-start: calc(var(--header-h) + 1rem); -webkit-text-size-adjust: 100%; }
html:has(dialog[open]) { overflow: hidden; }
body {
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  font-synthesis: none;
  line-height: var(--lh-body);
  overflow-wrap: break-word;
}
h1, h2, h3, h4 { color: var(--text); font-family: var(--font-head); font-weight: var(--head-weight); line-height: var(--lh-head); text-wrap: balance; }
p, li, dd { text-wrap: pretty; }
main { overflow-x: clip; }
/* Arabic words set in the mono face get wide gaps, so Arabic labels use the body face. Digits stay mono elsewhere. */
html[lang='ar'] :is(.fields dt, .role__period, .step__label, .job__period, .project__label, .bars__value) { font-family: var(--font-body); }
h2 { font-size: var(--h2-size); }
h3 { font-size: var(--h3-size); }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-inline-size: 100%; }
img { block-size: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; border-radius: 2px; }
#app { min-block-size: 100vh; }
.lang-pending #app { visibility: hidden; }

.wrap { inline-size: 100%; max-inline-size: 72rem; margin-inline: auto; padding-inline: var(--gutter); }
.brass { color: var(--brass); }
.sr-only { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.count { font-variant-numeric: tabular-nums; }
.estimate { color: var(--teal-light); font-weight: 500; }

.skip {
  position: absolute;
  inset-block-start: 0.5rem;
  inset-inline-start: 0.5rem;
  z-index: 30;
  padding: 0.6rem 1rem;
  background: var(--text);
  color: var(--bg);
  transform: translateY(-300%);
}
.skip:focus { transform: none; }

/* Header */
.site-head { position: sticky; inset-block-start: 0; z-index: 10; background: var(--bg); border-block-end: 1px solid var(--line); }
.site-head__row { display: flex; align-items: center; gap: 1rem; min-block-size: var(--header-h); position: relative; }
.brand__mark { flex: none; }
html[dir='rtl'] .brand__mark { transform: scaleX(-1); }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; min-block-size: 44px; color: var(--text); font-family: var(--font-head); font-size: 1.15rem; font-weight: var(--head-weight); text-decoration: none; }
.site-head__tools { display: flex; align-items: center; gap: 0.25rem; margin-inline-start: auto; }
.tool { display: inline-flex; align-items: center; justify-content: center; min-block-size: 44px; min-inline-size: 44px; padding-inline: 0.6rem; color: var(--text); font-size: 0.95rem; text-decoration: none; }
.tool:hover { color: var(--teal-light); }

.nav { display: none; position: absolute; inset-block-start: 100%; inset-inline: 0; background: var(--surface); border-block-end: 1px solid var(--line); padding-block: 0.5rem; }
.nav.is-open { display: block; }
.nav a { display: flex; align-items: center; min-block-size: 48px; padding-inline: var(--gutter); color: var(--text-2); text-decoration: none; }
.nav a:hover, .nav a[aria-current] { color: var(--teal-light); }

@media (min-width: 960px) {
  .nav { display: block; position: static; background: none; border: 0; padding: 0; margin-inline-start: auto; }
  .nav ul { display: flex; gap: 1.5rem; }
  .nav a { padding-inline: 0; min-block-size: 44px; font-size: 0.95rem; }
  .site-head__tools { margin-inline-start: 0.5rem; }
  .tool--menu { display: none; }
}

/* Hero */
.hero { padding-block-start: clamp(2rem, 5vw, 4.5rem); }
.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px;
  grid-template-areas: 'id photo' 'line line' 'cross cross' 'meta meta' 'cta cta' 'stats stats' 'now now';
  column-gap: 1rem;
  row-gap: 1.25rem;
  align-items: start;
}
.hero__id { grid-area: id; align-self: center; }
.hero__name { color: var(--text); font-family: var(--font-head); font-size: 1.3rem; font-weight: var(--head-weight); line-height: var(--lh-head); }
.hero__role { color: var(--text-2); font-size: 0.975rem; line-height: 1.5; }
.hero__tagline { color: var(--text-3); font-size: 0.925rem; line-height: 1.5; }
.hero__photo { grid-area: photo; inline-size: 84px; block-size: 105px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--teal); background: var(--surface); }
.hero__line { grid-area: line; font-size: var(--hero-size); font-weight: 400; max-inline-size: 20em; }
.hero__cross { grid-area: cross; margin-block-start: -0.5rem; color: var(--text-2); font-size: 1.05rem; line-height: 1.6; }
.hero__meta { grid-area: meta; color: var(--text-2); font-size: 0.975rem; line-height: 1.55; }
.hero__cta { grid-area: cta; display: flex; flex-wrap: wrap; gap: 0.75rem; }
.hero__now { grid-area: now; border-inline-start: 1px solid var(--teal); padding-inline-start: 0.9rem; font-size: 0.975rem; max-inline-size: 38rem; }
.hero__now h2 { font-size: 1rem; }
/* Proof strip: three figures in one row under the buttons, stacked on narrow phones. */
.hero__proof { grid-area: stats; display: grid; gap: 0.5rem; }
.hero__updated { color: var(--text-3); font-size: 0.85rem; }
.hero__stats { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-block-start: 0.5rem; }
.hero__stats li { display: grid; gap: 0.2rem; align-content: start; padding: 0.8rem 1rem; background: var(--surface); }
.hero__stat-value { color: var(--text); font-family: var(--font-mono); font-size: 1.2rem; font-weight: 500; line-height: 1.25; }
.hero__stat-label { color: var(--text-2); font-size: 0.9rem; line-height: 1.4; }
.arrow { color: var(--teal-light); font-family: var(--font-body); }
@media (min-width: 560px) {
  .hero__stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 900px) {
  .hero__grid {
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-areas: 'id photo' 'line photo' 'cross photo' 'meta photo' 'cta photo' 'stats stats' 'now now';
    grid-template-rows: auto auto auto auto auto auto 1fr;
    column-gap: 4rem;
    row-gap: 1.5rem;
  }
  .hero__photo { inline-size: 300px; block-size: 375px; }
  /* Until a real photo exists, the monogram stays small instead of filling a large empty panel. */
  .hero__grid:has(.hero__photo--placeholder) { grid-template-columns: minmax(0, 1fr) 168px; }
  .hero__photo--placeholder { inline-size: 168px; block-size: 210px; }
  .hero__name { font-size: 1.6rem; }
  .hero__role, .hero__meta { font-size: 1.0625rem; }
  .hero__cross { font-size: 1.15rem; }
}

/* Buttons and links. Brass marks the main action only. */
.btn { display: inline-flex; align-items: center; justify-content: center; min-block-size: 48px; padding-inline: 1.25rem; border-radius: 6px; font-weight: 500; font-size: 1rem; line-height: 1.2; text-decoration: none; }
.btn--primary { background: var(--brass); color: var(--bg); }
.btn--primary:hover { background: var(--text); }
.btn--ghost { border: 1px solid var(--teal); color: var(--text); }
.btn--ghost:hover { border-color: var(--teal-light); color: var(--teal-light); }
.textlink { color: var(--teal-light); text-underline-offset: 3px; display: inline-flex; align-items: center; min-block-size: 44px; }
.textlink:hover { color: var(--text); }
.btn--small { min-block-size: 40px; padding-inline: 0.9rem; font-size: 0.9rem; }
.head-cv { display: none; }
@media (min-width: 560px) { .head-cv { display: inline-flex; } }

/* Method: four steps on one line that fills on scroll (--method-progress from main.js).
   Vertical on phones, horizontal from 900px. Steps 01 to 03 are teal; the last is the brass outcome. */
.method__intro { color: var(--text-2); max-inline-size: 40rem; margin-block-end: 1.5rem; }
.method { --dot: 14px; position: relative; }
/* The track runs from the first dot to the last one; main.js measures the last step into --method-tail. */
.method__track { position: absolute; inset-block: calc(0.2rem + var(--dot) / 2) var(--method-tail, 0px); inset-inline-start: calc(var(--dot) / 2 - 1px); inline-size: 2px; background: var(--line); }
/* Without the script (or with reduced motion) the line is full and every dot filled. */
.method__fill { position: absolute; inset: 0; background: var(--teal); transform: scaleY(var(--method-progress, 1)); transform-origin: top; }
html:not(.counts-ready) .method__dot { background: var(--teal); }
html:not(.counts-ready) .method__step--end .method__dot { background: var(--brass); border-color: var(--brass); }
.method__steps { position: relative; display: grid; gap: 1.75rem; }
.method__step { position: relative; display: grid; gap: 0.3rem; padding-inline-start: calc(var(--dot) + 1.1rem); }
.method__dot { position: absolute; inset-block-start: 0.2rem; inset-inline-start: 0; inline-size: var(--dot); block-size: var(--dot); border-radius: 50%; border: 2px solid var(--teal); background: var(--bg); }
.method__step.is-on .method__dot { background: var(--teal); }
.method__step--end.is-on .method__dot { background: var(--brass); border-color: var(--brass); }
.method__num { color: var(--teal-light); font-family: var(--font-mono); font-size: 0.85rem; line-height: 1.4; }
.method__step--end .method__num { color: var(--brass); }
.method__label { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); }
.method__text { color: var(--text-2); max-inline-size: 30rem; }
.method__link { min-block-size: 44px; }
/* The strip version at the top of Projects: one horizontal row at every width, labels jump to their group. */
.method--strip { margin-block: 1.75rem 0.5rem; }
.method--strip .method__track { inset-block: calc(var(--dot) / 2 - 1px) auto; inset-inline: calc(var(--dot) / 2) calc((100% - 1.5rem) / 4 - var(--dot) / 2); inline-size: auto; block-size: 2px; }
.method--strip .method__fill { transform: scaleX(var(--method-progress, 1)); transform-origin: left; }
html[dir='rtl'] .method--strip .method__fill { transform-origin: right; }
.method--strip .method__steps { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; }
.method--strip .method__step { padding-inline-start: 0; padding-block-start: calc(var(--dot) + 0.7rem); gap: 0.1rem; }
.method--strip .method__dot { inset-block-start: 0; }
.method--strip .method__label { color: var(--text); font-family: var(--font-head); font-size: clamp(1rem, 0.85rem + 0.8vw, 1.5rem); text-decoration: none; min-block-size: 44px; display: inline-flex; align-items: start; }
.method--strip .method__label:hover { color: var(--teal-light); }
.method--strip .method__step--end .method__label { color: var(--brass); }
.work__intro { margin-block-end: 0.5rem; }
.group__head { display: grid; gap: 0.25rem; padding-block-end: 0.6rem; border-block-end: 1px solid var(--line); }
.group__head .group__title { padding: 0; border: 0; }
.group__text { color: var(--text-2); font-size: 0.95rem; }
.experience__intro { margin-block-end: 1.75rem; }
.contact__posts { margin-block-start: 1.25rem; }
.contact__posts p { color: var(--text-3); font-size: 0.9rem; }
@media (min-width: 900px) {
  .method--strip .method__steps { gap: 1.5rem; }
  .method--strip .method__track { inset-inline: calc(var(--dot) / 2) calc((100% - 4.5rem) / 4 - var(--dot) / 2); }
}
@media (min-width: 900px) {
  .method__track { inset-block: calc(var(--dot) / 2 - 1px) auto; inset-inline: calc(var(--dot) / 2) calc((100% - 4.5rem) / 4 - var(--dot) / 2); inline-size: auto; block-size: 2px; }
  .method__fill { transform: scaleX(var(--method-progress, 1)); transform-origin: left; }
  html[dir='rtl'] .method__fill { transform-origin: right; }
  .method__steps { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; }
  .method__step { padding-inline-start: 0; padding-block-start: calc(var(--dot) + 1.1rem); }
  .method__dot { inset-block-start: 0; }
}

/* The rail: a faint base line, a teal line that grows to the reading point (set by main.js),
   and one node per section that fills once reached. Contact, the last stop, fills brass. */
.route { position: relative; padding-block-end: 2rem; }
.route::before, .route::after { content: ''; position: absolute; inset-block: calc(var(--node) / -2) 0; inset-inline-start: calc(var(--node) / 2 - 0.5px); inline-size: 1px; background: var(--teal); }
.route::before { opacity: 0.3; }
.route::after { transform: scaleY(var(--rail-progress, 0)); transform-origin: top; }

/* Section heading band: a full-bleed panel the grid shows through, with drawing-style corner ticks. */
.stop { position: relative; padding-inline-start: var(--rail-gap); padding-block-start: clamp(3rem, 7vw, 5.5rem); }
.stop__head { position: relative; padding-block: 24px; margin-block-end: clamp(1.75rem, 3vw, 2.75rem); }
.stop__head::before { content: ''; position: absolute; z-index: -1; inset-block: 0; inset-inline: -100vw; background: rgb(16 36 43 / 0.88); border-block: 1px solid var(--line); }
.stop__head::after {
  content: ''; position: absolute; inset-block: 9px; inset-inline: -12px 0; pointer-events: none;
  background:
    linear-gradient(var(--teal) 0 0) left top / 10px 1px, linear-gradient(var(--teal) 0 0) left top / 1px 10px,
    linear-gradient(var(--teal) 0 0) right top / 10px 1px, linear-gradient(var(--teal) 0 0) right top / 1px 10px,
    linear-gradient(var(--teal) 0 0) left bottom / 10px 1px, linear-gradient(var(--teal) 0 0) left bottom / 1px 10px,
    linear-gradient(var(--teal) 0 0) right bottom / 10px 1px, linear-gradient(var(--teal) 0 0) right bottom / 1px 10px;
  background-repeat: no-repeat;
}
.stop__node { position: absolute; z-index: 1; inset-block-start: calc(24px + 0.75rem - var(--node) / 2); inset-inline-start: calc(var(--rail-gap) * -1); inline-size: var(--node); block-size: var(--node); border-radius: 50%; background: var(--bg); border: 1.5px solid var(--teal); }
.stop__num { display: block; color: var(--teal-light); font-family: var(--font-mono); font-size: 0.95rem; line-height: 1.5rem; }
.stop.is-reached .stop__node { background: var(--teal); }
#contact.is-reached .stop__node { background: var(--brass); border-color: var(--brass); transform: scale(1.25); }

/* Beliefs: three working rules in large serif type, each with the proof that backs it. */
.beliefs { display: grid; }
.beliefs li { padding-block: 1.1rem; border-block-start: 1px solid var(--line); }
.beliefs li:last-child { border-block-end: 1px solid var(--line); }
.belief { color: var(--text); font-family: var(--font-head); font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2.1rem); line-height: 1.25; }
.belief__proof { color: var(--text-2); font-size: 0.95rem; line-height: 1.5; margin-block-start: 0.35rem; }

/* About */
.prose { max-inline-size: 38rem; }
.prose p + p { margin-block-start: 1rem; }

/* Services */
.cells { display: grid; border-block-end: 1px solid var(--line); }
.cells > li { padding-block: 1.5rem; border-block-start: 1px solid var(--line); }
.cells h3 { margin-block-end: 0.5rem; }
.cells p { color: var(--text-2); }
@media (min-width: 720px) {
  .cells { grid-template-columns: 1fr 1fr; }
  .cells > li { padding-inline-end: 2.5rem; }
  .cells > li:nth-child(even) { padding-inline-start: 2.5rem; padding-inline-end: 0; border-inline-start: 1px solid var(--line); }
}

/* Proof */
.proof { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.proof li { background: var(--surface); padding: 1.1rem 0.9rem; }
.proof__value { color: var(--text); font-family: var(--font-mono); font-weight: 500; font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.75rem); line-height: 1.15; letter-spacing: -0.02em; }
.proof__value.brass { color: var(--brass); }
.proof__label { color: var(--text); font-size: 0.95rem; line-height: 1.4; margin-block-start: 0.5rem; }
.proof__detail { color: var(--text-2); font-size: 0.9rem; line-height: 1.4; margin-block-start: 0.25rem; }
.proof__note { color: var(--text-3); font-size: 0.925rem; margin-block-start: 0.9rem; max-inline-size: 38rem; }
.proof__value .comma { margin-inline: -0.22em; }
/* Before and after bars: before in muted grey, after in brass, figures printed beside each bar. */
.bars { margin-block-start: 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1rem; }
.bars__heading { font-size: 1.1rem; margin-block-end: 0.75rem; }
.bars__list { display: grid; gap: 1.25rem; }
.bars__label { color: var(--text); font-size: 0.975rem; line-height: 1.45; margin-block-end: 0.35rem; }
.bars__row { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr) 6.5rem; align-items: center; gap: 0.6rem; min-block-size: 26px; }
.bars__key { color: var(--text-3); font-size: 0.85rem; }
.bars__track { block-size: 12px; }
.bars__bar { display: block; block-size: 100%; inline-size: var(--w); min-inline-size: 3px; border-radius: 2px; }
.bars__bar--before { background: #5F716E; }
.bars__bar--after { background: var(--brass); }
.bars__value { color: var(--text-2); font-family: var(--font-mono); font-size: 0.9rem; }
.bars__row:last-of-type .bars__value { color: var(--text); }
.bars__note { color: var(--text-3); font-size: 0.85rem; line-height: 1.4; margin-block-start: 0.3rem; }
.bars__item--plain .bars__row { grid-template-columns: 3.5rem minmax(0, 1fr); }
/* Bars grow from zero when their item scrolls in (main.js adds .counts-ready and .is-in). */
@media (prefers-reduced-motion: no-preference) {
  .counts-ready .bars__bar { transition: inline-size 2.4s cubic-bezier(0.22, 0.61, 0.36, 1); }
  .counts-ready .bars__item:not(.is-in) .bars__bar { inline-size: 0; }
  /* Flow schematics: dot, then the line to the next dot, then that dot, and so on. */
  .counts-ready .schematic[data-draw] .sch__seg { stroke-dashoffset: var(--len); transition: stroke-dashoffset 0.45s ease-out calc(var(--i) * 0.6s + 0.3s); }
  .counts-ready .schematic[data-draw].is-in .sch__seg { stroke-dashoffset: 0; }
  .counts-ready .schematic[data-draw] .sch__step { opacity: 0; transition: opacity 0.35s ease-out calc(var(--i) * 0.6s); }
  .counts-ready .schematic[data-draw].is-in .sch__step { opacity: 1; }
}
@media (min-width: 900px) {
  .bars { padding: 1.5rem 1.75rem; }
  .bars__list { grid-template-columns: 1fr 1fr; gap: 1.5rem 3rem; }
}
/* Phones: one result per row, the figure beside its label, so all eight scan in one pass. */
@media (max-width: 479px) {
  .proof { grid-template-columns: 1fr; }
  .proof li { display: grid; grid-template-columns: 5.25rem minmax(0, 1fr); column-gap: 0.9rem; align-items: baseline; padding: 0.9rem 1rem; }
  .proof__value { grid-row: span 2; font-size: 1.55rem; }
  .proof__label { margin-block-start: 0; }
}
@media (min-width: 960px) {
  .proof { grid-template-columns: repeat(4, 1fr); }
  .proof li { padding: 1.75rem 1.5rem; }
}

/* Work: every project is a panel. The card shows its result; the full fields open in the case study. */
.projects { display: grid; gap: 1rem; }
.project { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.project__body { flex: 1; display: grid; gap: 1rem; align-content: start; padding: 1.25rem; }
.project__intro { display: grid; gap: 0.4rem; align-content: start; justify-items: start; }
.project__context { color: var(--text-2); font-size: 0.95rem; line-height: 1.5; }
.project__outcome p + p { margin-block-start: 0.2rem; }
.project__label { color: var(--text-3); font-family: var(--font-mono); font-size: 0.85rem; line-height: 1.4; }
.project__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; padding: 0.9rem 1.25rem; border-block-start: 1px solid var(--line); }
.project__key { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.7rem; color: var(--text-2); line-height: 1.4; }
.project__key-value { font-family: var(--font-mono); font-size: 2.1rem; font-weight: 500; line-height: 1; }
.project__open { margin-inline-start: auto; }
.project__key-label { color: var(--text-2); }
.project__sketch { padding: 1.1rem 1.25rem 0; }
.project__sketch .schematic, .case__sketch .schematic { inline-size: 100%; max-inline-size: 420px; block-size: auto; margin-inline: auto; display: block; }
.case__sketch { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }

/* Schematics: teal is process, one filled brass shape is the outcome. */
.schematic text { font-family: var(--font-body); }
.sch__line { stroke: var(--teal); stroke-width: 1.5; }
.sch__line--end { stroke: var(--brass); }
.sch__box { fill: var(--bg); stroke: var(--teal); stroke-width: 1.5; }
.sch__dot { fill: var(--bg); stroke: var(--teal); stroke-width: 2; }
.sch__core { fill: var(--surface); stroke: var(--teal); stroke-width: 2; }
.sch__ring { fill: none; stroke: var(--teal); stroke-opacity: 0.5; }
.sch__end { fill: var(--brass); }
.sch__exit { stroke: var(--text-3); stroke-dasharray: 3 3; }
.sch__text { fill: var(--text); }
.sch__text--strong { font-weight: 500; }
.sch__text--muted { fill: var(--text-3); }
.sch__text--on { fill: var(--bg); font-weight: 500; }
.badge { border: 1px solid var(--teal); border-radius: 4px; color: var(--teal-light); font-size: 0.875rem; line-height: 1.3; padding: 0.15rem 0.5rem; }
.fields { display: grid; gap: 0.9rem; }
.fields dt { color: var(--text-3); font-family: var(--font-mono); font-size: 0.85rem; line-height: 1.4; }
.fields dd { margin: 0; line-height: 1.55; }

@media (min-width: 720px) {
  .fields > div { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 1rem; }
}
/* Projects grouped by method step: a numbered heading, then the cards that prove that step. */
.projects { gap: 1.25rem; }
.project__title { font-size: var(--h3-size); }
.group { display: grid; gap: 1rem; margin-block-start: 1.5rem; }
.group__title { display: flex; align-items: baseline; gap: 0.6rem; padding-block-end: 0.5rem; border-block-end: 1px solid var(--line); font-size: 1.35rem; }
.group__num { color: var(--teal-light); font-family: var(--font-mono); font-size: 0.85rem; font-weight: 400; }
.group__cards { display: grid; gap: 1rem; }
@media (min-width: 900px) {
  .group__cards { grid-template-columns: 1fr 1fr; gap: 1.25rem; }
  .group__cards > :only-child { grid-column: 1 / -1; }
  .project__body { padding: 1.75rem; }
  .project__foot { padding: 1rem 1.75rem; }
  .project--lead .project__body { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); column-gap: 3rem; }
  .project--lead:has(.project__preview) .project__body { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
  .project--lead .project__preview { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
}

/* Frames for screenshots and diagrams: page background, 1px teal border */
.frame { background: var(--bg); border: 1px solid var(--teal); border-radius: var(--radius); padding: 0.75rem; }
.frame__title { color: var(--text); font-size: 0.95rem; line-height: 1.4; margin-block-end: 0.6rem; }
.frame__note { color: var(--text-3); font-size: 0.9rem; line-height: 1.5; margin-block-start: 0.6rem; }
.frame img { inline-size: 100%; border-radius: 6px; }

/* Diagrams. Teal is process, brass is outcome; each pair also differs in shape or label. */
.dia { inline-size: 100%; block-size: auto; overflow: visible; }
.dia text { font-family: var(--font-body); }
.dia .dia__mono { font-family: var(--font-mono); }
.dia__text { fill: var(--text); }
.dia__strong { fill: var(--text); font-weight: 500; }
.dia__muted { fill: var(--text-3); }
.dia__on-brass { fill: var(--bg); font-weight: 500; }
.dia__node { fill: var(--bg); stroke: var(--teal); stroke-width: 1.5; }
.dia__core { fill: var(--surface); stroke: var(--teal); stroke-width: 2; }
.dia__core-ring { fill: none; stroke: var(--teal); stroke-opacity: 0.5; }
.dia__spoke { stroke: var(--teal); }
.dia__stage { fill: var(--bg); stroke: var(--teal); stroke-width: 1.5; }
.dia__stage-end { fill: var(--brass); }
.dia__loss { stroke: var(--text-3); stroke-dasharray: 3 4; }
.dia__pill { fill: var(--surface); stroke: var(--line); }
.dia__pill--exit { fill: var(--bg); stroke: var(--text-3); stroke-dasharray: 3 4; }
.dia__grid { stroke: var(--line); }
.dia__bar-now { fill: var(--teal); }
.dia__bar-past { fill: none; stroke: var(--teal); stroke-width: 1.5; }
.dia--hub, .dia--funnel { max-inline-size: 460px; margin-inline: auto; }
.dia--narrow { max-inline-size: 480px; }
.dia--wide { display: none; }
@media (min-width: 900px) {
  .dia--narrow { display: none; }
  .dia--wide { display: block; }
}

/* Case study dialog */
.case { inline-size: min(48rem, calc(100vw - 1rem)); max-inline-size: none; max-block-size: calc(100dvh - 1rem); margin: auto; padding: 0; background: var(--surface); color: var(--text); border: 1px solid var(--teal); border-radius: var(--radius); }
.case::backdrop { background: rgba(5, 12, 15, 0.82); }
.case__inner { display: block; }
.case__head { position: sticky; inset-block-start: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 0.5rem; padding-inline: 1rem 0.5rem; background: var(--surface); border-block-end: 1px solid var(--line); }
.case__close { color: var(--teal-light); flex: none; }
.case__body { display: grid; gap: 1.25rem; padding: 1rem; }
@media (min-width: 720px) {
  .case__body { padding: 1.75rem; }
}

/* Experience: one card per company, roles inside. Closed cards still read as a CV line. */
.study__meta { display: flex; flex-wrap: wrap; gap: 0.15rem 1.25rem; color: var(--text-2); font-size: 0.95rem; line-height: 1.5; }
.jobs { display: grid; gap: 0.75rem; margin-block-start: 2rem; }
.job { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.job[open] { border-color: var(--teal); }
.job__summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.3rem 1rem; padding: 1rem 1.1rem; cursor: pointer; list-style: none; border-radius: var(--radius); }
.job__summary::-webkit-details-marker { display: none; }
.job__summary::after { content: '+'; grid-column: 2; grid-row: 1; align-self: center; color: var(--teal-light); font-family: var(--font-mono); font-size: 1.4rem; line-height: 1; }
.job[open] > .job__summary::after { content: '\2212'; }
.job__summary:hover .job__name { color: var(--teal-light); }
.job__line { grid-column: 1; grid-row: 1; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.15rem 1rem; }
.job__name { color: var(--text); font-family: var(--font-head); font-size: var(--h3-size); font-weight: var(--head-weight); line-height: var(--lh-head); }
.job__period { color: var(--teal-light); font-family: var(--font-mono); font-size: 0.85rem; line-height: 1.5; }
.job__roles { grid-column: 1 / -1; color: var(--text-2); font-size: 0.975rem; line-height: 1.5; }
.job__meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0.15rem 1.25rem; color: var(--text-3); font-size: 0.9rem; line-height: 1.5; }
.job__body { border-block-start: 1px solid var(--line); padding: 0.25rem 1.1rem 1.4rem; }
.job__about { color: var(--text-2); margin-block-start: 1rem; max-inline-size: 44rem; }
.role { margin-block-start: 1.25rem; max-inline-size: 46rem; }
.role + .role { padding-block-start: 1.25rem; border-block-start: 1px dashed var(--line); }
.role__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.15rem 1rem; }
.role h4 { font-size: 1.1rem; }
.role__period { color: var(--text-3); font-family: var(--font-mono); font-size: 0.85rem; line-height: 1.5; }
.role__summary { margin-block-start: 0.4rem; }
.role__points { list-style: disc; padding-inline-start: 1.15rem; margin-block-start: 0.5rem; color: var(--text-2); }
.role__points li + li { margin-block-start: 0.35rem; }
.role__points li::marker { color: var(--teal); }
.role__related { margin-block-start: 0.6rem; }
.role__related p { color: var(--text-3); font-size: 0.875rem; }
.role__related ul { display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
@media (min-width: 900px) {
  .job__summary { grid-template-columns: 22rem minmax(0, 1fr) auto; padding: 1.25rem 1.75rem; }
  .job__summary::after { grid-column: 3; }
  .job__line { flex-direction: column; justify-content: start; }
  .job__roles { grid-column: 2; grid-row: 1 / span 2; }
  .job__meta { grid-column: 1; }
  .job__body { padding: 0.25rem 1.75rem 1.75rem; }
}

/* Raw list of work in "What I do": small outline dots, the same mark as the path */
.ticks { display: grid; gap: 0.35rem; margin-block-start: 0.6rem; }
.ticks li { position: relative; padding-inline-start: 1.15rem; color: var(--text-2); line-height: 1.5; }
.ticks li::before { content: ''; position: absolute; inset-inline-start: 0; inset-block-start: 0.55em; inline-size: 7px; block-size: 7px; border-radius: 50%; border: 1.5px solid var(--teal); }

/* Skills, education, featured */
.rowgroup { display: grid; gap: 0.5rem; padding-block: 1.25rem; border-block-start: 1px solid var(--line); }
.inline { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.inline li { border: 1px solid var(--line); border-radius: 4px; padding: 0.2rem 0.65rem; color: var(--text-2); font-size: 0.95rem; line-height: 1.55; }
.level { color: var(--text-3); margin-inline-start: 0.5rem; }
.studies li { padding-block: 1.25rem; border-block-start: 1px solid var(--line); }
.studies + .rowgroup { margin-block-start: 0; }
.posts li { padding-block: 1.25rem; border-block-start: 1px solid var(--line); max-inline-size: 44rem; }
.posts p { margin-block-start: 0.4rem; color: var(--text-2); }
@media (min-width: 720px) {
  .rowgroup { grid-template-columns: 15rem minmax(0, 1fr); gap: 2rem; }
}

/* Testimonials */
.quotes { display: grid; gap: 1.5rem; }
.quote { border-inline-start: 1px solid var(--teal); padding-inline-start: 1rem; max-inline-size: 42rem; }
.quote blockquote { color: var(--text); }
.quote figcaption { display: flex; flex-wrap: wrap; gap: 0.15rem 1rem; color: var(--text-3); font-size: 0.95rem; margin-block-start: 0.5rem; }

/* Contact */
.contact__text { max-inline-size: 38rem; }
.contact__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-block-start: 1.5rem; }

/* Footer */
.site-foot { border-block-start: 1px solid var(--line); margin-block-start: 3rem; padding-block: 1.5rem; color: var(--text-3); font-size: 0.925rem; }

/* Without JavaScript every part stays readable */
html:not(.js) button.tool, html:not(.js) .project__open { display: none; }
html:not(.js) .nav { display: block; position: static; background: none; border: 0; }
html:not(.js) .site-head__row { flex-wrap: wrap; }
html:not(.js) .nav ul { display: flex; flex-wrap: wrap; gap: 0 1rem; }
html:not(.js) .nav a { padding-inline: 0; }
html:not(.js) .site-head { position: static; }
html:not(.js) dialog.case { display: block; position: static; inline-size: auto; max-block-size: none; margin: 0; }
html:not(.js) .project { grid-column: 1 / -1; }

/* Motion: the hero path draws once, sections reveal gently */
@media (prefers-reduced-motion: no-preference) {
  .stop { transition: opacity 0.6s ease-out, transform 0.6s ease-out; }
  .pre-reveal { opacity: 0; transform: translateY(14px); }
  .case[open] { animation: appear 0.2s ease-out; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
@keyframes draw { from { inline-size: 0; } }
@keyframes appear { from { opacity: 0; } }

@media print {
  .pre-reveal { opacity: 1; transform: none; }
  .site-head { position: static; }
}

/* Hero figures link to their project card. */
.hero__stat-link { display: grid; gap: 0.2rem; color: inherit; text-decoration: none; }
.hero__stat-link:hover .hero__stat-label, .hero__stat-link:focus-visible .hero__stat-label { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
/* What I am looking for. */
.hero__looking, .contact__looking { color: var(--text-2); line-height: 1.55; }
.hero__looking strong, .contact__looking strong { color: var(--text); font-weight: 500; }
.contact__looking { margin-block: 0.5rem 1.25rem; max-width: 62ch; }
/* Demo slot: hidden until the file exists (build.mjs). */
.demo { margin-block-start: 1rem; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.demo video, .demo img { display: block; width: 100%; height: auto; }
.demo__caption { padding: 0.6rem 0.9rem; color: var(--text-2); font-size: 0.875rem; }
