/* ==========================================================================
   Sebastian Rojas-Ordoñez — portfolio
   Plain CSS, no build step. Sections follow the page order in index.html.
   ========================================================================== */

/* ---------- 1. Design tokens ---------- */
:root {
  --bg: #f6f3ed;
  --bg-2: #ece6db;
  --surface: rgba(255, 255, 255, .66);
  --surface-2: #fffdf9;
  --surface-solid: #fbf9f5;
  --ink: #0f1f1b;
  --ink-2: #2e3d39;
  --muted: #55635e;
  --line: rgba(15, 31, 27, .11);
  --line-2: rgba(15, 31, 27, .2);
  --hover: rgba(15, 31, 27, .05);
  --grid: rgba(15, 31, 27, .05);

  --teal: #03695f;
  --teal-vivid: #0fbfac;
  --coral: #b33b25;
  --coral-vivid: #ef6a4f;
  --coral-soft: rgba(239, 106, 79, .12);
  --amber: #875609;
  --amber-vivid: #f0b048;
  --amber-soft: rgba(240, 176, 72, .2);
  --green: #17704a;
  --green-vivid: #2fbf7a;
  --green-soft: rgba(47, 191, 122, .14);

  --primary: #03695f;
  --primary-hover: #025249;
  --on-primary: #ffffff;
  --primary-shadow: rgba(3, 105, 95, .24);
  --primary-soft: rgba(15, 191, 172, .1);
  --icon-bg: rgba(15, 191, 172, .12);
  --tag-bg: rgba(255, 255, 255, .6);
  --ptag-bg: rgba(15, 31, 27, .06);
  --spot: rgba(15, 191, 172, .1);
  --focus: #c77d0a;
  --selection: rgba(15, 191, 172, .25);
  --grad-a: #04756a;
  --grad-b: #a35f0a;

  --shadow-sm: 0 1px 2px rgba(15, 31, 27, .04), 0 10px 30px rgba(15, 31, 27, .05);
  --shadow: 0 30px 80px rgba(33, 49, 44, .14);
  --shadow-nav: 0 14px 40px rgba(15, 31, 27, .1);
  --shadow-cover: 0 18px 40px rgba(15, 31, 27, .18), 0 2px 6px rgba(15, 31, 27, .08);
  --blob-opacity: .16;

  --font-display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Manrope', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'DM Mono', ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace;
  --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;

  --wrap: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
  --nav-h: 66px;
  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 24px;
  --radius-xl: 34px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #07120f; --bg-2: #0b1915; --surface: rgba(22, 44, 38, .55); --surface-2: #0f221d; --surface-solid: #0d1d19;
    --ink: #ebf4ef; --ink-2: #c4d2cc; --muted: #93a59f; --line: rgba(221, 243, 234, .1); --line-2: rgba(221, 243, 234, .2);
    --hover: rgba(221, 243, 234, .06); --grid: rgba(221, 243, 234, .045);
    --teal: #4fdfcb; --teal-vivid: #62f0db; --coral: #ff8a6f; --coral-vivid: #ff7a5c; --coral-soft: rgba(255, 122, 92, .14);
    --amber: #f2bb5a; --amber-vivid: #f4bb59; --amber-soft: rgba(242, 187, 90, .14); --green: #6ad8a2; --green-vivid: #4ee08a; --green-soft: rgba(106, 216, 162, .14);
    --primary: #62f0db; --primary-hover: #8ff7e7; --on-primary: #04201b; --primary-shadow: rgba(98, 240, 219, .16); --primary-soft: rgba(98, 240, 219, .08);
    --icon-bg: rgba(98, 240, 219, .1); --tag-bg: rgba(255, 255, 255, .03); --ptag-bg: rgba(221, 243, 234, .08); --spot: rgba(98, 240, 219, .08);
    --focus: #f4bb59; --selection: rgba(98, 240, 219, .3); --grad-a: #62f0db; --grad-b: #f4bb59;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .2), 0 12px 32px rgba(0, 0, 0, .18); --shadow: 0 34px 100px rgba(0, 0, 0, .45);
    --shadow-nav: 0 14px 40px rgba(0, 0, 0, .35); --shadow-cover: 0 20px 44px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .3); --blob-opacity: .13;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #07120f; --bg-2: #0b1915; --surface: rgba(22, 44, 38, .55); --surface-2: #0f221d; --surface-solid: #0d1d19;
  --ink: #ebf4ef; --ink-2: #c4d2cc; --muted: #93a59f; --line: rgba(221, 243, 234, .1); --line-2: rgba(221, 243, 234, .2);
  --hover: rgba(221, 243, 234, .06); --grid: rgba(221, 243, 234, .045);
  --teal: #4fdfcb; --teal-vivid: #62f0db; --coral: #ff8a6f; --coral-vivid: #ff7a5c; --coral-soft: rgba(255, 122, 92, .14);
  --amber: #f2bb5a; --amber-vivid: #f4bb59; --amber-soft: rgba(242, 187, 90, .14); --green: #6ad8a2; --green-vivid: #4ee08a; --green-soft: rgba(106, 216, 162, .14);
  --primary: #62f0db; --primary-hover: #8ff7e7; --on-primary: #04201b; --primary-shadow: rgba(98, 240, 219, .16); --primary-soft: rgba(98, 240, 219, .08);
  --icon-bg: rgba(98, 240, 219, .1); --tag-bg: rgba(255, 255, 255, .03); --ptag-bg: rgba(221, 243, 234, .08); --spot: rgba(98, 240, 219, .08);
  --focus: #f4bb59; --selection: rgba(98, 240, 219, .3); --grad-a: #62f0db; --grad-b: #f4bb59;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .2), 0 12px 32px rgba(0, 0, 0, .18); --shadow: 0 34px 100px rgba(0, 0, 0, .45);
  --shadow-nav: 0 14px 40px rgba(0, 0, 0, .35); --shadow-cover: 0 20px 44px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .3); --blob-opacity: .13;
  color-scheme: dark;
}

/* ---------- 1b. A personality per tab ----------
   Each tab redefines the tokens (light and dark). :root[data-view] lets the header, footer and page
   background follow the open tab; the .p-* classes also dress the Home preview cards. */
:root {
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .3 0 0 0 0 .14 0 0 0 .16 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --topo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='640' height='640' viewBox='0 0 640 640' fill='none' stroke='%236f7f74' stroke-opacity='.19' stroke-width='1.1'%3E%3Cpath d='M98 316c26-104 170-150 262-102 94 48 120 170 52 238-66 66-206 76-276 20-50-40-56-96-38-156z'/%3E%3Cpath d='M144 320c18-72 118-104 182-70 64 34 82 118 36 166-46 46-142 52-190 14-34-28-40-66-28-110z'/%3E%3Cpath d='M190 324c12-42 70-60 106-40 36 20 46 68 20 96-26 26-82 30-110 8-20-16-24-38-16-64z'/%3E%3Cpath d='M234 326c6-16 28-24 42-16 14 8 18 26 8 38-10 10-32 12-44 4-8-6-10-14-6-26z'/%3E%3Cpath d='M-10 92c70 18 120-26 196-14 86 14 120 74 214 64 92-10 150-70 250-40'/%3E%3Cpath d='M-10 122c74 16 124-22 198-10 88 14 124 70 214 62 90-8 148-62 248-36'/%3E%3Cpath d='M-10 548c96-40 150 8 236-12 90-20 128-90 222-80 86 10 120 70 202 60'/%3E%3Cpath d='M-10 580c100-36 152 6 240-12 88-18 126-82 220-74 84 8 118 64 200 56'/%3E%3Cpath d='M486 330c40-70 130-70 164-20M512 336c26-40 84-40 104-10'/%3E%3C/svg%3E");
}

