/* ============================================================
   Andrea Signoretti — Portfolio · "Blue Navigation"
   Tokens → base → nav + voyage → hero → sections → compass
   → footer → reveals → responsive
   ============================================================ */

:root{
  --mist:    #F2F7F9;  /* page background, pale blue paper */
  --ink:     #0C2233;  /* primary text, deep navy */
  --ocean:   #1F6E8C;  /* primary accent */
  --shallow: #7FB6C6;  /* secondary accent */
  --wave1:   #DCEBF0;
  --wave2:   #C9E0E8;
  --foam:    #EAF3F6;  /* empty media frames */
  --faded:   #52707D;  /* secondary text (AA on --mist) */
  --hair:    rgba(12,34,51,.22);
  --white:   #FFFFFF;

  /* content column shared by the hero, the sections and the footer */
  --page-max: 1280px;
  --gutter:   clamp(1.25rem,5vw,4rem);
}

*{margin:0;padding:0;box-sizing:border-box}
html{scroll-behavior:smooth;scroll-padding-top:5rem}
body{
  background:var(--mist);color:var(--ink);
  font-family:'Figtree',system-ui,-apple-system,sans-serif;
  font-weight:300;line-height:1.65;-webkit-font-smoothing:antialiased;
  overflow-x:hidden;
}
::selection{background:var(--wave2)}
img{max-width:100%;display:block}

.serif{font-family:'Instrument Serif',Georgia,serif;font-weight:400}
.mono{font-family:'Space Mono',ui-monospace,monospace}
em{font-style:italic}

a{color:var(--ocean);text-decoration:none}

/* Focus + skip link + reduced motion ------------------------ */
a:focus-visible,button:focus-visible,summary:focus-visible{
  outline:2px solid var(--ocean);outline-offset:3px;border-radius:2px;
}
.skip-link{
  position:absolute;left:-999px;top:0;z-index:100;
  background:var(--ink);color:var(--mist);padding:.7rem 1.1rem;
  font-family:'Space Mono',monospace;font-size:.72rem;
}
.skip-link:focus{left:.6rem;top:.6rem}

@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  *,*::before,*::after{animation:none!important;transition:none!important}
  .js .reveal{opacity:1!important;transform:none!important}
  #preloader{display:none!important}   /* no wave reveal — show page immediately */
}

/* ============================ NAV ============================ */
nav{
  position:fixed;top:0;left:0;right:0;z-index:30;
  display:flex;justify-content:space-between;align-items:baseline;
  padding:1rem 3rem .45rem;
  background:linear-gradient(var(--mist) 78%, rgba(242,247,249,0));
}
nav .mark{font-family:'Instrument Serif',serif;font-size:1.15rem;color:var(--ink)}
.nav-links > ul{display:flex;gap:clamp(1rem,1.9vw,2.1rem);list-style:none;
  font-family:'Space Mono',monospace;font-size:.66rem;
  letter-spacing:.13em;text-transform:uppercase;}
.nav-links > ul a{color:var(--ocean);opacity:.6;transition:opacity .25s}
.nav-links > ul a:hover{opacity:1}
.nav-links > ul a.active{opacity:1;position:relative}
.nav-links > ul a.active::after{
  content:"";position:absolute;left:0;right:0;bottom:-6px;height:1.5px;background:var(--ocean);
}

/* Voyage: the boat under the links. main.js sails it with the scroll over an
   unseen sea (calm at each link, rough between) and lets it leap crests on a brisk
   scroll; it stays nearest the link of the section being read. top:11px is the
   calm-water level: room above for a leap up to CEILING (9px in main.js) with the
   mast still clear of the link underline, and below for the deepest trough. */
.voyage{position:relative;height:36px;margin-top:5px}
.voyage-boat{
  position:absolute;left:-12.5px;top:11px;width:25px;will-change:transform;
  transform-origin:50% calc(100% - 3.5px);   /* pitch about the hull's waterline (y=79 of 96) */
}
/* Spray thrown up either side of the hull on a hard landing. Sits on the calm-water
   waterline (11px + 16.5px); main.js moves it to the landing point and replays it. */
