/* ==========================================================================
   Jaivanth Melanaturu · Portfolio stylesheet (home page + every project page)
   ==========================================================================

   Contents
     1.  Design tokens: light theme (colours, type, spacing, shape)
     2.  Design tokens: dark theme
     3.  Base elements
     4.  Shared components: section label, buttons, chips, figures, placeholders, inline code
     5.  Top bar: window dots, breadcrumb, site nav, All work button, theme toggle
     6.  Layout and the left side nav
     7.  Hero command line ("$ whoami")
     8.  Home page
     9.  Project pages
     10. Results and limitation lists
     11. Clip player (WasteSep)
     12. Build photos (collapsible)
     13. Motion: smooth scroll, reveal on scroll, hero entrance, page transitions
     14. Reduced motion and print

   Fonts are loaded by a <link> in each page's <head>: IBM Plex Sans (body, headings) and
   IBM Plex Mono (labels, buttons, data).

   Accessibility rule (WCAG 2.2 AA): the accent colours (--primary, --secondary, --success, --warning)
   are only for fills and decoration. Text in an accent colour must use the matching -ink token, which
   is at least 4.5:1 on the page background in BOTH themes. Light-theme ratios on white:
     --primary   #3B82F6  3.7:1 (fill)    --primary-ink   #1D4ED8  6.7:1 (text)
     --secondary #8B5CF6  4.2:1 (fill)    --secondary-ink #6D28D9  7.1:1 (text)
     --success   #16A34A  3.3:1 (fill)    --success-ink   #15803D  5.0:1 (text)
     --warning   #D97706  3.2:1 (fill)    --warning-ink   #B45309  5.0:1 (text)
     --danger    #DC2626  4.8:1 (fill and text)
   ========================================================================== */


/* 1. Design tokens: light theme ------------------------------------------- */
:root {
  /* brand colours: fill, text-safe "-ink", and a pale "-tint" background */
  --primary:#3B82F6;   --primary-ink:#1D4ED8;   --primary-tint:#DBEAFE;
  --secondary:#8B5CF6; --secondary-ink:#6D28D9; --secondary-tint:#EDE9FE;
  --success:#16A34A;   --success-ink:#15803D;   --success-tint:#DCFCE7;
  --warning:#D97706;   --warning-ink:#B45309;   --warning-tint:#FEF3C7;
  --danger:#DC2626;                             --danger-tint:#FEE2E2;

  /* neutrals */
  --surface:#FFFFFF;   /* page background */
  --surface-2:#F3F4F6; /* panels, chips */
  --surface-3:#E5E7EB; /* disabled */
  --text:#111827;      /* 17.7:1, main text */
  --text-2:#374151;    /* 10.3:1, body copy */
  --muted:#4B5563;     /*  7.6:1, labels and captions */
  --rule:#D1D5DB;      /* thin dividers only, never text */
  --ink:#111827;       /* 2px outlines */
  --shadow-ink:var(--ink); /* colour of the hard offset shadows */

  /* interactive states */
  --hover-bg:#FEF3C7;  --hover-fg:var(--text);   /* top-bar links, toggles, clip controls */
  --btn-hover-bg:var(--surface-2); --btn-hover-fg:var(--text); /* outline buttons */
  --btn-solid-bg:#1D4ED8; --btn-solid-bg-hover:#1E40AF; --btn-solid-fg:#FFFFFF; /* filled buttons */
  --back-bg:var(--primary-tint); --back-hover-bg:var(--primary-tint); /* "All work" button */
  --summary-bg:var(--warning-tint); /* "Build photos" toggle at rest */
  --focus:3px solid var(--primary-ink);

  /* type */
  --sans:'IBM Plex Sans', system-ui, sans-serif;
  --display:var(--sans);
  --mono:'IBM Plex Mono', ui-monospace, 'SFMono-Regular', monospace;
  --fs-xs:12px; --fs-sm:14px; --fs-md:17px; --fs-lg:20px; --fs-xl:28px;
  --fs-2xl:clamp(28px, 3.4vw, 40px);
  --fs-3xl:clamp(40px, 5.6vw, 64px);
  --fs-4xl:clamp(48px, 7.5vw, 96px);

  /* spacing scale: 4/8/12/16/24/32, bigger gaps are multiples of 32 */
  --s1:4px; --s2:8px; --s3:12px; --s4:16px; --s5:24px; --s6:32px;
  --s7:calc(var(--s6) * 2); --s8:calc(var(--s6) * 3);

  /* shape */
  --bw:2px; --radius:6px; --radius-sm:4px;
  --shadow-sm:2px 2px 0 var(--shadow-ink);
  --shadow:4px 4px 0 var(--shadow-ink);
  --shadow-lg:6px 6px 0 var(--shadow-ink);

  /* motion */
  --ease-out:cubic-bezier(.2, .7, .2, 1);
  --ease-in:cubic-bezier(.4, 0, 1, 1);
  --dur:.7s;              /* reveal-on-scroll duration */
  --stagger:70ms;         /* delay between blocks that enter together */

  --headshot:210px;       /* home page photo width */

  color-scheme:light;
}


