/* ============================================================
   TOKENS
   ============================================================ */
:root {
  --color-bg:           #f7f8fa;
  --color-surface:      #ffffff;
  --color-text:         #1e293b;
  --color-text-muted:   #64748b;
  --color-accent:       #1d4ed8;
  --color-accent-dark:  #1e40af;
  --color-accent-light: #dbeafe;
  --color-accent-mid:   #93c5fd;
  --color-accent-glint: #3b82f6;
  --color-border:       #e2e8f0;
  --color-nav-bg:       #0f172a;
  --color-nav-text:     #f1f5f9;
  --color-nav-hover:    #93c5fd;
  --color-footer-bg:    #0f172a;
  --color-footer-text:  #94a3b8;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  16px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:  0 4px 12px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:  0 10px 30px rgba(0,0,0,.12);

  --space-xs:   0.25rem;
  --space-sm:   0.5rem;
  --space-md:   1rem;
  --space-lg:   2rem;
  --space-xl:   4rem;
  --space-2xl:  6rem;

  --max-width:  1120px;
  --nav-height: 64px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

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

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

ul, ol { list-style: none; }

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4 {
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

h1 { font-size: clamp(2rem, 5vw, 3rem);   font-weight: 700; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 600; }
h3 { font-size: 1.2rem; font-weight: 600; }

p { max-width: 65ch; }

/* ============================================================
   LAYOUT UTILITIES
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--space-lg);
}

.section {
  padding-block: var(--space-xl);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.1s;
  text-decoration: none;
}

.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}
.btn-primary:hover {
  background: var(--color-accent-dark);
  border-color: var(--color-accent-dark);
  color: #fff;
}

/* ============================================================
   HEADER & NAVIGATION
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-nav-bg);
  height: var(--nav-height);
  border-bottom: 1px solid rgba(255,255,255,.06);
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
}

.nav-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-nav-text);
  letter-spacing: -0.01em;
  white-space: nowrap;
  text-decoration: none;
}
.nav-logo:hover { color: var(--color-nav-hover); text-decoration: none; }

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.nav-links a {
  color: var(--color-nav-text);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
  text-decoration: none;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--color-nav-hover);
  background: rgba(255,255,255,.07);
  text-decoration: none;
}

/* The nav needs no JavaScript: the links stay inline, and on small phones
   they wrap onto a second row rather than overflowing the viewport.
   Breakpoints leave room for the longer "Experience" link. */
@media (max-width: 640px) {
  .nav-inner { gap: var(--space-sm); }
  .nav-logo  { font-size: 1rem; }
  .nav-links { gap: 0; }
  .nav-links a { padding: 0.4rem 0.5rem; font-size: 0.85rem; }
}

@media (max-width: 560px) {
  .site-header { height: auto; }

  .nav-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding-block: 0.5rem;
  }

  .nav-links {
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .nav-links a { padding: 0.35rem 0.25rem; }
}

@media (max-width: 400px) {
  .nav-links a { font-size: 0.8rem; }
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: var(--color-footer-bg);
  color: var(--color-footer-text);
  margin-top: auto;
}

/* Same height as the header */
.footer-inner {
  min-height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.footer-copy { font-size: 0.85rem; }

.footer-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem var(--space-md);
}

.footer-links a {
  color: var(--color-footer-text);
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.15s;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.footer-links a:hover { color: var(--color-nav-hover); text-decoration: none; }

.footer-divider { color: #334155; }

@media (max-width: 640px) {
  .footer-inner { flex-direction: column; align-items: flex-start; padding-block: var(--space-md); }

  /* Contact links wrap onto a second row instead of running off the screen */
  .footer-links {
    gap: 0.4rem 1.1rem;
  }

  .footer-divider { display: none; }
}

/* ============================================================
   HOME — HERO
   ============================================================ */
.hero {
  position: relative;
  padding-block: 4rem 3.5rem;
}

/* Faint drafting grid. On the home page it fills the whole drawing sheet;
   the same grid sits behind the top of every inner page (.page-grid, below). */
.sheet-page::before,
.page-grid::before {
  --grid-c: rgba(29, 78, 216, 0.08);
  background-image:
    linear-gradient(to right, var(--grid-c) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-c) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* The inner pages keep a fainter grid than the home hero */
.page-grid::before { --grid-c: rgba(29, 78, 216, 0.06); }

/* ---- The home page as one drawing sheet: graph paper inside the border,
   room at the bottom for the title block ---- */
.sheet-page {
  position: relative;
  isolation: isolate;
  background: var(--color-surface);
}
.sheet-page::before {
  content: '';
  position: absolute;
  inset: 22px;
  z-index: -1;
  background-position: center top;
  pointer-events: none;
}

.hero-inner { position: relative; }

/* Photo and text sit as one centred group */
.hero-inner {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 40px;
}

/* The group is centred; the text inside stays left-aligned */
/* A set preferred width: the column is a size container (see the eyebrow
   rule below), so it can't take its width from its text */
.hero-content { flex: 0 1 640px; max-width: 640px; min-width: 0; }

/* Plain tracked caps under the text, in the page's own colours */
.hero-eyebrow {
  margin-top: var(--space-lg);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-text);
}

.hero-eyebrow__school {
  font-weight: 500;
  color: var(--color-text-muted);
}

/* Narrow text column: school on its own line, no stray dot */
.hero-content { container-type: inline-size; }
@container (max-width: 505px) {
  .hero-eyebrow__school { display: block; margin-top: 0.35rem; }
  .hero-eyebrow__sep { display: none; }
}

/* The name fills the width of the paragraph under it: at 100px it measures
   about 623px, so 16% of the text column's width makes it span the column */
.hero-headline {
  font-size: clamp(2.5rem, 6vw, 4rem);         /* fallback for older browsers */
  font-size: 16cqi;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
}

/* Each word clips its letters so they can rise from below a hidden edge;
   the padding keeps the descender of the "y" inside the clip */
.hero-word {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.14em;
  margin-bottom: -0.14em;
}

.hero-char { display: inline-block; }

/* Key phrase in the intro, marked like a highlighter pen */
.hero-mark {
  color: var(--color-text);
  font-weight: 500;
  background-image: linear-gradient(var(--color-accent-light), var(--color-accent-light));
  background-repeat: no-repeat;
  background-position: 0 90%;
  background-size: 100% 45%;
  padding-inline: 0.1em;
  margin-inline: -0.1em;
}

.hero-intro {
  color: var(--color-text-muted);
  font-size: 1.2rem;
  line-height: 1.65;
  margin-bottom: var(--space-md);
  max-width: 58ch;
}

.hero-seeking {
  color: var(--color-text-muted);
  font-size: 1.05rem;
}

/* Headshot */
.hero-photo-wrap { flex-shrink: 0; position: relative; }

.hero-photo {
  position: relative;
  z-index: 1;
  display: block;
  width: 300px;
  flex-shrink: 0;
  aspect-ratio: 3 / 4;
  border-radius: 20px;
  object-fit: cover;
  object-position: center top;
  box-shadow: 0 20px 48px rgba(0,0,0,.15), 0 4px 12px rgba(0,0,0,.08);
}

/* Up to small laptops the photo sits near the container's left edge, so
   give the height dimension beside it room inside the sheet border */
@media (min-width: 768px) and (max-width: 1199px) {
  .hero .hero-inner { padding-inline: 48px; }
  .hero-photo-wrap { margin-left: 28px; }
}

@media (max-width: 767px) {
  /* Photo above the text, the stack centred */
  .hero-inner {
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
  }

  .hero-photo { width: min(60vw, 300px); }

  .hero-content {
    flex: none;
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---- Technical-drawing lines around the headshot ----
   Extension lines, dimension lines with arrowheads and a centre line,
   all 1px in the light accent. They sit behind the photo (z-index 0). */
.bp {
  position: absolute;
  inset: 0;
  pointer-events: none;
  --bp: var(--color-accent-mid);
}

.bp > span {
  position: absolute;
  display: block;
  background: var(--bp);
}

/* Extension lines off the top and bottom edges, to the left */
.bp-ext--top,
.bp-ext--bottom { left: -50px; width: 42px; height: 1px; transform-origin: right; --bp-from: scaleX(0); }
.bp-ext--top    { top: 0; }
.bp-ext--bottom { top: calc(100% - 1px); }

/* Extension lines down from the left and right edges */
.bp-ext--left,
.bp-ext--right { top: calc(100% + 8px); width: 1px; height: 34px; transform-origin: top; --bp-from: scaleY(0); }
.bp-ext--left  { left: 0; }
.bp-ext--right { left: calc(100% - 1px); }

/* Dimension lines, drawn out from their middle */
.bp-dim--v { left: -32px; top: 0; width: 1px; height: 100%; --bp-from: scaleY(0); }
.bp-dim--h { top: calc(100% + 30px); left: 0; width: 100%; height: 1px; --bp-from: scaleX(0); }

/* Arrowheads: two-sided corners rotated to point along the line */
.bp-dim::before,
.bp-dim::after {
  content: '';
  position: absolute;
  width: 7px;
  height: 7px;
  border-left: 1px solid var(--bp);
  border-top: 1px solid var(--bp);
}
.bp-dim--v::before { left: -3px; top: 1px;    transform: rotate(45deg); }
.bp-dim--v::after  { left: -3px; bottom: 1px; transform: rotate(225deg); }
.bp-dim--h::before { top: -3px; left: 1px;    transform: rotate(-45deg); }
.bp-dim--h::after  { top: -3px; right: 1px;   transform: rotate(135deg); }

/* Centre line (long dash, short dash); only the ends show past the photo */
.bp > .bp-cl {
  left: 50%;
  top: -26px;
  width: 1px;
  height: calc(100% + 52px);
  background: repeating-linear-gradient(to bottom,
    var(--bp) 0 12px, transparent 12px 16px, var(--bp) 16px 19px, transparent 19px 23px);
  --bp-from: scaleY(0);
}

/* Phones: the text sits right under the photo, so drop the lines below it */
@media (max-width: 767px) {
  .bp > .bp-ext--left, .bp > .bp-ext--right, .bp > .bp-dim--h { display: none; }
  .bp > .bp-cl { height: calc(100% + 26px); }
}

/* ---- Drafting grid behind the title area of the inner pages ----
   Painted under main's content (isolation + z-index -1), fading out
   downwards and towards the sides. */
.page-grid { position: relative; isolation: isolate; }

.page-grid::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 460px;
  z-index: -1;
  background-position: center top;
  -webkit-mask-image: radial-gradient(ellipse 60% 100% at 50% 0%, #000 15%, transparent 75%);
          mask-image: radial-gradient(ellipse 60% 100% at 50% 0%, #000 15%, transparent 75%);
  pointer-events: none;
}

/* ---- Drawing lines around the About photo ----
   Same pieces as the home headshot; they draw in once on load. */
.bp-frame { position: relative; }
.bp-frame .about-photo { position: relative; z-index: 1; }

/* The section divider sits just under the photo, so only the height
   dimension and centre line are used here. Below 860px the text column
   comes close on the left, so the photo goes plain. */
.bp-frame .bp > .bp-ext--left,
.bp-frame .bp > .bp-ext--right,
.bp-frame .bp > .bp-dim--h { display: none; }

@media (max-width: 860px) {
  .bp-frame .bp { display: none; }
}

/* ---- Corner marks on project cards ----
   Hovering a card brings crop-mark corners in around its image. */
.project-card__img-wrap { position: relative; }

.project-card__img-wrap::after {
  content: '';
  position: absolute;
  inset: 10px;
  --c: var(--color-accent);
  --l: 14px;
  --t: 1.5px;
  background:
    linear-gradient(var(--c), var(--c)) top left     / var(--l) var(--t),
    linear-gradient(var(--c), var(--c)) top left     / var(--t) var(--l),
    linear-gradient(var(--c), var(--c)) top right    / var(--l) var(--t),
    linear-gradient(var(--c), var(--c)) top right    / var(--t) var(--l),
    linear-gradient(var(--c), var(--c)) bottom left  / var(--l) var(--t),
    linear-gradient(var(--c), var(--c)) bottom left  / var(--t) var(--l),
    linear-gradient(var(--c), var(--c)) bottom right / var(--l) var(--t),
    linear-gradient(var(--c), var(--c)) bottom right / var(--t) var(--l);
  background-repeat: no-repeat;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.2, 0.75, 0.25, 1);
  pointer-events: none;
}

.project-card:hover .project-card__img-wrap::after,
.project-card:focus-visible .project-card__img-wrap::after {
  opacity: 1;
  transform: none;
}

/* ---- Bottom of the sheet: the projects button, centred on the page and
   framed by the two views of the gripper (Detail B), with the caption
   under all three and the title block in the corner ---- */
.sheet-foot { padding: var(--space-sm) 0 92px; }

.sheet-foot__inner {
  display: grid;
  grid-template-columns: minmax(0, 240px) auto minmax(0, 240px);   /* equal sides keep the button centred */
  grid-template-areas: "section button front" "caption caption caption";
  justify-content: center;
  align-items: center;
  column-gap: 56px;
  row-gap: 18px;
  width: calc(100% - 64px);
  margin-inline: auto;
}

/* The drawings need the script; the button doesn't */
.detail-view { display: none; text-decoration: none; }
.js .detail-view { display: block; }
.detail-view--section { grid-area: section; justify-self: end; width: 220px; max-width: 100%; }
.detail-view--front { grid-area: front; justify-self: start; width: 240px; max-width: 100%; }
.drawing { display: block; width: 100%; height: auto; }

/* The main call to action: solid blue, with a thin outer frame line like a
   boxed callout on a drawing */
.sheet-btn {
  grid-area: button;
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 17px 30px;
  border: 1.5px solid var(--color-accent);
  border-radius: 2px;
  background: var(--color-accent);
  box-shadow: 0 0 0 5px var(--color-surface), 0 0 0 6px rgba(29, 78, 216, 0.35);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.sheet-btn:hover { background: var(--color-accent-dark); border-color: var(--color-accent-dark); color: #fff; text-decoration: none; }
.sheet-btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 9px; }
.sheet-btn__arrow { display: inline-block; transition: transform 0.15s; }
.sheet-btn:hover .sheet-btn__arrow { transform: translateX(4px); }

/* Hover: the callout frame opens up, a light sweep crosses the button and the
   arrow shoots forward like a leader line. Motion only if the visitor allows it. */
.sheet-btn { position: relative; overflow: hidden; }
.sheet-btn::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 -60%;
  width: 40%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  .sheet-btn {
    transition: background 0.15s, border-color 0.15s, transform 0.25s cubic-bezier(0.2, 0.8, 0.3, 1), box-shadow 0.25s ease;
  }
  .sheet-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 0 5px var(--color-surface), 0 0 0 7px rgba(29, 78, 216, 0.55), 0 12px 24px -8px rgba(29, 78, 216, 0.45);
  }
  .sheet-btn:hover::before { animation: sheet-btn-sweep 0.8s ease-out; }
  .sheet-btn:active { transform: translateY(-1px); }
  .sheet-btn__arrow { transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.3, 1); }
  .sheet-btn:hover .sheet-btn__arrow { transform: translateX(8px) scaleX(1.25); }
}
@keyframes sheet-btn-sweep { to { left: 130%; } }

/* Caption under the views, linking to the gripper write-up */
.view-label {
  grid-area: caption;
  justify-self: center;
  font-size: 0.62rem;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  color: var(--color-accent);
  text-decoration: none;
}
.view-label:hover { text-decoration: none; color: var(--color-accent-dark); }
.view-label b { font-weight: 700; }
.view-label__go { display: inline-block; transition: transform 0.15s; }
.view-label:hover .view-label__go { transform: translateX(3px); }
html:not(.js) .view-label { display: none; }   /* no drawing, no caption */

/* Short laptop screens: a slightly smaller photo keeps the button on the
   first screen */
@media (min-width: 1040px) and (max-height: 720px) {
  .hero { padding-block: 3.5rem 2.5rem; }
  .hero-photo { width: 255px; }
}

/* Narrower screens: the button first, then the two views side by side and
   the caption; the title block moves below everything */
@media (max-width: 1039px) {
  .sheet-foot { padding-bottom: 112px; }
}

@media (max-width: 899px) {
  .sheet-foot__inner {
    grid-template-columns: minmax(0, 220px) minmax(0, 240px);
    grid-template-areas: "button button" "section front" "caption caption";
    column-gap: 24px;
    row-gap: 28px;
  }
}

/* On the home page the photo's extension lines stop short of the sheet border */
.hero .bp-ext--top,
.hero .bp-ext--bottom { left: -44px; width: 36px; }

/* Drawing line styles (the SVG units are millimetres, about 0.9 px each) */
.drawing .d-part { fill: var(--color-surface); stroke: var(--color-accent); stroke-opacity: 0.55; stroke-width: 1.1; stroke-linejoin: round; }
.drawing .d-pad { stroke: var(--color-accent); stroke-opacity: 0.55; stroke-width: 1.1; }
.drawing .d-hatch-bg { fill: var(--color-surface); }
.drawing .d-hatch { stroke: var(--color-accent); stroke-opacity: 0.45; stroke-width: 0.55; }
.drawing .d-gear { fill: none; stroke: var(--color-accent); stroke-opacity: 0.6; stroke-width: 0.8; stroke-linejoin: round; }
.drawing .d-edge { fill: none; stroke: var(--color-accent); stroke-opacity: 0.45; stroke-width: 0.85; }
.drawing .d-thin { fill: none; stroke: var(--color-accent); stroke-opacity: 0.4; stroke-width: 0.65; }
.drawing .d-hid,
.drawing .d-hid-r { fill: none; stroke: var(--color-accent); stroke-opacity: 0.4; stroke-width: 0.65; stroke-dasharray: 3 2; }
.drawing .d-ctr { stroke: var(--color-accent); stroke-opacity: 0.35; stroke-width: 0.6; stroke-dasharray: 11 2.2 2.2 2.2; }
.drawing .d-cut,
.drawing .d-cut-end { stroke: var(--color-accent); stroke-opacity: 0.6; stroke-width: 1.3; }
.drawing .d-cut { stroke-dasharray: 14 2.5 2.5 2.5; }
.drawing .d-arrow { fill: var(--color-accent); fill-opacity: 0.65; }
.drawing .d-text { font-family: var(--font-sans); font-size: 10px; font-weight: 600; letter-spacing: 0.12em; fill: var(--color-accent); fill-opacity: 0.8; text-anchor: middle; }
.drawing .d-text--sm { font-size: 9px; letter-spacing: 0; }

/* The objects it picks up: simple line drawings, a little lighter than the gripper */
.drawing .o-body { fill: var(--color-surface); stroke: var(--color-accent); stroke-opacity: 0.55; stroke-width: 0.9; stroke-linejoin: round; }
.drawing .o-line { fill: none; stroke: var(--color-accent); stroke-opacity: 0.45; stroke-width: 0.65; stroke-linecap: round; stroke-linejoin: round; }
.drawing .o-dot { fill: var(--color-accent); fill-opacity: 0.45; }

/* ---- Drawing-sheet border ----
   ASME-style zone markers (numbers right to left, letters bottom to top)
   and a title block in the bottom-right corner. */
.sheet {
  position: absolute;
  z-index: -1;
  inset: 8px;
  border: 1px solid rgba(29, 78, 216, 0.22);
  pointer-events: none;
}
.sheet::before {
  content: '';
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(29, 78, 216, 0.34);
}
.sheet__band { position: absolute; overflow: visible; }
.sheet__band--top,
.sheet__band--bottom { left: 0; width: 100%; height: 14px; }
.sheet__band--top { top: 0; }
.sheet__band--bottom { bottom: 0; }
.sheet__band--left,
.sheet__band--right { top: 0; width: 14px; height: 100%; }
.sheet__band--left { left: 0; }
.sheet__band--right { right: 0; }
.sheet__band line { stroke: rgba(29, 78, 216, 0.22); stroke-width: 1; }
.sheet__band text {
  font-family: var(--font-sans);
  font-size: 8px;
  font-weight: 600;
  fill: rgba(29, 78, 216, 0.5);
  text-anchor: middle;
  dominant-baseline: central;
}

.title-block {
  position: absolute;
  right: 22px;
  bottom: 22px;
  z-index: 1;
  width: 340px;
  display: grid;
  grid-template-columns: 1.5fr 0.55fr 0.65fr 0.95fr 50px;
  background: var(--color-surface);
  border: 1px solid rgba(29, 78, 216, 0.34);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text);
  pointer-events: none;
}
.tb-cell {
  padding: 3px 6px 4px;
  border-right: 1px solid rgba(29, 78, 216, 0.34);
  white-space: nowrap;
}
.tb-title,
.tb-drawn { border-bottom: 1px solid rgba(29, 78, 216, 0.34); }
.tb-cell span {
  display: block;
  margin-bottom: 1px;
  font-size: 6.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--color-text-muted);
}
.tb-title { grid-column: 1 / 4; }
.tb-drawn { grid-column: 4; }
.tb-proj {
  grid-column: 5;
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
}
.tb-proj svg { fill: none; stroke: var(--color-accent); stroke-opacity: 0.6; stroke-width: 1; }
.tb-proj .tb-ctr { stroke-width: 0.6; stroke-opacity: 0.45; stroke-dasharray: 4 1.5 1 1.5; }

@media (max-width: 767px) {
  .title-block { left: 22px; width: auto; }
}

/* ---- GD&T callouts on the photo: basic dimensions, datum A and a
   parallelism control frame on the top edge ---- */
.gdt { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.gdt-basic {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 1px 4px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--color-accent);
  background: var(--color-surface);
  border: 1px solid var(--color-accent-mid);
}
.gdt-basic--v { left: -31.5px; top: 50%; }
.gdt-basic--h { left: 50%; top: calc(100% + 30.5px); }
.gdt svg { position: absolute; overflow: visible; fill: none; stroke: var(--color-accent); stroke-opacity: 0.7; stroke-width: 1; }
.gdt svg rect { fill: var(--color-surface); }
.gdt svg .gdt-fill { fill: var(--color-accent); fill-opacity: 0.7; stroke: none; }
.gdt svg text {
  fill: var(--color-accent);
  stroke: none;
  font-family: var(--font-sans);
  font-size: 9.5px;
  font-weight: 700;
  text-anchor: middle;
}
.gdt-datum { left: 72%; top: 100%; margin-left: -10px; }
.gdt-fcf { right: 0; bottom: 100%; }

@media (max-width: 767px) {
  /* The name sits right under the photo on phones: no room below it */
  .gdt-basic--h,
  .gdt-datum { display: none; }
}

/* ---- Intro animation (home page only) ----
   index.html adds .hero-anim straight away (hides the pieces) and
   .hero-go once Inter has loaded (plays them). Without JS, or with
   reduced motion, neither class is added and the hero is static. */
@media (prefers-reduced-motion: no-preference) {
  .hero-anim .hero-char,
  .hero-anim .hero-photo,
  .hero-anim .hero-intro,
  .hero-anim .hero-seeking,
  .hero-anim .hero-eyebrow,
  .hero-anim .sheet-page::before { opacity: 0; }
  .hero-anim .bp > span { transform: var(--bp-from); }
  .hero-anim .hero-mark { background-size: 0% 45%; }

  /* Name: letters rise in one after another, then a blue glint runs through them */
  .hero-go .hero-char {
    animation:
      hero-rise 0.75s cubic-bezier(0.2, 0.75, 0.25, 1) calc(0.1s + var(--i) * 40ms) both,
      hero-glint 0.7s ease-in-out calc(0.75s + var(--i) * 35ms) both;
  }

  .hero-go .hero-photo   { animation: hero-photo-in 0.9s cubic-bezier(0.2, 0.75, 0.25, 1) both; }
  .hero-go .sheet-page::before { animation: hero-fade 1.2s ease-out 0.1s both; }

  /* Supporting text fades up in order */
  .hero-go .hero-intro   { animation: hero-up 0.6s ease-out 0.45s both; }
  .hero-go .hero-seeking { animation: hero-up 0.6s ease-out 0.6s both; }
  .hero-go .hero-eyebrow { animation: hero-up 0.6s ease-out 0.75s both; }

  /* Highlighter sweeps left to right behind the key phrase */
  .hero-go .hero-mark { animation: hero-mark 0.7s cubic-bezier(0.65, 0, 0.35, 1) 1.05s both; }

  /* Drawing sheet first, GD&T callouts after the photo's dimension lines */
  .hero-anim .sheet,
  .hero-anim .title-block,
  .hero-anim .gdt { opacity: 0; }
  .hero-go .sheet,
  .hero-go .title-block { animation: hero-fade 0.8s ease-out 0.1s both; }
  .hero-go .gdt { animation: hero-fade 0.6s ease-out 1.25s both; }

  /* Featured gripper fades in with the text; its own script then animates it */
  .hero-anim .sheet-foot__inner { opacity: 0; }
  .hero-go .sheet-foot__inner   { animation: hero-up 0.6s ease-out 0.9s both; }

  /* Drawing lines: extension lines first, then dimensions, then centre line */
  .hero-go .bp > span     { animation: hero-draw 0.6s cubic-bezier(0.65, 0, 0.35, 1) 0.55s both; }
  .hero-go .bp > .bp-dim  { animation-delay: 0.8s; }
  .hero-go .bp > .bp-cl   { animation-delay: 1s; }
}

/* Inner pages: the grid fades in and the About lines draw in, once */
@media (prefers-reduced-motion: no-preference) {
  .page-grid::before { animation: hero-fade 0.9s ease-out both; }
  .bp-frame .bp > span          { animation: hero-draw 0.6s cubic-bezier(0.65, 0, 0.35, 1) 0.3s both; }
  .bp-frame .bp > .bp-dim       { animation-delay: 0.55s; }
  .bp-frame .bp > .bp-cl        { animation-delay: 0.75s; }
}

@media (prefers-reduced-motion: reduce) {
  .project-card__img-wrap::after { transform: none; transition: opacity 0.2s ease; }
}

@keyframes hero-rise {
  from { transform: translateY(105%); opacity: 0; }
  40%  { opacity: 1; }
  to   { transform: none; opacity: 1; }
}

@keyframes hero-glint {
  0%, 100% { color: var(--color-text); }
  45%      { color: var(--color-accent-glint); }
}

@keyframes hero-photo-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

@keyframes hero-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@keyframes hero-fade { from { opacity: 0; } to { opacity: 1; } }

@keyframes hero-mark {
  from { background-size: 0% 45%; }
  to   { background-size: 100% 45%; }
}

@keyframes hero-draw {
  from { transform: var(--bp-from); }
  to   { transform: none; }
}

/* ============================================================
   HOME — SECTION HEADING
   ============================================================ */
.section-header { margin-bottom: var(--space-lg); }

/* Overrides the global 65ch cap so the line does not wrap on desktop */
.section-header p {
  max-width: none;
  color: var(--color-text-muted);
}

/* ============================================================
   HOME — PROJECTS CTA ROW
   Sits directly under the grid and shares its edges.
   ============================================================ */
.projects-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-top: var(--space-lg);
  padding: var(--space-md) var(--space-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* Overrides the global p max-width, which would otherwise size this line */
.projects-cta__line {
  max-width: none;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-text);
}

@media (max-width: 640px) {
  .projects-cta {
    flex-direction: column;
    align-items: flex-start;
    padding: var(--space-md);
  }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.text-muted  { color: var(--color-text-muted); }
.text-accent { color: var(--color-accent); }
.text-center { text-align: center; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }

/* ============================================================
   BACK LINK
   ============================================================ */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s;
}

.back-link:hover { color: var(--color-accent); text-decoration: none; }

/* ============================================================
   PROJECT DETAIL PAGE
   ============================================================ */
.project-detail { padding-block: var(--space-xl); }

/* Skill tags */
.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.skill-tag {
  display: inline-block;
  background: var(--color-accent-light);
  color: var(--color-accent-dark);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 100px;
  white-space: nowrap;
}

/* Bottom back-link row */
.detail-bottom-nav {
  display: flex;
  justify-content: flex-start;
  padding-top: var(--space-xl);
}

/* ============================================================
   ABOUT PAGE
   Full container width, like the projects page. Each section is a
   text column beside a photo, with no card around either.
   ============================================================ */
.about-col { max-width: none; }

.about-block { padding-block: var(--space-lg); }
.about-block:first-child { padding-top: 0; }

/* A single thin divider between sections */
.about-block + .about-block { border-top: 1px solid var(--color-border); }

.about-block h1 { margin-bottom: var(--space-md); }

.about-block h2 {
  font-size: 1.35rem;
  margin-bottom: var(--space-md);
}

/* Text beside a photo. The photo centres on the text it sits next to,
   which is why the heading stays outside this grid. */
.about-split {
  display: grid;
  gap: var(--space-xl);
  align-items: center;
}

.about-split--intro { grid-template-columns: minmax(0, 1fr) 260px; }
.about-split--feature { grid-template-columns: 380px minmax(0, 1fr); }

/* Fills its column, so there is no dead gap before the photo */
.about-intro-text p,
.about-feature-text p {
  max-width: none;
  color: var(--color-text-muted);
  line-height: 1.8;
  font-size: 1.02rem;
}

.about-intro-text p + p { margin-top: var(--space-md); }

.about-feature-text h3 {
  font-size: 1.1rem;
  margin-bottom: var(--space-sm);
}

.about-photo {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center top;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  background: #ffffff;
}

.about-photo--wide {
  aspect-ratio: 4 / 3;
  object-position: center;
}


@media (max-width: 860px) {
  .about-split { gap: var(--space-lg); }
  .about-split--intro { grid-template-columns: minmax(0, 1fr) 220px; }
  .about-split--feature { grid-template-columns: 300px minmax(0, 1fr); }
}

@media (max-width: 680px) {
  /* Photo above its text on mobile */
  .about-split--intro,
  .about-split--feature { grid-template-columns: minmax(0, 1fr); }

  .about-split--intro .bp-frame {
    order: -1;
    width: 180px;
  }

  .about-split--intro .about-photo { aspect-ratio: 1; }
}

/* ============================================================
   EXPERIENCE PAGE
   One card per role. Bullets reuse .cs-bullets, tags reuse the
   project-card tags.
   A thin rail on the left joins the cards on wider screens.
   ============================================================ */
.exp { --exp-rail: 1.75rem; --exp-pad: var(--space-lg); }

.exp-list {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  padding-left: var(--exp-rail);
}

.exp-list::before {
  content: '';
  position: absolute;
  left: 0.4rem;
  top: 0.75rem;
  bottom: 0.75rem;
  width: 2px;
  background: var(--color-border);
}

.exp-card {
  position: relative;
  padding: var(--exp-pad);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* Dot on the rail, level with the role title */
.exp-card::before {
  content: '';
  position: absolute;
  left: calc(0.4rem + 1px - 6px - var(--exp-rail) - 1px);
  top: calc(var(--exp-pad) + 0.4rem);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 2px solid var(--color-accent);
}

/* Title left, dates and location right; wraps under the title when narrow */
.exp-card__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.25rem var(--space-lg);
}

.exp-card__title { font-size: 1.2rem; line-height: 1.35; }
.exp-card__company { color: var(--color-accent-dark); white-space: nowrap; }
.exp-card__company::before { content: '\00b7'; margin-right: 0.35rem; }

.exp-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.5rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.exp-card__meta span { white-space: nowrap; }
.exp-card__meta span + span::before { content: '\00b7'; margin-right: 0.5rem; }

.exp-card__context {
  margin-top: 0.25rem;
  color: var(--color-text-muted);
  font-size: 0.95rem;
  max-width: none;
}

.exp-card__bullets {
  margin-top: var(--space-md);
  max-width: 85ch;
  font-size: 0.95rem;
}

.exp-card__project {
  display: inline-block;
  margin-top: var(--space-md);
  font-size: 0.9rem;
  font-weight: 600;
}

.exp-card .exp-card__tags { margin-top: var(--space-md); max-width: none; }


@media (max-width: 640px) {
  /* No rail on phones: the width goes to the text instead */
  .exp { --exp-rail: 0rem; --exp-pad: var(--space-md); }
  .exp-list::before,
  .exp-card::before { display: none; }

  .exp-card__head { flex-direction: column; }

  /* Company and location each get their own line instead of a stray dot */
  .exp-card__company { display: block; }
  .exp-card__company::before,
  .exp-card__meta span + span::before { content: none; }
  .exp-card__meta { flex-direction: column; }
}

/* ============================================================
   CONTACT PAGE
   ============================================================ */
.contact-wrap {
  max-width: 900px;
  margin-inline: auto;
  text-align: center;
}

.contact-intro {
  color: var(--color-text-muted);
  font-size: 1.05rem;
  line-height: 1.75;
  margin-top: var(--space-md);
  margin-bottom: var(--space-xl);
  margin-inline: auto;
  max-width: 60ch;
}

/* One row on desktop, stacked on mobile */
.contact-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

/* Tall, centred cards: icon on top, label and value beneath */
.contact-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 1.1rem;
  height: 100%;
  min-height: 220px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem 2.25rem;
  text-align: center;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.contact-item:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  text-decoration: none;
  color: inherit;
}

.contact-item-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--color-accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-accent);
  transition: background 0.15s, color 0.15s;
}