.voyage-splash{position:absolute;left:0;top:27.5px;width:0;height:0;pointer-events:none}
.voyage-splash::before,.voyage-splash::after{
  content:"";position:absolute;left:-1.25px;top:-1.25px;width:2.5px;height:2.5px;
  border-radius:50%;background:var(--ocean);opacity:0;
}
.voyage-splash.go::before{animation:sprayAft .5s ease-out}
.voyage-splash.go::after{animation:sprayFore .5s ease-out}
@keyframes sprayAft{
  0%{opacity:.9;transform:translate(-5px,0)}
  45%{opacity:.75;transform:translate(-9px,-5px)}
  100%{opacity:0;transform:translate(-12px,0)}
}
@keyframes sprayFore{
  0%{opacity:.9;transform:translate(5px,0)}
  45%{opacity:.75;transform:translate(9px,-4px)}
  100%{opacity:0;transform:translate(12px,1px)}
}
.voyage-bob{transform-origin:50% calc(100% - 3.5px);animation:rock 3.6s ease-in-out infinite}
.voyage-bob svg{display:block}
@keyframes rock{
  0%,100%{transform:rotate(-2deg)}
  50%{transform:rotate(2deg) translateY(.5px)}
}

/* mobile <details> menu */
.nav-menu{display:none;position:relative}
.nav-menu summary{
  list-style:none;cursor:pointer;font-family:'Space Mono',monospace;
  font-size:.66rem;letter-spacing:.13em;text-transform:uppercase;color:var(--ocean);
  padding:.35rem .2rem;
}
.nav-menu summary::-webkit-details-marker{display:none}
.nav-menu[open] > ul{
  position:absolute;right:0;top:2rem;background:var(--white);
  border:1px solid var(--hair);border-radius:2px;padding:.6rem 0;
  display:flex;flex-direction:column;gap:0;min-width:160px;list-style:none;
  box-shadow:0 12px 30px rgba(12,34,51,.12);
}
.nav-menu[open] > ul a{
  display:block;padding:.5rem 1.1rem;color:var(--ocean);
  font-family:'Space Mono',monospace;font-size:.66rem;letter-spacing:.12em;text-transform:uppercase;
}
.nav-menu[open] > ul a:hover{background:var(--mist)}

/* ============================ HERO ============================ */
/* The sea is painted over the header's lower edge, so the header's bottom padding
   keeps that band clear: the hero is centred in the open water above the swell and
   grows the header, rather than running into the waves, when it doesn't fit.
   --sea-h mirrors .sea's height:34vh / min-height:220px. By default the band runs
   up to the boat's masthead (it rides the mid layer at 56% of the sea box and,
   with heave, pitch and the captain sticker, reaches ~106px above it); on wide
   screens the boat is moored in the open channel between copy and portrait
   instead (see .boat) and only the far swell (42% of the box, less its crests)
   needs clearing. Top padding clears the fixed nav and its voyage line (~85px). */
header{
  --sea-h:max(220px,34vh);
  position:relative;min-height:100vh;display:flex;align-items:center;
  overflow:hidden;padding:6.25rem 0 calc(var(--sea-h) * .44 + 124px);
}
/* Copy on the left, capped so an open channel stays between it and the portrait;
   the scroll cue sits under the portrait, closing the composition. */
.hero-inner{
  width:100%;max-width:var(--page-max);margin:0 auto;padding:0 var(--gutter);
  display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:1fr auto;
  column-gap:5vw;row-gap:1.4rem;align-items:center;
  position:relative;z-index:5;
}
.hero-copy{grid-column:1;grid-row:1 / 3;max-width:38rem}
/* Shell prompt over the name. "whoami" is typed once the preloader has cleared
   (main.js adds .booted); without JS it is simply shown, and with reduced motion
   the global animation:none leaves it at its full 6ch. */
.prompt{font-size:.7rem;letter-spacing:.04em;color:var(--faded);margin-bottom:.8rem;white-space:nowrap}
.prompt .p-host{color:var(--ocean)}
.prompt .p-path{color:var(--ink)}
.prompt .typed{
  display:inline-block;vertical-align:bottom;overflow:hidden;white-space:nowrap;
  width:6ch;color:var(--ink);
}
.js:not(.booted) .prompt .typed{width:0}
.booted .prompt .typed{animation:type .55s steps(6) .2s both}
@keyframes type{from{width:0}}
.prompt .p-comment{color:var(--faded);opacity:.8}
/* the vh terms shrink the display type on short laptop screens so the hero
   still clears the sea there instead of pushing it below the fold */