/* 2. Design tokens: dark theme --------------------------------------------
   <html data-theme="dark"> is set by the inline <head> script and js/theme.js.
   Every colour is redefined; all text tokens are at least 4.5:1 on #0B0F19. */
:root[data-theme="dark"] {
  --primary-ink:#93C5FD;   --primary-tint:#1E3A8A;    /* 11.4:1, 7.4:1 on its tint */
  --secondary-ink:#C4B5FD; --secondary-tint:#2E1065;  /* 10.0:1 */
  --success-ink:#86EFAC;   --success-tint:#052E16;    /* 13.9:1 */
  --warning-ink:#FCD34D;   --warning-tint:#451A03;    /* 13.6:1 */
  --danger:#F87171;        --danger-tint:#450A0A;     /*  7.0:1 */

  --surface:#0B0F19; --surface-2:#161B26; --surface-3:#222937;
  --text:#F3F4F6;    /* 17.6:1 */
  --text-2:#D1D5DB;  /* 13.4:1 */
  --muted:#9CA3AF;   /*  7.6:1 */
  --rule:#374151;
  --ink:#E5E7EB;
  --shadow-ink:#4B5563;

  /* buttons highlight light grey on hover in dark mode (15:1 text) */
  --hover-bg:#E5E7EB; --hover-fg:#0B0F19;
  --btn-hover-bg:var(--hover-bg); --btn-hover-fg:var(--hover-fg);
  --btn-solid-bg:#93C5FD; --btn-solid-bg-hover:#BFDBFE; --btn-solid-fg:#0B0F19;
  --back-hover-bg:var(--hover-bg);
  --summary-bg:var(--surface-2);

  color-scheme:dark;
}


/* 3. Base elements --------------------------------------------------------- */
* { box-sizing:border-box; }
html { -webkit-text-size-adjust:100%; scroll-behavior:smooth; scroll-padding-top:72px; } /* #links land below the sticky bar */
body { margin:0; background:var(--surface); color:var(--text); font-family:var(--sans); font-size:var(--fs-md); line-height:1.6; -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility; }
::selection { background:var(--primary-tint); color:var(--text); }
a { color:inherit; text-decoration:none; }
a:hover { color:var(--primary-ink); }
:focus-visible { outline:var(--focus); outline-offset:var(--s1); }
[tabindex="-1"]:focus { outline:none; } /* sections focused after a smooth #link scroll get no ring */
h1, h2, h3, h4 { margin:0; font-family:var(--display); font-weight:600; letter-spacing:-0.02em; line-height:1.05; }
p { margin:0; }
img { display:block; max-width:100%; height:auto; }
figure { margin:0; }
b, strong { font-weight:700; }

/* small uppercase mono text (footers, captions) */
.mono { font-family:var(--mono); font-size:var(--fs-xs); letter-spacing:.08em; text-transform:uppercase; color:var(--muted); }


/* 4. Shared components ----------------------------------------------------- */

/* section label: small uppercase eyebrow with a line after it, above each section */
.label { display:flex; align-items:center; gap:var(--s3); font-family:var(--mono); font-size:var(--fs-xs); font-weight:700; letter-spacing:.12em; text-transform:uppercase; color:var(--secondary-ink); }
.label::after { content:""; flex:1; height:var(--bw); background:var(--ink); }

/* buttons: .btn (outline) and .btn--solid (filled). States: hover lifts, active presses in. */
.btn { display:inline-flex; align-items:center; gap:var(--s2); min-height:40px; padding:var(--s2) var(--s4); font-family:var(--mono); font-size:var(--fs-sm); font-weight:500; letter-spacing:.02em; color:var(--text); background:var(--surface); border:var(--bw) solid var(--ink); border-radius:var(--radius); box-shadow:var(--shadow-sm); cursor:pointer; transition:transform .12s, box-shadow .12s, background .12s; }
.btn:hover { color:var(--btn-hover-fg); background:var(--btn-hover-bg); transform:translate(-1px, -1px); box-shadow:var(--shadow); }
.btn:active { transform:translate(2px, 2px); box-shadow:none; }
.btn--solid, .btn--solid:hover { color:var(--btn-solid-fg); }
.btn--solid { background:var(--btn-solid-bg); }
.btn--solid:hover { background:var(--btn-solid-bg-hover); }
.btn:disabled, .btn[aria-disabled="true"] { color:var(--muted); background:var(--surface-3); box-shadow:none; transform:none; cursor:not-allowed; }
.btn .arr { transition:transform .12s; }
.btn:hover .arr { transform:translate(2px, -2px); }
.btns { display:flex; flex-wrap:wrap; gap:var(--s3); }

/* chips: small pills for skills and tech */
.chip { padding:var(--s1) var(--s3); font-family:var(--mono); font-size:var(--fs-xs); color:var(--text); background:var(--surface-2); border:1px solid var(--ink); border-radius:999px; }

