/* ==========================================================================
   Muhammad Mustafa Khan — research portfolio
   Editorial engineering portfolio. Plain CSS, no build step, light theme.
   ========================================================================== */

:root {
  /* surfaces */
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f4f1ea;
  --ink-bg: #16191d;

  /* ink */
  --ink: #1a1e23;
  --ink-2: #333a42;
  --muted: #565d66;
  --on-dark: #f1efe9;
  --on-dark-muted: #bdb7ab;

  /* lines */
  --rule: #e4dfd4;
  --rule-2: #cfc8bb;
  --rule-ui: #8f8574;

  /* accent */
  --accent: #0f5c6e;
  --accent-deep: #0a4553;
  --accent-soft: #e7eff1;
  --focus: #a4460f;

  /* Two webfont families; the few technical labels use the system mono stack. */
  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* type scale — nothing that carries meaning falls below 13px */
  --fs-body: 1.09375rem;                                  /* 17.5px */
  --fs-caption: 0.9125rem;                                /* 14.6px */
  --fs-meta: 0.8125rem;                                   /* 13px  */
  --fs-name: clamp(2.4rem, 1.7rem + 2.8vw, 4.1rem);       /* 38 → 66px */
  --fs-case: clamp(1.95rem, 1.4rem + 2.1vw, 3rem);        /* 31 → 48px */
  --fs-h2: clamp(1.55rem, 1.25rem + 1.15vw, 2.15rem);     /* 25 → 34px */
  --fs-h3: clamp(1.14rem, 1.05rem + 0.35vw, 1.32rem);
  --fs-lede: clamp(1.1rem, 1.02rem + 0.35vw, 1.26rem);

  --wrap: 1220px;
  --gap: clamp(1.25rem, 0.9rem + 1.4vw, 2rem);
  --section-y: clamp(3rem, 2rem + 4vw, 5.5rem);
  --stage-y: clamp(2.5rem, 1.8rem + 2.6vw, 3.75rem);
  --nav-h: 4rem;
  --radius: 4px;
  --t: 200ms cubic-bezier(.2, .6, .3, 1);

  /* shared component tokens — labels, links, rules and spacing reused by every project page */
  --lh-body: 1.62;
  --lh-compact: 1.55;                                     /* summary, captions, dense text */
  --fs-small: 0.95rem;                                    /* 15.2px: contents links */
  --fs-summary: 1rem;                                     /* 16px: summary text */
  --label-weight: 600;                                    /* small uppercase labels */
  --label-tracking: 0.05em;
  --link: var(--accent);
  --link-hover: var(--accent-deep);
  --link-rule: var(--rule-2);                             /* resting underline on quiet links */
  --rule-strong: var(--ink);                              /* heavy rule that opens the summary */
  --space-hero: clamp(2rem, 4vw, 3rem);                   /* title block → summary */
  --space-sub: clamp(2.25rem, 4vw, 3.25rem);              /* subsection inside a stage */
  --measure: 62ch;                                        /* reading measure: 70–80 characters per line at 17.5px */
  --para-gap: 1.4em;                                      /* space between paragraphs at the reading measure */
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--nav-h) + 1.5rem);
  color-scheme: light;
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- layout ---------- */
.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.wrap-tight { width: min(100% - 2.5rem, 900px); margin-inline: auto; }
@media (max-width: 520px) { .wrap, .wrap-tight { width: calc(100% - 2rem); } }
.prose { max-width: 66ch; }
.prose-wide { max-width: 78ch; }
.section { padding-block: var(--section-y); }
.section-line { border-top: 1px solid var(--rule); }
.section-white { background: var(--surface); }
.section-dark { background: var(--ink-bg); color: var(--on-dark); }
.section-dark h2, .section-dark h3 { color: #fff; }
.section-dark .kicker { color: #8fd0dc; }
.section-dark a { color: #8fd0dc; }
.section-dark a:hover { color: #b9e3ea; }

.section-head { margin-bottom: clamp(1.75rem, 3vw, 2.75rem); }
.section-head p:last-child { margin-bottom: 0; }

/* directory / utility page headings */
.page-head { padding-block: clamp(2.25rem, 5vw, 4rem) clamp(1.25rem, 2.5vw, 2rem); }
.page-head h1 { font-size: var(--fs-case); line-height: 1.05; letter-spacing: -0.025em; margin-bottom: 0.65rem; }
.page-head .lede { max-width: 54ch; margin-bottom: 0; }
.section-foot { margin-top: clamp(2rem, 4vw, 3rem); padding-top: 1.1rem; border-top: 1px solid var(--rule); font-size: 0.95rem; color: var(--muted); }
.head-row { display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; align-items: baseline; justify-content: space-between; }

/* ---------- typography ---------- */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 500; color: var(--ink); line-height: 1.18; margin: 0 0 0.45em; letter-spacing: -0.015em; }
h2 { font-size: var(--fs-h2); }
h3 { font-family: var(--font-sans); font-size: var(--fs-h3); font-weight: 600; letter-spacing: -0.003em; line-height: 1.35; }
h4 { font-family: var(--font-sans); font-size: 1rem; font-weight: 600; }
p { margin: 0 0 1.05em; }
p:last-child, ul:last-child, ol:last-child { margin-bottom: 0; }

.lede { font-size: var(--fs-lede); line-height: 1.6; color: var(--ink-2); max-width: 62ch; }
.kicker {
  font-family: var(--font-sans); font-size: var(--fs-meta); font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 0.8rem;
}
.kicker-muted { color: var(--muted); }
.meta { font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--muted); letter-spacing: 0.01em; }

a { color: var(--link); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
.section-dark :focus-visible, .site-footer :focus-visible { outline-color: #f0a06a; }

ul, ol { padding-left: 1.15rem; margin: 0 0 1.05em; }
li { margin-bottom: 0.4em; }
li:last-child { margin-bottom: 0; }
.tight li { margin-bottom: 0.25em; }
.muted { color: var(--muted); }
.small { font-size: 0.93rem; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }
code, .mono { font-family: var(--font-mono); font-size: 0.92em; }

/* ---------- header ---------- */
.skip { position: absolute; left: -9999px; top: 0; z-index: 200; background: var(--ink); color: #fff; padding: 0.7rem 1rem; }
.skip:focus { left: 0; }
.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;
}

.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(251, 250, 247, 0.93);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.header-inner { display: flex; align-items: center; gap: 1rem; min-height: var(--nav-h); }
.brand {
  display: inline-flex; align-items: center; min-height: 44px;
  font-family: var(--font-display); font-size: 1.08rem; font-weight: 600; letter-spacing: -0.01em;
  color: var(--ink); text-decoration: none; margin-right: auto; white-space: nowrap;
}
.brand:hover { color: var(--accent); }
.nav { display: flex; align-items: center; gap: 1.5rem; }
.nav a {
  font-size: 0.94rem; color: var(--ink-2); text-decoration: none;
  padding: 0.45rem 0; border-bottom: 2px solid transparent; transition: color var(--t), border-color var(--t);
}
.nav a:hover { color: var(--accent); border-bottom-color: var(--rule-2); }
.nav a[aria-current] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.nav-cta {
  padding: 0.5rem 0.95rem !important; border: 1px solid var(--rule-ui);
  border-radius: 999px; font-size: 0.9rem !important; color: var(--ink) !important;
}
.nav-cta:hover { border-color: var(--accent) !important; background: var(--accent-soft); }
.nav-toggle { display: none; }

@media (max-width: 700px) {
  :root { --nav-h: 3.5rem; }
  .nav-toggle {
    display: inline-flex; align-items: center; gap: 0.5rem; min-height: 44px; padding: 0.4rem 0.75rem;
    font: inherit; font-size: 0.92rem; color: var(--ink); background: transparent;
    border: 1px solid var(--rule-ui); border-radius: var(--radius); cursor: pointer;
  }
  .nav-toggle:hover { border-color: var(--accent); }
  .nav-toggle .bars { display: inline-block; width: 16px; height: 10px; position: relative; }
  .nav-toggle .bars::before, .nav-toggle .bars::after, .nav-toggle .bars span {
    content: ""; position: absolute; left: 0; right: 0; height: 1.5px; background: currentColor;
  }
  .nav-toggle .bars::before { top: 0; }
  .nav-toggle .bars span { top: 4.25px; }
  .nav-toggle .bars::after { bottom: 0; }

  /* without JavaScript the links simply wrap under the brand */
  .header-inner { flex-wrap: wrap; padding-block: 0.4rem; }
  .nav { width: 100%; flex-wrap: wrap; gap: 0.15rem 1.1rem; padding-bottom: 0.5rem; }
  .nav a { font-size: 0.9rem; padding: 0.5rem 0; }
  .nav-cta { padding: 0.45rem 0.85rem !important; }

  /* upgraded to a disclosure menu when JavaScript runs */
  .js .nav {
    position: absolute; left: 0; right: 0; top: 100%; display: block; width: auto;
    background: var(--surface); border-bottom: 1px solid var(--rule);
    box-shadow: 0 14px 28px -22px rgba(20, 22, 25, 0.7);
    padding: 0.35rem 0 0.85rem; margin: 0;
  }
  .js .nav[hidden] { display: none; }
  .js .nav a {
    display: flex; align-items: center; min-height: 48px; padding: 0 1.25rem;
    border-bottom: 0; border-left: 3px solid transparent; font-size: 1rem;
  }
  .js .nav a[aria-current] { border-left-color: var(--accent); background: var(--accent-soft); }
  .js .nav-cta { margin: 0.6rem 1.25rem 0; border-radius: var(--radius); justify-content: center; display: inline-flex !important; }
}

/* narrow phones: keep brand and menu button on one row */
@media (max-width: 380px) {
  .header-inner { gap: 0.6rem; }
  .brand { font-size: 0.95rem; }
  .nav-toggle { padding: 0.4rem 0.6rem; font-size: 0.88rem; gap: 0.4rem; }
}

/* ---------- buttons ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 0.7rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 46px; font-size: 0.97rem; font-weight: 500; text-decoration: none;
  padding: 0.55rem 1.25rem; border-radius: var(--radius);
  border: 1px solid var(--accent); color: var(--accent); background: transparent;
  transition: background-color var(--t), color var(--t), border-color var(--t);
}
.btn:hover { background: var(--accent-soft); color: var(--accent-deep); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-deep); color: #fff; }
.btn-quiet { border-color: var(--rule-ui); color: var(--ink-2); }
.btn-quiet:hover { background: var(--surface-2); color: var(--ink); border-color: var(--muted); }
.btn-ghost { border-color: rgba(241, 239, 233, 0.45); color: var(--on-dark); }
.btn-ghost:hover { background: rgba(241, 239, 233, 0.12); color: #fff; }

.link-arrow { font-weight: 500; text-decoration: none; display: inline-flex; align-items: center; gap: 0.4rem; }
.link-arrow::after { content: "→"; transition: transform var(--t); }
.link-arrow:hover::after { transform: translateX(3px); }

/* ---------- hero ----------
   DOM order is identity → portrait → body, so a screen reader meets the H1 first.
   CSS places the portrait beside the identity at every width. */
.hero { padding-block: clamp(1.75rem, 1.2rem + 2.4vw, 3.25rem) clamp(2.5rem, 2rem + 2vw, 4rem); }
.hero-grid {
  display: grid; align-items: start;
  grid-template-columns: minmax(0, 1fr) 36%;
  gap: 1.15rem 1.15rem;
}
.hero-id { grid-column: 1; grid-row: 1; }
.hero-figure { grid-column: 2; grid-row: 1 / span 2; margin: 0; }
.hero-body { grid-column: 1 / -1; grid-row: 3; }

.hero-name { font-size: var(--fs-name); line-height: 1.03; letter-spacing: -0.028em; margin: 0 0 0.6rem; text-wrap: balance; }
.hero-role { font-size: 1rem; line-height: 1.45; color: var(--ink-2); margin: 0; max-width: 40ch; }
.hero-thesis {
  grid-column: 1; grid-row: 2;
  font-family: var(--font-display); font-size: clamp(1.2rem, 1.02rem + 0.8vw, 1.6rem);
  line-height: 1.38; color: var(--ink); margin: 0.9rem 0 0; max-width: 34ch; text-wrap: pretty;
}
.hero-lede { font-size: var(--fs-lede); line-height: 1.6; color: var(--ink-2); max-width: 62ch; margin: 0 0 1.5rem; }
.hero-actions { margin-bottom: 1.2rem; }
.hero-profiles {
  display: flex; flex-wrap: wrap; gap: 0.2rem 1.35rem;
  list-style: none; margin: 0 0 0.9rem; padding: 0; font-size: 0.97rem;
}
.hero-profiles li { margin: 0; }
.hero-profiles a { color: var(--ink-2); text-decoration: none; border-bottom: 1px solid var(--rule-2); padding-block: 0.35rem 1px; }
.hero-profiles a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.hero-note { font-size: var(--fs-caption); color: var(--muted); margin: 0; }
.hero-dev-note { font-size: 0.875rem; font-weight: 400; line-height: 1.5; color: var(--muted); margin: 0.875rem 0 0; }

/* Homepage reading size: ~18px body text on desktop, 17px on phones, 1.6 line spacing.
   The hero lede stays a step above body text at every width. */
.page-home { --fs-body: 1.125rem; --lh-body: 1.6; }
.page-home .hero-lede { font-size: clamp(1.125rem, 1.05rem + 0.35vw, 1.26rem); line-height: 1.6; }
@media (max-width: 560px) { .page-home { --fs-body: 1.0625rem; } }

.hero-figure img {
  display: block; width: 100%; height: auto;
  border-radius: var(--radius); background: var(--surface);
}
.hero-caption { font-size: var(--fs-meta); line-height: 1.4; color: var(--muted); margin: 0.55rem 0 0; }

/* Narrow phones: the name takes the full width and the portrait sits beside the
   thesis instead, so it is never an isolated thumbnail in an empty row. */
/* Phones: tighten the hero so the primary action reaches the first viewport. */
@media (max-width: 560px) {
  .hero { padding-block: 1.25rem 2rem; }
  .hero-grid { gap: 0.9rem 1.1rem; }
  .hero .kicker { margin-bottom: 0.6rem; }
  .hero-thesis { margin-top: 0.7rem; }
  .hero-lede { line-height: 1.55; margin-bottom: 1.1rem; }
  .hero-actions { margin-bottom: 1rem; }
}
@media (max-width: 430px) {
  .hero-id { grid-column: 1 / -1; }
  .hero-thesis { grid-column: 1; grid-row: 2; }
  .hero-figure { grid-column: 2; grid-row: 2; align-self: start; }
  .hero-name { margin-bottom: 0.5rem; }
  .hero-role { max-width: none; }
}
@media (min-width: 620px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr) 260px; gap: 0 2rem; }
  .hero-figure { grid-row: 1 / span 3; }
  .hero-body { grid-column: 1; grid-row: 3; margin-top: 1.5rem; }
}
@media (min-width: 900px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr) 320px; gap: 0 3.5rem; }
  .hero-figure { justify-self: end; }
  .hero-thesis { margin-top: 1.2rem; }
}
@media (max-width: 400px) { .hero-caption { display: none; } }