h1{
  font-family:'Instrument Serif',serif;font-weight:400;letter-spacing:.5px;
  font-size:clamp(2.3rem,min(5.6vw,8vh),4rem);line-height:.98;
}
.hero-id{display:flex;flex-wrap:wrap;align-items:center;gap:.55rem;margin-top:1.1rem}
.handle{
  font-size:.66rem;letter-spacing:.04em;color:var(--ocean);
  border:1px solid var(--hair);border-radius:2px;padding:.3rem .65rem;
  transition:background .25s,border-color .25s;
}
.handle::before{content:"> ";color:var(--shallow)}
.handle:hover,.handle.cta{background:rgba(31,110,140,.07);border-color:var(--ocean)}
.poly-badge{
  display:inline-flex;align-items:center;gap:.5rem;
  border:1px solid var(--hair);border-radius:2px;padding:.3rem .7rem .3rem .5rem;
}
.poly-badge .mono{font-size:.68rem;letter-spacing:.08em;color:var(--faded)}
.poly-logo{
  width:20px;height:20px;flex:none;border-radius:1px;
  background:
    url('assets/polytechnique.svg') center/contain no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4 L20 20 M20 4 L4 20' stroke='%231F6E8C' stroke-width='2.4' fill='none'/%3E%3C/svg%3E") center/contain no-repeat;
}
.hero-tagline{
  font-size:clamp(1.15rem,min(2.3vw,3.4vh),1.6rem);line-height:1.15;
  text-wrap:balance;margin:.8rem 0 1rem;
}
.hero-tagline em{color:var(--ocean)}
/* bio set as a shell comment: a mono "#" hangs in the left gutter */
.hero-sub{
  position:relative;max-width:62ch;color:var(--faded);font-size:.88rem;
  padding-left:1.3rem;text-wrap:pretty;
}
.hero-sub::before{
  content:"#";position:absolute;left:0;top:0;
  font-family:'Space Mono',monospace;color:var(--shallow);
}
.hero-sub em{color:var(--ink);font-style:italic}
.hero-status{margin-top:.8rem;font-size:.68rem;color:var(--ink);line-height:1.6}
.hero-status .k{color:var(--ocean)}
/* "live" dot: the compass's sonar ping in miniature */
.led{
  display:inline-block;width:6px;height:6px;border-radius:50%;margin-right:.55rem;
  background:var(--ocean);box-shadow:0 0 0 0 rgba(31,110,140,.45);
  animation:led 2.8s ease-out infinite;vertical-align:1px;
}
@keyframes led{
  0%{box-shadow:0 0 0 0 rgba(31,110,140,.45)}
  70%,100%{box-shadow:0 0 0 6px rgba(31,110,140,0)}
}

/* Work in progress: a shell readout set as one of the page's chart cards (white,
   hairline, 2px corners, mono label on top). Rows link down to the project cards. */
.term{
  margin-top:1.5rem;max-width:34rem;padding:0;   /* padding: stands down the page-section rule */
  background:var(--white);border:1px solid var(--hair);border-radius:2px;
}
/* chart-pin corners, as on the portrait */
.term::before,.term::after{
  content:"";position:absolute;width:10px;height:10px;border:1.5px solid var(--ocean);
}
.term::before{top:-4px;left:-4px;border-right:0;border-bottom:0}
.term::after{bottom:-4px;right:-4px;border-left:0;border-top:0}
.term-bar{
  display:flex;align-items:baseline;justify-content:space-between;gap:1rem;
  padding:.65rem 1rem .55rem;border-bottom:1px solid var(--hair);
}
.term-title{
  font-family:'Space Mono',monospace;font-size:.6rem;font-weight:400;line-height:1.4;
  letter-spacing:.14em;text-transform:uppercase;color:var(--ocean);margin:0;
}
.term-meta{font-size:.58rem;letter-spacing:.12em;text-transform:uppercase;color:var(--faded)}
.term-body{padding:.65rem 1rem .75rem;font-size:.68rem;line-height:1.75;color:var(--ink)}
.term-line .ps{color:var(--ocean)}
.term-line .c{color:var(--faded)}
.wip{list-style:none;margin:.2rem 0 .15rem}
.wip a{
  display:grid;grid-template-columns:1.4ch 13ch minmax(0,1fr) auto;column-gap:.6rem;
  align-items:baseline;padding:.1rem .4rem;margin:0 -.4rem;border-radius:2px;
  color:var(--ink);transition:background .25s;
}
.wip a::after{content:"↓";color:var(--ocean);opacity:0;transition:opacity .25s}
.wip a:hover,.wip a:focus-visible{background:rgba(31,110,140,.07)}
.wip a:hover::after,.wip a:focus-visible::after{opacity:1}
.wip .spin{color:var(--ocean);text-align:center}
.wip .w-name{font-weight:700}
.wip .w-state{color:var(--faded)}
.cursor{
  display:inline-block;width:.55em;height:1.05em;vertical-align:text-bottom;
  background:var(--ocean);opacity:.8;animation:blink 1.1s steps(1) infinite;
}
@keyframes blink{50%{opacity:0}}

