/* ============================================================
   Anthony Hamamji — portfolio
   Single stylesheet, light only. Load css/fonts.css before this file.
   ============================================================ */

:root {
  /* Warm Alabaster / Soft Charcoal / Terracotta.
     Roughly 90% background, 7% type, 3% accent. */
  --bg:          #FAF9F6;   /* Warm Alabaster */
  --bg-soft:     #F3F1EA;
  --bg-inset:    #ECE9E0;
  --text:        #2B2B2B;   /* Soft Charcoal */
  --text-muted:  #5F5C56;
  --text-faint:  #8A867E;
  --border:      #E5E1D8;
  --border-firm: #D2CDC1;

  /* Terracotta #C87A53 is 3.2:1 on Alabaster -- fine for rules, borders, hover
     and large display text, but it FAILS WCAG AA (4.5:1) for normal-size text
     and for light text on a terracotta fill. So the accent has two tiers:
       --accent      the exact brand color, for >=3:1 uses
       --accent-deep 4.6:1, for inline links and button fills
     They read as the same color family. Do not swap one for the other. */
  --accent:      #C87A53;
  --accent-deep: #A85A34;
  /* On the --accent-soft tint, --accent-deep drops to 4.15:1. Text sitting on the
     tint uses this darker step instead (5.0:1). */
  --accent-deepest: #94502E;
  --accent-soft: #F4E7DE;
  --accent-text: #A85A34;

  --radius: 8px;
  --radius-lg: 12px;
  --page: 1080px;
  --prose: 72ch;

  --font: "Almarai", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;

  --shadow: 0 1px 2px rgba(60, 50, 38, .05), 0 1px 3px rgba(60, 50, 38, .06);
  --shadow-lift: 0 4px 12px rgba(60, 50, 38, .09), 0 2px 4px rgba(60, 50, 38, .06);

  --header-h: 60px;
}

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

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

/* Smooth scrolling must not be forced on people who ask for reduced motion. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

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

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Almarai ships 300/400/700/800 only -- there is no 500 or 600. Asking for an
   unavailable weight makes the browser synthesise a fake bold, which looks muddy.
   Use only 300, 400, 700 or 800. */
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 2rem; letter-spacing: -.02em; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.12rem; }
h4 { font-size: 1rem; }
p  { margin: 0 0 1em; }

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

/* ---------- layout ---------- */

.wrap { max-width: var(--page); margin: 0 auto; padding: 0 24px; }
.section { padding: 56px 0; }
.section + .section { border-top: 1px solid var(--border); }

.section-head { display: flex; align-items: baseline; justify-content: space-between;
                gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.section-head h2 { margin: 0; }

.eyebrow { font-size: .75rem; font-weight: 700; letter-spacing: .08em;
           text-transform: uppercase; color: var(--text-faint); margin: 0 0 8px; }

/* ---------- header / nav ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--border);
  transition: background .25s ease, border-color .25s ease;
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; min-height: var(--header-h); flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 1rem; color: var(--text); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; color: var(--accent-deep); }

.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  color: var(--text-muted); font-size: .9rem; font-weight: 400;
  padding: 6px 11px; border-radius: 6px;
  transition: color .18s ease, background .18s ease;
}
.nav a:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--accent-deepest); background: var(--accent-soft); }

/* --- header over the full-bleed hero photo -----------------------------------
   On the home page the header floats over the photograph until you scroll past
   it. The photo's top is bright sky, so the links get a dark scrim behind them
   (.site-header::before) rather than relying on the image being dark enough. */

body.has-hero .site-header {
  position: fixed; left: 0; right: 0;
  background: transparent; backdrop-filter: none; border-bottom-color: transparent;
}
body.has-hero .site-header::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(to bottom, rgba(20, 16, 12, .55), rgba(20, 16, 12, 0));
  transition: opacity .25s ease;
}
body.has-hero .site-header .brand,
body.has-hero .site-header .nav a { color: rgba(255, 253, 250, .88); }
body.has-hero .site-header .brand:hover,
body.has-hero .site-header .nav a:hover {
  color: #fff; background: rgba(255, 255, 255, .14);
}
body.has-hero .site-header .nav a[aria-current="page"] {
  color: #fff; background: rgba(255, 255, 255, .18);
}