/* figures: .fig is any framed image; .figcap is its caption */
.fig { width:100%; background:var(--surface); border:var(--bw) solid var(--ink); border-radius:var(--radius); box-shadow:var(--shadow); }
.fig + .figcap + .fig { margin-top:var(--s4); } /* stacked images in one column */
.figcap { margin-top:var(--s3); font-family:var(--mono); font-size:var(--fs-xs); line-height:1.55; color:var(--muted); }
.figcap b { color:var(--text); }
.fig-block { margin:var(--s5) 0; }  /* wrapper: figure(s) + one caption */
.fig-row { display:grid; grid-template-columns:repeat(auto-fit, minmax(180px, 1fr)); gap:var(--s4); } /* images side by side */
/* matplotlib charts have a white background; in dark mode they are inverted so they don't glare */
.fig--chart { background:#fff; }
:root[data-theme="dark"] .fig--chart { filter:invert(.92) hue-rotate(180deg) saturate(1.15); }

/* placeholder for an image that hasn't been added yet (dashed box with the file path) */
.fig-ph { display:flex; align-items:center; justify-content:center; aspect-ratio:4 / 3; margin:0; padding:var(--s3); font:500 var(--fs-xs)/1.5 var(--mono); color:var(--muted); text-align:center; word-break:break-all; background:var(--surface-2); border:var(--bw) dashed var(--muted); border-radius:var(--radius); }
.fig-ph--wide { aspect-ratio:16 / 9; }

/* inline code in write-ups, e.g. JSON keys */
.prose code, .steps code, .res-list code { padding:0 var(--s1); font-family:var(--mono); font-size:.9em; color:var(--secondary-ink); white-space:nowrap; background:var(--secondary-tint); border:1px solid var(--ink); border-radius:var(--radius-sm); }


/* 5. Top bar ---------------------------------------------------------------- */
.bar { position:sticky; top:0; z-index:50; display:flex; align-items:center; gap:var(--s4); height:52px; padding:0 var(--s5); background:var(--surface); border-bottom:var(--bw) solid var(--ink); view-transition-name:topbar; /* stays still during page transitions */ }
/* four-colour stripe under the bar */
.bar::after { content:""; position:absolute; left:0; right:0; bottom:calc(-1 * var(--bw) - 4px); height:4px; background:linear-gradient(90deg, var(--primary) 0 25%, var(--secondary) 25% 50%, var(--success) 50% 75%, var(--warning) 75%); }

/* red / amber / green window dots (decoration) */
.bar .dots { display:flex; gap:var(--s2); }
.bar .dots i { display:block; width:12px; height:12px; background:var(--danger); border:var(--bw) solid var(--ink); border-radius:50%; }
.bar .dots i:nth-child(2) { background:var(--warning); }
.bar .dots i:nth-child(3) { background:var(--success); }

/* breadcrumb: ~/jaivanth / work / page. Each folder is a link. */
.bar .path { flex:0 1 auto; min-width:0; overflow:hidden; font-family:var(--mono); font-size:var(--fs-sm); color:var(--muted); white-space:nowrap; text-overflow:ellipsis; }
.bar .path a { padding:0 2px; color:var(--text-2); text-decoration:underline dotted; text-decoration-thickness:1px; text-underline-offset:3px; border-radius:var(--radius-sm); transition:color .12s, background .12s; }
.bar .path a:hover { color:var(--primary-ink); text-decoration-style:solid; background:var(--primary-tint); }
.bar .path b { color:var(--text); }

/* site nav on the right: links, All work button, theme toggle */
.site-nav { display:flex; align-items:center; gap:var(--s1); flex-shrink:0; margin-left:auto; }
.site-nav a { padding:var(--s1) var(--s3); font-family:var(--mono); font-size:var(--fs-sm); color:var(--text); border:var(--bw) solid transparent; border-radius:var(--radius-sm); transition:border-color .12s, background .12s; }
.site-nav a:hover { color:var(--hover-fg); background:var(--hover-bg); border-color:var(--ink); }

/* "All work" button (project pages) */
.site-nav a.back { display:inline-flex; align-items:center; gap:var(--s1); margin-right:var(--s2); font-weight:700; color:var(--text); background:var(--back-bg); border-color:var(--ink); box-shadow:var(--shadow-sm); transition:transform .12s, box-shadow .12s, background .12s; }
.site-nav a.back:hover { color:var(--hover-fg); background:var(--back-hover-bg); transform:translate(-1px, -1px); box-shadow:var(--shadow); }
.site-nav a.back:active { transform:translate(2px, 2px); box-shadow:none; }
.site-nav a.back span { transition:transform .12s; }
.site-nav a.back:hover span { transform:translateX(-3px); }

/* theme toggle. The half-filled circle follows the text colour. */
.theme-toggle { display:inline-flex; align-items:center; gap:var(--s2); margin-left:var(--s2); padding:var(--s1) var(--s3); font-family:var(--mono); font-size:var(--fs-sm); color:var(--text); background:var(--surface); border:var(--bw) solid var(--ink); border-radius:var(--radius-sm); box-shadow:var(--shadow-sm); cursor:pointer; transition:transform .12s, box-shadow .12s, background .12s; }
.theme-toggle:hover { color:var(--hover-fg); background:var(--hover-bg); transform:translate(-1px, -1px); box-shadow:var(--shadow); }
.theme-toggle:active { transform:translate(2px, 2px); box-shadow:none; }
.theme-toggle .ico { flex-shrink:0; width:14px; height:14px; border:var(--bw) solid currentColor; border-radius:50%; background:linear-gradient(90deg, currentColor 0 50%, transparent 50%); }
:root[data-theme="dark"] .theme-toggle .ico { background:linear-gradient(90deg, transparent 0 50%, currentColor 50%); }
:root:not([data-theme]) .theme-toggle { display:none; } /* no JavaScript: hide a button that can't work */

@media (max-width:600px) {
  .bar { padding:0 var(--s3); }
  .bar .dots, .bar .path { display:none; } /* phones: the All work button handles navigation */
  .site-nav { margin:0 auto; }
  .theme-toggle { padding:var(--s2); }
  /* keep the label for screen readers, hide it visually */
  .theme-toggle .txt { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
}


/* 6. Layout and the left side nav ----------------------------------------- */
.layout { display:flex; align-items:flex-start; gap:var(--s2); width:100%; }
.wrap-page { flex:1 1 auto; width:100%; min-width:0; max-width:1020px; margin:0 auto; padding:0 var(--s6); }

/* side nav: dots on a line, the line fills as you scroll (js/toc.js) */
.toc { position:sticky; top:96px; display:flex; flex:0 0 136px; flex-direction:column; gap:var(--s4); margin-left:var(--s3); padding:var(--s2) 0 var(--s2) var(--s5); }
.toc-line { position:absolute; left:var(--s5); top:var(--s3); bottom:var(--s3); width:var(--bw); background:var(--rule); transform:translateX(-50%); }
.toc-fill { position:absolute; top:0; left:0; width:100%; background:var(--primary); transition:height .1s linear; }
.toc-item { position:relative; padding-left:var(--s5); font-family:var(--mono); font-size:11px; letter-spacing:.06em; text-transform:uppercase; white-space:nowrap; color:var(--muted); transition:color .12s; }
.toc-item:hover { color:var(--text); }
.toc-item .d { position:absolute; left:0; top:50%; width:10px; height:10px; background:var(--surface); border:var(--bw) solid var(--ink); border-radius:50%; transform:translate(-50%, -50%); transition:background .12s; }
.toc-item.active { font-weight:700; color:var(--primary-ink); }
.toc-item.active .d { background:var(--primary); }

/* contact icons appended by js/toc.js */
.toc-contact { display:flex; flex-direction:column; gap:var(--s3); padding-top:var(--s3); border-top:var(--bw) solid var(--rule); position:relative; z-index:1; background:var(--surface); }
.toc-clink { display:flex; align-items:center; gap:var(--s2); padding-left:var(--s5); font-family:var(--mono); font-size:11px; letter-spacing:.06em; text-transform:uppercase; color:var(--muted); transition:color .12s; white-space:nowrap; }
.toc-clink:hover { color:var(--text); }
.toc-clink svg { flex-shrink:0; }

/* on small screens: hide section links, show a fixed icon-only strip on the left edge */
@media (max-width:900px) {
  .toc { position:fixed; left:0; top:50%; transform:translateY(-50%); flex:none; width:32px; margin:0; padding:var(--s3) 0; background:var(--surface); border:var(--bw) solid var(--ink); border-left:none; border-radius:0 var(--radius) var(--radius) 0; z-index:40; }
  .toc-item, .toc-line { display:none; }
  .toc-contact { padding-top:0; border-top:none; gap:0; background:none; z-index:auto; position:static; }
  .toc-clink { padding:var(--s3) 0; justify-content:center; }
  .toc-clink-label { display:none; }
}


/* 7. Hero command line ("jaivanth@ml:~$ whoami") ------------------------- */
.cmd { display:flex; flex-wrap:wrap; align-items:baseline; gap:var(--s2); font-family:var(--mono); font-size:var(--fs-sm); color:var(--text-2); }
.cmd .p { font-weight:700; color:var(--primary-ink); } /* prompt */
.cmd .c { font-weight:700; color:var(--text); }        /* command */
.cur { display:inline-block; width:9px; height:16px; vertical-align:-2px; background:var(--primary); animation:blink 1.1s steps(1) infinite; } /* blinking cursor */
@keyframes blink { 50% { opacity:0; } }


/* 8. Home page (index.html, <body class="home">) --------------------------- */
.home .wrap-page { max-width:1140px; }
.home section { padding:0 0 var(--s8); }
.home .sh { margin-bottom:var(--s6); }

/* hero: name, role line, intro, buttons, photo */
.home .hero { padding:var(--s7) 0; }
.hero h1 { margin:var(--s5) 0 0; font-size:var(--fs-4xl); letter-spacing:-0.04em; line-height:.95; }
.herorow { display:grid; grid-template-columns:1fr auto; align-items:end; gap:var(--s6); margin-top:var(--s5); }
.hero .role { font-family:var(--mono); font-size:var(--fs-sm); font-weight:700; letter-spacing:.06em; color:var(--secondary-ink); }
.hero .lede { max-width:46ch; margin-top:var(--s4); font-size:var(--fs-lg); line-height:1.5; color:var(--text-2); }
.hero .edu { margin-top:var(--s4); font-family:var(--mono); font-size:var(--fs-sm); color:var(--muted); }
.hero .btns { margin-top:var(--s5); }
.hero .por { width:var(--headshot); aspect-ratio:4 / 5; object-fit:cover; border:var(--bw) solid var(--ink); border-radius:var(--radius); box-shadow:var(--shadow-lg); }

/* featured thesis: text on the left, chart on the right */
.thesis { display:grid; grid-template-columns:1fr 1.05fr; align-items:center; gap:var(--s7); }
.thesis h2 { font-size:var(--fs-3xl); letter-spacing:-0.03em; line-height:1; }
.thesis p { max-width:46ch; margin-top:var(--s4); color:var(--text-2); }
.thesis p b { color:var(--text); }
.thesis .chips { display:flex; flex-wrap:wrap; gap:var(--s2); margin-top:var(--s5); }
.thesis .btns { margin-top:var(--s5); }

/* project list: one card, one row per project */
.work { overflow:hidden; border:var(--bw) solid var(--ink); border-radius:var(--radius); box-shadow:var(--shadow); }
.wrow { display:grid; grid-template-columns:48px 1fr auto auto; align-items:center; gap:var(--s5); padding:var(--s5); background:var(--surface); border-bottom:var(--bw) solid var(--ink); transition:background .12s; }
.wrow:last-child { border-bottom:0; }
.wrow:hover { color:inherit; background:var(--primary-tint); }
.wrow .num { font-family:var(--mono); font-size:var(--fs-sm); font-weight:700; color:var(--primary-ink); }
.wrow h3 { font-size:var(--fs-xl); }
.wrow .out { margin-top:var(--s1); font-family:var(--mono); font-size:var(--fs-sm); color:var(--muted); } /* method · result · hardware */
.wrow .tag { padding:var(--s1) var(--s3); font-family:var(--mono); font-size:11px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; white-space:nowrap; color:var(--text); background:var(--warning-tint); border:var(--bw) solid var(--ink); border-radius:999px; }
.wrow .go { font-family:var(--mono); font-size:var(--fs-lg); color:var(--text); transition:transform .12s; }
.wrow:hover .go { transform:translate(3px, -3px); }
.wrow--sm { padding:var(--s4) var(--s5); }   /* "Other work" rows */
.wrow--sm h3 { font-size:var(--fs-lg); }
.subhead { margin:var(--s7) 0 var(--s4); font-family:var(--mono); font-size:var(--fs-xs); font-weight:700; letter-spacing:.12em; text-transform:uppercase; color:var(--secondary-ink); }

/* stack card */
.stack { max-width:820px; padding:var(--s5); border:var(--bw) solid var(--ink); border-radius:var(--radius); box-shadow:var(--shadow); }
.stack h3 { padding-bottom:var(--s3); font-family:var(--mono); font-size:var(--fs-xs); font-weight:700; letter-spacing:.12em; text-transform:uppercase; color:var(--secondary-ink); border-bottom:var(--bw) solid var(--ink); }
.stack .row { display:flex; gap:var(--s4); padding:var(--s3) 0; border-bottom:1px solid var(--rule); }
.stack .row:last-child { padding-bottom:0; border-bottom:0; }
.stack .k { flex-shrink:0; width:112px; padding-top:2px; font-family:var(--mono); font-size:var(--fs-xs); font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--primary-ink); }
.stack .v { color:var(--text-2); }

.contact .btns { margin-top:var(--s5); }
.home footer { display:flex; flex-wrap:wrap; justify-content:space-between; gap:var(--s3); padding:var(--s5) 0; border-top:var(--bw) solid var(--ink); }

@media (max-width:860px) {
  .herorow, .thesis { grid-template-columns:1fr; gap:var(--s6); }
  .wrow { grid-template-columns:32px 1fr auto; gap:var(--s4); padding:var(--s4); }
  .wrow .tag { display:none; }
}


/* 9. Project pages (projects/*.html) -------------------------------------- */

/* hero: kicker line, title, summary, overview box + metric tiles */
.pj-hero { padding:var(--s7) 0 0; }
.pj-hero > .cmd:first-child { padding-top:var(--s6); }
.pj-hero .kick { margin:var(--s5) 0 var(--s3); font-family:var(--mono); font-size:var(--fs-xs); font-weight:700; letter-spacing:.1em; text-transform:uppercase; color:var(--secondary-ink); }
.pj-hero h1 { max-width:20ch; font-size:var(--fs-3xl); letter-spacing:-0.035em; line-height:1; }
.pj-hero .sub { max-width:56ch; margin-top:var(--s4); font-size:var(--fs-lg); line-height:1.5; color:var(--text-2); }

/* overview box (Role / Goal / Context). The ink background shows through the gaps as divider lines. */
.ov { display:grid; grid-template-columns:repeat(3, 1fr); gap:var(--bw); margin-top:var(--s6); overflow:hidden; background:var(--ink); border:var(--bw) solid var(--ink); border-radius:var(--radius) var(--radius) 0 0; }
.ov:last-child { border-radius:var(--radius); box-shadow:var(--shadow); } /* page without metric tiles */
.ov > div { padding:var(--s4); background:var(--surface-2); }
.ov .k { font-family:var(--mono); font-size:11px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; color:var(--muted); }
.ov .v { margin-top:var(--s1); font-size:var(--fs-sm); line-height:1.5; color:var(--text); }
.ov .v a { font-weight:700; color:var(--primary-ink); text-decoration:underline; text-decoration-thickness:2px; text-underline-offset:3px; }

/* metric tiles, attached under the overview box. Only real measurements go here. */
.mx { display:grid; grid-template-columns:repeat(auto-fit, minmax(220px, 1fr)); gap:var(--bw); overflow:hidden; background:var(--ink); border:var(--bw) solid var(--ink); border-top:0; border-radius:0 0 var(--radius) var(--radius); box-shadow:var(--shadow); }
.mx > div { padding:var(--s5) var(--s4); background:var(--surface); }
.mx .n { font-family:var(--sans); font-size:var(--fs-2xl); font-weight:600; letter-spacing:-0.03em; line-height:1.1; }  /* the number */
.mx .n .y { color:var(--primary-ink); }                                                                               /* its unit */
.mx .l { margin-top:var(--s2); font-family:var(--mono); font-size:var(--fs-xs); line-height:1.55; color:var(--muted); } /* what and under which conditions */

/* sections */
section.pj { padding:var(--s7) 0 0; }
.pj .sh { margin-bottom:var(--s5); }
.pj h2 { margin-bottom:var(--s4); font-size:var(--fs-2xl); }
.pj .prose { max-width:68ch; color:var(--text-2); }
.pj .prose b { color:var(--text); }
.pj .prose p + p { margin-top:var(--s3); }
.pj figure + figure { margin-top:var(--s6); }

/* numbered steps card */
.steps { display:grid; gap:var(--bw); max-width:760px; overflow:hidden; background:var(--ink); border:var(--bw) solid var(--ink); border-radius:var(--radius); box-shadow:var(--shadow); }
.steps > div { display:flex; align-items:baseline; gap:var(--s4); padding:var(--s4); background:var(--surface); }
.steps .sn { flex-shrink:0; padding:0 var(--s1); font-family:var(--mono); font-size:var(--fs-xs); font-weight:700; color:var(--primary-ink); background:var(--primary-tint); border:1px solid var(--ink); border-radius:var(--radius-sm); }
.steps .st { font-size:var(--fs-sm); line-height:1.65; color:var(--text-2); }
.steps .st b { color:var(--text); }
.prose + .steps, .steps + .prose { margin-top:var(--s5); }

/* two columns: list on the left, figures on the right */
.res { display:grid; grid-template-columns:1fr 1fr; align-items:start; gap:var(--s6); }

/* tables: .tbl for data, .tbl--kv for "label / value" rows */
.tbl { width:100%; max-width:760px; border-collapse:collapse; font-size:var(--fs-sm); color:var(--text-2); }
.tbl th, .tbl td { padding:var(--s2) var(--s3) var(--s2) 0; text-align:left; vertical-align:top; border-bottom:1px solid var(--rule); }
.tbl thead th { font-family:var(--mono); font-size:11px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); border-bottom:var(--bw) solid var(--ink); }
.tbl td.num, .tbl th.num { padding-right:0; padding-left:var(--s3); text-align:right; font-family:var(--mono); font-variant-numeric:tabular-nums; }
.tbl tbody th { font-weight:700; color:var(--text); }
.tbl--kv tbody th { width:176px; padding-top:var(--s3); font-size:var(--fs-xs); letter-spacing:.06em; text-transform:uppercase; color:var(--primary-ink); }
.tbl + .prose, .tbl + .res-list { margin-top:var(--s5); }
.tnote { max-width:760px; margin-top:var(--s2); font-family:var(--mono); font-size:var(--fs-xs); color:var(--muted); } /* note under a table */