/* Portrait, chart-pinned */
.portrait-frame{
  grid-column:2;grid-row:1;
  position:relative;justify-self:center;width:min(300px,72vw);
  background:var(--white);padding:12px 12px 10px;border:1px solid var(--hair);
  border-radius:2px;box-shadow:0 18px 40px rgba(12,34,51,.13);
  transform:rotate(1.3deg);
}
.portrait-frame::before,.portrait-frame::after{
  content:"";position:absolute;width:12px;height:12px;border:1.5px solid var(--ocean);
}
.portrait-frame::before{top:-4px;left:-4px;border-right:0;border-bottom:0}
.portrait-frame::after{bottom:38px;right:-4px;border-left:0;border-top:0}   /* two caption lines */
.portrait{
  aspect-ratio:4/5;border-radius:1px;
  background:
    url('assets/portrait.jpg') center/cover no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='380'%3E%3Ctext x='50%25' y='52%25' font-family='Instrument Serif,serif' font-size='140' fill='%23ffffff' fill-opacity='0.4' text-anchor='middle' dominant-baseline='middle'%3EAS%3C/text%3E%3C/svg%3E") center/cover no-repeat,
    linear-gradient(160deg,#2b7d99,#0C2233);
  display:flex;align-items:center;justify-content:center;
}
.portrait-fallback{display:none}
.portrait-frame figcaption{
  font-size:.6rem;letter-spacing:.14em;color:var(--faded);
  text-align:center;padding-top:8px;text-transform:uppercase;
}
.portrait-frame figcaption .school{display:block;color:var(--ocean)}

/* Scroll cue, under the portrait */
.scroll-cue{
  grid-column:2;grid-row:2;justify-self:end;
  font-size:.66rem;letter-spacing:.06em;color:var(--ocean);
  transition:opacity .5s;
}
.scroll-cue.gone{opacity:0}

/* Sea: waves + hero boat */
.sea{position:absolute;left:0;right:0;bottom:0;height:34vh;min-height:220px;pointer-events:none;z-index:4}
.sea svg.waves{position:absolute;bottom:0;left:0;width:100%;height:100%}

/* Surge, heave and tilt are set per-frame by JS (main.js, renderHeroSea) from the
   same swell model that draws the w1 path, so the hull is pinned to that exact
   surface. bottom:0 is only the zero-point those offsets are measured from; the
   17px origin offset is the hull's waterline (y=79 of the 96-unit boat SVG), so
   the boat pitches about where it meets the water rather than about its keel. */
.boat{
  position:absolute;left:15%;bottom:0;
  transform-origin:50% calc(100% - 17px);will-change:transform;
}
/* Wide enough for an open channel between the copy (38rem, flush left) and the
   300px portrait (flush right): moor the boat mid-channel, so its rig rises into
   empty water and the header only has to clear the far swell. The hero column is
   centred, so the channel's centre is 50% + (38rem - 300px) / 2 at any width;
   60px is half the boat. Below 1240px the channel is too tight for its swing and
   the full band is kept. */
@media (min-width:1240px){
  header{padding-bottom:calc(var(--sea-h) * .58 + 30px)}
  .boat{left:calc(50% + (38rem - 300px) / 2 - 60px)}
}
.boat svg{display:block}
@keyframes bob{
  0%,100%{transform:translateY(0) rotate(-1.2deg)}
  50%{transform:translateY(5px) rotate(1.3deg)}
}
/* captain's face sticker, riding above the hull */
.captain{
  position:absolute;left:5%;top:5px;transform:rotate(-30deg);
  width:44px;height:64px;z-index:2;
  background:url('assets/sticker.png') center/contain no-repeat;
}

/* ============================ MAIN ============================ */
main{max-width:var(--page-max);margin:0 auto;padding:0 var(--gutter)}

section{padding:6.5rem 0;position:relative}
.coord-line{
  font-family:'Space Mono',monospace;font-size:.66rem;letter-spacing:.15em;
  color:var(--ocean);margin-bottom:.8rem;text-transform:uppercase;
}
h2{
  font-family:'Instrument Serif',serif;font-weight:400;
  font-size:clamp(1.9rem,3.6vw,2.7rem);margin-bottom:.5rem;line-height:1.05;
}
h2 .sub{font-style:italic;color:var(--ocean);font-size:.62em}
.section-note{color:var(--faded);font-size:.95rem;margin-bottom:3rem;max-width:54ch}
.section-note.wide{max-width:70ch;font-size:1.02rem}

/* A heading with no note under it keeps the note's gap to the content */
main section > h2 + :not(.section-note){margin-top:2.4rem}

/* Small mono label over cards and entries */
.tag{
  display:block;font-family:'Space Mono',monospace;font-size:.6rem;
  letter-spacing:.14em;text-transform:uppercase;color:var(--ocean);text-wrap:balance;
}
.tag.muted{color:var(--faded)}

/* Purpose: copy beside the live brain figure (brain.js), three themes underneath */
#purpose{padding:clamp(3.5rem,8vw,6rem) 0;border-top:1px solid var(--hair)}
#purpose > h2{font-size:clamp(1.9rem,4vw,2.9rem);line-height:1.06;max-width:24ch}
.purpose-grid{
  display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.15fr);
  gap:clamp(1.5rem,4vw,3.5rem);align-items:center;
}
.purpose-lead{font-size:clamp(1.2rem,2.2vw,1.55rem);line-height:1.34;text-wrap:pretty}
.purpose-lead em{color:var(--ocean)}
.purpose-copy > p:not(.purpose-lead){color:var(--faded);font-size:1rem;margin-top:1.1rem;text-wrap:pretty}
.purpose-cards{
  display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1.2rem;
  margin-top:clamp(2rem,4vw,3rem);
}
.purpose-card{border:1px solid var(--hair);border-radius:2px;background:var(--white);padding:1.2rem 1.3rem}
.purpose-card p{color:var(--faded);font-size:.92rem;margin-top:.4rem;text-wrap:pretty}