/* once scrolled past the hero, revert to the normal solid bar */
body.has-hero .site-header.is-solid {
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom-color: var(--border);
}
body.has-hero .site-header.is-solid::before { opacity: 0; }
body.has-hero .site-header.is-solid .brand { color: var(--text); }
body.has-hero .site-header.is-solid .nav a { color: var(--text-muted); }
body.has-hero .site-header.is-solid .brand:hover { color: var(--accent-deep); }
body.has-hero .site-header.is-solid .nav a:hover { color: var(--text); background: var(--bg-soft); }
body.has-hero .site-header.is-solid .nav a[aria-current="page"] {
  color: var(--accent-deepest); background: var(--accent-soft);
}

/* ---------- hero (interior pages) ---------- */

.hero { padding: 64px 0 48px; }
.hero h1 { font-size: clamp(2rem, 5vw, 2.75rem); margin-bottom: 12px; }
.hero .lede { font-size: 1.12rem; color: var(--text-muted); max-width: 62ch; margin-bottom: 22px; }
.hero .lede strong { color: var(--text); font-weight: 700; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- home: full-bleed photograph ---------- */

.photo-hero {
  position: relative;
  height: 100vh;
  height: 100svh;          /* excludes mobile browser chrome; ignored where unsupported */
  min-height: 460px;
  width: 100%;
  overflow: hidden;
  background: var(--bg-inset);
}

.photo-hero img {
  width: 100%; height: 100%;
  object-fit: cover;
  /* Source is a tall portrait; a wide viewport shows only a band of it.
     The Y value keeps the face in frame -- raise it to show more sky. */
  object-position: 50% 26%;
  display: block;
}

/* Scrim under the name. It has to work over the brightest thing in the frame --
   a white t-shirt -- not just the stone wall, so it is deliberately heavy at the
   bottom. Measured in scripts/check_contrast.py against a pure white backdrop. */
.photo-hero::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 72%;
  background: linear-gradient(to top,
              rgba(22, 17, 12, .88) 0%,
              rgba(22, 17, 12, .72) 18%,
              rgba(22, 17, 12, .38) 46%,
              rgba(22, 17, 12, 0)   100%);
  pointer-events: none;
}

.photo-hero .hero-caption {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 0 0 clamp(32px, 6vh, 68px);
}
.photo-hero .hero-caption .wrap {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
}

.hero-name {
  margin: 0;
  font-size: clamp(2.1rem, 7.5vw, 5rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -.025em;
  color: #FFFDFA;
  text-shadow: 0 2px 24px rgba(0, 0, 0, .35);
}
.hero-role {
  margin: .3em 0 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.05rem, 2.6vw, 1.7rem);
  line-height: 1.2;
  color: rgba(255, 253, 250, .9);
  text-shadow: 0 2px 18px rgba(0, 0, 0, .35);
}

.scroll-cue {
  display: flex; align-items: center; gap: 8px;
  padding-bottom: 6px;
  font-size: .74rem; font-weight: 400; letter-spacing: .14em; text-transform: uppercase;
  color: rgba(255, 253, 250, .72); white-space: nowrap;
}
.scroll-cue:hover { color: #fff; text-decoration: none; }
.scroll-cue svg { animation: nudge 2.4s ease-in-out infinite; }

@keyframes nudge {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(4px); }
}
@media (prefers-reduced-motion: reduce) {
  .scroll-cue svg { animation: none; }
}

/* ---------- home: editorial intro ---------- */

.intro { padding: clamp(72px, 12vh, 140px) 0 clamp(56px, 9vh, 104px); }

.intro-headline {
  margin: 0 0 .9em;
  /* em-based so the measure scales with the font: ~35 characters per line, which
     lands the headline at 5-6 lines. A ch-based cap wraps it far too narrow. */
  max-width: 17em;
  font-size: clamp(1.75rem, 4.4vw, 3.5rem);
  font-weight: 400;
  line-height: 1.14;
  letter-spacing: -.02em;
  color: var(--text);
  text-wrap: balance;
}
.intro-headline em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -.01em;
}