.sk { display:flex; flex-wrap:wrap; gap:var(--s2); max-width:760px; } /* skills chips */

/* footer: back / next cards + contact buttons */
.pj-foot { margin-top:var(--s7); }
.pj-next { display:grid; grid-template-columns:1fr 1fr; gap:var(--s4); }
.pj-next a { display:flex; flex-direction:column; gap:var(--s2); padding:var(--s5); background:var(--surface); border:var(--bw) solid var(--ink); border-radius:var(--radius); box-shadow:var(--shadow-sm); transition:transform .12s, box-shadow .12s, background .12s; }
.pj-next a:hover { color:inherit; background:var(--primary-tint); transform:translate(-1px, -1px); box-shadow:var(--shadow); }
.pj-next a:active { transform:translate(2px, 2px); box-shadow:none; }
.pj-next .k { font-family:var(--mono); font-size:11px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; color:var(--muted); }
.pj-next .t { font-family:var(--display); font-size:var(--fs-lg); font-weight:600; letter-spacing:-0.02em; }
.pj-cta { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:var(--s4); padding:var(--s6) 0 var(--s7); }
.pj-cta .links { display:flex; flex-wrap:wrap; gap:var(--s3); }

@media (max-width:820px) {
  .ov, .mx, .res, .pj-next { grid-template-columns:1fr; }
}