/* The figure is one of the page's chart cards: white, hairline, pinned corners */
.neuro-fig{position:relative;margin:0;background:var(--white);border:1px solid var(--hair);border-radius:2px}
.neuro-fig::before,.neuro-fig::after{
  content:"";position:absolute;width:10px;height:10px;border:1.5px solid var(--ocean);
}
.neuro-fig::before{top:-4px;left:-4px;border-right:0;border-bottom:0}
.neuro-fig::after{bottom:-4px;right:-4px;border-left:0;border-top:0}
.neuro-bar{
  display:flex;flex-wrap:wrap;align-items:center;gap:.4rem .9rem;
  padding:.55rem 1rem .5rem;border-bottom:1px solid var(--hair);font-size:.6rem;
}
.neuro-title{flex:1 1 auto;letter-spacing:.14em;text-transform:uppercase;color:var(--ocean)}
.neuro-meta{color:var(--ink);letter-spacing:.04em;white-space:nowrap;font-variant-numeric:tabular-nums}
.neuro-meta .led{margin-right:.45rem}
.neuro-kick{
  font-size:.6rem;letter-spacing:.06em;color:var(--ocean);background:none;cursor:pointer;
  border:1px solid var(--hair);border-radius:2px;padding:.22rem .6rem;
  transition:background .25s,border-color .25s;
}
.neuro-kick:hover{background:rgba(31,110,140,.07);border-color:var(--ocean)}
#neuroCanvas{display:block;width:100%;height:auto;aspect-ratio:600/520;cursor:crosshair;touch-action:manipulation}
.neuro-fig figcaption{
  padding:.65rem 1rem .8rem;border-top:1px solid var(--hair);
  font-size:.78rem;line-height:1.5;color:var(--faded);text-wrap:pretty;
}

/* Projects. The grid reveals as one block, not card by card: .reveal's
   transform would otherwise override the hover lift. */
.projects{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1.4rem}
.project{
  border:1px solid var(--hair);border-radius:2px;background:var(--white);
  display:flex;flex-direction:column;overflow:hidden;
  transition:transform .3s, box-shadow .3s;
}
.project:hover{transform:translateY(-3px);box-shadow:0 10px 30px rgba(12,34,51,.09)}
/* landed on from the work-in-progress terminal */
.project{scroll-margin-top:1.5rem}   /* on top of html's scroll-padding, clears the nav's voyage line */
.project:target{border-color:var(--ocean);animation:targetPing 1.6s ease-out .3s}
@keyframes targetPing{
  0%{box-shadow:0 0 0 0 rgba(31,110,140,.45)}
  100%{box-shadow:0 0 0 14px rgba(31,110,140,0)}
}
/* 16:9 frame for a GIF or screen recording; left empty, it shows a bare chart tile */
.media{position:relative;aspect-ratio:16/9;border-bottom:1px solid var(--hair);background:var(--foam)}
.media img,.media video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.media .pin-left{object-position:left center}
/* an inline SVG drawing fills its frame over a bare chart grid */
.media > svg{position:absolute;inset:0;width:100%;height:100%;display:block}
.media-grid{
  background:
    linear-gradient(rgba(12,34,51,.07) 1px, transparent 1px) center/26px 26px,
    linear-gradient(90deg, rgba(12,34,51,.07) 1px, transparent 1px) center/26px 26px,
    var(--foam);
}
.media:empty{
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='8' fill='none' stroke='%231F6E8C' stroke-width='1.2' opacity='.5'/%3E%3Ccircle cx='12' cy='12' r='5' fill='%23F2F7F9' stroke='%231F6E8C' stroke-width='1.6'/%3E%3Ccircle cx='12' cy='12' r='1.8' fill='%231F6E8C'/%3E%3C/svg%3E") center/40px no-repeat,
    linear-gradient(rgba(12,34,51,.07) 1px, transparent 1px) center/26px 26px,
    linear-gradient(90deg, rgba(12,34,51,.07) 1px, transparent 1px) center/26px 26px,
    var(--foam);
}
.project-body{padding:1.5rem 1.6rem 1.6rem;display:flex;flex-direction:column;flex:1}
/* Spans both columns with the image beside the text; the image fills the card's
   height, pinned left so the screenshot's heading stays in view. */