.contact-item-icon svg {
  width: 28px;
  height: 28px;
}

.contact-item:hover .contact-item-icon {
  background: var(--color-accent);
  color: #fff;
}

.contact-item-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.contact-item-value .nowrap { white-space: nowrap; }

.contact-item-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.5;
  overflow-wrap: break-word;
}

/* Stacked on mobile: back to a compact row so three cards don't fill several screens */
@media (max-width: 820px) {
  .contact-list { grid-template-columns: 1fr; gap: var(--space-md); max-width: 460px; margin-inline: auto; }
  .contact-item {
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
    min-height: 0;
    padding: 1.25rem 1.5rem;
    gap: 1.1rem;
  }
  .contact-item-icon { width: 52px; height: 52px; }
  .contact-item-icon svg { width: 24px; height: 24px; }
  .contact-item-value { font-size: 1rem; }
}

/* ============================================================
   PROJECT CARDS (home + projects pages)
   ============================================================ */
.project-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-lg);
}

.project-card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.project-card:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  text-decoration: none;
}

.project-card__img-wrap {
  aspect-ratio: 16 / 10;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  overflow: hidden;
}

.project-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Stands in for a photo that does not exist yet */
.project-card__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, var(--color-accent-light), var(--color-bg));
  color: var(--color-accent);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  padding: var(--space-md);
}