/* 10. Results and limitation lists -----------------------------------------
   <ul class="res-list">                 results, green "+" marker
   <ul class="res-list res-list--done">  results stated as plain facts, neutral check mark
                                          (used on pages with no Limitations section)
   <ul class="res-list res-list--gaps">  limitations and failures, red "–" marker */
.res ul, .res-list { margin:0; padding:0; list-style:none; }
.res-list { max-width:68ch; }
.res-list + figure { margin-top:var(--s6); }
.prose + .res-list, .res-list + .prose { margin-top:var(--s4); }
.res li, .res-list li { position:relative; padding:var(--s3) 0 var(--s3) var(--s6); font-size:var(--fs-sm); color:var(--text-2); border-bottom:1px solid var(--rule); }
.res li:last-child, .res-list li:last-child { border-bottom:0; }
.res li b, .res-list li b { color:var(--text); }
/* the marker box */
.res li::before, .res-list li::before { content:"+"; position:absolute; left:0; top:var(--s3); display:flex; align-items:center; justify-content:center; width:20px; height:20px; font-family:var(--mono); font-size:var(--fs-xs); font-weight:700; line-height:1; color:var(--success-ink); background:var(--success-tint); border:1px solid var(--ink); border-radius:var(--radius-sm); }
.res-list--gaps li::before { content:"–"; color:var(--muted); background:var(--surface-2); }
.res-list--done li::before { content:""; background:var(--surface-2); }
.res-list--done li::after { content:""; position:absolute; left:7px; top:calc(var(--s3) + 4px); width:5px; height:10px; border:solid var(--text); border-width:0 2px 2px 0; transform:rotate(45deg); } /* drawn check mark */