.project-wide{grid-column:1 / -1;flex-direction:row}
.project-wide .media{flex:0 0 56%;aspect-ratio:auto;min-height:280px;border-bottom:0;border-right:1px solid var(--hair)}
.project-wide .media img{object-position:left top}
.project h3{font-weight:500;font-size:1.08rem;margin:.6rem 0 .45rem}
.project p{color:var(--faded);font-size:.92rem;flex:1;text-wrap:pretty}
.chips{
  display:flex;flex-wrap:wrap;gap:.4rem;margin:1rem 0 .9rem;list-style:none;
  font-family:'Space Mono',monospace;font-size:.58rem;letter-spacing:.08em;color:var(--faded);
}
.chips li{border:1px solid rgba(12,34,51,.16);border-radius:2px;padding:.22rem .5rem}
.project-link{
  align-self:flex-start;font-family:'Space Mono',monospace;font-size:.62rem;
  letter-spacing:.12em;text-transform:uppercase;color:var(--ocean);transition:color .25s;
}
a.project-link:hover{color:var(--ink)}
.project-link.muted{color:var(--faded)}

/* Experience */
.port{
  display:grid;grid-template-columns:150px 1fr;gap:2.3rem;
  padding:2rem 0;border-top:1px solid var(--hair);
}
.port:last-child{border-bottom:1px solid var(--hair)}
.port .when{font-size:.7rem;color:var(--ocean);padding-top:.4rem;line-height:1.5}
.port .when .place{color:var(--faded)}
.port h3{font-weight:500;font-size:1.08rem;margin-bottom:.4rem}
.port p{color:var(--faded);max-width:62ch;font-size:.95rem;text-wrap:pretty}

/* Education */
.edu{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1.2rem}
.edu-card{
  border:1px solid var(--hair);border-top:3px solid var(--ocean);border-radius:2px;
  background:var(--white);padding:1.6rem;
}
.edu-card:nth-child(2){border-top-color:var(--shallow)}
.edu-card:nth-child(3){border-top-color:var(--wave2)}
.edu-card h3{font-weight:500;font-size:1.05rem;margin:.55rem 0 .3rem}
.edu-card .tag.muted{margin-bottom:.6rem}
.edu-card p{color:var(--faded);font-size:.92rem;text-wrap:pretty}
.edu-list{color:var(--faded);font-size:.92rem;list-style:none;margin:0;padding:0}
.edu-list li{position:relative;padding-left:1rem;text-wrap:pretty}
.edu-list li+li{margin-top:.4rem}
.edu-list li::before{content:"–";position:absolute;left:0;color:var(--ocean)}

/* Beyond the lab */
.crew{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1.2rem}
.crew article{border-left:2px solid var(--ocean);padding:.2rem 0 .2rem 1.2rem}
.crew article:nth-child(2){border-left-color:var(--shallow)}
.crew article:nth-child(3){border-left-color:var(--wave2)}
.crew h3{font-weight:500;font-size:1.02rem;margin:.4rem 0 .3rem}
.crew p{color:var(--faded);font-size:.92rem}

/* ============================ COMPASS ============================ */
.compass-radial{display:flex;justify-content:center;margin-top:1rem}
.compass-stage{
  position:relative;width:720px;height:560px;
  transform-origin:top center;
}
.compass-radial{overflow:hidden}
.compass-rose{
  position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);
}
.rose-letter{font-family:'Space Mono',monospace;font-size:13px;font-weight:700;letter-spacing:.05em}
#needle{transform-box:view-box;transform-origin:100px 100px;transition:transform .4s cubic-bezier(.45,0,.2,1)}