.project-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: var(--space-md);
  flex: 1;
}

.project-card__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.35;
}

.project-card:hover .project-card__title { color: var(--color-accent); }

.project-card__outcome {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
  flex: 1;
}

.project-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.project-card__tag {
  padding: 0.18rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-size: 0.72rem;
  font-weight: 500;
}

/* ============================================================
   PROJECT PAGE COMPONENTS
   ============================================================ */
/* Status badge beside a project title */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: var(--space-sm);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d97706;
  flex-shrink: 0;
}

/* Headline numbers across the top of a project page */
.results-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.result-stat {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-md);
}

.result-stat__value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-accent);
  line-height: 1.25;
}

.result-stat__label {
  margin-top: 4px;
  color: var(--color-text-muted);
  font-size: 0.82rem;
}

/* Requirement / spec rows */
.spec-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: var(--space-sm);
}

.spec-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px dashed var(--color-border);
  font-size: 0.9rem;
}

.spec-list li:last-child { border-bottom: 0; padding-bottom: 0; }

.spec-list dfn,
.spec-name {
  font-style: normal;
  font-weight: 600;
  color: var(--color-text);
  min-width: 190px;
}

.spec-value { color: var(--color-text-muted); }

/* Test plan table */
.table-scroll { overflow-x: auto; margin-top: var(--space-md); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 540px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
}