.intro-bio { max-width: 58ch; }
.intro-bio p {
  font-size: clamp(1rem, 1.35vw, 1.12rem);
  line-height: 1.7;
  color: var(--text-muted);
  margin: 0 0 1.1em;
}
.intro-bio p:last-child { margin-bottom: 0; }

/* ---------- home: contact row ---------- */

.contact-row {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
  margin-top: clamp(40px, 6vh, 72px);
}
.contact-link {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 18px 11px 15px;
  border: 1px solid var(--border-firm); border-radius: 999px;
  font-size: .92rem; font-weight: 400; color: var(--text);
  background: transparent;
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}
.contact-link svg {
  width: 18px; height: 18px; flex: none;
  stroke: var(--accent); stroke-width: 1.6; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
  transition: stroke .18s ease;
}
.contact-link:hover {
  text-decoration: none;
  color: var(--accent-deep);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.contact-link:hover svg { stroke: var(--accent-deep); }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radius);
  font-size: .9rem; font-weight: 400; line-height: 1.2;
  border: 1px solid var(--border-firm); color: var(--text);
  background: var(--bg); cursor: pointer; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--bg-soft); text-decoration: none; border-color: var(--text-faint); }
/* Deep terracotta fill: alabaster on --accent is only 3.3:1, on --accent-deep 4.6:1 */
.btn-primary { background: var(--accent-deep); border-color: var(--accent-deep); color: var(--bg); }
.btn-primary:hover { background: #94502E; border-color: #94502E; color: var(--bg); }
.btn-sm { padding: 6px 12px; font-size: .82rem; }

/* ---------- cards ---------- */

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.card {
  display: flex; flex-direction: column;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--bg); overflow: hidden;
  transition: box-shadow .15s, border-color .15s, transform .15s;
}
.card:hover { box-shadow: var(--shadow-lift); border-color: var(--border-firm); transform: translateY(-2px); }
.card a.card-link { color: inherit; }
.card a.card-link:hover { text-decoration: none; }

.card-thumb {
  aspect-ratio: 16 / 9; background: var(--bg-inset);
  border-bottom: 1px solid var(--border); overflow: hidden;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }

.card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.card-body h3 { margin: 0 0 4px; font-size: 1.05rem; }
.card-body h3 a { color: var(--text); }
.card-body h3 a:hover { color: var(--accent); text-decoration: none; }
.card-meta { font-size: .8rem; color: var(--text-faint); margin: 0 0 10px; }
.card-summary { font-size: .9rem; color: var(--text-muted); margin: 0 0 14px; flex: 1; }
.card-foot { margin-top: auto; }

/* ---------- project category groups ---------- */

.project-group + .project-group { margin-top: clamp(48px, 7vh, 80px); }

.group-heading {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 22px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  font-size: .82rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-muted);
}
.group-heading::before {
  content: ""; width: 22px; height: 2px; flex: none;
  background: var(--accent); border-radius: 2px;
}
.group-count {
  margin-left: auto;
  font-size: .78rem; font-weight: 400; letter-spacing: .04em;
  color: var(--text-faint);
}

/* ---------- deep-dive call to action ---------- */