.cword{
  position:absolute;transform:translate(-50%,-50%);
  font-family:'Figtree',sans-serif;white-space:nowrap;color:var(--ink);
  background:transparent;border:0;cursor:pointer;padding:2px 5px;line-height:1;
  transition:color .3s, opacity .3s;
}
.cword.t1{font-size:1.05rem;font-weight:600}
.cword.t2{font-size:.85rem;font-weight:500}
.cword.t3{font-size:.7rem;font-weight:400}
.cword.on{color:var(--ocean)}
.cword.dim{opacity:.35}
.clabel{
  position:absolute;transform:translate(-50%,-50%);
  font-family:'Space Mono',monospace;font-size:.6rem;letter-spacing:.16em;
  text-transform:uppercase;color:var(--faded);opacity:.65;transition:opacity .3s,color .3s;
  pointer-events:none;text-align:center;
}
.clabel.bright{opacity:1;color:var(--ocean)}

/* Mobile tag-group fallback */
.compass-tags{display:none;margin-top:2rem}
.tag-group{margin-bottom:1.6rem}
.tag-group h4{
  font-family:'Space Mono',monospace;font-size:.62rem;letter-spacing:.14em;
  text-transform:uppercase;color:var(--ocean);margin-bottom:.7rem;
}
.tag-group .pills{display:flex;flex-wrap:wrap;gap:.5rem}
.tag-group .pill{
  border:1px solid var(--hair);border-radius:2px;padding:.35rem .7rem;
  font-size:.78rem;color:var(--ink);background:var(--white);
}

/* ============================ FOOTER ============================ */
footer{
  max-width:var(--page-max);margin:0 auto;padding:5.5rem var(--gutter) 3rem;
  position:relative;overflow:hidden;
}
.footer-top,.footer-fine{position:relative;z-index:1}
.footer-top{display:flex;justify-content:space-between;align-items:flex-end;flex-wrap:wrap;gap:2rem}
footer .big{font-size:clamp(1.5rem,3vw,2.3rem);line-height:1.2}
footer .big a{color:var(--ocean)}
footer .big a:hover{text-decoration:underline}
footer .links{display:flex;gap:2rem;font-family:'Space Mono',monospace;font-size:.68rem;letter-spacing:.1em;text-transform:uppercase;flex-wrap:wrap}
footer .links a{color:var(--faded)}
footer .links a:hover{color:var(--ocean)}
.footer-fine{
  display:flex;justify-content:space-between;flex-wrap:wrap;gap:.6rem;
  margin-top:2.6rem;font-size:.72rem;color:var(--faded);letter-spacing:.04em;
}

/* ============================ REVEALS ============================ */
.js .reveal{opacity:0;transform:translateY(14px);transition:opacity .5s ease-out,transform .5s ease-out}
.js .reveal.in{opacity:1;transform:none}

/* ============================ RESPONSIVE ============================ */
@media (max-width:980px){
  .hero-inner{grid-template-columns:1fr;grid-template-rows:none;gap:2.5rem}
  .hero-copy,.portrait-frame,.scroll-cue{grid-column:auto;grid-row:auto}
  .portrait-frame{justify-self:start;order:-1;width:min(240px,60vw);transform:rotate(-1.2deg)}
  .scroll-cue{justify-self:start}
  .edu,.crew{grid-template-columns:1fr}
  .purpose-grid{grid-template-columns:1fr}
  .neuro-fig{max-width:640px}
}
/* seven nav links stop fitting on one line below this */
@media (max-width:900px){
  nav{flex-wrap:wrap}
  .nav-links{order:3;flex-basis:100%}   /* the course alone on a second row */
  .nav-links > ul{display:none}
  .nav-menu{display:block}
  header{padding-top:7.25rem}           /* clear the taller, wrapped nav */
}
@media (max-width:820px){
  nav{padding:.9rem 1.6rem .45rem}
  .compass-radial{display:none}
  .compass-tags{display:block}
  .footer-top{flex-direction:column;align-items:flex-start}
}
@media (max-width:720px){
  :root{--gutter:1.5rem}
  .projects{grid-template-columns:1fr}
  .purpose-cards{grid-template-columns:1fr}
  .project-wide{flex-direction:column}
  .project-wide .media{flex:none;aspect-ratio:16/9;min-height:0;border-right:0;border-bottom:1px solid var(--hair)}
  .port{grid-template-columns:1fr;gap:.5rem}
  .port .when{padding-top:0}
  footer{padding-top:4rem;padding-bottom:2.5rem}
}
/* terminal rows: status drops under the process name */
@media (max-width:560px){
  .wip a{grid-template-columns:1.4ch minmax(0,1fr)}
  .wip a::after{display:none}
  .wip .w-state{grid-column:2}
  .prompt .p-comment{display:none}
}
@media (max-width:400px){
  h1{font-size:2.1rem}
  .hero-id{gap:.5rem}
}

