/* Simple page: a sea chart followed downwards. Tokens come from ../css/tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--step-body) / 1.55 var(--font-text);
  -webkit-font-smoothing: antialiased;
}
ul, ol { list-style: none; padding: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.skip {
  position: absolute; left: 24px; top: -100px; z-index: 30;
  background: var(--accent); color: var(--accent-ink); padding: 12px 16px;
}
.skip:focus { top: 12px; }

/* ── The chart: paper with a lat/long scale down both edges ─────── */
.chart {
  --pad: 22px;      /* room inside the edge scale */
  --spread: 1;      /* how far waypoints step sideways; 0 on phones */
  position: relative; overflow: hidden; padding: 0 var(--pad);
}
.rail {
  position: absolute; top: 0; bottom: 0; width: 10px;
  /* taste-skill-ignore: hard-stop stripes are the chart's scale, not a gradient wash */
  background: repeating-linear-gradient(to bottom, var(--ink) 0 48px, var(--paper) 48px 96px);
}
.rail--left { left: 0; border-right: 1px solid var(--ink); }
.rail--right { right: 0; border-left: 1px solid var(--ink); }

/* ── Bar ─────────────────────────────────────────────────────────── */
.bar { position: relative; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding: 14px var(--margin); }
.wordmark { margin-right: auto; padding: 9px 0; font: 800 26px/1 var(--font-display); letter-spacing: -0.03em; text-decoration: none; }
.bar__nav ul { display: flex; gap: 4px; }
.bar__nav a {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px;
  font-size: var(--step-small); font-weight: 600; text-decoration: none;
}
.bar__menu { display: none; min-height: 44px; padding: 0 12px; font-size: var(--step-small); font-weight: 600; }
.bar__actions { display: flex; align-items: center; gap: 8px; }

/* Section links fly their signal flag; it flutters when pointed at. */
.flag { flex: none; width: 21px; height: 14px; outline: 1px solid var(--rule); transform-origin: left center; }
.f-blue { fill: var(--flag-blue); }
.f-red { fill: var(--flag-red); }
.f-white { fill: var(--flag-white); }
.bar__nav a:hover .flag, .bar__nav a:focus-visible .flag { animation: flutter var(--duration-slow) var(--ease-in-out-smooth); }
@keyframes flutter {
  30% { transform: skewY(-7deg) scaleX(0.92); }
  65% { transform: skewY(4deg) scaleX(0.97); }
}

.icon-button {
  display: inline-grid; place-items: center; width: 44px; height: 44px;
  transition: background-color var(--duration-fast) var(--ease-out-snappy), transform var(--duration-fast) var(--ease-overshoot);
}
.icon-button:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
.icon-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.shutdown:hover { transform: rotate(-12deg); }
.ship:active .ship__hull, .boat:active, .icon-button:active, .track-button:active { transform: scale(0.97); }

.mood__moon { display: none; }
:root[data-mood="night"] .mood__sun { display: none; }
:root[data-mood="night"] .mood__moon { display: block; }