.deepdive-cta {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  margin-top: 24px; padding: 18px 22px;
  border: 1px solid var(--accent); border-radius: var(--radius-lg);
  background: var(--accent-soft); color: var(--text);
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.deepdive-cta:hover {
  text-decoration: none; transform: translateY(-1px);
  background: #F0DDD0; border-color: var(--accent-deep);
}
.deepdive-label {
  display: block; font-weight: 700; font-size: 1rem; color: var(--accent-deepest);
}
.deepdive-blurb {
  display: block; margin-top: 3px; font-size: .9rem; color: var(--text-muted);
}
.deepdive-arrow { flex: none; color: var(--accent-deep); }
.deepdive-cta:hover .deepdive-arrow { transform: translateX(3px); }
.deepdive-arrow { transition: transform .18s ease; }

.prose > .deepdive-cta { margin: 24px 0 8px; }

/* ---------- in-page section nav (deep-dive page) ---------- */

.section-nav {
  position: sticky; top: var(--header-h); z-index: 40;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--border);
}
.section-nav .wrap {
  display: flex; gap: 6px; align-items: center;
  overflow-x: auto; scrollbar-width: none;
  padding-top: 10px; padding-bottom: 10px;
}
.section-nav .wrap::-webkit-scrollbar { display: none; }
.section-nav a {
  white-space: nowrap; flex: none;
  padding: 6px 12px; border-radius: 999px;
  font-size: .82rem; font-weight: 400; color: var(--text-muted);
  transition: color .18s ease, background .18s ease;
}
.section-nav a:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.section-nav a.is-active {
  color: var(--accent-deepest); background: var(--accent-soft); font-weight: 700;
}
.section-nav .nav-num {
  font-family: var(--mono); font-size: .74rem; opacity: .65; margin-right: 6px;
}

/* ---------- deep-dive page sections ---------- */

.sys-page { padding-bottom: 72px; }

.sys-hero { padding: clamp(40px, 7vh, 72px) 0 clamp(28px, 4vh, 44px); }
.sys-hero h1 {
  font-size: clamp(1.9rem, 4.6vw, 3.2rem);
  letter-spacing: -.025em; margin-bottom: 16px; text-wrap: balance;
}
.sys-hero .lede { font-size: 1.06rem; color: var(--text-muted); max-width: 62ch; }

.sys-section { padding: clamp(44px, 6vh, 72px) 0; border-top: 1px solid var(--border); }
.sys-section > .wrap > :first-child { margin-top: 0; }

.sys-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 8px; }
.sys-num {
  font-family: var(--mono); font-size: .8rem; font-weight: 400;
  color: var(--accent-deep); letter-spacing: .04em; flex: none;
}
.sys-head h2 {
  margin: 0; font-size: clamp(1.3rem, 2.6vw, 1.9rem); letter-spacing: -.015em;
}
.sys-intro { color: var(--text-muted); max-width: 68ch; margin-bottom: 28px; }

.sys-section h3 {
  margin: 36px 0 10px; font-size: 1.05rem;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.sys-section p { max-width: 72ch; color: var(--text-muted); }
.sys-section p strong { color: var(--text); font-weight: 700; }
.sys-section ul { max-width: 72ch; color: var(--text-muted); padding-left: 20px; }
.sys-section li { margin-bottom: .4em; }

/* ---------- power chain flow diagram (CSS only, no image) ---------- */

.sys-flow {
  display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap;
  margin: 28px 0 8px;
}
.flow-node {
  flex: 1 1 150px; min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--border-firm); border-radius: var(--radius);
  background: var(--bg-soft);
}
/* A chain long enough to wrap. Without this the nodes still grow to fill their
   row, so a trailing row of two ends up twice the width of the five above it. */
.sys-flow.is-long .flow-node { flex: 0 1 190px; }

.flow-node.is-stage { border-color: var(--accent); background: var(--accent-soft); }
.flow-stage-num {
  display: block; font-family: var(--mono); font-size: .7rem;
  color: var(--accent-deep); letter-spacing: .06em; margin-bottom: 4px;
}
.flow-name { display: block; font-weight: 700; font-size: .92rem; color: var(--text); }
.flow-spec { display: block; margin-top: 3px; font-size: .8rem; color: var(--text-muted); }
.flow-arrow {
  flex: 0 0 auto; align-self: center;
  color: var(--accent); font-size: 1.1rem; line-height: 1;
}

/* ---------- spec tables ---------- */

.spec-table { margin: 20px 0 8px; }
.spec-table table { font-size: .88rem; }
.spec-table td:first-child { color: var(--text); width: 46%; }
.spec-table td:last-child { font-family: var(--mono); font-size: .84rem; color: var(--text-muted); }
.spec-table caption {
  caption-side: top; text-align: left;
  font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-faint); padding-bottom: 8px;
}

/* ---------- optional per-section figure on project detail pages ---------- */