/* ---------- project cards ---------- */
.work-featured { display: grid; gap: clamp(1.25rem, 3vw, 2.5rem); align-items: center; margin-bottom: clamp(2rem, 4vw, 3.25rem); }
@media (min-width: 900px) { .work-featured { grid-template-columns: 6fr 5fr; } }

.work-grid { display: grid; gap: clamp(1.5rem, 3vw, 2.25rem); }
@media (min-width: 720px) { .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* three compact entries beneath the featured project */
.work-row { display: grid; gap: clamp(1.75rem, 3vw, 2.25rem); }
@media (min-width: 620px) and (max-width: 859px) { .work-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 860px) { .work-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.card { display: flex; flex-direction: column; gap: 0.85rem; }
.card.card-featured { display: grid; gap: clamp(1.25rem, 3vw, 2.5rem); align-items: center; }
@media (min-width: 900px) { .card.card-featured { grid-template-columns: 6fr 5fr; } }
.card-media { margin: 0; overflow: hidden; border-radius: var(--radius); background: var(--surface); }
.card-media img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; transition: transform var(--t); }
.card-media-contain { border: 1px solid var(--rule); }
.card-media-contain img { object-fit: contain; padding: 0.6rem; }
/* only media that is itself a link responds to hover */
.card:hover .card-media-link img,
.card:focus-within .card-media-link img { transform: scale(1.02); }
.card-featured .card-media img { aspect-ratio: 16 / 10; }
.card > div { display: flex; flex-direction: column; gap: 0.6rem; }
.card-kicker { font-family: var(--font-mono); font-size: var(--fs-meta); letter-spacing: 0.01em; color: var(--muted); margin: 0; }
.card h2, .card h3 { margin: 0; }
.card-title-lg { font-family: var(--font-display) !important; font-size: clamp(1.5rem, 1.15rem + 1.25vw, 2rem) !important; font-weight: 500 !important; line-height: 1.16; letter-spacing: -0.015em; }
.card-result { font-size: 0.95rem !important; color: var(--ink) !important; padding-top: 0.7rem; border-top: 1px solid var(--rule); }
.card-result i { font-family: var(--font-display); font-style: italic; }
.card a.card-title-link { color: var(--ink); text-decoration: none; }
.card a.card-title-link:hover { color: var(--accent); }
.card p { margin: 0; color: var(--ink-2); font-size: 0.99rem; }
.card-featured p { font-size: 1.04rem; max-width: 54ch; }
.card .card-role { color: var(--muted); font-size: 0.95rem; }
.card-methods { display: flex; flex-wrap: wrap; gap: 0.3rem 0.5rem; list-style: none; padding: 0; margin: 0; }
.card-methods li { font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--muted); margin: 0; }
.card-methods li + li::before { content: "· "; color: var(--rule-ui); }
.card-note {
  font-family: var(--font-mono); font-size: var(--fs-meta); letter-spacing: 0.01em; color: var(--muted);
  margin: 0.15rem 0 0; padding-top: 0.7rem; border-top: 1px solid var(--rule);
}
.card-more { margin: 0; font-size: 0.95rem; }
.card:focus-within .card-media { outline: 2px solid var(--focus); outline-offset: 3px; }