/* 11. Clip player (WasteSep, js/clips.js) --------------------------------- */
.clips { overflow:hidden; border:var(--bw) solid var(--ink); border-radius:var(--radius); box-shadow:var(--shadow); }
.clips .figcap { margin:0; padding:var(--s3) var(--s4); background:var(--surface); border-top:var(--bw) solid var(--ink); }
.clips__stage { position:relative; aspect-ratio:8 / 5; overflow:hidden; background:#000; }
.clips__video { display:block; width:100%; height:100%; object-fit:cover; cursor:pointer; }

/* prev / next arrows: appear on hover (always visible on touch screens) */
.clips__nav { position:absolute; top:50%; display:flex; align-items:center; justify-content:center; width:40px; height:40px; font-family:var(--mono); font-size:var(--fs-md); font-weight:700; color:var(--text); background:var(--surface); border:var(--bw) solid var(--ink); border-radius:var(--radius); box-shadow:var(--shadow-sm); cursor:pointer; opacity:0; transform:translateY(-50%); transition:opacity .12s, background .12s; }
.clips__nav--prev { left:var(--s3); }
.clips__nav--next { right:var(--s3); }
.clips__stage:hover .clips__nav, .clips__nav:focus-visible { opacity:1; }
.clips__nav:hover { color:var(--hover-fg); background:var(--hover-bg); }
.clips__nav:active { box-shadow:none; }
@media (hover:none) { .clips__nav { opacity:1; } }

/* "01 / 05" counter and Pause button over the video */
.clips__hud { position:absolute; left:var(--s3); bottom:var(--s3); display:flex; align-items:center; gap:var(--s2); }
.clips__hud > * { padding:var(--s1) var(--s2); font-family:var(--mono); font-size:11px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--text); background:var(--surface); border:var(--bw) solid var(--ink); border-radius:var(--radius-sm); }
.clips__toggle { box-shadow:var(--shadow-sm); cursor:pointer; }
.clips__toggle:hover { color:var(--hover-fg); background:var(--hover-bg); }
.clips__toggle:active { box-shadow:none; }