.section-figure { margin: 22px 0 28px; }
.section-figure img {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

/* ---------- tags ---------- */

.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  font-size: .72rem; font-weight: 400; padding: 3px 9px; border-radius: 999px;
  background: var(--bg-inset); color: var(--text-muted); white-space: nowrap;
}
.tag-accent { background: var(--accent-soft); color: var(--accent-text); }

/* ---------- experience: role cards ---------- */

.role-list { display: grid; gap: 20px; }

/* One column by default -- a role with no photo must not leave its text in the
   narrow image column. The photo column only appears when there is a photo. */
.role-card {
  display: grid; grid-template-columns: 1fr;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--bg); overflow: hidden; color: var(--text);
  transition: box-shadow .15s, border-color .15s, transform .15s;
}
/* Only the roles that lead somewhere respond to the pointer. A card with no
   detail page should not advertise one. */
.role-card.is-linked { cursor: pointer; }
.role-card.is-linked:hover {
  text-decoration: none; transform: translateY(-2px);
  box-shadow: var(--shadow-lift); border-color: var(--border-firm);
}

.role-card.has-photo { grid-template-columns: 260px 1fr; }
.role-photo { background: var(--bg-inset); border-right: 1px solid var(--border); }
.role-photo img { width: 100%; height: 100%; min-height: 180px; object-fit: cover; display: block; }

.role-body { padding: 22px 24px 24px; }
.role-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: baseline; }
.role-org {
  display: flex; align-items: center; gap: 8px;
  margin: 0; font-weight: 700; font-size: 1.1rem;
}
.role-arrow { flex: none; color: var(--accent-deep); transition: transform .18s ease; }
.role-card.is-linked:hover .role-arrow { transform: translateX(3px); }
.role-title { color: var(--accent-text); font-weight: 400; font-size: .93rem; margin: 2px 0 0; }
.role-when { text-align: right; font-size: .82rem; color: var(--text-faint); white-space: nowrap; }
.role-where { font-size: .82rem; color: var(--text-faint); }
.role-blurb { margin: 14px 0 0; font-size: .95rem; color: var(--text); }
.role-card ul { margin: 12px 0 0; padding-left: 18px; }
.role-card li { margin-bottom: 6px; color: var(--text-muted); font-size: .92rem; }
.role-cue {
  display: inline-block; margin-top: 14px;
  font-size: .82rem; font-weight: 700; letter-spacing: .04em;
  color: var(--accent-deep);
}
.role-card.is-linked:hover .role-cue { text-decoration: underline; }

/* ---------- education ---------- */

.xp { border-left: 2px solid var(--border); padding-left: 24px; margin-left: 4px; }
.xp-item { position: relative; padding-bottom: 32px; }
.xp-item:last-child { padding-bottom: 0; }
.xp-item::before {
  content: ""; position: absolute; left: -31px; top: 7px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--border-firm);
}
.xp-item.current::before { background: var(--accent); border-color: var(--accent); }
.xp-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: baseline; }
.xp-org { font-weight: 700; font-size: 1.05rem; margin: 0; }
.xp-role { color: var(--accent-text); font-weight: 400; font-size: .93rem; margin: 2px 0 0; }
.xp-when { font-size: .82rem; color: var(--text-faint); white-space: nowrap; }
.xp-where { font-size: .82rem; color: var(--text-faint); }
.xp ul { margin: 10px 0 0; padding-left: 18px; }
.xp li { margin-bottom: 6px; color: var(--text-muted); font-size: .92rem; }

/* ---------- skills ---------- */

.skill-group { margin-bottom: 20px; }
.skill-group h4 { margin: 0 0 8px; font-size: .82rem; letter-spacing: .05em;
                  text-transform: uppercase; color: var(--text-faint); font-weight: 700; }

/* ---------- report list ---------- */

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.filter {
  font-size: .85rem; font-weight: 400; padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--border-firm); background: var(--bg);
  color: var(--text-muted); cursor: pointer;
}
.filter:hover { background: var(--bg-soft); color: var(--text); }
.filter[aria-pressed="true"] {
  background: var(--accent-deep); border-color: var(--accent-deep); color: var(--bg);
}