/* ---------- research direction ---------- */
.direction-grid { display: grid; gap: var(--gap); }
@media (min-width: 820px) { .direction-grid { grid-template-columns: repeat(3, 1fr); } }
.direction-item { border-top: 2px solid rgba(241, 239, 233, 0.35); padding-top: 0.9rem; }
.direction-item h3 { color: #fff; margin-bottom: 0.4rem; }
.direction-item p { color: var(--on-dark-muted); font-size: 0.99rem; margin: 0; }

/* ---------- outputs ---------- */
.outputs { display: grid; gap: 1.5rem; }
.output { display: grid; gap: 0.5rem 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--rule); }
.output:last-child { border-bottom: 0; padding-bottom: 0; }
@media (min-width: 760px) { .output { grid-template-columns: 116px minmax(0, 1fr); align-items: start; } }
.output-thumb { margin: 0; }
.output-thumb img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--radius); }
.output-type {
  font-family: var(--font-sans); font-size: var(--fs-meta); font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 0.3rem;
}
.output h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.22rem; line-height: 1.3; margin: 0 0 0.4rem; letter-spacing: -0.01em; }
.output-authors { font-size: 0.97rem; color: var(--ink); margin: 0 0 0.15rem; }
.output-authors .self { font-weight: 600; }
.output-venue { font-size: 0.97rem; color: var(--muted); margin: 0 0 0.6rem; }
.output p { font-size: 0.97rem; color: var(--ink-2); margin: 0 0 0.5rem; }
.output-links { display: flex; flex-wrap: wrap; gap: 0.3rem 1.25rem; font-size: 0.94rem; margin: 0; padding: 0; list-style: none; }
.output-links li { margin: 0; }
.output-links a { display: inline-flex; align-items: center; padding-block: 0.35rem; }
.output-note { font-size: var(--fs-caption); color: var(--muted); margin: 0.45rem 0 0; }