.data-table caption {
  caption-side: top;
  text-align: left;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  padding-bottom: var(--space-sm);
}

.data-table th,
.data-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.data-table thead th {
  background: var(--color-bg);
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.data-table tbody tr:last-child td { border-bottom: 0; }

/* Worked calculation steps */
.calc-list {
  list-style: none;
  counter-reset: calcstep;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-top: var(--space-md);
  margin-bottom: var(--space-lg);
}

.calc-list li {
  counter-increment: calcstep;
  position: relative;
  padding: var(--space-md);
  /* The badge sits in the left padding, so the right padding matches it
     (gutter + badge + gap) and the frame ends up centred on the text. */
  padding-left: calc(var(--space-md) + 2.25rem);
  padding-right: calc(var(--space-md) + 2.25rem);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.calc-list li::before {
  content: counter(calcstep);
  position: absolute;
  left: var(--space-md);
  top: var(--space-md);
  width: 1.6rem;
  height: 1.6rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--color-accent-light);
  color: var(--color-accent);
  font-size: 0.75rem;
  font-weight: 700;
}

.calc-step__name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.calc-step__body {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  line-height: 1.75;
  max-width: 72ch;
}

/* ============================================================
   PROJECT CASE-STUDY LAYOUT
   Result-first page. Every image is its own framed block with a
   real heading underneath it, never text laid over or inside it.
   Shared by all project pages (cs- = case study).
   ============================================================ */
.cs-page { padding-block: 2.5rem; }

/* Headline row: text beside the hero image on wide screens.
   The back link spans both columns; the hero starts on the title's row,
   and its top margin (the title's top margin plus the gap between the top
   of the title's line box and the top of its capitals, 0.211em in Inter)
   lines the image's top edge up with the top of the title text. The last
   row is 1fr, so when the image is taller than the text the extra height
   goes there instead of spreading the title and paragraph apart. */
.cs-intro {
  --cs-h1-size: clamp(1.6rem, 3.5vw, 2.25rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 560px);
  grid-template-rows: auto auto auto auto 1fr;
  column-gap: var(--space-lg);
}

.cs-intro__top              { display: contents; }
.cs-intro__top .back-link   { grid-column: 1 / -1; grid-row: 1; justify-self: start; }
.cs-intro__top h1           { grid-column: 1; grid-row: 2; }
.cs-lead                    { grid-column: 1; grid-row: 3; }
.cs-intro__bottom           { grid-column: 1; grid-row: 4; }

.cs-intro .cs-fig--hero {
  grid-column: 2;
  grid-row: 2 / 6;
  align-self: start;
  margin-top: calc(var(--space-md) + 0.211 * var(--cs-h1-size));
}

.cs-intro h1 {
  font-size: var(--cs-h1-size);
  margin-block: var(--space-md) 0.75rem;
}

.cs-lead {
  font-size: 1.08rem;
  line-height: 1.6;
  color: var(--color-text);
  max-width: 60ch;
}

.cs-meta {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.cs-intro .skill-tags { margin-top: 0.85rem; }

.cs-metrics { margin-top: var(--space-lg); margin-bottom: var(--space-sm); }
.cs-metrics .result-stat__value { font-size: 1.35rem; }
.cs-metrics-note { margin-bottom: var(--space-sm); color: var(--color-text-muted); font-size: 0.85rem; max-width: none; }

/* Sections share one reading column, centred on the page */
.cs-sec {
  max-width: 880px;
  margin-inline: auto;
  padding-block: 2rem;
  border-top: 1px solid var(--color-border);
}

.cs-page h2 {
  font-size: 1.45rem;
  margin-bottom: var(--space-md);
}

.cs-h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.cs-prose p,
.cs-prose-line {
  color: var(--color-text);
  line-height: 1.7;
  max-width: 70ch;
}

.cs-prose-line { margin-bottom: var(--space-md); color: var(--color-text-muted); }
.cs-prose .cs-h3 { margin-top: var(--space-lg); }
.cs-prose .spec-list li { display: block; }
.cs-prose .spec-name { display: block; min-width: 0; }

.cs-page dfn { font-style: normal; font-weight: 600; }

.cs-bullets {
  list-style: disc;
  padding-left: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  line-height: 1.6;
}

.cs-bullets li::marker { color: var(--color-accent); }

.cs-after-fig { margin-top: var(--space-md); }

/* Problem text beside the portrait render */
.cs-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: var(--space-lg);
  align-items: start;
}

/* Two-column role split */
.cs-role {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-lg);
}