@supports (color: light-dark(#000, #fff)) {
  /* Research: the library — warm paper, ink and gold */
  :root[data-view="research"], .p-research {
    --bg: light-dark(#f4eee2, #15110b); --bg-2: light-dark(#e9e1d1, #1c170f);
    --surface: light-dark(rgba(255, 251, 242, .86), rgba(36, 29, 20, .8)); --surface-2: light-dark(#fffdf7, #241e15); --surface-solid: light-dark(#faf4e8, #1a150e);
    --ink: light-dark(#21190f, #f4ebdb); --ink-2: light-dark(#3d3223, #dccfb8); --muted: light-dark(#685a46, #b1a38c);
    --line: light-dark(rgba(70, 48, 18, .15), rgba(244, 235, 219, .12)); --line-2: light-dark(rgba(70, 48, 18, .3), rgba(244, 235, 219, .24));
    --hover: light-dark(rgba(70, 48, 18, .06), rgba(244, 235, 219, .06)); --grid: light-dark(rgba(70, 48, 18, .05), rgba(244, 235, 219, .04));
    --teal: light-dark(#85570a, #e6b862); --teal-vivid: light-dark(#d39b2f, #f0c674);
    --coral: light-dark(#9b3b1c, #f09a72); --coral-vivid: light-dark(#d0643a, #ff9a6b); --coral-soft: light-dark(rgba(208, 100, 58, .12), rgba(255, 154, 107, .14));
    --amber: light-dark(#85570a, #f0c674); --amber-vivid: light-dark(#d39b2f, #f0c674); --amber-soft: light-dark(rgba(211, 155, 47, .18), rgba(240, 198, 116, .14));
    --primary: light-dark(#2a2014, #ecc77c); --primary-hover: light-dark(#120d07, #f5d79a); --on-primary: light-dark(#fff8ea, #1c1508);
    --primary-shadow: light-dark(rgba(42, 32, 20, .22), rgba(236, 199, 124, .14)); --primary-soft: light-dark(rgba(211, 155, 47, .12), rgba(236, 199, 124, .08));
    --icon-bg: light-dark(rgba(211, 155, 47, .15), rgba(236, 199, 124, .1)); --tag-bg: light-dark(rgba(255, 250, 240, .7), rgba(255, 255, 255, .03));
    --ptag-bg: light-dark(rgba(70, 48, 18, .07), rgba(244, 235, 219, .08)); --spot: light-dark(rgba(211, 155, 47, .1), rgba(236, 199, 124, .07));
    --focus: light-dark(#b4441f, #f0c674); --selection: light-dark(rgba(211, 155, 47, .28), rgba(240, 198, 116, .3));
    --grad-a: light-dark(#85570a, #f0c674); --grad-b: light-dark(#9b3b1c, #ff9a6b);
    --shadow-sm: 0 1px 0 light-dark(rgba(70, 48, 18, .06), rgba(0, 0, 0, .3)); --shadow-nav: 0 14px 40px light-dark(rgba(60, 40, 10, .12), rgba(0, 0, 0, .4));
    --radius-sm: 6px; --radius: 8px; --radius-lg: 10px; --radius-xl: 14px;
  }

  /* Engineering: the blueprint — technical blue, square corners, orange annotations */
  :root[data-view="engineering"], .p-engineering {
    --bg: light-dark(#edf3fa, #0a182b); --bg-2: light-dark(#e1eaf5, #0e2036);
    --surface: light-dark(rgba(255, 255, 255, .86), rgba(14, 36, 62, .8)); --surface-2: light-dark(#ffffff, #10294a); --surface-solid: light-dark(#f6f9fd, #0d2340);
    --ink: light-dark(#0b1c31, #e7f1ff); --ink-2: light-dark(#1f3450, #c3d5ec); --muted: light-dark(#4a5d76, #90a8c6);
    --line: light-dark(rgba(16, 70, 140, .16), rgba(120, 180, 255, .18)); --line-2: light-dark(rgba(16, 70, 140, .3), rgba(120, 180, 255, .34));
    --hover: light-dark(rgba(16, 70, 140, .06), rgba(120, 180, 255, .07)); --grid: light-dark(rgba(16, 90, 180, .075), rgba(120, 180, 255, .075));
    --teal: light-dark(#0a5bb0, #6cc7ff); --teal-vivid: light-dark(#2d8cf0, #7dd3ff);
    --coral: light-dark(#b8430f, #ffab73); --coral-vivid: light-dark(#f0722e, #ff9a55); --coral-soft: light-dark(rgba(240, 114, 46, .12), rgba(255, 154, 85, .14));
    --amber: light-dark(#8a5a06, #f5c46b); --amber-vivid: light-dark(#f0b048, #f5c46b); --amber-soft: light-dark(rgba(240, 176, 72, .2), rgba(245, 196, 107, .14));
    --primary: light-dark(#0a5bb0, #6cc7ff); --primary-hover: light-dark(#084a90, #9ad8ff); --on-primary: light-dark(#ffffff, #04162b);
    --primary-shadow: light-dark(rgba(10, 91, 176, .25), rgba(108, 199, 255, .16)); --primary-soft: light-dark(rgba(45, 140, 240, .1), rgba(108, 199, 255, .08));
    --icon-bg: light-dark(rgba(45, 140, 240, .12), rgba(108, 199, 255, .1)); --tag-bg: light-dark(rgba(255, 255, 255, .7), rgba(255, 255, 255, .03));
    --ptag-bg: light-dark(rgba(16, 70, 140, .07), rgba(120, 180, 255, .08)); --spot: light-dark(rgba(45, 140, 240, .1), rgba(108, 199, 255, .08));
    --focus: light-dark(#f0722e, #ffab73); --selection: light-dark(rgba(45, 140, 240, .25), rgba(108, 199, 255, .3));
    --grad-a: light-dark(#0a5bb0, #6cc7ff); --grad-b: light-dark(#b8430f, #ffab73);
    --shadow-sm: 0 1px 0 light-dark(rgba(16, 70, 140, .06), rgba(0, 0, 0, .25)); --shadow-nav: 0 14px 40px light-dark(rgba(10, 40, 90, .12), rgba(0, 0, 0, .45));
    --radius-sm: 4px; --radius: 4px; --radius-lg: 4px; --radius-xl: 6px;
  }

  /* Background: the journey map — map paper, forest green and a terracotta route */
  :root[data-view="background"], .p-background {
    --bg: light-dark(#f1f0e8, #0f1512); --bg-2: light-dark(#e5e4d8, #151d19);
    --surface: light-dark(rgba(255, 255, 250, .84), rgba(26, 38, 32, .8)); --surface-2: light-dark(#fffffa, #18241e); --surface-solid: light-dark(#f8f7f0, #141e19);
    --ink: light-dark(#17221b, #eaf1eb); --ink-2: light-dark(#2d3a31, #c8d4cb); --muted: light-dark(#56635a, #94a499);
    --line: light-dark(rgba(40, 60, 45, .15), rgba(220, 240, 226, .12)); --line-2: light-dark(rgba(40, 60, 45, .28), rgba(220, 240, 226, .24));
    --hover: light-dark(rgba(40, 60, 45, .06), rgba(220, 240, 226, .06)); --grid: light-dark(rgba(40, 60, 45, .06), rgba(220, 240, 226, .05));
    --teal: light-dark(#1d6a4e, #74d6a8); --teal-vivid: light-dark(#33b07c, #7fe0b0);
    --coral: light-dark(#ad3f1b, #ff9c74); --coral-vivid: light-dark(#e2643a, #ff8a5c); --coral-soft: light-dark(rgba(226, 100, 58, .13), rgba(255, 138, 92, .15));
    --primary: light-dark(#1d6a4e, #74d6a8); --primary-hover: light-dark(#155039, #9ae6bf); --on-primary: light-dark(#ffffff, #06231a);
    --primary-shadow: light-dark(rgba(29, 106, 78, .24), rgba(116, 214, 168, .16)); --primary-soft: light-dark(rgba(51, 176, 124, .1), rgba(116, 214, 168, .08));
    --icon-bg: light-dark(rgba(51, 176, 124, .13), rgba(116, 214, 168, .1)); --tag-bg: light-dark(rgba(255, 255, 250, .7), rgba(255, 255, 255, .03));
    --ptag-bg: light-dark(rgba(40, 60, 45, .07), rgba(220, 240, 226, .08)); --spot: light-dark(rgba(226, 100, 58, .08), rgba(255, 138, 92, .07));
    --focus: light-dark(#e2643a, #ff9c74); --selection: light-dark(rgba(226, 100, 58, .22), rgba(255, 138, 92, .28));
    --grad-a: light-dark(#1d6a4e, #74d6a8); --grad-b: light-dark(#ad3f1b, #ff9c74);
  }
}

/* Contact: let's talk — white on a warm gradient, the same in both themes */
:root[data-view="contact"], .p-contact {
  --bg: #6e2347; --bg-2: #5c1f3d; --surface: rgba(255, 255, 255, .1); --surface-2: rgba(255, 255, 255, .14); --surface-solid: #6e2347;
  --ink: #ffffff; --ink-2: rgba(255, 255, 255, .94); --muted: rgba(255, 255, 255, .86);
  --line: rgba(255, 255, 255, .24); --line-2: rgba(255, 255, 255, .4); --hover: rgba(255, 255, 255, .1); --grid: rgba(255, 255, 255, .06);
  --teal: #ffd29a; --teal-vivid: #ffd29a; --coral: #ffe2d6; --coral-vivid: #ffb59a; --amber-vivid: #ffd29a;
  --primary: #ffffff; --primary-hover: #fff1ec; --on-primary: #8c2a45; --primary-shadow: rgba(40, 0, 20, .3); --primary-soft: rgba(255, 255, 255, .12);
  --icon-bg: rgba(255, 255, 255, .14); --tag-bg: rgba(255, 255, 255, .1); --ptag-bg: rgba(255, 255, 255, .12); --spot: rgba(255, 255, 255, .1);
  --focus: #ffe08a; --selection: rgba(255, 255, 255, .3); --shadow-nav: 0 14px 40px rgba(30, 0, 15, .35);
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 92px; }
body {
  margin: 0; min-width: 320px; background: var(--bg); color: var(--ink-2);
  font: 400 16px/1.65 var(--font-body); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: clip; transition: background-color .3s ease;
}
main { overflow-x: clip; } /* body's clip only reaches the viewport; this keeps decorations such as the portrait orbit from widening the page on phones */
img, svg, video, iframe { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
em { font-style: italic; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--selection); color: var(--ink); }

/* Content stays hidden for a moment while Spanish is swapped in (failsafe after 1.2 s). */
.lang-pending body { opacity: 0; animation: lang-failsafe 0s linear 1.2s forwards; }
@keyframes lang-failsafe { to { opacity: 1; } }

/* ---------- 3. Utilities ---------- */
.wrap { width: min(var(--wrap), 100% - 2 * var(--gutter)); margin-inline: auto; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.flag { width: 1.35em; height: .9em; flex: none; border-radius: 2px; box-shadow: 0 0 0 1px var(--line-2); }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link {
  position: fixed; left: 16px; top: -80px; z-index: 300; padding: 10px 16px; border-radius: 12px;
  background: var(--ink); color: var(--bg); font-weight: 700; transition: top .2s;
}
.skip-link:focus { top: 14px; }

/* ---------- 4. Ambient background & scroll progress ---------- */
.backdrop { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.backdrop::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse 85% 65% at 50% 0%, #000 25%, transparent 75%);
  mask-image: radial-gradient(ellipse 85% 65% at 50% 0%, #000 25%, transparent 75%);
}
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: var(--blob-opacity); animation: drift 18s ease-in-out infinite alternate; }
.blob-a { width: min(620px, 70vw); aspect-ratio: 1; background: var(--coral-vivid); top: -240px; right: -200px; }
.blob-b { width: min(520px, 60vw); aspect-ratio: 1; background: var(--teal-vivid); top: 40%; left: -260px; animation-delay: -9s; }
@keyframes drift { to { transform: translate3d(40px, 50px, 0) scale(1.08); } }

.scroll-progress { position: fixed; top: 0; left: 0; right: 0; z-index: 210; height: 3px; pointer-events: none; }
.scroll-progress span {
  display: block; height: 100%; transform-origin: 0 50%; transform: scaleX(var(--progress, 0));
  background: linear-gradient(90deg, var(--teal-vivid), var(--amber-vivid), var(--coral-vivid));
}

/* ---------- 5. Header & navigation ---------- */
.site-header { position: fixed; top: 12px; left: 0; right: 0; z-index: 100; pointer-events: none; }
.nav-shell {
  position: relative; pointer-events: auto; width: min(var(--wrap), 100% - 24px); height: var(--nav-h); margin-inline: auto;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; padding: 0 10px 0 12px;
  border: 1px solid var(--line); border-radius: 20px;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%);
  box-shadow: 0 10px 34px rgba(0, 0, 0, .05); transition: box-shadow .3s, background-color .3s;
}
.site-header.is-scrolled .nav-shell { box-shadow: var(--shadow-nav); background: color-mix(in srgb, var(--bg) 90%, transparent); }
.brand { display: flex; align-items: center; gap: 11px; justify-self: start; min-width: 0; border-radius: 12px; }
.brand-mark {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 13px;
  background: linear-gradient(135deg, #2fd9c3, #93ffe9); color: #06211c;
  font: 700 14px/1 var(--font-display); letter-spacing: -.02em;
  box-shadow: 0 8px 20px rgba(15, 191, 172, .28); transform: rotate(-4deg); transition: transform .3s var(--ease);
}
.brand:hover .brand-mark { transform: rotate(0) scale(1.05); }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-text strong { font: 700 14px/1.2 var(--font-display); color: var(--ink); letter-spacing: -.01em; white-space: nowrap; }
.brand-text span { font: 500 9.5px/1.5 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }

/* Desktop tabs: a pill slides under the open tab and takes that tab's colour */
.tabs {
  position: relative; display: flex; align-items: center; gap: 2px; padding: 4px;
  border: 1px solid var(--line); border-radius: 15px; background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}
.tabs a { position: relative; z-index: 1; padding: 8px 14px; border-radius: 11px; font-size: 13.5px; font-weight: 700; line-height: 1.2; color: var(--muted); white-space: nowrap; transition: color .3s; }
.tabs a:hover { color: var(--ink); }
.tabs.is-ready a.is-active { color: var(--on-primary); }
.tabs:not(.is-ready) a.is-active { color: var(--ink); background: var(--hover); }
.tabs-indicator {
  position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0; width: var(--iw, 0px); border-radius: 11px;
  background: var(--primary); box-shadow: 0 6px 16px var(--primary-shadow); transform: translateX(var(--ix, 0px)); opacity: 0;
  view-transition-name: tabs-indicator;
}
.tabs.is-ready .tabs-indicator { opacity: 1; transition: transform .45s var(--ease), width .45s var(--ease), background-color .45s; }
:root[data-vt] .tabs-indicator { transition: none; }

/* Phones and small tablets: the same tabs as a floating bar at the bottom */
.tabbar { display: none; }

.nav-tools { display: flex; align-items: center; justify-self: end; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; flex: none;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink);
  cursor: pointer; transition: border-color .2s, background-color .2s, transform .2s;
}
.icon-btn:hover { border-color: var(--line-2); background: var(--surface-2); }
.icon-btn .icon { width: 18px; height: 18px; }

.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

.lang-toggle {
  position: relative; display: flex; align-items: center; height: 40px; padding: 3px; flex: none;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer;
  font: 500 11px/1 var(--font-mono); letter-spacing: .06em; transition: border-color .2s;
}
.lang-toggle:hover { border-color: var(--line-2); }
.lang-toggle::before {
  content: ""; position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 9px;
  background: var(--ink); transition: transform .35s var(--ease);
}
:root[lang="es"] .lang-toggle::before { transform: translateX(100%); }
.lang-opt { position: relative; z-index: 1; display: grid; place-items: center; width: 34px; height: 100%; color: var(--muted); transition: color .3s; }
:root[lang="en"] .lang-opt[data-opt="en"], :root[lang="es"] .lang-opt[data-opt="es"] { color: var(--bg); }

/* ---------- 6. Buttons, pills, tags, cards ---------- */
.btn {
  --btn-bg: var(--surface); --btn-ink: var(--ink); --btn-line: var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 20px;
  border: 1px solid var(--btn-line); border-radius: 14px; background: var(--btn-bg); color: var(--btn-ink);
  font: 800 14px/1 var(--font-body); letter-spacing: -.005em; white-space: nowrap; cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .2s, background-color .2s, border-color .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn .icon { width: 18px; height: 18px; }
.btn small { margin-left: -3px; font: 500 11px/1 var(--font-mono); opacity: .72; }
.btn-sm { min-height: 40px; padding: 0 15px; border-radius: 12px; font-size: 13px; gap: 8px; }
.btn-sm .icon { width: 16px; height: 16px; }
.btn-block { width: 100%; }
.btn-primary { --btn-bg: var(--primary); --btn-ink: var(--on-primary); --btn-line: transparent; box-shadow: 0 12px 28px var(--primary-shadow); }
.btn-primary:hover { --btn-bg: var(--primary-hover); box-shadow: 0 16px 34px var(--primary-shadow); }
.btn-ghost:hover { --btn-line: var(--line-2); --btn-bg: var(--surface-2); }
.btn-outline { --btn-bg: transparent; --btn-line: var(--line-2); }
.btn-outline:hover { --btn-bg: var(--surface-2); }
.btn .icon-ext { opacity: .75; }
.icon-move { transition: transform .25s var(--ease); }
.btn:hover .icon-move { transform: translateX(3px); }

.link-pill {
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 13px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  font: 500 12px/1.2 var(--font-mono); color: var(--ink-2);
  transition: border-color .2s, color .2s, transform .2s;
}
.link-pill:hover { border-color: var(--teal); color: var(--teal); transform: translateY(-1px); }
.link-pill .icon { width: 15px; height: 15px; }
.icon-ext { width: 13px !important; height: 13px !important; opacity: .7; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { padding: 5px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--tag-bg); font: 500 11px/1.3 var(--font-mono); color: var(--muted); }
.tags-lg li { padding: 6px 10px; font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chips li { padding: 6px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--tag-bg); font-size: 13px; font-weight: 600; line-height: 1.35; color: var(--ink-2); }

.card { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.spot { position: relative; isolation: isolate; }
.spot::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; opacity: 0; transition: opacity .3s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), var(--spot), transparent 45%);
}
.spot:hover::before { opacity: 1; }

/* ---------- 7. Hero ---------- */
.hero { position: relative; display: flex; flex-direction: column; justify-content: center; min-height: 100svh; padding: calc(var(--nav-h) + 76px) 0 48px; }
.hero::before {
  content: ""; position: absolute; z-index: -1; width: 640px; height: 640px; right: 4%; top: 12%; pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--teal-vivid) 22%, transparent), transparent 65%);
  transform: translate3d(calc(var(--hx, 0) * 26px), calc(var(--hy, 0) * 26px), 0); transition: transform .4s ease-out;
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); gap: clamp(40px, 6vw, 88px); align-items: center; }
.availability {
  display: inline-flex; align-items: center; gap: 10px; margin-bottom: 26px; padding: 7px 14px 7px 11px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm);
  font: 500 12px/1.45 var(--font-mono); color: var(--ink-2);
}
.pulse { position: relative; width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--green-vivid); }
.pulse::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--green-vivid); opacity: .6; animation: ping 2s var(--ease) infinite; }
@keyframes ping { to { transform: scale(1.9); opacity: 0; } }
.hero-name { margin-bottom: 18px; font: 700 clamp(2.7rem, 1rem + 6.6vw, 6.4rem)/.95 var(--font-display); letter-spacing: -.055em; color: var(--ink); text-wrap: balance; }
.hero-role { margin-bottom: 22px; font: 700 clamp(1rem, .9rem + .5vw, 1.25rem)/1.4 var(--font-body); color: var(--teal); }
.hero-tagline { max-width: 20ch; font: 600 clamp(1.6rem, .95rem + 2.3vw, 2.8rem)/1.12 var(--font-display); letter-spacing: -.035em; color: var(--ink); text-wrap: balance; }
.grad { background: linear-gradient(100deg, var(--grad-a), var(--grad-b)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-lead { max-width: 62ch; margin-top: 20px; font-size: clamp(1rem, .95rem + .3vw, 1.15rem); color: var(--muted); }
.hero-lead strong { color: var(--ink); font-weight: 700; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.profile-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.profile-pills a {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 12.5px; font-weight: 700; color: var(--muted); transition: color .2s, border-color .2s, background-color .2s;
}
.profile-pills a:hover { color: var(--ink); border-color: var(--line-2); background: var(--surface); }
.profile-pills .icon { width: 15px; height: 15px; }

.hero-visual { display: flex; justify-content: center; }
.portrait-stage { position: relative; width: min(440px, 100%); perspective: 1000px; }
@property --angle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.portrait {
  position: relative; aspect-ratio: 4 / 5; padding: 7px; border-radius: 44px 44px 132px 44px;
  background: conic-gradient(from var(--angle), var(--teal-vivid), var(--amber-vivid), var(--coral-vivid), var(--teal-vivid));
  box-shadow: var(--shadow); transform-style: preserve-3d; transition: transform .25s ease-out;
  animation: spin-angle 10s linear infinite;
}
@keyframes spin-angle { to { --angle: 360deg; } }
.portrait picture { width: 100%; height: 100%; }
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 36%; border-radius: 38px 38px 126px 38px; background: var(--bg-2); }
.portrait::after {
  content: ""; position: absolute; inset: 7px; border-radius: 38px 38px 126px 38px; pointer-events: none;
  background: linear-gradient(to top, rgba(4, 14, 12, .8), transparent 42%);
}
.portrait figcaption { position: absolute; z-index: 2; left: 30px; right: 70px; bottom: 26px; color: #fff; }
.portrait figcaption strong { display: block; font: 700 16px/1.3 var(--font-display); }
.portrait figcaption > span { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font: 500 11px/1.4 var(--font-mono); opacity: .88; }
.portrait figcaption .icon { width: 13px; height: 13px; }
.orbit { position: absolute; inset: -26px; border: 1px dashed color-mix(in srgb, var(--teal) 45%, transparent); border-radius: 46% 54% 58% 42%; animation: spin 30s linear infinite; pointer-events: none; }
@keyframes spin { to { transform: rotate(1turn); } }
.float-chip {
  position: absolute; z-index: 3; padding: 9px 13px; border: 1px solid rgba(255, 255, 255, .2); border-radius: 12px;
  background: rgba(7, 18, 15, .84); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  color: #e9fffa; font: 500 11px/1 var(--font-mono); letter-spacing: .04em; white-space: nowrap;
  box-shadow: 0 14px 30px rgba(0, 0, 0, .22); animation: float 5s ease-in-out infinite;
}
.chip-a { top: 9%; left: -34px; }
.chip-b { top: 34%; right: -38px; animation-delay: -1.2s; }
.chip-c { bottom: 30%; left: -30px; animation-delay: -2.4s; }
.chip-d { bottom: 9%; right: -22px; animation-delay: -3.6s; background: rgba(176, 54, 74, .92); }
@keyframes float { 50% { transform: translateY(-10px); } }

.hero-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); margin-top: clamp(48px, 7vw, 84px); overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm);
}
.hero-stats li { display: flex; flex-direction: column; gap: 6px; padding: 22px 24px; }
.hero-stats li + li { border-left: 1px solid var(--line); }
.hero-stats strong { font: 700 clamp(1.9rem, 1.3rem + 1.6vw, 2.75rem)/1 var(--font-display); letter-spacing: -.04em; color: var(--teal); font-variant-numeric: tabular-nums; }
.hero-stats span { font-size: 13px; line-height: 1.45; color: var(--muted); }

/* ---------- 8. Marquee ---------- */
.marquee {
  position: relative; overflow: hidden; border-block: 1px solid var(--line); background: var(--surface);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-track { display: flex; width: max-content; animation: marquee 48s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-list { display: flex; flex: none; }
.marquee-list li { display: flex; align-items: center; gap: 22px; padding: 17px 11px; font: 500 12px/1 var(--font-mono); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.marquee-list li::after { content: "✦"; font-size: 10px; color: var(--coral-vivid); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- 9. Sections ---------- */
.section { position: relative; padding: clamp(80px, 10vw, 136px) 0; }
.section-head { margin-bottom: clamp(36px, 5vw, 60px); }
.section-head.has-intro { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 24px 64px; align-items: end; }
.section-head.has-intro > p { max-width: 52ch; justify-self: end; font-size: 16px; color: var(--muted); }
.kicker { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 16px; font: 500 12px/1 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--coral); }
.kicker-num { display: inline-grid; place-items: center; min-width: 32px; height: 22px; padding: 0 8px; border: 1px solid color-mix(in srgb, var(--coral) 40%, transparent); border-radius: 999px; font-size: 11px; letter-spacing: .04em; }
.section h2 { max-width: 18ch; font: 700 clamp(2.2rem, 1.35rem + 3.3vw, 4rem)/1.02 var(--font-display); letter-spacing: -.045em; color: var(--ink); text-wrap: balance; }
.side-label { margin-bottom: 14px; font: 500 11px/1.2 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.side-title { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font: 700 16px/1.3 var(--font-display); color: var(--ink); }
.side-title .icon { width: 20px; height: 20px; color: var(--teal); }

/* ---------- 10. About ---------- */
.about-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: clamp(28px, 5vw, 64px); align-items: start; }
.about-copy p { max-width: 64ch; font-size: 17px; color: var(--muted); }
.about-copy p + p { margin-top: 18px; }
.about-copy .lede { font: 500 clamp(1.25rem, 1.05rem + .7vw, 1.6rem)/1.45 var(--font-display); letter-spacing: -.015em; color: var(--ink); }
.about-copy .lede strong { font-weight: 600; color: var(--teal); }
.about-copy strong { color: var(--ink); font-weight: 700; }
.facts { position: sticky; top: 104px; padding: 28px; }
.facts h3 { margin-bottom: 16px; font: 500 12px/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.facts dl { display: grid; margin-bottom: 22px; }
.facts dl > div { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.facts dt { font: 500 11px/1.6 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.facts dd { font-size: 14px; font-weight: 600; line-height: 1.5; color: var(--ink); }
.pillars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: clamp(36px, 5vw, 56px); }
.pillar { padding: 26px; }
.pillar-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 18px; border-radius: 13px; background: var(--icon-bg); color: var(--teal); }
.pillar-icon .icon { width: 22px; height: 22px; }
.pillar h3 { margin-bottom: 8px; font: 700 18px/1.25 var(--font-display); letter-spacing: -.02em; color: var(--ink); }
.pillar p { font-size: 14px; color: var(--muted); }

/* ---------- 11. Selected work ---------- */
.cases { display: grid; gap: 28px; }
.case { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow-sm); }
.case:nth-child(even) .case-visual { order: -1; }
.case-copy { display: flex; flex-direction: column; padding: clamp(28px, 4vw, 52px); }
.case-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 16px; font: 500 11px/1.4 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--coral); }
.case-index { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--coral-soft); color: var(--coral); }
.case-context { flex-basis: 100%; color: var(--muted); letter-spacing: .06em; }
.case h3 { margin-bottom: 16px; font: 700 clamp(1.6rem, 1.2rem + 1.4vw, 2.35rem)/1.1 var(--font-display); letter-spacing: -.035em; color: var(--ink); text-wrap: balance; }
.case-copy > p { font-size: 15.5px; color: var(--muted); }
.case-copy > p strong { color: var(--ink); }
.case-points { display: grid; gap: 9px; margin: 20px 0 4px; }
.case-points li { position: relative; padding-left: 26px; font-size: 14.5px; color: var(--ink-2); }
.case-points li::before { content: ""; position: absolute; left: 3px; top: .5em; width: 11px; height: 6px; border-left: 2px solid var(--teal); border-bottom: 2px solid var(--teal); transform: rotate(-45deg); }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 24px 0 22px; }
.metric { padding: 14px 14px 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.metric strong { display: block; font: 700 clamp(1.25rem, 1rem + .8vw, 1.6rem)/1.05 var(--font-display); letter-spacing: -.03em; color: var(--teal); white-space: nowrap; }
.metric span { display: block; margin-top: 6px; font: 500 10.5px/1.35 var(--font-mono); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.case-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }

/* Visual panels: always a dark "lab screen", in both themes */
.case-visual { position: relative; min-height: 460px; overflow: hidden; background: radial-gradient(120% 80% at 70% 10%, #0e2a24, #061310 60%); color: #dffbf5; }
.case-visual::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(98, 240, 219, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(98, 240, 219, .07) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 40%, transparent 85%); mask-image: radial-gradient(ellipse at 50% 40%, #000 40%, transparent 85%);
}
.viz-label { position: absolute; z-index: 5; left: 22px; top: 20px; max-width: calc(100% - 150px); font: 500 10px/1.5 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: rgba(223, 251, 245, .62); }
.viz-badge { position: absolute; z-index: 5; right: 20px; top: 15px; padding: 6px 9px; border-radius: 7px; background: #62f0db; color: #04201b; font: 500 10px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.viz-foot { position: absolute; z-index: 5; left: 22px; right: 22px; bottom: 18px; display: flex; flex-wrap: wrap; gap: 8px 18px; font: 500 10.5px/1.2 var(--font-mono); color: rgba(223, 251, 245, .75); }
.viz-foot span { display: inline-flex; align-items: center; gap: 7px; }
.viz-foot span::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #62f0db; }

.pipe { position: absolute; inset: 58px 20px 54px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.pipe-node { flex: none; display: grid; place-items: center; gap: 5px; width: 92px; padding: 16px 8px; border: 1px solid rgba(112, 241, 220, .3); border-radius: 16px; background: rgba(10, 36, 30, .92); text-align: center; box-shadow: 0 16px 36px rgba(0, 0, 0, .35); }
.pipe-node b { font: 600 11px/1.2 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: #e9fffa; }
.pipe-node small { font: 400 9.5px/1.3 var(--font-mono); color: rgba(223, 251, 245, .62); }
.pipe-core { width: 104px; border-color: #ff8065; box-shadow: 0 0 0 6px rgba(255, 128, 101, .08), 0 0 44px rgba(255, 128, 101, .22); }
.pipe-wire { position: relative; flex: 1 1 0; min-width: 16px; max-width: 46px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, #62f0db, #ff8065); }
.pipe-wire::after { content: ""; position: absolute; top: -3px; left: 0; width: 8px; height: 8px; border-radius: 50%; background: #fff; box-shadow: 0 0 12px #fff; animation: packet 1.6s linear infinite; }
@keyframes packet { to { left: calc(100% - 8px); } }
.pipe-targets { display: grid; gap: 7px; flex: none; }
.pipe-targets li { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 150px; padding: 8px 10px; border: 1px solid rgba(112, 241, 220, .22); border-radius: 10px; background: rgba(7, 22, 18, .88); font: 500 10px/1 var(--font-mono); animation: target-ok 3.2s ease-in-out infinite; }
.pipe-targets li:nth-child(2) { animation-delay: .4s; }
.pipe-targets li:nth-child(3) { animation-delay: .8s; }
.pipe-targets li:nth-child(4) { animation-delay: 1.2s; }
.pipe-targets b { font-weight: 500; color: #e9fffa; }
.pipe-targets span { color: #62f0db; }
.pipe-targets li:first-child span { color: rgba(223, 251, 245, .55); }
@keyframes target-ok { 0%, 70%, 100% { border-color: rgba(112, 241, 220, .22); } 80% { border-color: #62f0db; box-shadow: 0 0 18px rgba(98, 240, 219, .25); } }

.radar { position: absolute; left: 50%; top: 46%; width: min(330px, 72%); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; border: 1px solid rgba(98, 240, 219, .25); background: repeating-radial-gradient(circle, transparent 0 46px, rgba(98, 240, 219, .12) 47px 48px); }
.radar-sweep { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, transparent 0 75%, rgba(98, 240, 219, .28) 98%, transparent); animation: spin 4s linear infinite; }
.nav-stage { position: absolute; left: 50%; top: 46%; width: 320px; height: 240px; transform: translate(-50%, -50%); }
.nav-route { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.nav-route path { fill: none; stroke: rgba(142, 168, 255, .9); stroke-width: 2; stroke-dasharray: 6 6; animation: dash 1.2s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -12; } }
.robot {
  position: absolute; left: 0; top: 0; width: 26px; height: 20px; border-radius: 7px 7px 5px 5px; background: #ff8065;
  box-shadow: 0 0 0 7px rgba(255, 128, 101, .14), 0 0 30px rgba(255, 128, 101, .55);
  offset-path: path("M 30 200 C 90 190, 110 120, 170 112 S 255 66, 292 40"); offset-rotate: auto; animation: drive 7s ease-in-out infinite alternate;
}
@keyframes drive { from { offset-distance: 0%; } to { offset-distance: 100%; } }
@supports not (offset-path: path("M 0 0")) { .robot { left: 280px; top: 30px; } }
.node-stack { position: absolute; z-index: 4; right: 18px; bottom: 50px; display: grid; gap: 7px; }
.node-stack li { display: flex; align-items: baseline; gap: 10px; padding: 8px 11px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 11px; background: rgba(10, 30, 25, .9); font: 500 10px/1.2 var(--font-mono); color: rgba(223, 251, 245, .72); }
.node-stack b { min-width: 64px; font-weight: 500; letter-spacing: .06em; color: #e9fffa; }
.node-stack .is-core { border-color: #ff8065; box-shadow: 0 0 24px rgba(255, 128, 101, .2); }
.node-stack .is-core b { color: #ffb19f; }

.scene { position: absolute; inset: 66px 30px 54px; perspective: 600px; }
.scene-floor { position: absolute; left: 4%; right: 4%; bottom: 0; height: 72%; transform: rotateX(62deg); transform-origin: bottom; border: 1px solid rgba(98, 240, 219, .25); background-image: linear-gradient(rgba(98, 240, 219, .22) 1px, transparent 1px), linear-gradient(90deg, rgba(98, 240, 219, .22) 1px, transparent 1px); background-size: 30px 30px; }
.scene-wall { position: absolute; left: 12%; top: 6%; width: 52%; height: 52%; border: 1px solid rgba(142, 168, 255, .5); background: linear-gradient(135deg, rgba(142, 168, 255, .16), transparent 70%); }
.scene-box { position: absolute; border: 1.5px solid #f2bb5a; border-radius: 4px; box-shadow: 0 0 18px rgba(242, 187, 90, .25); animation: box-in 4s ease-in-out infinite; }
.box-a { left: 58%; top: 42%; width: 20%; height: 25%; }
.box-b { left: 20%; top: 52%; width: 16%; height: 30%; border-color: #ff8065; box-shadow: 0 0 18px rgba(255, 128, 101, .25); animation-delay: -2s; }
@keyframes box-in { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.scene-points {
  position: absolute; inset: 0; opacity: .9; background-image: radial-gradient(#62f0db 1.2px, transparent 1.6px); background-size: 18px 15px;
  -webkit-mask-image: linear-gradient(120deg, transparent 6%, #000 30%, #000 70%, transparent 92%); mask-image: linear-gradient(120deg, transparent 6%, #000 30%, #000 70%, transparent 92%);
  animation: scan 3.4s ease-in-out infinite alternate;
}
.scene-scan { position: absolute; top: 0; bottom: 0; left: 6%; width: 2px; background: linear-gradient(transparent, #62f0db, transparent); box-shadow: 0 0 18px #62f0db; animation: sweep 5s ease-in-out infinite; }
@keyframes scan { to { transform: translateX(10px); opacity: .55; } }
@keyframes sweep { 50% { left: 92%; } }

/* ---------- 12. Experience ---------- */
.exp-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: clamp(28px, 5vw, 64px); align-items: start; }
.timeline { position: relative; }
.timeline::before { content: ""; position: absolute; left: 11px; top: 10px; bottom: 10px; width: 2px; border-radius: 2px; opacity: .6; background: linear-gradient(var(--teal-vivid), var(--coral-vivid) 70%, transparent); }
.job { position: relative; padding: 0 0 44px 48px; }
.job:last-child { padding-bottom: 0; }
.job::before { content: ""; position: absolute; left: 4px; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 3px solid var(--teal); box-shadow: 0 0 0 6px color-mix(in srgb, var(--teal) 12%, transparent); }
.job:first-child::before { border-color: var(--coral-vivid); box-shadow: 0 0 0 6px var(--coral-soft); }
.job-date { margin-bottom: 8px; font: 500 11.5px/1.4 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--coral); }
.job h3 { font: 700 clamp(1.25rem, 1.1rem + .6vw, 1.55rem)/1.25 var(--font-display); letter-spacing: -.025em; color: var(--ink); }
.job-org { margin-top: 4px; font-size: 14.5px; font-weight: 700; color: var(--teal); }
.job-points { display: grid; gap: 8px; margin: 16px 0; }
.job-points li { position: relative; padding-left: 20px; font-size: 15px; color: var(--muted); }
.job-points li::before { content: ""; position: absolute; left: 3px; top: .68em; width: 7px; height: 7px; border-radius: 2px; background: var(--teal-vivid); transform: rotate(45deg); }
.exp-side { position: sticky; top: 104px; display: grid; gap: 18px; }
.side-card { padding: 24px; }
.side-note { margin-bottom: 16px; font-size: 13.5px; color: var(--muted); }
.programmes { display: grid; gap: 10px; }
.programme { padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.programme-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.programme-code { font: 500 10.5px/1 var(--font-mono); color: var(--muted); }
.status { padding: 4px 8px; border-radius: 999px; background: var(--hover); font: 500 10px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.status-active { background: var(--green-soft); color: var(--green); }
.programme-name { margin-top: 9px; font: 700 15px/1.3 var(--font-display); color: var(--ink); }
.programme-name span { color: var(--teal); }
.programme-meta { margin-top: 3px; font-size: 13px; color: var(--muted); }
.earlier { display: grid; gap: 12px; }
.earlier li { display: grid; gap: 2px; padding-top: 12px; border-top: 1px solid var(--line); }
.earlier li:first-child { padding-top: 0; border-top: 0; }
.earlier-date { font: 500 11px/1.4 var(--font-mono); color: var(--coral); }
.earlier strong { font-size: 14.5px; color: var(--ink); }
.earlier li > span:last-child { font-size: 13px; color: var(--muted); }

/* ---------- 13. Research & publications ---------- */
.research-overview { display: grid; grid-template-columns: minmax(220px, .7fr) minmax(0, 1.15fr) minmax(0, 1.15fr); gap: 16px; }
.big-stat { display: flex; flex-direction: column; justify-content: space-between; gap: 20px; padding: 28px; background: linear-gradient(150deg, var(--primary-soft), var(--surface)); }
.big-stat strong { font: 700 clamp(4.5rem, 3rem + 5vw, 7rem)/.8 var(--font-display); letter-spacing: -.07em; color: var(--teal); }
.big-stat span { font-size: 14.5px; font-weight: 600; color: var(--ink-2); }
.overview-card { padding: 24px; }
.profile-list { display: grid; gap: 8px; }
.profile-list a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); transition: border-color .2s, transform .2s; }
.profile-list a:hover { border-color: var(--teal); transform: translateX(3px); }
.profile-list a > .icon:first-child { width: 20px; height: 20px; color: var(--teal); }
.profile-list a > span { flex: 1; display: grid; line-height: 1.3; min-width: 0; }
.profile-list b { font-size: 13.5px; color: var(--ink); }
.profile-list small { font: 400 11px/1.3 var(--font-mono); color: var(--muted); overflow-wrap: anywhere; }
.papers-hint { margin: 30px 0 18px; font-size: 14.5px; color: var(--muted); }
.papers-hint em { font-style: normal; font-weight: 700; color: var(--ink); }

.papers { display: grid; gap: 22px; }
.paper { display: grid; grid-template-columns: clamp(150px, 18vw, 230px) minmax(0, 1fr); gap: clamp(22px, 3.6vw, 46px); padding: clamp(20px, 3vw, 36px); scroll-margin-top: 100px; }
.paper-cover {
  position: relative; display: block; align-self: start; overflow: hidden; border-radius: 10px; background: #fff;
  box-shadow: var(--shadow-cover); transform: rotate(-1.2deg); transition: transform .35s var(--ease), box-shadow .35s;
}
.paper-cover img { width: 100%; height: auto; }
.paper:hover .paper-cover, .paper-cover:focus-visible { transform: rotate(0) translateY(-4px); }
.cover-hint {
  position: absolute; left: 50%; bottom: 14px; display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 999px;
  background: rgba(7, 18, 15, .88); color: #fff; font: 700 12px/1 var(--font-body); white-space: nowrap;
  opacity: 0; transform: translate(-50%, 8px); transition: opacity .25s, transform .25s;
}
.cover-hint .icon { width: 15px; height: 15px; }
.paper-cover:hover .cover-hint, .paper-cover:focus-visible .cover-hint { opacity: 1; transform: translate(-50%, 0); }
.paper-body { min-width: 0; }
.paper-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.ptag { display: inline-flex; align-items: center; padding: 6px 11px; border-radius: 999px; background: var(--ptag-bg); font-size: 12px; font-weight: 700; line-height: 1.2; color: var(--ink-2); }
.ptag-accent { background: var(--amber-soft); color: var(--amber); }
.paper h3 { margin-bottom: 10px; font: 700 clamp(1.2rem, 1.02rem + .65vw, 1.6rem)/1.28 var(--font-serif); letter-spacing: -.012em; color: var(--ink); text-wrap: pretty; }
.paper h3 a { background-image: linear-gradient(currentColor, currentColor); background-repeat: no-repeat; background-position: 0 100%; background-size: 0 1px; transition: background-size .3s var(--ease); }
.paper h3 a:hover { background-size: 100% 1px; }
.paper-venue { margin-bottom: 4px; font-size: 14px; color: var(--muted); }
.paper-venue em { color: var(--ink-2); }
.paper-authors { margin-bottom: 14px; font-size: 14px; color: var(--muted); }
.paper-authors strong { font-weight: 800; color: var(--ink); }
.paper-abstract { font-size: 15px; line-height: 1.7; color: var(--ink-2); }
.js .paper-abstract {
  max-height: 6.8em; overflow: hidden; transition: max-height .45s var(--ease);
  -webkit-mask-image: linear-gradient(#000 40%, transparent); mask-image: linear-gradient(#000 40%, transparent);
}
.js .paper-abstract.is-open { max-height: var(--abstract-h, 60em); -webkit-mask-image: none; mask-image: none; }
.abstract-toggle { display: none; margin-top: 6px; padding: 4px 0; border: 0; background: none; font-size: 13.5px; font-weight: 800; color: var(--teal); cursor: pointer; }
.js .abstract-toggle { display: inline-flex; }
.abstract-toggle:hover { text-decoration: underline; text-underline-offset: 3px; }
.abstract-toggle .when-open, .abstract-toggle[aria-expanded="true"] .when-closed { display: none; }
.abstract-toggle[aria-expanded="true"] .when-open { display: inline; }
.keywords { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 20px; }
.keywords li { padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); font-size: 12.5px; color: var(--muted); }
.paper-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.paper-license { margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.paper-license a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 14. Open source ---------- */
.repo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.repo { position: relative; display: flex; flex-direction: column; padding: 24px; transition: transform .25s var(--ease), border-color .25s; }
.repo:hover { transform: translateY(-4px); border-color: var(--line-2); }
.repo-top { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; color: var(--muted); }
.repo-top .icon { width: 18px; height: 18px; color: var(--teal); }
.repo-kind { font: 500 11px/1.3 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }
.repo h3 { margin-bottom: 8px; padding-right: 30px; font: 700 17px/1.3 var(--font-display); letter-spacing: -.015em; color: var(--ink); overflow-wrap: anywhere; }
.stretched::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.repo p { flex: 1; margin-bottom: 16px; font-size: 14px; color: var(--muted); }
.repo-go { position: absolute; top: 22px; right: 22px; display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); transition: background-color .25s, color .25s, border-color .25s; }
.repo-go .icon { width: 15px; height: 15px; }
.repo:hover .repo-go { border-color: transparent; background: var(--primary); color: var(--on-primary); }
.more-link { margin-top: 28px; text-align: center; }
.link-arrow { display: inline-flex; align-items: center; gap: 9px; padding: 10px 4px; border-bottom: 2px solid var(--teal-vivid); font-weight: 800; color: var(--ink); }
.link-arrow .icon:last-child { transition: transform .25s var(--ease); }
.link-arrow:hover .icon:last-child { transform: translateX(4px); }

/* ---------- 15. Skills ---------- */
.skill-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.skill { padding: 24px; }
.skill h3 { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; font: 700 16.5px/1.3 var(--font-display); color: var(--ink); }
.skill-icon { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 11px; background: var(--icon-bg); color: var(--teal); }
.skill-icon .icon { width: 19px; height: 19px; }
.skills-bottom { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr); gap: 16px; margin-top: 16px; }
.toolbelt, .languages { padding: 24px; }
.logo-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px 10px; }
.logo-grid li { display: grid; justify-items: center; gap: 8px; text-align: center; }
.logo-tile { display: grid; place-items: center; width: 100%; aspect-ratio: 1.35; border: 1px solid rgba(15, 31, 27, .08); border-radius: 14px; background: #fff; box-shadow: 0 4px 14px rgba(15, 31, 27, .06); transition: transform .25s var(--ease); }
.logo-grid li:hover .logo-tile { transform: translateY(-3px); }
.logo-tile img { width: 64%; height: 56%; object-fit: contain; }
.tile-text { font: 700 17px/1 var(--font-display); letter-spacing: -.02em; color: #0b5d55; }
.logo-grid li > span:last-child { font: 500 10.5px/1.25 var(--font-mono); color: var(--muted); }
.lang-bars { display: grid; gap: 16px; }
.lang-bars li { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 7px 12px; font-size: 14px; font-weight: 600; color: var(--ink); }
.lang-bars b { font: 500 11.5px/1 var(--font-mono); color: var(--teal); }
.bar { position: relative; grid-column: 1 / -1; height: 6px; overflow: hidden; border-radius: 99px; background: var(--hover); }
.bar::after { content: ""; position: absolute; inset: 0; border-radius: inherit; transform-origin: 0 50%; transform: scaleX(var(--level)); background: linear-gradient(90deg, var(--teal-vivid), var(--amber-vivid)); transition: transform 1.1s var(--ease) .25s; }
.js .reveal:not(.is-visible) .bar::after { transform: scaleX(0); }

/* ---------- 16. Education ---------- */
.journey { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); margin-bottom: 30px; padding: 6px 0; }
.journey::before { content: ""; position: absolute; left: 10%; right: 10%; top: 14px; height: 2px; background: repeating-linear-gradient(90deg, var(--line-2) 0 6px, transparent 6px 12px); }
.journey li { position: relative; display: grid; justify-items: center; gap: 3px; text-align: center; }
.journey-dot { position: relative; z-index: 1; width: 18px; height: 18px; margin-bottom: 10px; border-radius: 50%; background: var(--bg); border: 3px solid var(--teal); }
.journey-dot.is-now { border-color: var(--coral-vivid); box-shadow: 0 0 0 6px var(--coral-soft); }
.journey b { display: inline-flex; align-items: center; gap: .45em; font: 700 15px/1.2 var(--font-display); letter-spacing: .04em; color: var(--ink); }
.journey li > span:last-child { font: 500 11px/1.3 var(--font-mono); color: var(--muted); }
.degree-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.degree { padding: 26px; }
.degree-date { margin-bottom: 10px; font: 500 11px/1.4 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--coral); }
.degree h3 { font: 700 clamp(1.1rem, 1rem + .4vw, 1.3rem)/1.3 var(--font-display); letter-spacing: -.02em; color: var(--ink); }
.degree-school { margin: 5px 0 12px; font-size: 14px; font-weight: 700; color: var(--teal); }
.degree p:last-child { font-size: 14.5px; color: var(--muted); }
.degree strong { color: var(--ink); }
.honours { margin-top: 16px; padding: 26px; }
.honour-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 36px; }
.honour-list li { display: grid; grid-template-columns: 52px 1fr; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.honour-year { font: 500 12px/1.6 var(--font-mono); color: var(--coral); }
.honour-list strong { color: var(--ink); }

/* ---------- 17. Engineering archive ---------- */
.archive-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; align-items: start; }
.arch { overflow: hidden; border-radius: 20px; transition: border-color .25s; }
.arch[open] { border-color: var(--line-2); }
.arch summary { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "type toggle" "title toggle"; align-items: center; gap: 4px 16px; padding: 20px 22px; list-style: none; cursor: pointer; border-radius: 20px; }
.arch summary::-webkit-details-marker { display: none; }
.arch-type { grid-area: type; font: 500 10.5px/1.3 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--coral); }
.arch-title { grid-area: title; font: 700 16.5px/1.3 var(--font-display); letter-spacing: -.015em; color: var(--ink); }
.arch-toggle { position: relative; grid-area: toggle; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 10px; transition: transform .3s var(--ease), background-color .3s, border-color .3s; }
.arch-toggle::before, .arch-toggle::after { content: ""; position: absolute; left: 50%; top: 50%; width: 12px; height: 2px; border-radius: 2px; background: var(--ink); transform: translate(-50%, -50%); transition: transform .3s var(--ease), background-color .3s; }
.arch-toggle::after { transform: translate(-50%, -50%) rotate(90deg); }
.arch summary:hover .arch-toggle { border-color: var(--line-2); }
.arch[open] .arch-toggle { border-color: transparent; background: var(--primary); transform: rotate(180deg); }
.arch[open] .arch-toggle::before, .arch[open] .arch-toggle::after { background: var(--on-primary); }
.arch[open] .arch-toggle::after { transform: translate(-50%, -50%) rotate(0); }
.arch-body { padding: 0 22px 22px; }
.arch-body p { margin-bottom: 14px; font-size: 14.5px; color: var(--muted); }
.arch-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* ---------- 18. Contact ---------- */
.contact { padding-bottom: clamp(56px, 7vw, 88px); }
.contact-card {
  position: relative; isolation: isolate; overflow: hidden; padding: clamp(36px, 6vw, 76px); border-radius: var(--radius-xl);
  background: linear-gradient(125deg, #c8432c, #b0364a 52%, #8f2f57); color: #fff; box-shadow: 0 34px 90px rgba(176, 54, 74, .28);
}
.contact-card::before { content: ""; position: absolute; z-index: -1; width: 520px; height: 520px; right: -170px; top: -230px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 43% 57% 52% 48%; box-shadow: 0 0 0 56px rgba(255, 255, 255, .035), 0 0 0 112px rgba(255, 255, 255, .025); animation: spin 40s linear infinite; }
.contact-card::after { content: ""; position: absolute; z-index: -1; inset: 0; background: radial-gradient(640px circle at 0% 100%, rgba(98, 240, 219, .16), transparent 60%); }
.kicker-light { color: rgba(255, 255, 255, .85); }
.kicker-light .kicker-num { border-color: rgba(255, 255, 255, .45); }
.contact-card h2 { max-width: 18ch; font-size: clamp(2.3rem, 1.4rem + 3.6vw, 4.4rem); color: #fff; }
.contact-text { max-width: 60ch; margin: 22px 0 32px; font-size: 17px; color: rgba(255, 255, 255, .92); }
.contact-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-light { --btn-bg: #fff; --btn-ink: #9c2f45; --btn-line: transparent; box-shadow: 0 12px 28px rgba(60, 10, 20, .25); }
.btn-glass { --btn-bg: rgba(255, 255, 255, .12); --btn-ink: #fff; --btn-line: rgba(255, 255, 255, .32); }
.btn-glass:hover { --btn-bg: rgba(255, 255, 255, .2); }
.copy-btn .icon-done, .copy-btn .copy-done { display: none; }
.copy-btn.is-copied .icon-done { display: block; }
.copy-btn.is-copied .copy-done { display: inline; }
.copy-btn.is-copied .icon-copy, .copy-btn.is-copied .copy-label { display: none; }
.contact-meta { display: flex; flex-wrap: wrap; gap: 12px 28px; margin-top: 40px; padding-top: 22px; border-top: 1px solid rgba(255, 255, 255, .24); font: 500 12px/1.4 var(--font-mono); color: rgba(255, 255, 255, .9); }
.contact-meta li { display: inline-flex; align-items: center; gap: 8px; }
.contact-meta .icon { width: 15px; height: 15px; }

/* ---------- 19. Footer ---------- */
.site-footer { padding: 28px 0 40px; border-top: 1px solid var(--line); }
.footer-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 20px 32px; }
.footer-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 18px; }
.footer-nav a { font-size: 13.5px; font-weight: 700; color: var(--muted); transition: color .2s; }
.footer-nav a:hover { color: var(--ink); }
.footer-meta { justify-self: end; }
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-brand .brand-mark { width: 34px; height: 34px; border-radius: 11px; font-size: 12px; }
.footer-brand p { display: grid; font-size: 13px; line-height: 1.45; color: var(--muted); }
.footer-brand p > span:first-child { font-weight: 700; color: var(--ink); }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px; }
.footer-links a { padding: 7px 11px; border: 1px solid var(--line); border-radius: 9px; font: 500 11.5px/1 var(--font-mono); color: var(--muted); transition: color .2s, border-color .2s; }
.footer-links a:hover { color: var(--ink); border-color: var(--line-2); }
.footer-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: 12.5px; color: var(--muted); }
.to-top { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--ink); }
.to-top .icon { width: 15px; height: 15px; }

/* ---------- 20. PDF viewer ---------- */
.viewer {
  width: min(1100px, 100% - 32px); height: min(92vh, 1000px); max-width: none; max-height: none; padding: 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: 20px; background: var(--surface-2); color: var(--ink); box-shadow: 0 40px 120px rgba(0, 0, 0, .45);
}
.viewer[open] { display: flex; flex-direction: column; animation: viewer-in .3s var(--ease); }
.viewer:focus { outline: none; }
@keyframes viewer-in { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.viewer::backdrop { background: rgba(4, 12, 10, .72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 10px 10px 20px; border-bottom: 1px solid var(--line); }
.viewer-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 700 15px/1.3 var(--font-display); color: var(--ink); }
.viewer-actions { display: flex; flex: none; align-items: center; gap: 8px; }
.viewer-frame { flex: 1; width: 100%; border: 0; background: #525659; }
html:has(.viewer[open]) { overflow: hidden; }

/* ---------- 20b. Tabs as views ----------
   One view at a time, chosen by the URL fragment: #research, or any element inside it, opens that tab;
   no fragment opens Home. Pure CSS, so links, back/forward and bookmarks work even before the JS runs.
   Browsers without :has() simply show every view one after the other. */
@supports selector(:has(*)) {
  .js .view:not(:target, :has(:target)) { display: none; }
  .js:not(:has(.view:target, .view :target)) .view-home { display: block; }
}
.view:not(.view-home) { background-color: var(--bg); }
:root[data-view]:not([data-view="home"]) .backdrop { display: none; } /* the ambient glow belongs to Home */
.view.is-entering { animation: view-in .45s var(--ease) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(14px); } }

.view-head { padding: calc(var(--nav-h) + 12px + clamp(52px, 8vw, 104px)) 0 clamp(20px, 3vw, 36px); }
.view-title { max-width: 17ch; font: 700 clamp(2.6rem, 1.3rem + 4.8vw, 5.4rem)/.98 var(--font-display); letter-spacing: -.055em; color: var(--ink); text-wrap: balance; }
.view-intro { max-width: 62ch; margin-top: 24px; font-size: clamp(1.02rem, .95rem + .35vw, 1.2rem); color: var(--muted); }
.view-head + .section { padding-top: clamp(40px, 6vw, 72px); }
.view.section { padding-top: calc(var(--nav-h) + 12px + clamp(52px, 8vw, 104px)); }

/* Animated change of tab (View Transitions); the header and the tab pill stay put */
.site-header { view-transition-name: site-header; }
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) { animation: vt-out .24s var(--ease) both; }
  ::view-transition-new(root) { animation: vt-in .46s var(--ease) both; }
  :root[data-vt="back"]::view-transition-old(root) { animation-name: vt-out-back; }
  :root[data-vt="back"]::view-transition-new(root) { animation-name: vt-in-back; }
  ::view-transition-group(tabs-indicator) { animation-duration: .45s; animation-timing-function: var(--ease); }
}
@keyframes vt-out { to { opacity: 0; transform: translateX(-28px); } }
@keyframes vt-in { from { opacity: 0; transform: translateX(36px); } }
@keyframes vt-out-back { to { opacity: 0; transform: translateX(28px); } }
@keyframes vt-in-back { from { opacity: 0; transform: translateX(-36px); } }

/* ---------- 20c. Home: one card per tab, and a call to action ---------- */
.explore-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.explore-grid > li { display: flex; }
.explore-card {
  position: relative; display: flex; flex-direction: column; width: 100%; overflow: hidden; padding: 0 24px 26px;
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--bg); color: var(--ink-2); box-shadow: var(--shadow-sm);
  transition: transform .35s var(--ease), box-shadow .35s;
}
.explore-card:hover { transform: translateY(-6px); box-shadow: 0 26px 60px rgba(15, 31, 27, .16); }
.explore-art { position: relative; display: block; height: 184px; margin: 0 -24px 22px; overflow: hidden; border-bottom: 1px solid var(--line); }
.explore-label { display: inline-flex; align-items: center; gap: 8px; font: 500 11px/1.2 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--coral); }
.explore-label .icon { width: 15px; height: 15px; transition: transform .3s var(--ease); }
.explore-card:hover .explore-label .icon { transform: translateX(4px); }
.explore-card strong { margin: 12px 0 8px; font: 700 clamp(1.25rem, 1.05rem + .6vw, 1.55rem)/1.2 var(--font-display); letter-spacing: -.02em; color: var(--ink); }
.explore-card.p-research strong { font-family: var(--font-serif); font-weight: 600; letter-spacing: -.012em; }
.explore-text { font-size: 14.5px; color: var(--muted); }

.art-covers { background: var(--grain), var(--bg-2); }
.art-covers img {
  position: absolute; left: 50%; bottom: -34px; width: 96px; border-radius: 2px 4px 4px 2px;
  box-shadow: 0 12px 26px rgba(30, 20, 5, .32); transform-origin: 50% 130%; transition: transform .5s var(--ease);
}
.art-covers img:nth-child(1) { transform: translateX(-50%) rotate(-26deg); }
.art-covers img:nth-child(2) { transform: translateX(-50%) rotate(-13deg); }
.art-covers img:nth-child(3) { transform: translateX(-50%) rotate(0deg); z-index: 1; }
.art-covers img:nth-child(4) { transform: translateX(-50%) rotate(13deg); }
.art-covers img:nth-child(5) { transform: translateX(-50%) rotate(26deg); }
.explore-card:hover .art-covers img:nth-child(1) { transform: translateX(-50%) rotate(-34deg); }
.explore-card:hover .art-covers img:nth-child(2) { transform: translateX(-50%) rotate(-17deg); }
.explore-card:hover .art-covers img:nth-child(3) { transform: translateX(-50%) translateY(-8px); }
.explore-card:hover .art-covers img:nth-child(4) { transform: translateX(-50%) rotate(17deg); }
.explore-card:hover .art-covers img:nth-child(5) { transform: translateX(-50%) rotate(34deg); }

.art-blueprint {
  display: flex; align-items: center; justify-content: center;
  background-color: var(--bg-2);
  background-image: linear-gradient(color-mix(in srgb, var(--teal) 16%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--teal) 16%, transparent) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 92px 92px, 92px 92px, 23px 23px, 23px 23px;
}
.bp-node { display: grid; place-items: center; width: 52px; height: 52px; border: 1.5px solid var(--teal); border-radius: 4px; background: var(--surface-2); color: var(--teal); }
.bp-node .icon { width: 24px; height: 24px; }
.bp-core { width: 66px; height: 66px; border-color: var(--coral); color: var(--coral); box-shadow: 0 0 0 6px var(--coral-soft); }
.bp-wire { position: relative; width: 46px; height: 1.5px; background: var(--teal); }
.bp-wire::after { content: ""; position: absolute; top: -3px; left: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--coral-vivid); animation: packet 1.6s linear infinite; }

.art-route { background: var(--topo) center / 520px, var(--bg-2); }
.rt-line { position: absolute; left: 12%; right: 12%; top: 52%; height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--teal-vivid), var(--coral-vivid)); transform: translateY(-50%); }
.art-route i { position: absolute; top: 52%; width: 15px; height: 15px; border: 3px solid var(--teal-vivid); border-radius: 50%; background: var(--surface-2); transform: translate(-50%, -50%); }
.art-route .flag {
  position: absolute; left: 50%; bottom: calc(100% + 14px); width: 27px; height: 18px; max-width: none;
  box-shadow: 0 0 0 1px var(--line-2), 0 4px 10px rgba(20, 40, 25, .18); transform: translateX(-50%); transition: transform .45s var(--ease) var(--d, 0s);
}
.explore-card:hover .art-route .flag { transform: translate(-50%, -5px); }
.art-route b { position: absolute; left: 50%; top: calc(100% + 14px); font: 600 11px/1 var(--font-mono); letter-spacing: .12em; color: var(--ink-2); transform: translateX(-50%); }
.art-route .is-now b { color: var(--coral); }
.art-route i:nth-of-type(1) { left: 12%; }
.art-route i:nth-of-type(2) { left: 31%; --d: .04s; }
.art-route i:nth-of-type(3) { left: 50%; --d: .08s; }
.art-route i:nth-of-type(4) { left: 69%; --d: .12s; }
.art-route i:nth-of-type(5) { left: 88%; --d: .16s; border-color: var(--coral-vivid); box-shadow: 0 0 0 6px var(--coral-soft); }

.home-cta { padding-top: 0; }
.cta-band {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px 48px; padding: clamp(28px, 4.5vw, 56px);
  border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow-sm);
  background: radial-gradient(600px circle at 100% 0%, color-mix(in srgb, var(--coral-vivid) 12%, transparent), transparent 60%), linear-gradient(135deg, color-mix(in srgb, var(--teal-vivid) 12%, var(--surface-2)), var(--surface));
}
.cta-band h2 { max-width: 20ch; font-size: clamp(1.7rem, 1.1rem + 2vw, 2.8rem); }
.cta-band p { max-width: 56ch; margin-top: 12px; color: var(--muted); }
.cta-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- 20d. Research: the library ---------- */
.view-research { background-image: var(--grain); }
.view-research .section-head { margin-bottom: clamp(40px, 6vw, 72px); }
.view-research .section-head h2 { max-width: 15ch; font: 600 clamp(2.7rem, 1.3rem + 5.2vw, 5.6rem)/1 var(--font-serif); letter-spacing: -.03em; }
.view-research .section-head.has-intro > p { font: 400 clamp(1.05rem, 1rem + .3vw, 1.25rem)/1.6 var(--font-serif); color: var(--ink-2); }
.view-research .kicker { gap: 12px; }
.view-research .kicker::before { content: ""; width: 34px; height: 1.5px; background: currentColor; }
.view-research .research-overview { padding-top: 26px; border-top: 3px double var(--line-2); }
.view-research .big-stat { background: var(--surface); }
.view-research .big-stat strong { font-family: var(--font-serif); font-weight: 600; letter-spacing: -.04em; }
.view-research .tags li, .view-research .ptag, .view-research .keywords li { border-radius: 3px; }
.view-research .papers-hint { margin: 44px 0 6px; font: italic 400 17px/1.6 var(--font-serif); }
.view-research .papers-hint em { font-style: normal; font-weight: 600; }
.view-research .papers { gap: 0; }
.view-research .paper.card { padding: clamp(28px, 4vw, 52px) 0; border: 0; border-top: 1px solid var(--line-2); border-radius: 0; background: none; box-shadow: none; }
.view-research .paper:last-child { border-bottom: 1px solid var(--line-2); }
.view-research .paper-cover { border-radius: 2px 5px 5px 2px; box-shadow: 0 1px 2px rgba(30, 20, 5, .14), 0 28px 46px -16px rgba(30, 20, 5, .55); }
.view-research .paper-cover::before { content: ""; position: absolute; z-index: 1; inset: 0 auto 0 0; width: 12px; pointer-events: none; background: linear-gradient(90deg, rgba(0, 0, 0, .3), rgba(255, 255, 255, .14) 45%, transparent); }
.view-research .cover-hint { z-index: 2; }
.view-research .paper h3 { font-size: clamp(1.35rem, 1.1rem + .85vw, 1.95rem); font-weight: 600; }
.view-research .paper-abstract { font: 400 16.5px/1.7 var(--font-serif); }
.view-research .keywords li { background: transparent; font: 400 14px/1.3 var(--font-serif); }

/* ---------- 20e. Engineering: the blueprint ---------- */
.view-engineering {
  --major: color-mix(in srgb, var(--teal) 11%, transparent);
  background-image: linear-gradient(var(--major) 1px, transparent 1px), linear-gradient(90deg, var(--major) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
}
.view-engineering .kicker-num, .view-engineering .case-index { border-radius: 3px; }
.view-engineering .view-title { position: relative; padding-bottom: 30px; }
.view-engineering .view-title::after {
  content: ""; position: absolute; left: 0; bottom: 0; width: min(100%, 520px); height: 12px; opacity: .8;
  border-inline: 1.5px solid var(--teal); background: linear-gradient(var(--teal), var(--teal)) center / 100% 1.5px no-repeat;
}
.spec-strip { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: clamp(32px, 4vw, 48px); border: 1.5px solid var(--line-2); border-radius: 4px; background: var(--surface); }
.spec-strip li { display: grid; align-content: start; gap: 6px; padding: 16px 18px; }
.spec-strip li + li { border-left: 1.5px solid var(--line-2); }
.spec-strip b { font: 500 clamp(1.8rem, 1.3rem + 1.5vw, 2.6rem)/1 var(--font-mono); letter-spacing: -.03em; color: var(--teal); }
.spec-strip span { font: 500 11px/1.4 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
/* square corners with registration ticks, as on a drawing sheet */
.view-engineering :is(.card, .case) {
  --tk: color-mix(in srgb, var(--teal) 80%, transparent);
  border-color: var(--line-2); box-shadow: none;
  background:
    linear-gradient(var(--tk), var(--tk)) left top / 14px 1.5px no-repeat, linear-gradient(var(--tk), var(--tk)) left top / 1.5px 14px no-repeat,
    linear-gradient(var(--tk), var(--tk)) right top / 14px 1.5px no-repeat, linear-gradient(var(--tk), var(--tk)) right top / 1.5px 14px no-repeat,
    linear-gradient(var(--tk), var(--tk)) left bottom / 14px 1.5px no-repeat, linear-gradient(var(--tk), var(--tk)) left bottom / 1.5px 14px no-repeat,
    linear-gradient(var(--tk), var(--tk)) right bottom / 14px 1.5px no-repeat, linear-gradient(var(--tk), var(--tk)) right bottom / 1.5px 14px no-repeat,
    var(--surface);
}
.view-engineering :is(.metric, .logo-tile, .repo-go, .arch-toggle, .chips li, .tags li, .link-pill, .btn) { border-radius: 4px; }
.view-engineering .arch, .view-engineering .arch summary { border-radius: 4px; }
.view-engineering .chips li { font: 500 12px/1.35 var(--font-mono); }
.view-engineering .case-visual { background: radial-gradient(120% 80% at 70% 10%, #10294a, #06111f 60%); }
.view-engineering .case-visual::before { background-image: linear-gradient(rgba(108, 199, 255, .08) 1px, transparent 1px), linear-gradient(90deg, rgba(108, 199, 255, .08) 1px, transparent 1px); }
.view-engineering .skills-bottom { grid-template-columns: 1fr; }
.view-engineering .logo-grid { grid-template-columns: repeat(12, 1fr); }

/* ---------- 20f. Background: the journey map ---------- */
.view-background { background-image: var(--topo); background-size: 720px; }
.view-background .journey { margin-top: clamp(40px, 5vw, 64px); padding: 30px 8px 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.view-background .journey::before { left: 10%; right: 10%; top: 41px; height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--teal-vivid), var(--coral-vivid)); }
.view-background .journey-dot { width: 26px; height: 26px; border: 4px solid var(--teal-vivid); background: var(--surface-2); box-shadow: 0 4px 10px rgba(20, 40, 25, .15); }
.view-background .journey-dot.is-now { border-color: var(--coral-vivid); box-shadow: 0 0 0 7px var(--coral-soft); }
.view-background .journey-dot.is-now::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 2px solid var(--coral-vivid); opacity: .6; animation: ping 2.2s var(--ease) infinite; }
.view-background .journey b { font-size: clamp(1rem, .9rem + .5vw, 1.3rem); }
.view-background .timeline::before { left: 11px; width: 3px; opacity: .85; background: repeating-linear-gradient(var(--coral-vivid) 0 9px, transparent 9px 16px); }
.view-background .job::before {
  left: 3px; top: 2px; width: 19px; height: 19px; border: 3px solid var(--bg); border-radius: 50% 50% 50% 0;
  background: var(--teal-vivid); box-shadow: 0 0 0 2px var(--teal-vivid); transform: rotate(-45deg);
}
.view-background .job:first-child::before { background: var(--coral-vivid); box-shadow: 0 0 0 2px var(--coral-vivid), 0 0 0 9px var(--coral-soft); }
.view-background .degree { border-top: 3px solid var(--teal-vivid); }
.view-background .degree:first-child { border-top-color: var(--coral-vivid); }
.edu-bottom { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, .5fr); gap: 16px; margin-top: 16px; align-items: start; }
.edu-bottom .honours { margin-top: 0; }
.edu-bottom .honour-list { grid-template-columns: 1fr; }

/* ---------- 20g. Contact: let's talk ---------- */
.view-contact.section {
  min-height: 100svh; display: flex; align-items: center; overflow: clip; padding-bottom: clamp(56px, 8vw, 96px);
  background-image: radial-gradient(900px circle at 88% 0%, rgba(255, 196, 140, .22), transparent 60%), radial-gradient(700px circle at 0% 100%, rgba(98, 240, 219, .14), transparent 60%),
    linear-gradient(to bottom, transparent 78%, var(--bg)), linear-gradient(125deg, #a8341f, #a02f45 45%, #7d2850 75%, #4f2463);
}
@supports (color: light-dark(#000, #fff)) {
  .view-contact.section {
    background-image: radial-gradient(900px circle at 88% 0%, rgba(255, 196, 140, .22), transparent 60%), radial-gradient(700px circle at 0% 100%, rgba(98, 240, 219, .14), transparent 60%),
      linear-gradient(to bottom, transparent 78%, var(--bg)),
      linear-gradient(125deg, light-dark(#a8341f, #7c2616), light-dark(#a02f45, #73203a) 45%, light-dark(#7d2850, #591c40) 75%, light-dark(#4f2463, #33173f));
  }
}
.view-contact > .wrap { position: relative; }
.view-contact .contact-card { padding: 0; overflow: visible; border-radius: 0; background: none; box-shadow: none; }
.view-contact .contact-card::before { right: -40px; top: -200px; }
.view-contact .contact-card::after { display: none; }
.view-contact .contact-card h2 { max-width: 16ch; font-size: clamp(2.6rem, 1.4rem + 4.6vw, 5.6rem); line-height: 1; }
.contact-profiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 28px; }
.contact-profiles a {
  display: flex; align-items: center; gap: 12px; height: 100%; padding: 15px 16px; border: 1px solid rgba(255, 255, 255, .26); border-radius: 16px;
  background: rgba(255, 255, 255, .08); color: #fff; transition: background-color .2s, transform .2s var(--ease);
}
.contact-profiles a:hover { background: rgba(255, 255, 255, .16); transform: translateY(-2px); }
.contact-profiles a > .icon:first-child { width: 22px; height: 22px; }
.contact-profiles span { display: grid; flex: 1; min-width: 0; line-height: 1.3; }
.contact-profiles b { font-size: 14px; }
.contact-profiles small { font: 400 11px/1.35 var(--font-mono); opacity: .88; overflow-wrap: anywhere; }

/* ---------- 21. Scroll reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s var(--ease), transform .7s var(--ease); transition-delay: calc(var(--stagger, 0) * 70ms); }
.js .reveal.is-visible { opacity: 1; transform: none; }

/* ---------- 22. Responsive ---------- */
@media (max-width: 1120px) {
  .brand-text { display: none; }
  .tabs a { padding: 8px 12px; }
  .view-engineering .logo-grid { grid-template-columns: repeat(6, 1fr); }
  .contact-profiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pillars { grid-template-columns: repeat(2, 1fr); }
  .research-overview { grid-template-columns: repeat(2, 1fr); }
  .big-stat { grid-column: 1 / -1; flex-direction: row; align-items: center; }
  .big-stat span { max-width: 36ch; }
}

@media (max-width: 980px) {
  .hero { min-height: 0; padding-top: calc(var(--nav-h) + 64px); }
  .hero-grid { grid-template-columns: 1fr; gap: 64px; }
  .hero-visual { order: -1; }
  .portrait-stage { width: min(380px, 78vw); }
  .chip-d { display: none; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .hero-stats li:nth-child(3) { border-left: 0; }
  .hero-stats li:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .section-head.has-intro { grid-template-columns: 1fr; }
  .section-head.has-intro > p { justify-self: start; }
  .about-grid, .exp-layout { grid-template-columns: 1fr; }
  .facts, .exp-side { position: static; }
  .exp-side { grid-template-columns: repeat(2, 1fr); align-items: start; }
  .case { grid-template-columns: 1fr; }
  .case:nth-child(even) .case-visual { order: 0; }
  .case-visual { min-height: 380px; }
  .repo-grid, .skill-grid { grid-template-columns: repeat(2, 1fr); }
  .skills-bottom { grid-template-columns: 1fr; }
  .honour-list { grid-template-columns: 1fr; }
  .edu-bottom { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; justify-items: start; }
  .footer-nav { justify-content: flex-start; }
  .footer-meta { justify-self: start; }
}

@media (max-width: 860px) {
  .tabs { display: none; }
  .brand-text { display: flex; }
  .tabbar {
    position: fixed; z-index: 110; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 5px; border: 1px solid var(--line); border-radius: 22px; background: color-mix(in srgb, var(--bg) 88%, transparent);
    -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%); box-shadow: var(--shadow-nav);
    view-transition-name: tabbar;
  }
  .tabbar a { display: grid; justify-items: center; gap: 2px; min-width: 0; padding: 6px 2px 5px; border-radius: 17px; font: 700 10.5px/1.15 var(--font-body); color: var(--muted); transition: color .25s; }
  .tabbar a > span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar .icon { width: 46px; height: 28px; padding: 4px 13px; border-radius: 999px; transition: background-color .3s, color .3s; }
  .tabbar a.is-active { color: var(--ink); }
  .tabbar a.is-active .icon { background: var(--primary); color: var(--on-primary); }
  body { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .explore-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  :root { --nav-h: 60px; }
  .site-header { top: 8px; }
  .nav-shell { width: calc(100% - 16px); padding: 0 8px 0 10px; gap: 10px; border-radius: 18px; }
  .brand-text { display: none; }
  .icon-btn, .lang-toggle { height: 38px; }
  .icon-btn { width: 38px; }
  .lang-opt { width: 30px; }
  .hero { padding-top: calc(var(--nav-h) + 40px); }
  .hero-grid { gap: 44px; }
  .portrait-stage { width: min(300px, 74vw); }
  .hero-actions .btn { flex: 1 1 auto; }
  .chip-a { left: -14px; }
  .chip-b { right: -14px; }
  .chip-c { left: -12px; }
  .float-chip { padding: 8px 10px; font-size: 10px; }
  .portrait figcaption { left: 22px; right: 22px; bottom: 20px; }
  .portrait figcaption strong { font-size: 14px; }
  .pillars, .repo-grid, .skill-grid, .degree-grid, .archive-grid, .exp-side { grid-template-columns: 1fr; }
  .research-overview { grid-template-columns: 1fr; }
  .big-stat { flex-direction: column; align-items: flex-start; }
  .paper { grid-template-columns: 1fr; }
  .paper-cover { width: min(210px, 62%); }
  .metrics { grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); }
  .case-copy { padding: 26px 22px 30px; }
  .case-visual { min-height: 340px; }
  .pipe { gap: 5px; inset: 56px 12px 52px; }
  .pipe-node { width: 70px; padding: 12px 4px; }
  .pipe-node b { font-size: 9.5px; }
  .pipe-core { width: 78px; }
  .pipe-targets li { min-width: 0; gap: 6px; padding: 7px 8px; font-size: 9px; }
  .pipe-targets span { display: none; }
  .viz-radar { min-height: 450px; }
  .radar { top: 37%; }
  .nav-stage { top: 37%; transform: translate(-50%, -50%) scale(.82); }
  .node-stack { left: 14px; right: 14px; bottom: 46px; }
  .logo-grid { grid-template-columns: repeat(4, 1fr); }
  .journey { grid-template-columns: 1fr; gap: 14px; padding-left: 4px; }
  .journey::before { left: 12px; right: auto; top: 8px; bottom: 8px; width: 2px; height: auto; background: repeating-linear-gradient(180deg, var(--line-2) 0 6px, transparent 6px 12px); }
  .journey li { grid-template-columns: 26px 4em 1fr; justify-items: start; align-items: center; gap: 10px; text-align: left; }
  .journey-dot { margin: 0; justify-self: center; }
  .view-background .journey { padding: 18px 14px; }
  .view-background .journey::before { left: 25px; right: auto; top: 31px; bottom: 31px; width: 4px; height: auto; background: linear-gradient(var(--teal-vivid), var(--coral-vivid)); }
  .view-engineering .logo-grid { grid-template-columns: repeat(4, 1fr); }
  .spec-strip { grid-template-columns: repeat(2, 1fr); }
  .spec-strip li:nth-child(3) { border-left: 0; }
  .spec-strip li:nth-child(n + 3) { border-top: 1.5px solid var(--line-2); }
  .cta-actions .btn { flex: 1 1 auto; }
  .facts dl > div { grid-template-columns: 1fr; gap: 2px; }
  .viewer { width: 100%; height: 100%; max-height: 100dvh; border-radius: 0; }
}

@media (max-width: 420px) {
  .hero-stats li { padding: 18px 16px; }
  .hero-stats span { font-size: 12.5px; }
  .logo-grid, .view-engineering .logo-grid { grid-template-columns: repeat(3, 1fr); }
  .paper-actions .btn { flex: 1 1 auto; }
  .tabbar a { font-size: 9.5px; }
}

/* ---------- 23. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; transition-delay: 0s !important; }
  .js .reveal { opacity: 1; transform: none; }
  .marquee { -webkit-mask-image: none; mask-image: none; }
  .marquee-track { width: 100%; animation: none; }
  .marquee-list { flex: 1 1 100%; flex-wrap: wrap; justify-content: center; padding: 8px 12px; }
  .marquee-list li { padding: 8px 11px; }
  .marquee-list[aria-hidden="true"] { display: none; }
  .portrait { transform: none !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* ---------- 24. Print ---------- */
@media print {
  .site-header, .scroll-progress, .backdrop, .marquee, .case-visual, .hero-visual, .contact-actions, .viewer,
  .abstract-toggle, .repo-go, .arch-toggle, .skip-link, .paper-cover, .more-link,
  .tabbar, .footer-nav, .explore, .home-cta, .contact-profiles { display: none !important; }
  .js .view { display: block !important; }
  .view, .view.section { min-height: 0; padding-top: 24px; background: none !important; }
  .view-head { padding: 24px 0 0; }
  body { background: #fff; color: #111; padding-bottom: 0; }
  .js .reveal { opacity: 1 !important; transform: none !important; }
  .hero { min-height: 0; padding: 0 0 24px; }
  .section { padding: 24px 0; }
  .case, .paper, .job, .degree, .repo, .arch, .skill, .pillar { break-inside: avoid; }
  .case, .paper { grid-template-columns: 1fr; }
  .js .paper-abstract { max-height: none; -webkit-mask-image: none; mask-image: none; }
  .card, .case { box-shadow: none; }
  .contact-card { background: none; color: #111; box-shadow: none; border: 1px solid #ccc; }
  .contact-card h2, .contact-text, .contact-meta, .kicker-light { color: #111; }
  .view-contact { --ink: #111; --ink-2: #333; --muted: #555; --line: #ccc; color: #111; }
}