/* research interests — light editorial treatment, no dark marketing band */
.interests { display: grid; gap: clamp(1.5rem, 3vw, 2.5rem); }
@media (min-width: 820px) { .interests { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.interest { border-top: 2px solid var(--ink); padding-top: 0.95rem; }
.interest h3 { margin-bottom: 0.4rem; }
.interest p { font-size: 0.99rem; color: var(--ink-2); margin: 0 0 0.55rem; }
.interest-status {
  font-size: var(--fs-caption); color: var(--muted); margin: 0;
  padding-top: 0.6rem; border-top: 1px solid var(--rule);
}
.interest-status b { font-weight: 600; color: var(--ink-2); }
.interest-status.is-current b { color: var(--accent); }

/* ---------- about ---------- */
.about-section .section-head { margin-bottom: clamp(1.5rem, 1.1rem + 1.2vw, 2rem); }   /* heading → content: 24–32px */
.about-grid { display: grid; gap: var(--gap); align-items: start; }
@media (min-width: 900px) { .about-grid { grid-template-columns: 7fr 5fr; gap: clamp(2rem, 4vw, 3.5rem); } }
/* Both columns open with the same rule, so their tops line up side by side and stack cleanly. */
.about-prose, .about-facts { border-top: 2px solid var(--ink); padding-top: 1rem; }
.fact { padding-bottom: 0.85rem; margin-bottom: 0.85rem; border-bottom: 1px solid var(--rule); }
.fact:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.fact-label { font-family: var(--font-sans); font-weight: 600; font-size: var(--fs-meta); letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin: 0 0 0.2rem; }
.fact p { margin: 0; font-size: 0.97rem; color: var(--ink-2); }
.fact strong { color: var(--ink); font-weight: 600; }

/* ---------- case study ---------- */
.case-hero { padding-block: clamp(1.75rem, 3vw, 2.75rem) 0; }
.case-hero .case-title { max-width: 30ch; text-wrap: balance; }
.breadcrumb { font-size: 0.88rem; color: var(--muted); margin: 0 0 1rem; }
.breadcrumb a { color: var(--muted); }
.case-grid { display: grid; gap: clamp(1.5rem, 3.5vw, 3rem); align-items: center; }
@media (min-width: 900px) { .case-grid { grid-template-columns: 6fr 6fr; } }
.case-title { font-size: var(--fs-case); line-height: 1.06; letter-spacing: -0.025em; margin: 0 0 0.6rem; }
.case-thesis { font-size: var(--fs-lede); line-height: 1.55; color: var(--ink-2); max-width: 46ch; margin: 0 0 1.4rem; }
.case-facts { display: flex; flex-wrap: wrap; gap: 0.9rem 2rem; margin: 0; padding: 0; list-style: none; }
.case-facts li { margin: 0; font-size: 0.95rem; color: var(--ink-2); max-width: 32ch; }
.case-facts b { display: block; font-family: var(--font-sans); font-weight: 600; font-size: var(--fs-meta); letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); font-weight: 400; margin-bottom: 0.1rem; }
.case-figure { margin: 0; }
.case-figure img { display: block; width: 100%; height: auto; border-radius: var(--radius); background: var(--surface); }
.case-figure figcaption { font-size: var(--fs-caption); color: var(--muted); margin-top: 0.55rem; }
.case-figure-stack { display: grid; gap: 0.75rem; }
@media (min-width: 560px) { .case-figure-stack { grid-template-columns: 7fr 5fr; align-items: end; } }

/* ---------- research brief (replaces the old At-a-glance + contribution pair) ---------- */
.brief {
  margin-top: var(--space-hero);
  border-top: 2px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule);
  padding-block: 1.4rem 1.5rem;
}
.brief dl { display: grid; gap: 1.15rem 2.5rem; margin: 0; }
@media (min-width: 780px) { .brief dl { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1080px) { .brief dl { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem 2rem; } }
.brief dt {
  font-family: var(--font-sans); font-size: var(--fs-meta); font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking); text-transform: uppercase; color: var(--accent); margin-bottom: 0.3rem;
}
.brief dd { margin: 0; font-size: var(--fs-summary); line-height: var(--lh-compact); color: var(--ink-2); }
.brief dd strong { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.brief .brief-wide { grid-column: 1 / -1; }

/* three-column summary: Research question · What I did · Key result.
   Stacked with hairlines on narrow screens; three columns divided by hairlines from 900px. */
.brief-3 dl { grid-template-columns: minmax(0, 1fr); gap: 0; }
.brief-3 dl > div { padding-block: 1rem; border-top: 1px solid var(--rule); }
.brief-3 dl > div:first-child { padding-top: 0; border-top: 0; }
.brief-3 dl > div:last-child { padding-bottom: 0; }
.brief-3 dd { max-width: 62ch; }
.brief-3 dd strong { white-space: nowrap; }
@media (min-width: 900px) {
  .brief-3 dl { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .brief-3 dl > div { padding: 0 clamp(1.25rem, 2.5vw, 2.25rem); border-top: 0; border-left: 1px solid var(--rule); }
  .brief-3 dl > div:first-child { padding-left: 0; border-left: 0; }
  .brief-3 dl > div:last-child { padding-right: 0; }
}

/* project meta line under the title */
.case-meta {
  font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--muted);
  margin: 0 0 0.9rem; letter-spacing: 0.01em;
}
.case-sub { font-size: var(--fs-lede); line-height: 1.55; color: var(--ink-2); max-width: 52ch; margin: 0 0 1.3rem; }
.case-links { display: flex; flex-wrap: wrap; gap: 0.6rem 1.4rem; margin: 0; padding: 0; list-style: none; font-size: 0.97rem; }
.case-links li { margin: 0; }

/* ---------- contents ---------- */
.contents { margin-top: clamp(1.25rem, 2.5vw, 1.75rem); }
.contents h2 {
  font-family: var(--font-sans); font-size: var(--fs-meta); font-weight: var(--label-weight); letter-spacing: var(--label-tracking);
  text-transform: uppercase; color: var(--muted); margin: 0 0 0.5rem;
}
.contents ol {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem; list-style: none; margin: 0; padding: 0;
}
.contents li { margin: 0; }
.contents a {
  font-size: var(--fs-small); color: var(--ink-2);
  text-decoration: underline; text-decoration-color: var(--link-rule); text-underline-offset: 0.3em;
  transition: color var(--t), text-decoration-color var(--t);
}
.contents a:hover, .contents a:focus-visible { color: var(--link); text-decoration-color: currentColor; }
/* label beside the links on wider screens; two tidy columns of links on phones */
@media (min-width: 760px) {
  .contents { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 2.25rem; align-items: baseline; }
  .contents h2 { margin: 0; }
}
@media (max-width: 559px) {
  .contents ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.25rem 1.25rem; }
}