.cs-role > div {
  padding: var(--space-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.cs-steps { margin-bottom: 0; }
.cs-steps + .cs-fig { margin-top: 2rem; }

/* ---- Figures: the image block, then a separate heading ---- */
.cs-fig { margin: 0; }
.cs-fig + .cs-fig { margin-top: 2.5rem; }
.cs-key + .cs-fig { margin-top: 2rem; }

.cs-fig__media {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.cs-fig__media img {
  display: block;
  width: 100%;
  height: auto;
}

a.cs-fig__media { cursor: zoom-in; transition: border-color 0.15s, box-shadow 0.15s; }
a.cs-fig__media:hover { border-color: var(--color-accent-mid); box-shadow: var(--shadow-md); }
a.cs-fig__media:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 3px; }

.cs-fig__cap { margin-top: 0.85rem; }

.cs-fig__title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--color-text);
  margin: 0;
}

.cs-page .cs-fig--hero .cs-fig__title { font-size: 1rem; margin: 0; }

.cs-fig__note {
  margin-top: 0.3rem;
  color: var(--color-text-muted);
  font-size: 0.95rem;
  line-height: 1.55;
  max-width: 72ch;
}

/* Portrait render: keep it from towering over its text */
.cs-fig--portrait .cs-fig__media { padding: var(--space-md); }
.cs-fig--portrait img { max-height: 480px; width: auto; max-width: 100%; margin-inline: auto; }