.report-row {
  display: flex; gap: 20px; align-items: center; justify-content: space-between;
  padding: 18px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.report-row:last-child { border-bottom: none; }
.report-main { flex: 1; min-width: 260px; }
.report-main h3 { margin: 0 0 3px; font-size: 1rem; }
.report-main h3 a { color: var(--text); }
.report-main h3 a:hover { color: var(--accent); text-decoration: none; }
.report-meta { font-size: .8rem; color: var(--text-faint); margin: 0 0 6px; }
.report-blurb { font-size: .88rem; color: var(--text-muted); margin: 0; max-width: 68ch; }
.report-links { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding-top: 2px; }

/* ---------- prose / report pages ---------- */

/* Narrow the whole column so the title, meta and prose share one left edge and
   the page stays balanced on wide screens. */
.report-page { padding: 40px 0 64px; max-width: 840px; }
.report-hero { border-bottom: 1px solid var(--border); padding-bottom: 24px; margin-bottom: 32px; }
.report-hero h1 { font-size: clamp(1.6rem, 4vw, 2.15rem); margin-bottom: 10px; }
.report-hero .report-meta { font-size: .88rem; margin-bottom: 16px; }

.prose { max-width: var(--prose); }
.prose h2 {
  font-size: 1.3rem; margin-top: 2.2em; margin-bottom: .5em;
  padding-bottom: .3em; border-bottom: 1px solid var(--border);
}
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 1.05rem; margin-top: 1.8em; margin-bottom: .4em; color: var(--text); }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 1.1em; }
.prose li { margin-bottom: .4em; }
.prose code { font-family: var(--mono); font-size: .88em; background: var(--bg-inset);
              padding: 1px 5px; border-radius: 4px; }
.prose blockquote { margin: 0 0 1em; padding: 2px 0 2px 16px;
                    border-left: 3px solid var(--border-firm); color: var(--text-muted); }

figure { margin: 28px 0; }
figure img {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius);
  background: #fff;
}
/* Video gets the same frame as a figure image. `height: auto` overrides the
   height attribute on the element, which is there so the box reserves its
   aspect ratio before the poster loads rather than jumping. */
figure video {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-inset);
}
figcaption { font-size: .82rem; color: var(--text-faint); margin-top: 8px; line-height: 1.5; }
figcaption b { color: var(--text-muted); font-weight: 700; }

.figure-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 28px 0; }
.figure-pair figure { margin: 0; }

/* Portrait photographs. At full column width a phone photo comes out taller
   than the viewport and shoves the rest of the section off the screen, so cap
   the height and center what's left. */
.figure-portrait img {
  width: auto; max-width: 100%; max-height: 78vh;
  margin-inline: auto; display: block;
}
/* The image is centered but the caption is not, which reads as misalignment --
   the caption starts at the figure's left edge, well away from the picture. */
.figure-portrait figcaption { text-align: center; }

/* Figures smaller than the column. `figure img { width: 100% }` upscales them,
   which on a 634 px spreadsheet screenshot means 1168 px of blurred text. This
   caps them at their own resolution instead. Unlike .figure-portrait there is no
   height limit -- these are small in both directions, not tall. */
.figure-natural img { width: auto; max-width: 100%; margin-inline: auto; }
.figure-natural figcaption { text-align: center; }

.callout {
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  background: var(--bg-soft); border-radius: var(--radius);
  padding: 14px 18px; margin: 24px 0; font-size: .92rem;
}
.callout p:last-child { margin-bottom: 0; }
.callout strong { color: var(--text); }

table { border-collapse: collapse; width: 100%; font-size: .88rem; margin: 0 0 1.2em; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); }
th { font-weight: 700; color: var(--text); background: var(--bg-soft); }
td { color: var(--text-muted); }
.table-scroll { overflow-x: auto; margin-bottom: 1.2em; }

/* ---------- resume ---------- */

.pdf-frame {
  width: 100%; height: 82vh; min-height: 520px;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--bg-inset);
}
.pdf-fallback { display: none; padding: 28px; text-align: center;
                border: 1px solid var(--border); border-radius: var(--radius-lg);
                background: var(--bg-soft); }