.glance { display: grid; gap: 1px; background: var(--rule); border-block: 1px solid var(--rule); margin-top: clamp(2rem, 4vw, 3rem); }
@media (min-width: 760px) { .glance { grid-template-columns: repeat(4, 1fr); } }
.glance > div { background: var(--bg); padding: 1.1rem 1.15rem 1.25rem; }
.glance dt { font-family: var(--font-sans); font-weight: 600; font-size: var(--fs-meta); letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.35rem; }
.glance dd { margin: 0; font-size: 0.97rem; color: var(--ink-2); }

.contribution { background: var(--surface); border-left: 3px solid var(--accent); padding: 1.15rem 1.35rem; margin-top: clamp(1.75rem, 3vw, 2.5rem); max-width: 88ch; }
.contribution h2 { font-family: var(--font-sans); font-size: 1.05rem; font-weight: 600; margin-bottom: 0.45rem; }
.contribution p { font-size: 0.98rem; color: var(--ink-2); max-width: 78ch; }
.contribution p + p { margin-top: 0.7rem; }

.case-nav { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin-top: clamp(1.75rem, 3vw, 2.5rem); }
.case-nav ol { display: flex; gap: 1.5rem; list-style: none; margin: 0; padding: 0.7rem 0; overflow-x: auto; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.case-nav li { margin: 0; white-space: nowrap; }
.case-nav a { font-size: 0.88rem; color: var(--muted); text-decoration: none; padding-block: 0.35rem; }
.case-nav a:hover { color: var(--accent); }
.case-nav-label { font-family: var(--font-sans); font-weight: 600; font-size: var(--fs-meta); letter-spacing: 0.05em; text-transform: uppercase; color: var(--rule-ui); }

/* ---------- stages and editorial rhythm ---------- */
.stage { padding-block: var(--stage-y); border-top: 1px solid var(--rule); }
.stage-head { margin-bottom: 1.1rem; }
.stage-num { font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--accent); letter-spacing: 0.08em; display: block; margin-bottom: 0.3rem; }
.stage h2 { margin-bottom: 0; }
.subsection { margin-top: var(--space-sub); }
.subsection > h3 { margin-bottom: 0.9rem; }

.split { display: grid; gap: clamp(1.25rem, 3vw, 2.5rem); align-items: center; }
@media (min-width: 860px) {
  .split { grid-template-columns: 1fr 1fr; }
  .split-wide-media { grid-template-columns: 5fr 7fr; }
  .split-media-first .split-media { order: -1; }
}
/* Project pages: running text spans the full content width (.wrap). */
.stage .prose, .split .prose { max-width: none; }
/* Introductory text (e.g. Overview) keeps a comfortable reading measure. */
.stage .prose-measure { max-width: var(--measure); }
.prose-measure p:not(:last-child) { margin-bottom: var(--para-gap); }
.split-media { margin: 0; }

.callout { background: var(--accent-soft); border-radius: var(--radius); padding: 1.15rem 1.35rem; margin: 1.5rem 0; max-width: none; }
.callout h3 { font-size: 1rem; margin-bottom: 0.4rem; }
.callout p { font-size: 0.97rem; color: var(--ink-2); }

.metrics { display: grid; gap: 1px; background: var(--rule); border-block: 1px solid var(--rule); margin: 1.75rem 0; }
@media (min-width: 620px) { .metrics { grid-template-columns: repeat(3, 1fr); } }
.metrics-stack { grid-template-columns: 1fr !important; margin: 0; }
.metrics > div { background: var(--bg); padding: 1rem 1.15rem; }
.metric-value { font-family: var(--font-display); font-size: 1.7rem; line-height: 1.1; color: var(--ink); display: block; }
.metric-label { font-size: 0.88rem; color: var(--muted); display: block; margin-top: 0.3rem; }

.limits { background: var(--surface-2); border-radius: var(--radius); padding: 1.2rem 1.4rem; max-width: none; }
.limits h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.limits li { font-size: 0.97rem; color: var(--ink-2); }