/* clip tabs under the video; the bar on top of the active tab fills as the clip plays */
.clips__tabs { display:grid; grid-template-columns:repeat(auto-fit, minmax(118px, 1fr)); gap:var(--bw); background:var(--ink); border-top:var(--bw) solid var(--ink); }
.clips__tab { position:relative; display:flex; flex-direction:column; gap:var(--s1); padding:var(--s4) var(--s3) var(--s3); font-family:var(--mono); font-size:11px; letter-spacing:.05em; text-align:left; text-transform:uppercase; color:var(--muted); background:var(--surface); border:0; cursor:pointer; transition:background .12s, color .12s; }
.clips__tab:hover { color:var(--text); background:var(--surface-2); }
.clips__tab[aria-selected="true"] { font-weight:700; color:var(--text); background:var(--primary-tint); }
.clips__tab .n { font-weight:700; color:var(--muted); }
.clips__tab[aria-selected="true"] .n { color:var(--primary-ink); }
.clips__tab:focus-visible { outline-offset:-4px; }
.clips__bar { position:absolute; left:0; right:0; top:0; height:4px; }
.clips__bar i { display:block; width:0; height:100%; background:var(--primary); }
.clips__tab.done .clips__bar i { width:100%; background:var(--rule); }

@media (max-width:600px) {
  .clips__tabs { grid-template-columns:1fr 1fr; }
  .clips__tab { padding:var(--s3); }
  .clips__tab:last-child:nth-child(odd) { grid-column:span 2; } /* odd count: last tab spans the row */
}