/* ---------- gallery ---------- */

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.gallery figure { margin: 0; }
.gallery img { aspect-ratio: 4 / 3; object-fit: cover; cursor: zoom-in; }

/* Slide decks. 16:9 and `contain`, because a slide cropped to fill is a slide
   with its title cut off. The dark mat matches the deck's own background so a
   letterboxed slide doesn't sit in a bright frame. */
.slide-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.slide-grid img {
  aspect-ratio: 16 / 9; object-fit: contain;
  background: #000; border-color: var(--border-firm);
}
.slide-grid figcaption { margin-top: 6px; font-size: .78rem; }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--border); background: var(--bg-soft);
  padding: 36px 0; margin-top: 64px; font-size: .88rem; color: var(--text-muted);
}
.site-footer .wrap { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent); }

/* ---------- utility ---------- */

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: .85rem; }
.stack > * + * { margin-top: 10px; }
.mb-0 { margin-bottom: 0; }
.backlink { display: inline-flex; align-items: center; gap: 6px;
            font-size: .88rem; color: var(--text-muted); margin-bottom: 20px; }
.backlink:hover { color: var(--accent); }

.empty { padding: 48px 24px; text-align: center; color: var(--text-muted);
         border: 1px dashed var(--border-firm); border-radius: var(--radius-lg); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- responsive ---------- */

@media (max-width: 700px) {
  .section { padding: 40px 0; }
  .hero { padding: 40px 0 32px; }

  /* Portrait phone: the photo is itself a portrait, so show more of it and
     let the caption stack under the scroll cue instead of beside it. */
  .photo-hero img { object-position: 50% 22%; }
  .photo-hero .hero-caption .wrap { flex-direction: column; align-items: flex-start; gap: 14px; }
  .scroll-cue { padding-bottom: 0; }
  .intro-headline { max-width: none; }
  .contact-row { gap: 10px; }
  .contact-link { padding: 10px 16px 10px 13px; font-size: .88rem; }

  /* the power chain stacks vertically; arrows rotate to point down */
  .sys-flow { flex-direction: column; gap: 8px; }
  /* .is-long sets a 190px flex-basis, which is a WIDTH while the chain runs
     across the page. Once it stacks, that basis becomes a HEIGHT and pads every
     node out to 190px whatever it contains. Hand the height back to the text. */
  .sys-flow.is-long .flow-node { flex: 0 0 auto; }
  .flow-arrow { align-self: flex-start; transform: rotate(90deg); margin-left: 24px; }
  .deepdive-cta { padding: 16px 18px; gap: 14px; }
  .sys-head { flex-direction: column; gap: 2px; align-items: flex-start; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .figure-pair { grid-template-columns: 1fr; }

  /* role cards go photo-over-text; the date drops under the job title rather
     than fighting it for the same line */
  .role-card.has-photo { grid-template-columns: 1fr; }
  .role-photo { border-right: 0; border-bottom: 1px solid var(--border); }
  .role-photo img { min-height: 0; aspect-ratio: 16 / 9; }
  .role-body { padding: 18px 20px 20px; }
  .role-when { text-align: left; }
  .slide-grid { grid-template-columns: 1fr; }
  .site-header .wrap { min-height: auto; padding-top: 10px; padding-bottom: 10px; }
  .nav { width: 100%; overflow-x: auto; }
  .pdf-frame { display: none; }
  .pdf-fallback { display: block; }
  .report-links { width: 100%; }
}

/* ---------- print ---------- */

@media print {
  .site-header, .site-footer, .report-links, .backlink, .actions, .filters { display: none !important; }
  body { color: #000; background: #fff; font-size: 11pt; }
  .wrap { max-width: none; padding: 0; }
  .prose { max-width: none; }
  a { color: #000; text-decoration: underline; }
  figure { break-inside: avoid; page-break-inside: avoid; }
  h2, h3 { break-after: avoid; page-break-after: avoid; }
  figure img { border: 1px solid #999; }
}