/* ---------- figures ---------- */
figure { margin: 0; }
.fig { margin: 1.5rem 0; }
.fig img, .fig video { display: block; width: 100%; height: auto; max-width: 100%; border-radius: var(--radius); background: var(--surface); }
.fig-frame img { border: 1px solid var(--rule); }
.fig-pad img { border: 1px solid var(--rule); padding: 0.75rem; }
.fig-narrow { max-width: 560px; }
.fig-mid { max-width: 780px; }
.fig-wide { max-width: 940px; }
.fig-center { margin-inline: auto; }  /* centres a figure; its caption and surrounding text stay left-aligned */
/* identified-model block: rendered equation + copyable source */
.model-block { max-width: 940px; margin: 1.75rem auto 0; }
.model-block h3 { margin-bottom: 0.4rem; }
.model-note { margin: 0 0 0.9rem; color: var(--ink-2); }
.eq-render { overflow-x: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 0.9rem; }
.eq-render { padding: clamp(0.85rem, 2vw, 1.25rem) clamp(1rem, 3vw, 2rem); }
.eq-render img { display: block; height: auto; margin-inline: auto; }
.eq-render .eq-main { width: 321px; max-width: 100%; margin-bottom: clamp(0.6rem, 1.5vw, 0.95rem); }
.eq-render .eq-factors { width: auto; max-width: none; }
.eq-note { font-size: 0.97rem; color: var(--ink-2); }
/* Controller: paragraphs, then a centred "PI controller" card (same width as the plant-model card) */
.law-block { margin-top: 1.5rem; max-width: 760px; }
.law-render { margin-bottom: 0; }
.law-label { margin: 0 0 0.6rem; text-align: center; font-size: var(--fs-meta); font-weight: var(--label-weight); letter-spacing: var(--label-tracking); text-transform: uppercase; color: var(--accent); }
.law-render .law-eq { display: block; width: 275px; max-width: 100%; height: auto; margin: 0 auto 1rem; }
.sym-table { width: 100%; max-width: 560px; margin: 0 auto; border-collapse: collapse; border-top: 1px solid var(--rule); font-size: 0.93rem; line-height: 1.45; }
.sym-table th, .sym-table td { padding: 0.28rem 0; vertical-align: top; text-align: left; line-height: 1.5rem; }
.sym-table tr:first-child th, .sym-table tr:first-child td { padding-top: 0.75rem; }
.sym-table th { width: 7.5rem; padding-right: 1rem; font-weight: 400; font-family: var(--font-display); font-size: 1.05rem; color: var(--ink); white-space: nowrap; }
.sym-table td { color: var(--ink-2); }
.sym-table sub { line-height: 0; }  /* keep row heights even when a symbol has a subscript */
.eq-source { margin-top: 0.4rem; }
.eq-source summary { cursor: pointer; font-size: var(--fs-caption); color: var(--link); }
.eq-source pre { overflow-x: auto; background: var(--surface-2); border-radius: var(--radius); padding: 0.8rem 1rem; margin: 0.5rem 0 0; font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.5; color: var(--ink); }
/* AFM Overview video: centred within the content width; standard caption styling */
.fig-overview-video { margin-inline: auto; }
.fig-overview-video figcaption { max-width: none; }  /* one line at desktop; wraps naturally when narrow */
/* AFM Results scan figures (2D grid, 3D views): caption uses the figure width, so it sits on one line at desktop and wraps naturally when narrow */
.fig-cap-wide figcaption { max-width: none; }
.nowrap { white-space: nowrap; }  /* keeps a short term such as a model number on one line */
.ic { padding-inline-end: 0.07em; }  /* italic correction: the synthesised italic (no italic font file is loaded) leans into the next character */
/* rounded, outlined player: poster, video and native controls clip to one outline */
.video-frame { border: 1px solid var(--rule-2); border-radius: 12px; overflow: hidden; background: #000; }
.video-frame video { border-radius: 0; background: #000; }
.fig-hero { margin: clamp(1.5rem, 3vw, 2.25rem) 0 0; }
.related-h { margin-top: clamp(2.5rem, 4vw, 3.5rem); }
/* never upscale a small source beyond the pixels it actually has */
.fig-native img { width: auto; max-width: 100%; }
/* diagrams read at roughly their drawn size, not stretched to the column */
.fig-diagram { max-width: 720px; }
figcaption { font-size: var(--fs-caption); line-height: 1.55; color: var(--muted); margin-top: 0.55rem; max-width: 72ch; }
figcaption b, figcaption strong { color: var(--ink-2); font-weight: 600; }
.tag { font-family: var(--font-sans); font-weight: 600; font-size: var(--fs-meta); letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); margin-right: 0.45rem; }
.tag-sim { color: #8a4a12; }
.fig-grid { display: grid; gap: var(--gap); margin: 1.5rem 0; align-items: start; }
@media (min-width: 720px) {
  .fig-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fig-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.fig-grid .fig { margin: 0; }
.zoom { display: block; position: relative; overflow: hidden; border-radius: var(--radius); }
.zoom img { transition: transform var(--t); }
.zoom:hover img { transform: scale(1.012); }
.zoom::after {
  content: "⤢"; position: absolute; right: 0.55rem; bottom: 0.55rem; font-size: 0.8rem; line-height: 1;
  color: var(--ink); background: rgba(255, 255, 255, 0.92); border: 1px solid var(--rule);
  border-radius: 2px; padding: 0.2rem 0.32rem; opacity: 0; transition: opacity var(--t);
}
.zoom:hover::after, .zoom:focus-visible::after { opacity: 1; }

.eq {
  font-family: var(--font-mono); font-size: 0.88rem; line-height: 1.95; color: var(--ink);
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 0.9rem 1.1rem; margin: 1.25rem 0 0.5rem; overflow-x: auto; max-width: 56ch;
}

/* ==========================================================================
   PROJECT LISTING SURFACES
   A shared visual language for the homepage selection and the projects index:
   one 16:10 cover, a label attached directly to it, then a fixed information
   schema. Concept illustrations are always labelled as such.
   ========================================================================== */

/* --- 16:10 cover with its label attached underneath --- */
.cover { margin: 0; }
.cover-frame {
  display: block; overflow: hidden; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--rule);
}
.cover-frame img {
  display: block; width: 100%; height: auto; aspect-ratio: 16 / 10;
  object-fit: cover; transition: transform var(--t);
}
a.cover-frame:hover img, a.cover-frame:focus-visible img { transform: scale(1.012); }
.cover figcaption {
  display: flex; flex-wrap: wrap; gap: 0.15rem 0.5rem; align-items: baseline;
  font-size: var(--fs-meta); line-height: 1.45; color: var(--muted); margin-top: 0.5rem;
}
.tag-concept { color: #8a4a12; }

/* --- featured project on the homepage --- */
.work-feature {
  display: grid; gap: clamp(1.25rem, 3vw, 2.5rem); align-items: center;
  padding-bottom: clamp(2rem, 4vw, 3rem); margin-bottom: clamp(2rem, 4vw, 3rem);
  border-bottom: 1px solid var(--rule);
}
@media (min-width: 900px) { .work-feature { grid-template-columns: 7fr 5fr; } }
.work-feature .pcard-title { font-size: clamp(1.5rem, 1.15rem + 1.25vw, 2rem); }
.work-feature .pcard-lede { font-size: 1.05rem; }

/* --- the shared project card --- */
.pcard { display: flex; flex-direction: column; gap: 0.75rem; }
.pcard-meta {
  font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--muted);
  letter-spacing: 0.01em; margin: 0;
}
.pcard-title {
  font-family: var(--font-display); font-weight: 500; font-size: 1.28rem; line-height: 1.2;
  letter-spacing: -0.012em; margin: 0;
}
.pcard-title a { color: var(--ink); text-decoration: none; }
.pcard-title a:hover { color: var(--accent); }
.pcard-lede { margin: 0; color: var(--ink-2); font-size: 1rem; }
.pcard-facts { margin: 0; display: grid; gap: 0.3rem; }
.pcard-facts p { margin: 0; font-size: 0.95rem; color: var(--ink-2); }
.pcard-facts b {
  font-family: var(--font-sans); font-weight: 600; color: var(--muted);
  font-size: var(--fs-meta); letter-spacing: 0.04em; text-transform: uppercase;
  margin-right: 0.35rem;
}
.pcard-foot { margin-top: auto; padding-top: 0.85rem; border-top: 1px solid var(--rule); }
.pcard-methods {
  display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; list-style: none; padding: 0;
  margin: 0 0 0.5rem; font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--muted);
}
.pcard-methods li { margin: 0; }
.pcard-methods li + li::before { content: "· "; color: var(--rule-ui); }
.pcard-links { display: flex; flex-wrap: wrap; gap: 0.2rem 1.25rem; list-style: none; margin: 0; padding: 0; font-size: 0.95rem; }
.pcard-links li { margin: 0; }
/* the whole card lifts quietly when either of its links is hovered or focused */
.pcard:focus-within .cover-frame { border-color: var(--accent); }

/* --- concept animation: explanatory motion, never a result ---
   Static by default. Runs on hover, on keyboard focus, or when the button is
   pressed (the only route on touch). Stops completely under reduced motion. */
.concept-anim { margin: 1.5rem 0; }
.anim-stage {
  position: relative; border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--bg); padding: 0.5rem;
}
.anim-stage svg { display: block; width: 100%; height: auto; }
.anim-tip { animation: anim-scan 5.2s ease-in-out infinite alternate; }
.anim-pulse { animation: anim-loop 5.2s linear infinite; offset-rotate: 0deg; }
/* declared after the shorthands, which would otherwise reset the play state */
.anim-move { animation-play-state: paused; }
.concept-anim:hover .anim-move,
.concept-anim:focus-within .anim-move,
.concept-anim.is-playing .anim-move { animation-play-state: running; }
@keyframes anim-scan { from { transform: translateX(0); } to { transform: translateX(196px); } }
@keyframes anim-loop { from { offset-distance: 0%; } to { offset-distance: 100%; } }
.anim-toggle {
  position: absolute; right: 0.6rem; bottom: 0.6rem;
  display: inline-flex; align-items: center; min-height: 34px; padding: 0.3rem 0.7rem;
  font: inherit; font-size: var(--fs-meta); color: var(--ink);
  background: rgba(255, 255, 255, 0.94); border: 1px solid var(--rule-ui);
  border-radius: var(--radius); cursor: pointer;
}
.anim-toggle:hover { border-color: var(--accent); }
@media (hover: hover) and (pointer: fine) { .anim-toggle { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .anim-move { animation: none !important; }
  .anim-toggle { display: none; }
}

/* --- responsive secondary-project grid --- */
.work-grid-3 { display: grid; gap: clamp(1.75rem, 3.5vw, 2.75rem); }
@media (min-width: 700px) { .work-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .work-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- project index: alternating editorial entries ---------- */
.index-list { display: grid; gap: 0; }
.index-entry {
  display: grid; gap: 1rem 0;
  padding-block: clamp(2rem, 4vw, 3.25rem);
  border-top: 1px solid var(--rule);
  align-items: center;
}
.index-entry:last-child { border-bottom: 1px solid var(--rule); }
/* Mobile keeps one predictable order: visual, then text. */
.index-entry .cover { grid-row: 1; }
.index-entry .index-body { grid-row: 2; }
@media (min-width: 880px) {
  .index-entry { grid-template-columns: 42fr 58fr; gap: 0 clamp(2rem, 4vw, 3.5rem); }
  .index-entry .cover { grid-row: 1; grid-column: 1; }
  .index-entry .index-body { grid-row: 1; grid-column: 2; }
  /* alternate only where there is room for it — the cover keeps its 42% share */
  .index-entry.is-flipped { grid-template-columns: 58fr 42fr; }
  .index-entry.is-flipped .cover { grid-column: 2; }
  .index-entry.is-flipped .index-body { grid-column: 1; }
}
.index-cat {
  display: flex; flex-wrap: wrap; gap: 0.3rem 0.75rem; align-items: baseline;
  font-size: var(--fs-meta); margin: 0 0 0.45rem;
}
.index-cat .cat {
  font-family: var(--font-sans); font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--accent);
}
.index-cat .where { font-family: var(--font-mono); color: var(--muted); }
.index-entry h2 {
  font-size: clamp(1.4rem, 1.15rem + 0.9vw, 1.85rem); line-height: 1.18;
  margin: 0 0 0.35rem; text-wrap: balance;
}
.index-entry h2 a { color: var(--ink); text-decoration: none; }
.index-entry h2 a:hover { color: var(--accent); }
.index-sub { font-size: 1.04rem; color: var(--ink-2); margin: 0 0 1rem; max-width: 56ch; }
.index-facts { display: grid; gap: 0.4rem; margin: 0 0 1.1rem; max-width: 60ch; }
.index-facts p { margin: 0; font-size: 0.97rem; color: var(--ink-2); }
.index-facts b {
  font-family: var(--font-sans); font-weight: 600; color: var(--muted);
  font-size: var(--fs-meta); letter-spacing: 0.04em; text-transform: uppercase;
  margin-right: 0.35rem;
}
.index-links { display: flex; flex-wrap: wrap; gap: 0.3rem 1.4rem; list-style: none; margin: 0; padding: 0; font-size: 0.97rem; }
.index-links li { margin: 0; }
.index-links a { display: inline-flex; align-items: center; padding-block: 0.3rem; }
.index-entry:focus-within .cover-frame { border-color: var(--accent); }

/* ---------- related projects ---------- */
.related { display: grid; gap: 1.1rem; margin-top: 1.25rem; }
@media (min-width: 720px) { .related { grid-template-columns: repeat(2, 1fr); } }
.related a {
  display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 0.9rem; align-items: center;
  text-decoration: none; color: var(--ink); background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius); padding: 0.75rem; transition: border-color var(--t);
}
.related a:hover { border-color: var(--accent); }
.related img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 2px; }
.related b { display: block; font-size: 0.99rem; font-weight: 600; margin-bottom: 0.15rem; }
.related span { display: block; font-size: 0.88rem; color: var(--muted); }