/* 12. Build photos (collapsible <details class="build">) ------------------ */
.build { margin:var(--s5) 0; }
.build summary { display:inline-flex; align-items:center; gap:var(--s2); padding:var(--s2) var(--s4); font:700 var(--fs-sm)/1.4 var(--mono); color:var(--text); list-style:none; background:var(--summary-bg); border:var(--bw) solid var(--ink); border-radius:var(--radius); box-shadow:var(--shadow-sm); cursor:pointer; }
.build summary::-webkit-details-marker { display:none; }
.build summary::before { content:"+"; }
.build[open] summary::before { content:"–"; }
.build summary:hover { color:var(--hover-fg); background:var(--hover-bg); transform:translate(-1px, -1px); box-shadow:var(--shadow); }
.build[open] summary { margin-bottom:var(--s3); }


/* 13. Motion ----------------------------------------------------------------
   Everything animated sits behind prefers-reduced-motion: no-preference.
   Animations use the separate `translate` / `scale` properties, so they never override
   the `transform` used by hover and press states on buttons and cards. */

/* Lenis smooth scrolling (js/motion.js adds these classes to <html>) */
html.lenis, html.lenis body { height:auto; }
.lenis.lenis-smooth { scroll-behavior:auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior:contain; }
.lenis.lenis-stopped { overflow:hidden; }

@media (prefers-reduced-motion: no-preference) {
  /* reveal on scroll: js/motion.js adds .rv to blocks below the fold, then .rv-in once they appear */
  .rv { opacity:0; translate:0 28px; }
  .rv.rv-in { opacity:1; translate:0 0; transition:opacity var(--dur) var(--ease-out), translate var(--dur) var(--ease-out); transition-delay:calc(var(--rv-i, 0) * var(--stagger)); }
  .label.rv::after { scale:0 1; transform-origin:left; }                        /* section rule draws in */
  .label.rv-in::after { scale:1 1; transition:scale 1s var(--ease-out) .15s; }

  /* hero entrance when a page loads, one element after another.
     Project titles (h1) are skipped because they morph in from the home page instead. */
  .hero > *, .pj-hero > :not(h1) { animation:rise .8s var(--ease-out) both; }
  .hero > :nth-child(2), .pj-hero > :nth-child(2) { animation-delay:.06s; }
  .hero > :nth-child(3), .pj-hero > :nth-child(4) { animation-delay:.14s; }
  .pj-hero > :nth-child(5)    { animation-delay:.2s; }
  .pj-hero > :nth-child(6)    { animation-delay:.26s; }
  .pj-hero > :nth-child(n+7)  { animation-delay:.32s; }
  .toc { animation:fade .9s var(--ease-out) .3s both; }

  /* page-to-page transitions (Chrome/Edge 126+, Safari 18.2+; other browsers just load the page) */
  @view-transition { navigation:auto; }
}
@keyframes rise { from { opacity:0; translate:0 18px; } }
@keyframes fade { from { opacity:0; } }

/* the old page fades up and out, the new one rises in; the top bar stays still */
::view-transition-old(root) { animation:vt-out .26s var(--ease-in) both; }
::view-transition-new(root) { animation:vt-in .46s var(--ease-out) both; }
::view-transition-group(*) { animation-duration:.5s; animation-timing-function:var(--ease-out); }
@keyframes vt-out { to { opacity:0; translate:0 -12px; } }
@keyframes vt-in { from { opacity:0; translate:0 22px; } }

/* project title morph: the title in the home list (h3) moves and resizes into the project page h1.
   The same vt-<page> class goes on both. Text cross-fades at its own size instead of stretching.
   New project? Add a line here and put the class on its home-page h3 and its page h1. */
::view-transition-old(.pj-title), ::view-transition-new(.pj-title) { width:auto; height:100%; object-fit:none; object-position:left top; }
.vt-wastesep        { view-transition-name:pj-wastesep;        view-transition-class:pj-title; }
.vt-video-detection { view-transition-name:pj-video-detection; view-transition-class:pj-title; }
.vt-kart-perception { view-transition-name:pj-kart-perception; view-transition-class:pj-title; }
.vt-rgbd-range      { view-transition-name:pj-rgbd-range;      view-transition-class:pj-title; }
.vt-feral-animal    { view-transition-name:pj-feral-animal;    view-transition-class:pj-title; }
.vt-daps            { view-transition-name:pj-daps;            view-transition-class:pj-title; }
.vt-miq-forecasting { view-transition-name:pj-miq-forecasting; view-transition-class:pj-title; }
.vt-voxel51         { view-transition-name:pj-voxel51;         view-transition-class:pj-title; }


/* 14. Reduced motion and print -------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { transition:none !important; animation:none !important; }
  html { scroll-behavior:auto; }
}
@media print {
  .rv { opacity:1 !important; translate:none !important; }
}
