/* Portfolio styles on top of the template (site.css) and its overrides (naturalise.css):
   GNOME-style terminals, the project cards, the skills list and the thin-line schematic. */

/* ---- Terminal: modelled on GNOME Terminal's dark theme (libadwaita header bar, Tango palette) ---- */
:root {
  --term-window: #1e1e1e;      /* GNOME Terminal dark background */
  --term-headerbar: #303030;   /* libadwaita dark header bar */
  --term-button: #484848;      /* header-bar window buttons */
  --term-text: #d0cfcc;        /* GNOME default foreground; 11.9:1 on the background */
  --term-user: #8ae234;        /* Tango bright green: user@host */
  --term-path: #729fcf;        /* Tango bright blue: working directory */
  --term-dim: #9a9996;         /* secondary output */
  --term-font: "DejaVu Sans Mono", "Ubuntu Mono", "Geist Mono", ui-monospace, monospace;
}

.term {
  background: var(--term-window);
  border-radius: 12px;                      /* libadwaita window corner radius */
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 18px 48px -20px rgba(0, 0, 0, 0.7);
  text-align: left;
}
.term-bar {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  height: 46px; padding: 0 120px;           /* side padding keeps the title clear of the buttons */
  background: var(--term-headerbar);
  color: #ffffff;
  font: 600 0.9375rem / 1 -apple-system, "Cantarell", "Segoe UI", Helvetica, Arial, sans-serif;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* minimise, maximise and close sit on the right, as in GNOME */
.term-buttons { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); display: flex; gap: 10px; }
.term-buttons i {
  width: 24px; height: 24px; border-radius: 50%; background: var(--term-button);
  display: grid; place-items: center; font-style: normal; font-size: 13px; line-height: 1; color: #ffffff;
}
.term-body {
  margin: 0; padding: 18px 22px 22px;
  font-family: var(--term-font); font-size: 1rem; line-height: 1.6;   /* 16px keeps code legible */
  color: var(--term-text);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.term-body .user { color: var(--term-user); font-weight: 700; }
.term-body .path { color: var(--term-path); font-weight: 700; }
.term-body .dim { color: var(--term-dim); }
.term-cursor { display: inline-block; width: 0.6em; height: 1.2em; vertical-align: text-bottom; background: var(--term-text); }

/* Hero terminal: large and centred under the name */
.hero-term { max-width: 880px; margin: 56px auto 0; }
.hero-term .term-body { font-size: 1.0625rem; }   /* 17px for the one-liner */

/* Project-card terminals: smaller window, same legibility floor (15px) */
.card-term { margin: 20px 0 0; }   /* overrides the browser default figure margin (40px each side) */
.card-term .term-bar { height: 38px; font-size: 0.8125rem; padding: 0 96px; }
.card-term .term-buttons i { width: 20px; height: 20px; font-size: 11px; }
.card-term .term-body { font-size: 0.9375rem; padding: 14px 18px 18px; }

/* ---- Hero: role line without the employer ---- */
.hero-role.single { margin-bottom: 0; }

/* ---- About: the template's two-column grid, with a single-tone lead sentence and a detail column
   larger than the template's 18px ---- */
.about-lead {
  margin: 0;
  font-size: clamp(1.875rem, 3.4vw, 2.75rem); font-weight: 650; line-height: 1.18; letter-spacing: -0.03em;
  color: var(--ink);
}
.about-copy p { font-size: 1.25rem; line-height: 1.6; }   /* 20px */

/* ---- Projects: one featured card full width, then a two-column grid ---- */
.projects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.projects .work { display: flex; flex-direction: column; }
.projects .work-feature { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 40px; align-items: start; }
.project-context { color: var(--ink-3); font-size: 0.95rem; margin: -4px 0 14px; }
.pwr { margin: 0 0 16px; }
.pwr p { margin: 0 0 10px; font-size: 1.0625rem; line-height: 1.55; color: var(--ink-2); }
.pwr strong { color: var(--ink); font-weight: 640; }
.projects .links { margin-top: auto; padding-top: 8px; }

/* ---- Skills: grouped plain list; each group names the projects that prove it ---- */
.skills { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 48px; }
.skills h3 { font-size: 1.125rem; margin: 0 0 6px; }
.skills p { margin: 0; font-size: 1.0625rem; line-height: 1.55; color: var(--ink-2); }
.skills .proof { display: block; margin-top: 4px; color: var(--ink-3); font-size: 0.95rem; }

/* ---- Thin-line engineering schematic ---- */
.schematic { width: 100%; height: auto; color: var(--ink); }
.schematic .outline { fill: none; stroke: currentColor; stroke-width: 1.25; }
.schematic .booth { fill: none; stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 6 5; }
.schematic .axis-x { stroke: #c01c28; stroke-width: 1.5; }   /* x axes in red, the usual frame convention */
.schematic .axis-y { stroke: #26a269; stroke-width: 1.5; }   /* y axes in green */
.schematic .leader { stroke: var(--ink-3); stroke-width: 1; fill: none; }
.schematic text { fill: currentColor; font: 500 13px var(--font); }
.schematic .label-muted { fill: var(--ink-3); }
.schematic .value { font-weight: 650; }

@media (max-width: 860px) {
  .projects, .skills { grid-template-columns: 1fr; }
  .projects .work-feature { grid-template-columns: 1fr; }
  .term-bar { padding: 0 96px 0 16px; justify-content: flex-start; }
}

.prose p a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }

/* Experience: one step up from the template's 15-16px so it reads at the same size as About */
.when { font-size: 1.0625rem; }                                   /* 15px -> 17px */
.timeline h3 { font-size: 1.625rem; }                             /* 22px -> 26px */
.timeline > li.brief h3 { font-size: 1.375rem; }                  /* 18px -> 22px */
.timeline .org, .timeline .note, .timeline li li { font-size: 1.125rem; line-height: 1.6; }   /* -> 18px */

/* Solid bullets everywhere. The Experience bullets are nested inside the timeline's own list, and browsers
   draw nested lists with hollow circles by default. */
.timeline ul, .prose ul, .about-copy ul { list-style-type: disc; }
.timeline li li::marker, .prose li::marker { color: var(--ink-2); }
.timeline > li.brief ul { margin-top: 8px; }   /* brief entries had no list before; give it room under the company */

/* Experience: company names in bold, a step darker than the bullets, as the second line of each entry */
.timeline .org { font-weight: 600; color: var(--ink); }

/* Project cards: the context line (company / university / personal project) in bold, matching Experience */
.project-context { font-weight: 600; color: var(--ink); }
/* The schematic's caption stays a quiet note */
.schematic-note { color: var(--ink-3); font-size: 0.95rem; margin: 8px 0 0; }

/* Clear section boundaries. With the template's colours, neighbouring sections measured 1.00-1.07:1 and cards
   1.10:1 against their bands, so this block deepens the bands, draws a hairline at every section boundary and a
   1px edge on every card, and gives "Let's talk" its own dark-mode band. */
:root {
  --band: #eceef2;                              /* deeper than the template's #f3f4f7 so the alternation shows */
  --section-rule: rgba(20, 24, 33, 0.16);
  --card-edge: rgba(20, 24, 33, 0.12);
  --ink-2: #363a43;                             /* body text two shades darker than the template's #5f6470 */
}
@media (prefers-color-scheme: dark) {
  /* same selector as site.css's dark palette: a plain :root loses to its :root:not([data-theme="light"]) */
  :root:not([data-theme="light"]) {
    --band: #121419;                            /* the template's #0b0c0f was almost identical to the #000 page */
    --tile: #1c1f26;                            /* one step up from #15171c so cards stay distinct from the deeper band */
    --section-rule: rgba(255, 255, 255, 0.16);
    --card-edge: rgba(255, 255, 255, 0.12);
    --ink-2: #d4d6dc;                           /* body text two shades lighter than the template's #a1a4ad */
  }
  .contact { background: #0d0f13; }            /* not the same black as Experience below it */
}
main > section + section { border-top: 1px solid var(--section-rule); }
.projects .work, .cert { box-shadow: 0 0 0 1px var(--card-edge); }

/* Skills: same type scale as Experience */
.skills h3 { font-size: 1.375rem; margin-bottom: 8px; }                    /* 18px -> 22px, like the internship titles */
.skills p { font-size: 1.125rem; line-height: 1.6; }                       /* 17px -> 18px, like the Experience bullets */
.skills .proof { font-size: 1.0625rem; margin-top: 6px; }                 /* 15px -> 17px, like the Experience dates */
.skills { gap: 36px 56px; }                                                /* more room for the larger type */

/* Profile photo: a circle under the About lead sentence, filling that column's empty space */
.about-photo {
  display: block; width: 240px; height: 240px; margin-top: 40px;
  border-radius: 50%; object-fit: cover;
  box-shadow: 0 0 0 1px var(--card-edge);      /* a faint ring keeps the white background off the band */
}
@media (max-width: 860px) { .about-photo { width: 160px; height: 160px; margin-top: 28px; } }

/* Photo beside the lead: a row with the circle on the left and the lead top-aligned to it,
   so nothing floats alone in the left column. */
.about-left { display: flex; align-items: flex-start; gap: 32px; }
.about-left .about-photo { flex: none; width: 160px; height: 160px; margin-top: 0; }
.about-left .about-lead { margin-top: -0.12em; }   /* optical alignment: the cap height, not the line box, meets the circle's top */
@media (max-width: 860px) {
  .about-left { flex-direction: column; gap: 20px; }
  .about-left .about-photo { width: 120px; height: 120px; }
}

/* Photo below the lead, as a rounded portrait rectangle (replaces the side-by-side circle above) */
.about-left { display: block; }
.about-left .about-photo {
  width: 300px; height: auto; aspect-ratio: 4 / 5; margin-top: 40px;   /* 300x375: bottom lines up with the right column */
  border-radius: 20px;                           /* same family as the cards' rounded corners */
  object-fit: cover;
}
.about-left .about-lead { margin-top: 0; }
@media (max-width: 860px) {
  .about-left .about-photo { width: 100%; max-width: 300px; margin-top: 24px; }
}

/* Symmetric About: the photo and the paragraphs end on the same line. The left column stretches to the right
   column's height and the photo fills what's left under the lead, so the photo's bottom edge lands on the last
   paragraph's last line at every desktop width instead of matching one width by luck. */
@media (min-width: 861px) {
  .about-grid { align-items: stretch; }
  .about-left { display: flex; flex-direction: column; }
  .about-left .about-photo {
    flex: 1 1 auto; height: auto; min-height: 280px; aspect-ratio: auto;
    width: 300px; object-fit: cover; object-position: 50% 30%;   /* keep the face framed as the height changes */
    /* end on the text, not the line box: drop the last line's half-leading, (1.6 - 1) / 2 x 20px = 6px */
    margin-bottom: calc((1.6 - 1) / 2 * 1.25rem);
  }
  .about-copy p:last-child { margin-bottom: 0; }   /* the column's end is the text's end */
}
@media (min-width: 861px) {
  /* A zero flex-basis stops the photo's natural 375px height from setting the row height; it now only
     fills the space the paragraphs create (min 220px so it never collapses on very wide screens). */
  .about-left .about-photo { flex: 1 1 0; height: 0; min-height: 220px; }
}
@media (min-width: 861px) {
  /* End on the last line's baseline, where the letters sit. Measured with an empty inline-block probe: the
     baseline is 8px above the column's end at every desktop width (20px text, 1.6 line height). */
  .about-left .about-photo { margin-bottom: 8px; }
}

/* About lead: display size, tops out at 40px. Like all text it wraps at the column edge (the wrap rule at the
   end of this file). */
.about-lead { font-size: clamp(1.75rem, 3.1vw, 2.5rem); }
/* Phones: max 26px, and below that the size tracks the text column (viewport minus the 2 x 18px gutters,
   divided by 13), so the lead keeps the same number of words per line as the screen narrows. */
@media (max-width: 860px) { .about-lead { font-size: min(1.625rem, calc((100vw - 36px) / 13)); } }

/* Hero quote under the role line: quieter than the role, set as a pull-quote */
.hero-quote {
  margin: 14px auto 0;
  font-size: clamp(1.125rem, 2vw, 1.375rem); line-height: 1.4; font-style: italic;
  color: var(--stage-ink-2);
}
.hero-quote + .hero-links { margin-top: 32px; }

/* Phones: the featured card's single column must be allowed to shrink below its widest child
   (terminal / schematic); a bare 1fr grew to 423px at a 375px screen and the card clipped the text. */
@media (max-width: 860px) {
  .projects .work-feature { grid-template-columns: minmax(0, 1fr); }
}

/* Terminal titles: a bare text node in the flex header bar can't be ellipsised, so on phones it ran under
   the window buttons. In its own element it shortens with an ellipsis before them. */
.term-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 860px) {
  .card-term .term-bar { padding: 0 100px 0 14px; justify-content: flex-start; }   /* 3 x 20px buttons + gaps + edge + 8px air */
}
/* Hero quote one step smaller: 17px on desktop, 16px on phones */
.hero-quote { font-size: clamp(1rem, 1.4vw, 1.0625rem); margin-top: 10px; }

/* All section titles at the size of the largest one, "Let's talk": 88px desktop / 44px phone,
   same width axis and tracking as .contact h2 */
.kicker-head h2, .contact h2 {
  font-size: clamp(2.75rem, 8vw, 5.5rem);
  font-weight: 680; font-stretch: 110%; letter-spacing: -0.045em;
}

/* One title-to-content gap everywhere, set to the largest in use: the template's kicker-head spacing,
   clamp(44px, 6vw, 72px). "Let's talk" was the outlier at 20px. */
:root { --title-gap: clamp(44px, 6vw, 72px); }
.kicker-head { margin-bottom: var(--title-gap); }
.contact h2 + p { margin-top: var(--title-gap); }

/* Hero point cloud: fills the dark hero behind the content, never intercepts clicks, kept dim so the
   name, title and buttons stay the focus (the cloud script is assets/js/pointcloud.js) */
.hero { position: relative; overflow: hidden; }
.hero-cloud { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0.5; }
.hero > .wrap { position: relative; z-index: 1; }

/* Case-study image gallery: real project screenshots, one wide image across the top, two below */
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 0 0 2em; max-width: 100%; }
.gallery figure { margin: 0; }
.gallery figure:nth-child(2) { grid-column: 1 / -1; grid-row: 1; }   /* the wide grasping shot leads */
.gallery img { display: block; width: 100%; height: 100%; max-height: 360px; object-fit: cover; border-radius: 14px; box-shadow: 0 0 0 1px var(--card-edge); }
.gallery figcaption { margin-top: 8px; font-size: 0.95rem; color: var(--ink-3); }
@media (max-width: 860px) { .gallery { grid-template-columns: 1fr; } .gallery figure:nth-child(2) { grid-row: auto; } }
/* Gallery fix: images keep their own height so each caption gets its own space; the two lower shots share
   one 4:3 frame so the row is even, and the wide shot keeps its natural proportions */
.gallery img { height: auto; max-height: none; }
.gallery figure:not(:nth-child(2)) img { aspect-ratio: 4 / 3; object-fit: cover; }

/* "Let's chat" background: a SLAM pose graph, poses joined by odometry edges plus dashed loop-closure
   links. Static (the hero stays the only moving element), faded out behind the text. */
.contact { position: relative; overflow: hidden; }
.contact::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: url("../img/pose-graph.svg") center / cover no-repeat;
  -webkit-mask-image: radial-gradient(ellipse 60% 70% at 50% 50%, transparent 30%, #000 75%);
          mask-image: radial-gradient(ellipse 60% 70% at 50% 50%, transparent 30%, #000 75%);
}
.contact > .wrap { position: relative; z-index: 1; }

/* A short centred rule under every section title. Drawn from currentColor at low opacity so it suits light
   sections and the dark "Let's chat" band alike; it sits inside the heading box, so the title-to-content gap
   stays equal everywhere. */
.kicker-head h2::after, .contact h2::after {
  content: ""; display: block;
  width: clamp(96px, 14vw, 220px); height: 2px; border-radius: 1px;
  margin: clamp(18px, 2.4vw, 30px) auto 0;
  background: currentColor; opacity: 0.28;
}

/* "Let's chat" background v2: chains of connected nodes converge on the buttons, brightening and turning blue
   as they near them, as leading lines to the call to action. The graph is anchored to the button group, not
   the section, so it converges on the buttons at every width. Replaces the pose-graph background above. */
.contact::before { content: none; }
.contact .hero-links { position: relative; }
.contact .hero-links::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  left: 50%; top: 50%; width: 1600px; height: 900px; transform: translate(-50%, -50%);
  background: url("../img/connect-graph.svg") center / contain no-repeat;
}
/* The LinkedIn button carries a soft accent glow: the strongest pull in the section */
.contact .hero-links .pill:not(.pill-ghost) {
  box-shadow: 0 0 0 6px rgba(126, 162, 255, 0.12), 0 0 42px 6px rgba(126, 162, 255, 0.38);
}
/* Title rule closer to its title: was clamp(18px, 2.4vw, 30px) below the heading box */
.kicker-head h2::after, .contact h2::after { margin-top: clamp(4px, 0.6vw, 8px); }
/* measured: 8px put the rule into the descenders of "Experience"/"Projects"; this leaves ~6px below them */
.kicker-head h2::after, .contact h2::after { margin-top: clamp(10px, 1.6vw, 20px); }

/* Equal-looking title rules: the same title-to-rule distance, at the largest. Measured in pixels: titles with
   descenders ("Experience" p, "Projects" j) showed 19px of air above the rule against 33px for the rest, at
   1280px (9-10px vs 16px on phones). The difference is 0.16 x the title size, so those titles' rules drop by
   exactly that. */
.kicker-head h2.descends::after { margin-top: calc(clamp(10px, 1.6vw, 20px) + 0.16em); }

/* Hero: Download resume carries the same soft accent glow as Connect on LinkedIn */
.pill-glow { box-shadow: 0 0 0 6px rgba(126, 162, 255, 0.12), 0 0 42px 6px rgba(126, 162, 255, 0.38); }

/* One body-text shade per surface and theme. Titles use one shade too (--ink, and --stage-ink on the black
   panels).
   - The black panels (hero, Let's chat, case-study header) are black in both themes, so their body text
     takes the dark-mode body shade in both.
   - The dim meta text (dates, issuers, captions, context and proof lines, footer) moves up to the body
     shade. --ink-3 itself stays, because the schematic and diagram strokes and labels also draw with it. */
:root { --stage-ink-2: #d4d6dc; }               /* was #a1a4ad; same as dark-mode --ink-2 */
.cs-facts dt { color: var(--stage-ink-2); }    /* was a fixed #7f838d */
.soon, .project-context, .skills .proof, .schematic-note, .gallery figcaption,
.statement span, .when, .roles .role-when, .cert .issuer, .cert .issued, .site-footer,
.prose figcaption, .prose .next-up p { color: var(--ink-2); }

/* Symmetric featured card: the art column stretches to the text column's height and its note drops to the
   bottom, so the note's last line sits level with "Read the case study". Desktop only: below 861px the
   columns stack. */
@media (min-width: 861px) {
  .projects .work-feature { align-items: stretch; }
  .work-feature .art-feature { display: flex; flex-direction: column; }
  .work-feature .schematic-note { margin-top: auto; }
}

/* Hero location: city under the role line, worded as on LinkedIn; the same body shade as the quote */
.hero-location { margin: 10px auto 0; font-size: clamp(1rem, 1.6vw, 1.1875rem); letter-spacing: -0.01em; color: var(--stage-ink-2); }

/* Experience: the title's underline already separates it from the first job, so that job's top rule made a double line */
.timeline > li:first-child { border-top: 0; }

/* Skills as Experience-style rows: the same centred 60rem box, the same left | 1fr columns and the same
   hairline rules, so the page keeps one grid. The group name sits where Experience puts its dates. Baseline
   alignment puts the name and the first line of skills on one line. */
.skills { display: block; max-width: 60rem; margin: 0 auto; }
/* Left column for both lists: 14.5rem (232px) fits the widest group name, "State estimation and fusion" (230px),
   on one line, so no row ends unevenly. Experience moves from 12rem with it, so the two lists share one grid. */
.timeline > li { grid-template-columns: 14.5rem minmax(0, 1fr); }
.skills > li {
  display: grid; grid-template-columns: 14.5rem minmax(0, 1fr); gap: 6px 40px; align-items: baseline;
  padding: 26px 0; border-top: 1px solid var(--hairline);
}
.skills > li:first-child { border-top: 0; }   /* the title's underline already separates it, as in Experience */
.skills > li:last-child { border-bottom: 1px solid var(--hairline); }
.skills > li h3 { margin: 0; font-size: 1.125rem; }
@media (max-width: 700px) { .timeline > li, .skills > li { grid-template-columns: minmax(0, 1fr); } }   /* re-applied: the 14.5rem rule above loads after site.css's phone rule */

/* Calibration case study: two visualisations side by side under the thin-line schematic.
   One shared 6:5 frame so the pair ends on the same line whatever each image's own proportions. */
.prose .wrap > .figure-pair { max-width: 100%; }   /* full width, like the schematic panel above */
.figure-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 0 0 2em; }
.figure-pair figure { margin: 0; }
.figure-pair img { display: block; width: 100%; height: auto; aspect-ratio: 6 / 5; object-fit: cover; border-radius: 14px; box-shadow: 0 0 0 1px var(--card-edge); }
@media (max-width: 640px) { .figure-pair { grid-template-columns: minmax(0, 1fr); } }

/* Home project cards: each card's picture fills its column with the same rounded frame as the figures */
.feature-img { display: block; width: 100%; height: auto; border-radius: 14px; box-shadow: 0 0 0 1px var(--card-edge); }

/* Case-study header: both section paddings roughly halve, so the facts row and the first figure no longer
   leave a tall empty band between them. */
.cs-head { padding-bottom: clamp(40px, 5vw, 64px); }
.prose { padding-top: clamp(40px, 5vw, 64px); }
/* each fact is a two-row grid stretched to the tallest fact's height, which pushed one-line values down; pin them to the top */
.cs-facts div { align-content: start; }
/* Case-study facts framed by two rules: the bottom rule mirrors the top one's colour and 22px gap */
.cs-facts { padding-bottom: 22px; border-bottom: 1px solid var(--stage-hairline); }

/* Four full-width project cards. A terminal in the right column (tracking has no image yet) fills
   the column so its bottom edge lands on the link's baseline; the offset below is measured, not guessed. */
.art-feature > .card-term { margin-top: 0; display: flex; flex-direction: column; flex: 1; margin-bottom: 6px; }   /* measured: the link's baseline sits 6.3px above its line box at every width */
.art-feature > .card-term .term-body { flex: 1; }
.projects { row-gap: 24px; }
.more-projects { margin: 32px 0 0; text-align: center; font-size: 1.0625rem; }
/* the tracking terminal no longer stretches: it sits at the top like an image, and its caption carries the alignment */
.art-feature > .card-term { flex: none; margin-bottom: 0; }
/* Robot_manipulator's grasping shot is 2:1, which left a tall gap under it; a 4:3 frame fills the column, kept on the arm */
.work-feature .feature-img[src*="grasping"] { aspect-ratio: 4 / 3; object-fit: cover; object-position: 72% 50%; }

/* Symmetric project cards on a Fibonacci scale. One grid per card: two equal columns, five shared rows
   (title, context, Problem/What/Result, terminal, link). The column wrappers dissolve with display: contents
   so both sides use the same row lines: the picture spans rows 1-4 (top = title top, bottom = terminal bottom)
   and its caption shares row 5 with the link, baseline to baseline. */
:root { --fib-xs: 8px; --fib-s: 13px; --fib-m: 21px; --fib-l: 34px; --fib-xl: 55px; }
@media (min-width: 861px) {
  .projects { row-gap: var(--fib-l); }
  .projects .work-feature {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: repeat(5, auto); column-gap: var(--fib-l); row-gap: 0;
    padding: var(--fib-xl); align-items: start;
  }
  .projects .work-feature > div:first-child, .projects .work-feature > .art-feature { display: contents; }
  .projects .work-feature > div:first-child > * { grid-column: 1; }
  .projects .work-feature h3 { grid-row: 1; margin: 0; }
  .projects .work-feature .project-context { grid-row: 2; margin: var(--fib-xs) 0 0; }
  .projects .work-feature .pwr { grid-row: 3; margin: var(--fib-m) 0 0; }
  .projects .work-feature .pwr p { margin: 0 0 var(--fib-s); }
  .projects .work-feature .pwr p:last-child { margin-bottom: 0; }
  .projects .work-feature .card-term { grid-row: 4; margin: var(--fib-m) 0 0; }
  .projects .work-feature .links { grid-row: 5; margin: 0; padding-top: var(--fib-m); align-self: baseline; }
  .projects .work-feature .art-feature > .feature-img {
    grid-column: 2; grid-row: 1 / 5; align-self: stretch;
    width: 100%; height: 100%; aspect-ratio: auto; object-fit: cover;
  }
  .projects .work-feature .art-feature > .schematic-note { grid-column: 2; grid-row: 5; margin: 0; padding-top: var(--fib-m); align-self: baseline; }
}

/* Digital-twin case study: the simulation clip, full width like the panel above it, with the same rounded frame as the images */
.clip-video { display: block; width: 100%; height: auto; border-radius: 14px; box-shadow: 0 0 0 1px var(--card-edge); background: #000; }

/* One body size everywhere: 20px Mona Sans at 1.6, the largest body size already on the site (About).
   Display text keeps its own size: hero role/location/quote, the About lead, the "Let's chat" line, case-study ledes,
   crumbs, the "Next" label and terminal code. The #main id outranks every earlier class rule. */
:root { --body-size: 1.25rem; --body-leading: 1.6; }
#main :is(p, li, dd, figcaption):not(.lede, .hero-role, .hero-quote, .hero-location, .about-lead, .crumb, .more-projects, .cs-link) {
  font-size: var(--body-size); line-height: var(--body-leading);
}
#main .contact p, #main .next-up p, #main .term p { font-size: revert-layer; }
#main .contact p { font-size: clamp(1.0625rem, 2vw, 1.375rem); }   /* the "Let's chat" lead keeps its display size */
#main .next-up p { font-size: 0.875rem; }                          /* the "Next" label */
/* titles stay a step above the body: Skills group names were 18px, now the Experience title size */
.skills > li h3 { font-size: 1.375rem; }

/* Case-study sections on the same grid as Experience and Skills: heading in the 14.5rem left column, text on the
   right at the full width of the figures above, rows divided by hairlines (none above the first, one under the last) */
.prose .wrap > .cs-section { max-width: 100%; }
.cs-section { display: grid; grid-template-columns: 14.5rem minmax(0, 1fr); column-gap: 40px; align-items: baseline;
  padding: var(--fib-l) 0; border-top: 1px solid var(--hairline); }
.prose .wrap > figure + .cs-section, .prose .wrap > .figure-pair + .cs-section, .prose .wrap > .cs-section:first-child { border-top: 0; }
.cs-section:last-of-type { border-bottom: 1px solid var(--hairline); }
.cs-section h2 { margin: 0; font-size: 1.375rem; line-height: 1.3; letter-spacing: -0.02em; }
.cs-body > * { max-width: none; margin: 0 0 var(--fib-s); }
.cs-body > :last-child { margin-bottom: 0; }
.cs-body .gallery { margin: 0; }
@media (max-width: 700px) { .cs-section { grid-template-columns: minmax(0, 1fr); row-gap: var(--fib-s); } }
.prose .next-up { margin-top: var(--fib-xl); }

/* Case-study header: the lede, the facts rules and the title use the full column, as wide as the panels */
.lede { max-width: none; }
.cs-facts { max-width: none; }
.cs-head h1 { max-width: none; }
/* card caption and link meet on their LAST lines, so a caption that wraps at narrow widths still ends level with the link */
@media (min-width: 861px) {
  .projects .work-feature .links, .projects .work-feature .art-feature > .schematic-note { align-self: last baseline; }
}
/* A terminal is already a framed window: inside a case-study panel it needs no second box around it
   (the panel padding left a tall empty frame above and below the terminal) */
.prose figure.panel:has(> .term:only-child) { background: none; box-shadow: none; padding: 0; }
.prose figure.panel:has(> .term:only-child) > .term { margin: 0; }
/* header to body on the Fibonacci scale: 55px from the facts row's bottom rule to the first block */
.cs-head { padding-bottom: 0; }
.cs-head .cs-facts { margin-bottom: 0; }
.prose { padding-top: var(--fib-xl); }
/* the "Next" card spans the column like everything above it */
.prose .wrap > .next-up { max-width: 100%; }
#main .cs-link { font-size: var(--body-size); }   /* the robot page's GitHub line matches the body size */
/* Case-study figure (tracking's vehicle point cloud): full column width with the same rounded frame as the clip and card images */
.cs-figure img { display: block; width: 100%; height: auto; border-radius: 14px; box-shadow: 0 0 0 1px var(--card-edge); background: #000; }
/* More projects as rows on the case-study grid. Title and context in the left column, Problem/What/Result,
   the terminal at its natural height and the link on the right, so no box is stretched or left empty. */
.project-row .row-head .project-context { margin: var(--fib-xs) 0 0; }
.project-row .pwr { margin: 0; }
.project-row .pwr p { margin: 0 0 var(--fib-s); }
.project-row .pwr p:last-child { margin-bottom: 0; }
.cs-body > .card-term { margin: var(--fib-m) 0 0; }
.project-row .cs-link { margin: var(--fib-m) 0 0; }
/* A case-study header with no facts row (More projects) ends on its lede: give it the same 55px bottom as the body's top */
.cs-head:not(:has(.cs-facts)) { padding-bottom: var(--fib-xl); }
/* captions run the full figure width like the body text, instead of breaking at site.css's 42rem under a 992px figure */
.prose figcaption { max-width: none; }
/* "Read the case study" / "View on GitHub" lines look like the home cards' links: underline on hover only */
.prose .cs-link .chev { text-decoration: none; }
.prose .cs-link .chev:hover { text-decoration: underline; }
/* More projects has no facts rule between header and body, and in dark mode both are black, so 55 + 55 read as an empty band */
.cs-head:not(:has(.cs-facts)) { padding-bottom: var(--fib-l); }
.cs-head:not(:has(.cs-facts)) + .prose { padding-top: var(--fib-l); }
/* terminals wrap only at spaces and after "/": the prompt path and hyphenated file names stay whole on phones */
.term-body .path, .term-body .nowrap { white-space: nowrap; }
/* Project card titles stay on one line. The card is the size container, because on desktop the title's own
   wrapper is display: contents. --title-fit-em is the longest title's width in em ("Real-time vehicle pose
   tracking" measures 14.67em), plus about 2% slack. The title keeps its clamp size and shrinks only when the
   title column is too narrow for that size. Raise --title-fit-em when a longer title is added. The nowrap that
   holds the line sits after the wrap rule below. */
.projects .work-feature { container-type: inline-size; --title-fit-em: 15; }
.projects .work-feature h3 {
  /* base layout (the first .projects .work-feature rule, also live in the sub-pixel gap between 860px and 861px):
     columns 1fr : 1.1fr, 40px gap */
  font-size: min(clamp(1.625rem, 3vw, 2.25rem), calc((100cqi - 40px) / 2.1 / var(--title-fit-em)));
}
@media (max-width: 860px) {
  /* one column: the title spans the card's content box */
  .projects .work-feature h3 { font-size: min(clamp(1.625rem, 3vw, 2.25rem), calc(100cqi / var(--title-fit-em))); }
}
@media (min-width: 861px) {
  /* two columns: the title column is half the card's content box, less the column gap */
  .projects .work-feature h3 { font-size: min(clamp(1.625rem, 3vw, 2.25rem), calc((100cqi - var(--fib-l)) / 2 / var(--title-fit-em))); }
}
/* Project-context lines sit 2px under the 20px body size. #main p.project-context matches the one-body-size
   rule's (1,1,1) specificity and wins by coming later. */
#main p.project-context { font-size: calc(var(--body-size) - 2px); }
/* Image captions (home card notes and case-study figcaptions) sit 4px under the body size.
   :is(p.x, figure figcaption) counts as (0,1,1), so with #main it ties the one-body-size rule and wins by order. */
#main :is(p.schematic-note, figure figcaption) { font-size: calc(var(--body-size) - 4px); }
/* Every line runs to the edge of its box before it wraps. This replaces site.css's "pretty" wrapping and its
   ch/rem measure caps on text, so the box edge is the column, card or grid cell. The #main id outranks each of
   those class rules. */
#main :is(h1, h2, h3, h4, p, li, dt, dd, figcaption, blockquote) { text-wrap: wrap; max-width: none; }
/* The one exception: project card titles never wrap. (1,2,1) beats the wrap rule's (1,0,1); the font size
   above makes every title fit its column, so nothing overflows. */
#main .projects .work-feature h3 { text-wrap-mode: nowrap; }