/* ---------- CV page ---------- */
.cv-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin: 1.5rem 0 2rem; }
.cv-pages { display: grid; gap: clamp(1.25rem, 3vw, 2rem); max-width: 960px; }
@media (min-width: 820px) { .cv-pages { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cv-page { margin: 0; }
.cv-page img {
  display: block; width: 100%; height: auto; background: #fff;
  border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: 0 12px 26px -20px rgba(20, 22, 25, 0.55);
}
.cv-page figcaption { font-size: var(--fs-caption); color: var(--muted); margin-top: 0.5rem; }
@media (max-width: 720px) {
  .cv-preview { display: none; }
  .cv-preview-small { display: block; }
}
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.2rem 1.35rem; }

/* ---------- lightbox ---------- */
dialog.lightbox { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; overflow: visible; }
dialog.lightbox::backdrop { background: rgba(18, 20, 23, 0.92); }
.lightbox-inner { position: relative; }
dialog.lightbox img { max-width: 94vw; max-height: 74vh; width: auto; height: auto; display: block; margin-inline: auto; background: #fff; border-radius: var(--radius); }
.lightbox-close {
  position: absolute; top: -0.75rem; right: -0.75rem; z-index: 2;
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
  font: inherit; font-size: 1.1rem; line-height: 1; color: #16191d; background: #f1efe9;
  border: 1px solid rgba(20, 22, 25, 0.25); box-shadow: 0 2px 10px -4px rgba(0, 0, 0, 0.6);
}
.lightbox-close:hover { background: #fff; }
.lightbox-caption {
  color: #ece9e2; font-size: 0.9rem; line-height: 1.5; margin: 0.85rem auto 0; max-width: 70ch;
  max-height: 18vh; overflow-y: auto; padding-right: 0.5rem;
}
@media (max-width: 640px) {
  dialog.lightbox img { max-height: 60vh; }
  .lightbox-close { top: -0.6rem; right: -0.3rem; }
  .lightbox-caption { max-height: 24vh; font-size: 0.88rem; }
}

/* ---------- footer ---------- */
.site-footer { background: var(--ink-bg); color: var(--on-dark-muted); padding-block: clamp(2.5rem, 4vw, 3.5rem); }
.footer-grid { display: grid; gap: 1.5rem 2rem; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 1fr auto; align-items: start; } }
.site-footer p { color: var(--on-dark-muted); }
/* Scoped under .site-footer so it outranks the paragraph colour above. */
.site-footer .footer-name { font-family: var(--font-display); font-size: 1.375rem; line-height: 1.3; color: var(--on-dark); margin: 0 0 0.5rem; }   /* 22px */
.footer-statement { font-size: 1.125rem; line-height: 1.55; max-width: 58ch; margin: 0; }   /* 18px */
.site-footer a { color: var(--on-dark); text-decoration: none; border-bottom: 1px solid rgba(241, 239, 233, 0.3); }
.site-footer a:hover { border-bottom-color: #8fd0dc; color: #fff; }
.footer-links, .footer-nav { display: flex; flex-wrap: wrap; gap: 0.6rem 1.5rem; margin: 0; padding: 0; list-style: none; font-size: 0.9375rem; }   /* 15px */
.footer-links { margin-top: 1.25rem; }
.footer-nav { margin-top: 0.9rem; }
.footer-links li, .footer-nav li { margin: 0; }
.footer-links a, .footer-nav a { display: inline-block; padding-block: 0.3rem; }
.footer-meta { font-size: 0.8125rem; margin: 1.75rem 0 0; }   /* 13px */
@media (max-width: 700px) {
  .site-footer .footer-name { font-size: 1.25rem; }          /* 20px */
  .footer-statement { font-size: 1rem; }                     /* 16px */
  .footer-links, .footer-nav { font-size: 0.875rem; }        /* 14px */
}

/* ---------- motion ---------- */
/* No scroll-reveal: content is never hidden waiting for a script to run.
   Motion is limited to short hover and focus transitions. */

/* ---------- comfortable touch targets for standalone links ---------- */
@media (max-width: 700px) {
  .hero-profiles a, .card-more a, .output-links a, .index-links a,
  .case-links a, .contents a, .footer-links a, .footer-nav a, .head-row .meta a {
    display: inline-flex; align-items: center; min-height: 44px;
  }
  .hero-profiles { gap: 0 1.35rem; }
  .footer-links li, .footer-nav li { margin-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .card:hover .card-media img, .zoom:hover img { transform: none; }
}

/* ---------- print ---------- */
@media print {
  .site-header, .site-footer, .actions, .cv-actions, .case-nav, .zoom::after { display: none; }
  body { background: #fff; font-size: 11pt; }
  .section, .stage { border: 0; padding-block: 1rem; }
  a { color: inherit; text-decoration: none; }
}