/* ============================================================
   WAVE ENHANCEMENTS
   preloader reveal · title underlines · compass sonar · harbour
   ============================================================ */

/* ---------- Preloader: title card, one wave passage, then the panel fades out ---------- */
#preloader{
  position:fixed;inset:0;z-index:1000;overflow:hidden;
  transition:opacity .6s ease;
}
#preloader.done{opacity:0;pointer-events:none}
/* the page's paper colour: the footage is tinted onto it, and it stands in
   if the video decodes late, so nothing ever flashes dark or white */
.pl-fill{position:absolute;inset:0;background:var(--mist)}
/* the wave footage fills the panel and fades with it. Multiply turns its white
   paper into the mist fill underneath while leaving the blues almost untouched;
   the slight brightness lift first clips the compressed near-white paper to pure
   white, so it lands exactly on --mist instead of a greyer, blotchy shade */
.pl-video{
  position:absolute;inset:0;width:100%;height:100%;
  object-fit:cover;object-position:center;
  mix-blend-mode:multiply;filter:brightness(1.05);
  opacity:0;transition:opacity .5s ease;
}
.pl-video.ready{opacity:1}

/* title card sits over the footage and is wiped away left to right by the
   incoming wave: main.js moves --wipe-a (fully cleared) and --wipe-b (fully
   opaque) along with the wave front, so the soft band rides the crest */
.pl-title{
  position:absolute;inset:0;z-index:3;background:var(--mist);
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  text-align:center;padding:0 1.5rem;
  --wipe-a:-2px;--wipe-b:-1px;
  -webkit-mask-image:linear-gradient(90deg,transparent var(--wipe-a),#000 var(--wipe-b));
  mask-image:linear-gradient(90deg,transparent var(--wipe-a),#000 var(--wipe-b));
}
.pl-name,.pl-sub{animation:plNameIn .55s ease-out .06s both}
.pl-name{font-size:clamp(2.4rem,7vw,5rem);letter-spacing:.5px;line-height:1;color:var(--ink)}
.pl-sub{
  font-size:clamp(.56rem,1.5vw,.7rem);letter-spacing:.3em;line-height:1.9;
  text-transform:uppercase;color:var(--ocean);text-wrap:balance;
  padding:0 1rem;margin:1.05rem -.3em 0 0;
}
.pl-rule{
  display:block;width:clamp(96px,13vw,132px);height:2px;border-radius:2px;margin-top:2.3rem;
  background:var(--ocean);opacity:.85;transform-origin:left center;
  animation:plDraw 1.05s cubic-bezier(.4,0,.2,1) .1s both;
}
@keyframes plNameIn{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}
@keyframes plDraw{from{transform:scaleX(0)}to{transform:scaleX(1)}}

/* ---------- Animated wavy underline beneath each section title ---------- */
main section > h2::after{
  content:"";display:block;height:8px;width:120px;margin-top:.7rem;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 8'%3E%3Cpath d='M0 5 Q4.5 1 9 5 T18 5 T27 5 T36 5' fill='none' stroke='%231F6E8C' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat:repeat-x;background-size:36px 8px;background-position:0 50%;
  opacity:.95;animation:uDrift 1.8s linear infinite;
}
@keyframes uDrift{to{background-position-x:36px}}

/* ---------- Compass sonar pings ---------- */
.sonar{
  transform-box:view-box;transform-origin:100px 100px;
  fill:none;stroke:var(--ocean);stroke-width:1.3;opacity:0;
  animation:sonar 2.8s ease-out infinite;
}
.sonar.d2{animation-delay:1.4s}
@keyframes sonar{
  0%{transform:scale(.26);opacity:.65}
  70%{opacity:0}
  100%{transform:scale(1.02);opacity:0}
}

/* ---------- Harbour waterline above the footer ---------- */
@keyframes drift{from{transform:translateX(0)}to{transform:translateX(-50%)}}
.harbour-waves{position:absolute;top:0;left:0;right:0;height:56px;pointer-events:none;z-index:0}
.harbour-waves .hw{position:absolute;bottom:0;left:0;width:200%;height:100%}
.harbour-waves .hw-back{fill:var(--wave2);opacity:1;animation:drift 18s linear infinite reverse}
.harbour-waves .hw-front{fill:var(--wave1);animation:drift 13s linear infinite}