/* Baseline / Optimized label above each FEA title */
.cs-badge {
  display: inline-block;
  margin-bottom: 0.35rem;
  padding: 0.12rem 0.6rem;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cs-badge--after {
  background: var(--color-accent-light);
  border-color: var(--color-accent-mid);
  color: var(--color-accent-dark);
}

/* ---- Before / after comparison ---- */
.cs-compare {
  display: grid;
  gap: var(--space-md);
}

.cs-bars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md) var(--space-lg);
  padding: var(--space-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.cs-bars__metric {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.cs-bars__row {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr) 4.75rem;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
}

.cs-bars__row + .cs-bars__row { margin-top: 0.4rem; }

.cs-bars__label { color: var(--color-text-muted); }
.cs-bars__scale { display: block; font-size: 0.75rem; font-weight: 500; color: var(--color-text-muted); }
.cs-bars__val { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

.cs-bars__track {
  display: block;
  height: 14px;
  background: var(--color-bg);
  border-radius: 4px;
}

.cs-bars__fill {
  display: block;
  height: 100%;
  border-radius: 0 4px 4px 0;
}

.cs-bars__fill--before { background: #64748b; }
.cs-bars__fill--after  { background: var(--color-accent); }

.cs-table { min-width: 560px; }
.cs-table tbody th { font-weight: 600; color: var(--color-text); }
.cs-delta { color: var(--color-accent-dark); white-space: nowrap; }

/* Reading guide for the FEA plots */
.cs-key {
  margin-top: var(--space-lg);
  padding: var(--space-md) 1.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
}

/* Heading with a status badge beside it */
.cs-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.85rem;
  margin-bottom: var(--space-md);
}

.cs-page .cs-head h2 { margin-bottom: 0; }
.cs-head .status-badge { margin-top: 0; }

.cs-intro .status-badge { margin-top: 0.75rem; }

/* Video inside a figure frame (white CAD background) */
.cs-fig__media video {
  display: block;
  width: 100%;
  height: auto;
  background: #ffffff;
}

/* Block diagram drawn in inline SVG; scrolls sideways on small phones */
.cs-diagram {
  padding: var(--space-md);
  overflow-x: auto;
}

.cs-diagram svg { display: block; width: 100%; height: auto; min-width: 640px; }

.cs-after-table { margin-top: var(--space-md); }

/* Numbered next steps */
.cs-next {
  list-style: decimal;
  padding-left: 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  line-height: 1.6;
}

.cs-next li::marker { color: var(--color-accent); font-weight: 700; }

/* Missing information: loud on purpose, so it cannot ship unnoticed */
.cs-todo {
  display: inline;
  padding: 0.05rem 0.4rem;
  border-radius: var(--radius-sm);
  background: #fef3c7;
  border: 1px dashed #d97706;
  color: #92400e;
  font-size: 0.85em;
  font-weight: 600;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

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

.cs-page .detail-bottom-nav {
  max-width: 880px;
  margin-inline: auto;
  padding-top: var(--space-lg);
}

@media (max-width: 899px) {
  .cs-split { grid-template-columns: minmax(0, 1fr); }

  /* Phone/tablet headline order: title, result, hero image, then meta */
  .cs-intro { display: flex; flex-direction: column; }
  .cs-intro__top { order: 1; display: block; }
  .cs-lead { order: 2; }
  .cs-intro .cs-fig--hero { order: 3; margin-block: 1.25rem 0.25rem; }
  .cs-intro__bottom { order: 4; }

  .cs-fig--portrait { max-width: 360px; }
}

@media (max-width: 640px) {
  .cs-role,
  .cs-bars { grid-template-columns: minmax(0, 1fr); }
  .cs-sec { padding-block: 1.5rem; }
  .cs-fig + .cs-fig { margin-top: 2rem; }
  .cs-steps li { padding-right: var(--space-md); }

  /* Comparison table fits the screen instead of scrolling sideways */
  .cs-table { min-width: 0; font-size: 0.8rem; }
  .cs-table th,
  .cs-table td { padding: 0.5rem 0.45rem; }
  .cs-table thead th { font-size: 0.7rem; letter-spacing: 0; }
  .cs-delta { display: block; }
}

@media (max-width: 400px) {
  .cs-bars__row { grid-template-columns: 4.6rem minmax(0, 1fr) 4.4rem; gap: 0.45rem; }
}

/* ============================================================
   LIGHTBOX (assets/lightbox.js)
   ============================================================ */
html.lightbox-open { overflow: hidden; }

.lightbox {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #0f172a;
  color: var(--color-nav-text);
}

.lightbox[open] { display: flex; flex-direction: column; }
.lightbox::backdrop { background: rgba(15, 23, 42, 0.6); }

.lightbox__bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem var(--space-md);
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.lightbox__title {
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lightbox__btn {
  flex-shrink: 0;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,.25);
  background: transparent;
  color: var(--color-nav-text);
  cursor: pointer;
}

.lightbox__btn:hover { background: rgba(255,255,255,.1); }
.lightbox__btn:focus-visible { outline: 2px solid var(--color-nav-hover); outline-offset: 2px; }

.lightbox__stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm);
  overflow: auto;
}

.lightbox__stage img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: zoom-in;
  background: #ffffff;
}

/* 1:1 pixels; the stage scrolls */
.lightbox__stage.is-zoomed { display: block; padding: 0; }
.lightbox__stage.is-zoomed img { max-width: none; max-height: none; cursor: zoom-out; }

@media (max-width: 480px) {
  .lightbox__title { display: none; }
  .lightbox__bar { justify-content: flex-end; }
}

/* ============================================================
   REDIRECT STUB PAGES
   ============================================================ */
.redirect-page {
  max-width: 44ch;
  margin: 0 auto;
  padding-block: var(--space-2xl);
  text-align: center;
}

.redirect-page p { color: var(--color-text-muted); margin-bottom: var(--space-md); }

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  .site-header,
  .site-footer { display: none; }

  .section { padding-block: 0; }
  body { background: #fff; }

  a[href]::after { content: none; }
}