/* ── Things that leave the site sail ─────────────────────────────── */
/* Download CV: a container ship. Clicking it lifts a box off the deck. */
.ship { position: relative; display: inline-flex; flex-direction: column; justify-content: flex-end; min-height: 44px; padding-top: 12px; text-decoration: none; }
.ship__deck { position: absolute; top: 0; left: 10px; right: 14px; height: 12px; display: flex; align-items: flex-end; gap: 2px; }
.ship__deck i { width: 13px; height: 9px; background: var(--flag-blue); }
.ship__deck i:nth-child(2) { background: var(--flag-yellow); }
.ship__deck i:nth-child(3) { background: var(--flag-green); }
.ship__deck i:nth-child(4) { background: var(--flag-red); }
.ship__bridge { margin-left: auto; width: 9px; height: 12px; background: var(--ink); }
.ship__hull {
  display: block; padding: 8px 22px 9px 14px; background: var(--accent); color: var(--accent-ink);
  font: 600 var(--step-small)/1 var(--font-text);
  clip-path: polygon(0 0, 100% 0, 100% 25%, 91% 100%, 4% 100%, 0 45%);
  transition: background-color var(--duration-fast) var(--ease-out-snappy);
}
.ship:hover .ship__hull { background: color-mix(in srgb, var(--accent) 84%, #000); }
.ship:hover, .boat:hover { animation: bob 1.4s var(--ease-in-out-smooth) infinite; }
@keyframes bob {
  50% { transform: translateY(-2px) rotate(-1.2deg); }
}
.ship.is-unloading .ship__deck i:first-child { animation: unload var(--duration-page) var(--ease-anticipate) forwards; }
@keyframes unload {
  60% { opacity: 1; }
  to { transform: translateY(-26px); opacity: 0; }
}

/* Outside links in the harbour: small sailboats. A rounded hull carries the label,
   a mast rises from the deck, and a red mainsail fills out on hover. */
.boat {
  position: relative; isolation: isolate; display: inline-flex; align-items: center;
  min-height: 44px; padding: 46px 30px 10px 24px; color: var(--ink); text-decoration: none; font-weight: 600;
}
.boat::before {
  content: ""; position: absolute; z-index: -1; left: 0; right: 0; bottom: 0; height: 38px;
  background: var(--paper); box-shadow: inset 0 3px 0 var(--accent);
  border-radius: 4px 14px 50% 50% / 4px 14px 100% 100%;
}
.boat::after {
  content: ""; position: absolute; left: 32px; bottom: 37px; width: 2px; height: 42px;
  background: var(--fjord-ink); border-radius: 1px;
}
.boat__sail {
  position: absolute; left: 35px; bottom: 41px; width: 28px; height: 34px;
  background: var(--accent); clip-path: polygon(0 0, 0 100%, 100% 100%);
  transform-origin: bottom left; transition: transform var(--duration-base) var(--ease-overshoot);
}
.boat__sail::before {
  content: ""; position: absolute; inset: 0; background: var(--flag-white); opacity: 0.25;
  clip-path: polygon(0 55%, 0 70%, 100% 100%, 75% 100%);
}
.boat:hover .boat__sail, .boat:focus-visible .boat__sail { transform: scaleX(1.25); }

/* ── Shared chart pieces ─────────────────────────────────────────── */
/* A framed piece of chart: the title block and every project inset. */
.cartouche, .inset__card { background: var(--paper); border: 4px double var(--ink); }
/* Section headings and their lede lines share one size each. */
.waypoint h2, .harbour h2 { font: 700 var(--step-statement)/1.2 var(--font-display); }
.cartouche__lede, .harbour__lede { font-size: clamp(19px, 1.6vw, 22px); }
/* The plotted course, wherever it is drawn. */
.c-course, .leg path { fill: none; stroke: var(--accent); stroke-width: 3; stroke-dasharray: 10 7; vector-effect: non-scaling-stroke; }

/* ── Hero: title block and the coast of departure ────────────────── */
.hero { position: relative; display: flex; padding: 40px var(--margin) 0; min-height: 600px; }
.cartouche { position: relative; z-index: 1; align-self: start; max-width: 640px; padding: 40px 40px 32px; }
.cartouche__kicker { font-size: var(--step-small); font-weight: 600; margin-bottom: 16px; }
.cartouche h1 { font: 800 var(--step-display) / 0.9 var(--font-display); letter-spacing: -0.04em; }
.cartouche__lede { margin-top: 24px; max-width: 30ch; }
.cartouche__notes { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin-top: 28px; font-size: var(--step-small); }
.cartouche__notes dt { color: var(--muted); }
.cartouche__notes dd { margin: 0; }

.hero__coast { position: absolute; right: 0; top: 0; width: min(62%, 860px); height: 100%; }
.c-contour path { fill: none; stroke: var(--contour); stroke-width: 1.5; }
.c-land { fill: var(--land); }
.c-land-ink { fill: var(--land-ink); }
.c-ink { fill: var(--ink); }
.c-label { font: 600 18px var(--font-text); }
.c-place { font: italic 400 14px var(--font-text); }
.c-place.c-ink { paint-order: stroke; stroke: var(--paper); stroke-width: 4px; stroke-linejoin: round; }
.c-coastline path { stroke: var(--shallow); stroke-width: 18px; paint-order: stroke; stroke-linejoin: round; }
.c-fjord-shallow, .c-fjord { fill: none; stroke-linecap: round; }
.c-fjord-shallow { stroke: var(--shallow); stroke-width: 30px; }
.c-fjord { stroke: var(--paper); stroke-width: 13px; }
.c-sounding text { fill: var(--muted); font: 14px var(--font-text); }
.c-rose { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.c-rose__body { fill: var(--paper); }
.c-rose__north { fill: var(--ink); }
.c-rose__n { fill: var(--ink); font: 700 16px var(--font-display); }
.c-departure { fill: var(--paper); stroke: var(--accent); stroke-width: 3; }

/* ── Legs of the course between sections (paths are built by simple.js) ── */
.leg { position: relative; height: 170px; }
.leg svg { position: absolute; inset: 0; width: 100%; height: 100%; transform-origin: top; }
/* A chart annotation: the course passes behind its label. */
.leg p {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  padding: 4px 12px; background: var(--paper); border: 1px solid var(--rule); border-radius: 999px;
  font-size: var(--step-small); font-weight: 600; color: var(--muted); white-space: nowrap;
}

/* ── Sections and their waypoints ────────────────────────────────── */
.section { padding: 0 var(--margin); }
.waypoint { display: flex; align-items: center; gap: 12px; margin-left: calc(var(--at, 0%) * var(--spread)); }
.waypoint--center { justify-content: center; }
.waypoint::before {
  content: ""; flex: none; width: 28px; height: 28px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent) 0 4px, var(--paper) 4.5px); /* taste-skill-ignore: a dot, not a wash */
  border: 3px solid var(--accent);
}

/* The shallows: a soft blob of shallow water behind the text. The blob is drawn larger than
   the text box (an ellipse only holds a rectangle when it reaches past its corners), so the
   words never run out over its edge. */
.shallows {
  position: relative; isolation: isolate;
  margin: 84px 0 64px calc(var(--at, 0%) * var(--spread)); max-width: 700px; padding: 8px 16px;
}
.shallows::before {
  content: ""; position: absolute; inset: -30% -16%; z-index: -1;
  background: var(--shallow); border-radius: 50% 50% 47% 53% / 52% 46% 54% 48%;
}
@media (max-width: 999px) { /* too narrow for the blob to reach past the words: a rounded pool */
  .shallows { margin-block: 24px 0; padding: 36px 40px; }
  .shallows::before { inset: 0; border-radius: 28px; }
}
.shallows p { font-size: var(--step-statement); line-height: 1.4; }

/* ── Course rows: a dashed line with a marker per stop ───────────── */
.course-row { position: relative; display: flex; gap: 32px; }
.course-row::before { content: ""; position: absolute; left: 0; right: 0; top: 9px; border-top: 3px dashed var(--accent); }
.inset::before, .port::before {
  content: ""; display: block; position: relative; width: 21px; height: 21px; border-radius: 50%;
  background: var(--paper); border: 3px solid var(--ink);
}

/* Projects: chart-inset cards scrolling sideways */
.track-controls { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 16px; }
.track-controls p { font-size: var(--step-small); color: var(--muted); }
.track-button {
  width: 44px; height: 44px; border: 2px solid var(--ink); background: var(--paper); font-size: 22px; line-height: 1;
  transition: background-color var(--duration-fast) var(--ease-out-snappy), opacity var(--duration-fast) var(--ease-out-snappy), transform var(--duration-instant) var(--ease-out-snappy);
}
.track-button:hover { background: var(--shallow); }

.track {
  --card: 380px;
  margin: 32px calc(-1 * (var(--margin) + var(--pad))) 0; overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none; /* the buttons and the cut-off card show it scrolls */
  cursor: grab; overscroll-behavior-x: contain;
}
.track::-webkit-scrollbar { display: none; }
/* While dragged with a mouse: no snapping fights the hand, no text gets selected. */
.track.is-dragging { cursor: grabbing; scroll-snap-type: none; user-select: none; }
.track.is-gliding { scroll-snap-type: none; }
.track.is-dragging .inset__card { transform: none; }
.track a { -webkit-user-drag: none; }
/* The row loops (copies on both sides), so it needs no end padding to centre a card. */
.track__list { width: max-content; padding: 0 0 24px; }
/* The turn between the last project and the first one coming round again. */
.track__turn {
  position: relative; flex: none; width: 180px; padding-top: 18px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.track__turn-mark {
  position: absolute; top: -6px; left: 50%; translate: -50% 0;
  width: 4px; height: 34px; background: var(--accent); border-radius: 2px;
}
.track__turn p {
  margin-top: 120px; padding: 10px 14px; border: 2px dashed var(--rule); border-radius: 12px;
  font-size: var(--step-small); font-weight: 600; color: var(--muted);
}
.inset { position: relative; flex: none; width: var(--card); padding-top: 18px; scroll-snap-align: center; display: flex; flex-direction: column; }
.inset::before { position: absolute; left: 28px; top: 0; }
.inset__card {
  position: relative; flex: 1; margin-top: 24px; min-height: 420px; display: flex; flex-direction: column; cursor: pointer;
  transition: transform var(--duration-base) var(--ease-out-snappy), border-color var(--duration-fast) var(--ease-out-snappy);
}
.inset:hover .inset__card { border-color: var(--accent); transform: translateY(-4px); }
/* The whole card is the link: its "Open" link stretches over the card. */
.inset__card:has(.inset__link:focus-visible) { outline: 3px solid var(--focus); outline-offset: 4px; }
.inset__link:focus-visible { outline: none; }
.inset__map { position: relative; height: 112px; background: var(--shallow); overflow: hidden; }
.inset__map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.inset__tag {
  position: absolute; bottom: 12px; padding: 2px 8px; background: var(--paper);
  font-size: var(--step-small); font-weight: 600; font-variant-numeric: tabular-nums;
}
.inset__tag--kind { left: 20px; }
.inset__tag--year { right: 20px; }
.inset__body { flex: 1; display: flex; flex-direction: column; padding: 20px 24px 24px; }
.inset__body > * + * { margin-top: 10px; }
.inset__body h3 { font: 700 var(--step-large) / 1.05 var(--font-display); letter-spacing: -0.02em; }
.inset__tech { margin-top: auto; padding-top: 12px; font-size: var(--step-small); font-weight: 600; }
.inset__link {
  align-self: start; display: inline-flex; align-items: center; min-height: 44px;
  font-size: var(--step-small); font-weight: 600;
  text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 5px;
}
.inset__link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.inset:hover .inset__link { text-underline-offset: 8px; }

.inset__password { position: relative; z-index: 2; cursor: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: var(--step-small); }
.inset__secret {
  padding: 2px 10px; background: var(--shallow); border: 1px dashed var(--muted);
  font-weight: 600; font-size: var(--step-body); letter-spacing: 0.04em; user-select: all;
}
.inset__copy {
  position: relative; z-index: 2; min-height: 44px; padding: 0 12px; margin: -10px 0;
  font-weight: 600; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px;
}
.inset__copy:hover { color: var(--accent); }
.inset__copied { font-weight: 600; color: var(--muted); }

/* Work and education: ports of call, oldest on the left */
.ports { margin-top: 32px; overflow-x: auto; padding-bottom: 8px; }
.ports__list { min-width: 840px; }
.port { flex: 1 1 0; min-width: 0; }
.port__when { margin-top: 16px; font-size: var(--step-small); color: var(--muted); font-variant-numeric: tabular-nums; }
.port h3 { margin-top: 4px; font: 700 var(--step-large) / 1.1 var(--font-display); }
.port__where { margin-top: 4px; font-size: var(--step-small); font-weight: 600; }
.port__what { margin-top: 10px; }

/* Skills: soundings across the shallows */
.soundings {
  margin-top: 32px; padding: 48px; border-radius: 40px; background: var(--shallow);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 32px 24px;
}
.soundings h3 { margin-bottom: 8px; font-size: var(--step-small); font-weight: 600; color: var(--muted); }
.soundings li { font: 600 22px/1.4 var(--font-display); }

/* ── Harbour: where the course ends ──────────────────────────────── */
.harbour {
  --focus: var(--fjord-ink);
  position: relative; margin: 0 calc(-1 * var(--pad)); padding: 0 calc(var(--margin) + var(--pad)) 32px;
  background: var(--fjord); color: var(--fjord-ink);
}
.harbour__swell { position: absolute; left: 0; right: 0; bottom: 72px; width: 100%; height: 120px; }
.harbour__swell path { fill: none; stroke: var(--fjord-ink); stroke-width: 1.5; opacity: 0.14; vector-effect: non-scaling-stroke; }
.harbour__anchor {
  display: block; width: 56px; height: 64px; margin: -32px auto 0;
  fill: none; stroke: var(--fjord-ink); stroke-width: 3; stroke-linecap: round;
}
.harbour__buoy { fill: var(--accent); stroke: none; }
.harbour__grid {
  position: relative; max-width: 1160px; margin: 40px auto 0;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 40px 64px;
}
.harbour__main { flex: 1 1 520px; }
.harbour__lede { margin-top: 8px; max-width: 34ch; }
.harbour__email {
  display: inline-block; margin-top: 20px;
  padding-block: 6px; font: 600 clamp(24px, 2.8vw, 36px) / 1.2 var(--font-display); letter-spacing: -0.02em; overflow-wrap: anywhere;
  text-decoration-color: var(--accent); text-decoration-thickness: 3px; text-underline-offset: 8px;
}
.harbour__email:hover { text-underline-offset: 12px; }
.harbour__side { flex: 0 1 380px; }
.harbour__label { font-size: var(--step-small); opacity: 0.8; }
.harbour__links { display: flex; flex-wrap: wrap; gap: 22px 14px; margin-top: 12px; }
.harbour__legal {
  position: relative; max-width: 1160px; margin: 112px auto 0;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 24px; font-size: var(--step-small);
}
.harbour__legal a { display: inline-flex; align-items: center; min-height: 44px; }

.noscript { padding: 24px; background: var(--shallow); }

/* ── Entrances ───────────────────────────────────────────────────── */
/* Each part rises a little and fades in once, staggered within its section. */
.js .reveal:not(.is-in) { opacity: 0; transform: translateY(24px); }
.js .reveal.is-in {
  transition: opacity var(--duration-page) var(--ease-out-snappy), transform var(--duration-page) var(--ease-out-snappy);
  transition-delay: var(--delay, 0ms);
}
/* Waypoint markers pop in just after their heading. */
.js .waypoint:not(.is-in)::before { transform: scale(0.4); }
.js .waypoint.is-in::before { transition: transform var(--duration-slow) var(--ease-overshoot) calc(var(--delay, 0ms) + 80ms); }
/* Each leg draws its course downwards as it arrives, then shows its label. */
.js .leg:not(.is-in) svg { transform: scaleY(0); }
.js .leg:not(.is-in) p { opacity: 0; }
.js .leg.is-in svg { transition: transform var(--duration-page) var(--ease-in-out-smooth); }
.js .leg.is-in p { transition: opacity var(--duration-base) var(--ease-out-snappy) var(--duration-slow); }
/* The opening chart: title block first, then the coast fades up behind it. */
.js .cartouche { animation: rise-in var(--duration-page) var(--ease-out-snappy) both; }
.js .hero__coast { animation: fade-in var(--duration-page) var(--ease-out-snappy) 120ms both; }
@keyframes rise-in { from { opacity: 0; transform: translateY(16px); } }
@keyframes fade-in { from { opacity: 0; } }

/* Everything that moves, calmed in one place. Durations already collapse via tokens.css. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal:not(.is-in) { transform: none; }
  .js .leg:not(.is-in) svg, .js .waypoint:not(.is-in)::before { transform: none; }
  .js .cartouche, .js .hero__coast { animation: none; }
  .ship:hover, .boat:hover, .bar__nav a:hover .flag, .ship.is-unloading .ship__deck i:first-child { animation: none; }
  .inset:hover .inset__card, .shutdown:hover, .boat:hover .boat__sail, .boat:focus-visible .boat__sail { transform: none; }
}

/* ── Phone ───────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .chart { --pad: 14px; --spread: 0; }
  .rail { width: 6px; }
  .bar { gap: 4px; padding: 10px 8px; }
  .bar__menu { display: inline-flex; align-items: center; }
  .bar__nav ul {
    display: none; position: absolute; top: 64px; right: 8px; z-index: 5;
    flex-direction: column; min-width: 200px; padding: 8px;
    background: var(--ink); color: var(--paper); --focus: var(--paper);
    box-shadow: 0 12px 32px rgb(0 0 0 / 0.25); /* taste-skill-ignore: a real dropdown that floats */
  }
  .bar__nav ul.is-open { display: flex; }
  .bar__nav ul a { width: 100%; font-size: var(--step-body); }
  .ship .long { display: none; }
  .ship__deck i:nth-child(n+3) { display: none; }

  .hero { flex-direction: column; padding: 16px 8px 0; min-height: 0; }
  .cartouche { padding: 28px 22px 24px; }
  .hero__coast { position: relative; width: 100%; height: 260px; margin-top: -40px; }

  .section { padding: 0 8px; }
  .waypoint--center { justify-content: flex-start; }
  .shallows { padding: 32px 26px; }
  .leg { height: 120px; }
  .leg p { display: none; }

  .track { --card: 280px; margin-inline: calc(-1 * var(--pad) - 8px); }

  .ports { overflow: visible; padding-bottom: 0; }
  .ports__list { min-width: 0; flex-direction: column; gap: 32px; padding-left: 36px; }
  .ports__list::before { top: 0; bottom: 0; left: 12.5px; right: auto; border-top: 0; border-left: 3px dashed var(--accent); }
  .port { position: relative; }
  .port::before { position: absolute; left: -32.5px; top: 2px; }
  .port__when { margin-top: 0; }

  .soundings { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 28px 22px; border-radius: 28px; }
  .harbour { padding: 0 22px 32px; }
  .harbour__legal { margin-top: 72px; }
}
.load-error { margin-top: 16px; padding: 16px 20px; background: var(--shallow); text-align: center; }
