/* =========================================================
   Michela Congiu, MedSea
   One page, one breath-hold: 0 m at the buoy, 42 m at the tag.
   Three design directions share the structure; each one only
   redefines the tokens below.
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --rope-x: clamp(18px, 8vw, 140px);
  --gap: clamp(26px, 4.5vw, 64px);
  --col-x: calc(var(--rope-x) + var(--gap));
  --measure: 34rem;
  --wl: 64vh;                 /* waterline, from the top of the hero */

  /* section boundaries as fractions of the water column, set by main.js */
  --f-meadow: 18%;
  --f-free: 45%;
  --f-sketch: 66%;
  --f-bottom: 83%;

  /* type scale (18 / 21 / 24 / 36 / 48 / 60) */
  --fs-body: 1.125rem;
  --fs-lead: 1.3125rem;
  --fs-h3: 1.5rem;
  --fs-h2: clamp(2.25rem, 4.6vw, 3.75rem);
  --name-size: clamp(3.5rem, 13vw, 10.5rem);
}
@supports (height: 1svh) { :root { --wl: 64svh; } }

/* ---------- Direction 1: Taccuino (field sketchbook) ---------- */
[data-theme="taccuino"] {
  --sky: #e3e9e6;
  --sky-ink: #1f2c34;
  --w0: #b0dad5; --w1: #86c3c3; --w2: #68a9b8;
  --w3: #2a6080; --w4: #173d5b; --w5: #0a1f33;
  --ink-dark: #1f2c34;
  --ink-light: #e9ece2;
  --bar-shallow: var(--ink-dark);

  --leaf: rgba(70, 124, 80, .5);
  --leaf-far: rgba(70, 124, 80, .28);
  --animal: rgba(255, 255, 255, .22);
  --whale: rgba(6, 22, 36, .32);
  --pale: rgba(255, 255, 255, .55);
  --shell: rgba(120, 82, 60, .25);
  --sand: rgba(214, 196, 160, .35);
  --seabed: #cbc3a1;
  --rock: rgba(8, 20, 32, .4);
  --gorgo: #c22a3f;
  --buoy: #f2861e;
  --vein: .35;

  --paper: #eef0ea;
  --paper-ink: #1f2c34;
  --tag-bg: #eef0ea;
  --tag-ink: #1f2c34;
  --rope-a: #1f2c34;
  --rope-b: #e9ece2;
  --name-water: #24657a;

  --f-display: "Newsreader", Georgia, serif;
  --f-body: "Newsreader", Georgia, serif;
  --f-note: "Nanum Pen Script", "Segoe Print", cursive;
  --display-weight: 300;
  --display-track: -0.015em;
  --display-fvs: "opsz" 72;
  --name-weight: 300;
  --name-style: normal;
  --body-weight: 400;
  --strong-weight: 600;
  --lh-body: 1.62;
  --fs-note: 1.65rem;
  --fs-note-sm: 1.35rem;
  --note-style: normal;
  --note-opacity: .88;
  --ill-w: 1.35;
  --ill-filter: url(#wobble);
  --rays: .9;
  --snow: .55;
  --grain: .22;
  --wash: .55;
}

/* ---------- Direction 2: Cianotipia (cyanotype print) ---------- */
[data-theme="cianotipia"] {
  --sky: #f1f3ef;
  --sky-ink: #173f74;
  --w0: #2f6ca8; --w1: #275f9c; --w2: #22558f;
  --w3: #1a4880; --w4: #123766; --w5: #0a2247;
  --ink-dark: #f2f6f7;
  --ink-light: #f2f6f7;
  --bar-shallow: var(--ink-light);

  --leaf: rgba(240, 247, 250, .58);
  --leaf-far: rgba(240, 247, 250, .26);
  --animal: rgba(240, 247, 250, .86);
  --whale: rgba(240, 247, 250, .82);
  --pale: rgba(255, 255, 255, .96);
  --shell: rgba(240, 247, 250, .78);
  --sand: #5a82b4;
  --seabed: #4774aa;
  --rock: rgba(240, 247, 250, .3);
  --gorgo: #c22a3f;
  --buoy: #f2f6f7;
  --detail: #23558f;
  --sheath: transparent;
  --halo: 0 0 10px #123766, 0 0 22px #123766;
  --vein: 0;

  --paper: #23558f;
  --paper-ink: #f2f6f7;
  --tag-bg: #f2f6f7;
  --tag-ink: #173f74;
  --rope-a: #f2f6f7;
  --rope-b: rgba(242, 246, 247, .45);
  --name-water: rgba(242, 246, 247, .94);

  --f-display: "IM Fell English", Georgia, serif;
  --f-body: "Spectral", Georgia, serif;
  --f-note: "IM Fell English", Georgia, serif;
  --display-weight: 400;
  --display-track: 0;
  --display-fvs: normal;
  --name-weight: 400;
  --name-style: normal;
  --body-weight: 300;
  --strong-weight: 500;
  --lh-body: 1.66;
  --fs-note: 1.125rem;
  --fs-note-sm: 1rem;
  --note-style: italic;
  --note-opacity: .9;
  --ill-w: .9;
  --ill-filter: url(#bleed);
  --rays: .35;
  --snow: .4;
  --grain: .3;
  --wash: 0;
}

/* ---------- Direction 3: Carta nautica (nautical chart) ---------- */
[data-theme="carta"] {
  --sky: #efe3bd;
  --sky-ink: #16262f;
  --w0: #d6ecec; --w1: #acd7dc; --w2: #7fbccb;
  --w3: #2f6886; --w4: #22536f; --w5: #11324a;
  --ink-dark: #16262f;
  --ink-light: #f4f1e6;
  --bar-shallow: var(--ink-dark);

  --leaf: #5d8a57;
  --leaf-far: #87ab7c;
  --animal: #93a7ae;
  --whale: #2b3b46;
  --pale: #e8ece6;
  --shell: #a48a72;
  --sand: #e3d4a6;
  --rock: #4d5d55;
  --gorgo: #c22a3f;
  --buoy: #e0a21c;
  --ill-stroke: #16262f;
  --detail: #16262f;
  --vein: 0;

  --paper: #f7f5ec;
  --paper-ink: #16262f;
  --tag-bg: #f7f5ec;
  --tag-ink: #16262f;
  --rope-a: #16262f;
  --rope-b: #f4f1e6;
  --name-water: #1d5a73;

  --f-display: "Bodoni Moda", "Didot", serif;
  --f-body: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;
  --f-note: "Bodoni Moda", "Didot", serif;
  --display-weight: 500;
  --display-track: -0.01em;
  --display-fvs: "opsz" 96;
  --name-weight: 500;
  --name-style: normal;
  --body-weight: 400;
  --strong-weight: 600;
  --lh-body: 1.55;
  --fs-note: 1rem;
  --fs-note-sm: .9375rem;
  --note-style: italic;
  --note-opacity: 1;
  --ill-w: .9;
  --ill-filter: none;
  --rays: 0;
  --snow: 0;
  --grain: .1;
  --wash: 0;
  --stepped: 1;
}

/* ---------- Base ---------- */
/* clip, not hidden: on <body>, hidden turns it into a scroll container of its own, and the
   scroll-driven parallax would then follow a box that never scrolls */
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; overflow-x: clip; }
body {
  margin: 0;
  position: relative;
  overflow-x: clip;
  background: var(--sky);
  color: var(--ink-dark);
  font-family: var(--f-body);
  font-size: var(--fs-body);
  font-weight: var(--body-weight);
  line-height: var(--lh-body);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
main { position: relative; z-index: 2; }

h1, h2, h3, h4 { text-wrap: balance; }
h2 {
  font-family: var(--f-display);
  font-weight: var(--display-weight);
  font-size: var(--fs-h2);
  font-variation-settings: var(--display-fvs);
  letter-spacing: var(--display-track);
  line-height: 1.04;
  margin: 0 0 .55em;
}
h3 {
  font-family: var(--f-display);
  font-weight: var(--display-weight);
  font-size: var(--fs-h3);
  line-height: 1.2;
  margin: 0 0 1.1rem;
}
h4 {
  font-family: var(--f-body);
  font-size: var(--fs-body);
  font-weight: var(--strong-weight);
  line-height: 1.3;
  margin: 0 0 .2rem;
}
p { margin: 0 0 1em; max-width: var(--measure); text-wrap: pretty; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .18em; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; border-radius: 2px; }

.note {
  font-family: var(--f-note);
  font-size: var(--fs-note);
  font-style: var(--note-style);
  font-weight: 400;
  line-height: 1.12;
  opacity: var(--note-opacity);
}
.note i { font-style: inherit; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: #fff; color: #000; padding: 8px 12px;
}
.skip:focus { top: 12px; }

.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- The sea ----------
   One viewport-sized layer fixed behind the page. main.js repaints its gradient
   for the depth you're at, so there is no giant element to tile into seams. */
.sea {
  position: fixed; inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.sea > * { position: absolute; inset: 0; }
.water { background: var(--w2); }
/* watercolour blooms, sketchbook only; main.js slides them with the page on the compositor */
.wash {
  display: none;
  bottom: -1000px;
  opacity: var(--wash);
  will-change: transform;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='1000' height='1000'><filter id='w' x='0' y='0' width='1' height='1'><feTurbulence type='fractalNoise' baseFrequency='.005' numOctaves='3' seed='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  1.6 0 0 0 -.62'/></filter><rect width='100%' height='100%' filter='url(%23w)'/></svg>");
  background-size: 1000px 1000px;
}
/* plain transparency, not a blend mode: blending a full-screen layer redoes the whole screen every frame */
[data-theme="taccuino"] .wash { display: block; opacity: calc(var(--wash) * .4); }
.rays {
  left: -10%; right: -10%;
  opacity: calc(var(--rays) * var(--light, 1) * .5);
  filter: blur(5px);
  will-change: transform;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 95%);
          mask-image: linear-gradient(to bottom, #000 0%, transparent 95%);
  background:
    linear-gradient(104deg, transparent 8%, rgba(255,255,255,.55) 10%, transparent 14%),
    linear-gradient(98deg, transparent 22%, rgba(255,255,255,.35) 25%, transparent 31%),
    linear-gradient(108deg, transparent 46%, rgba(255,255,255,.5) 48.5%, transparent 52%),
    linear-gradient(101deg, transparent 62%, rgba(255,255,255,.3) 66%, transparent 73%),
    linear-gradient(106deg, transparent 82%, rgba(255,255,255,.45) 84.5%, transparent 88%);
}
.snow {
  bottom: -640px;
  opacity: calc(var(--snow) * var(--dark, 0));
  background-size: 640px 640px;
  will-change: transform;
}
.grain {
  position: fixed; inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: calc(var(--grain) * .8);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n' x='0' y='0' width='1' height='1'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .1  0 0 0 0 .12  0 0 0 0 .14  0 0 0 .7 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- The line ---------- */
.rope {
  position: absolute;
  z-index: 3;
  left: calc(var(--rope-x) - 1.5px);
  top: var(--wl);
  height: 700vh;
  width: 3px;
  background: repeating-linear-gradient(160deg, var(--rope-a) 0 3px, var(--rope-b) 3px 6px);
}
.tick {
  position: absolute;
  left: -5px;
  width: 13px; height: 3px;
  margin-top: -1.5px;
  background: var(--rope-a);
  box-shadow: 0 0 0 1px var(--rope-b);
}
.tick span {
  position: absolute;
  left: 20px; top: 50%;
  transform: translateY(-52%);
  white-space: nowrap;
  font-family: var(--f-note);
  font-style: var(--note-style);
  font-size: var(--fs-note-sm);
  line-height: 1;
  color: var(--ink-dark);
}
.tick.deep span { color: var(--ink-light); }
.weight {
  position: absolute; left: 50%; bottom: -14px;
  width: 16px; height: 16px; margin-left: -8px;
  border-radius: 50%;
  background: var(--rope-a);
  box-shadow: 0 0 0 1.5px var(--rope-b);
}

/* ---------- Fixed bar: wordmark and dive computer ---------- */
.bar {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 30;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 18px 22px 0 var(--col-x);
  pointer-events: none;
  color: var(--sky-ink);
  transition: color .5s ease;
}
html[data-zone="shallow"] .bar { color: var(--bar-shallow); }
html[data-zone="deep"] .bar { color: var(--ink-light); }
.bar a { pointer-events: auto; }
html:not([data-zone="air"]) .mark { opacity: 0; pointer-events: none; }
.mark {
  display: block;
  width: 44px; height: 44px;
  margin: -6px 0 0 -4px;
  color: inherit;
  transition: opacity .4s ease;
}
.mark svg { display: block; width: 100%; height: 100%; }
.lang {
  display: flex;
  gap: 2px;
  margin: .35rem 1.25rem 0 auto;
  pointer-events: auto;
}
.lang button {
  font: inherit;
  font-family: var(--f-body);
  font-size: .8125rem;
  letter-spacing: .04em;
  color: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: .25em .7em;
  cursor: pointer;
  opacity: .7;
}
.lang button:hover { opacity: 1; }
.lang button[aria-pressed="true"] { border-color: currentColor; opacity: 1; }
.gauge { text-align: right; line-height: 1; text-shadow: var(--halo, none); }
.gauge-depth {
  font-family: var(--f-display);
  font-weight: var(--display-weight);
  font-size: clamp(2rem, 3.6vw, 3rem);
  font-variant-numeric: tabular-nums lining-nums;
}
.gauge .unit { font-size: .42em; margin-left: .18em; }
.gauge-breath { display: block; margin-top: .3rem; font-size: var(--fs-note-sm); }

/* ---------- Hero: the surface ---------- */
.hero {
  position: relative;
  height: 100vh;
  min-height: 560px;
  color: var(--sky-ink);
  /* the sky hides the fixed sea down to just under the swell */
  background: linear-gradient(to bottom, var(--sky) calc(var(--wl) + 8px), transparent calc(var(--wl) + 8px));
}
@supports (height: 1svh) { .hero { height: 100svh; } }

.coast {
  position: absolute;
  right: 2vw;
  top: calc(var(--wl) - min(11vw, 120px));
  width: min(46vw, 680px);
  height: min(11vw, 120px);
  --ink: var(--sky-ink);
  --ill-stroke: var(--sky-ink);
}
.coast-note {
  position: absolute;
  right: 4vw;
  top: calc(var(--wl) - min(11vw, 120px) - 1.4rem);
  margin: 0;
  color: var(--sky-ink);
  transform: rotate(-2deg);
}

.name {
  position: absolute;
  z-index: 2;
  left: calc(var(--col-x) - .06em);
  top: calc(var(--wl) - 1.56 * var(--name-size));
  margin: 0;
  font-family: var(--f-display);
  font-weight: var(--name-weight);
  font-style: var(--name-style);
  font-size: var(--name-size);
  font-variation-settings: var(--display-fvs);
  letter-spacing: -0.025em;
  line-height: 1;
}
.name .ln { display: block; }
.name-air {
  display: block;
  color: var(--sky-ink);
  clip-path: inset(0 0 calc(100% - 1.56em) 0);
}
.name-water {
  position: absolute; inset: 0;
  display: block;
  color: var(--name-water);
  clip-path: inset(1.56em 0 0 0);
  filter: url(#refract);
}

.waterline {
  position: absolute;
  z-index: 1;
  left: 0;
  top: calc(var(--wl) - 12px);
  width: 100%;
  height: 40px;
  overflow: hidden;
}
.wave {
  position: absolute;
  left: 0; top: 0;
  width: 200%; height: 100%;
}
.wave-back { top: -5px; opacity: .45; }
.wb-fill { fill: var(--w0); }
.wl-fill { fill: var(--w0); }
.wl-stroke {
  fill: none;
  stroke: var(--sky-ink);
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
[data-theme="cianotipia"] .wl-stroke { stroke: none; }
[data-theme="taccuino"] .wl-stroke { stroke-width: 1.8; }

.buoy {
  position: absolute;
  z-index: 2;
  left: calc(var(--rope-x) - 22px);
  top: calc(var(--wl) - 22px);
  width: 44px; height: 34px;
  --ink: var(--sky-ink);
  transform-origin: 50% 70%;
}
.buoy .buoy-shell { fill: var(--buoy); }

.under {
  position: absolute;
  z-index: 2;
  left: var(--col-x);
  right: 24px;
  top: calc(var(--wl) + max(.64 * var(--name-size), 3.5rem));
  --ink: var(--ink-dark);
  color: var(--ink);
}
.intro { font-size: var(--fs-lead); line-height: 1.45; max-width: 26rem; }
.cue { display: flex; align-items: flex-start; gap: .5rem; margin-top: 1.5rem; }
.cue svg {
  width: 16px; height: 28px; margin-top: .2rem;
  fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Zones ---------- */
.zone {
  position: relative;
  padding: 14vh 0 10vh;
  --ink: var(--ink-dark);
  color: var(--ink);
}
.zone[data-z="3"], .zone[data-z="4"], .zone[data-z="5"] {
  --ink: var(--ink-light);
  color: var(--ink);
}
[data-theme="cianotipia"] .zone,
[data-theme="cianotipia"] .under { --ink: var(--ink-light); }

.col {
  position: relative;
  margin-left: var(--col-x);
  margin-right: 24px;
  max-width: var(--measure);
}
.phase {
  position: absolute;
  right: calc(100% + var(--gap) + 14px);
  top: .55rem;
  width: max-content;
  max-width: calc(var(--rope-x) - 18px);
  margin: 0;
  text-align: right;
  transform: rotate(-4deg);
  transform-origin: right center;
}

/* ---------- Illustrations ---------- */
.ill { display: block; overflow: visible; filter: var(--ill-filter); }
:where(.ill, symbol) .body,
:where(.ill, symbol) .leaf {
  stroke: var(--ill-stroke, var(--ink));
  stroke-width: var(--ill-w);
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
:where(.ill, symbol) .line, .ill .vein, .ill .rhizome {
  fill: none;
  stroke: var(--ill-stroke, var(--ink));
  stroke-width: var(--ill-w);
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
:where(.ill, symbol) .line.thin { stroke-width: calc(var(--ill-w) * .6); opacity: .7; }
:where(.ill, symbol) .line.in { stroke: var(--detail, var(--ill-stroke, var(--ink))); }
:where(.ill, symbol) .dot { fill: var(--detail, var(--ill-stroke, var(--ink))); }
:where(.ill, symbol) .dolphin { fill: var(--animal); }
:where(.ill, symbol) .whale { fill: var(--whale); }
:where(.ill, symbol) .pale { fill: var(--pale); }
:where(.ill, symbol) .shell { fill: var(--shell); }
:where(.ill, symbol) .sand { fill: var(--sand); }
:where(.ill, symbol) .rock { fill: var(--rock); }
:where(.ill, symbol) .bell, .ill .arm, :where(.ill) .hull { fill: var(--animal); }
:where(.ill) .sail { fill: var(--pale); }
:where(.ill, symbol) .buoy-shell { stroke: var(--ill-stroke, var(--ink)); }

/* dolphins, crossing as you pass */
.pod { margin: 8vh 0 0; }
.pod svg {
  width: min(1000px, 94vw);
  margin-left: auto;
  transform: translateX(calc((var(--p, .5) - .5) * 28vw));
  will-change: transform;
  filter: none;
}
.pod figcaption { margin: .5rem 24px 0 var(--col-x); transform: rotate(-1.5deg); }

/* meadow */
.work { margin-top: 9vh; }
.work-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.4rem; }
.work-list p { margin: 0; }

.meadow-scene { position: relative; margin-top: 6vh; }
.meadow-layers { position: relative; height: clamp(320px, 40vw, 560px); }
.meadow-layers > canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.meadow-svg { filter: none; }
.meadow-layers .sway {
  transform-origin: 50% 100%;
  will-change: transform;
  animation: sway var(--sway-t, 7s) ease-in-out var(--sway-d, 0s) infinite alternate;
}
.meadow-scene:not(.in-view) .sway { animation-play-state: paused; }
.meadow-svg .leaf { fill: var(--leaf); }
.meadow-svg .far .leaf { fill: var(--leaf-far); stroke-opacity: .45; }
.meadow-svg .vein { opacity: var(--vein); stroke-width: .6; }
.meadow-svg .seabed { fill: var(--seabed, var(--sand)); }
.meadow-svg .sheath { fill: var(--sheath, #5b4630); opacity: .7; }
.ill .rock-edge { stroke-width: calc(var(--ill-w) * 1.2); }
.ill .rock { stroke: none; }
@keyframes sway {
  from { transform: skewX(var(--sway-a, 2deg)); }
  to   { transform: skewX(calc(var(--sway-a, 2deg) * -1)); }
}
.facts { position: absolute; inset: 0; z-index: 1; margin: 0; padding: 0; list-style: none; pointer-events: none; }
.facts li {
  position: absolute;
  left: var(--x); top: var(--y);
  max-width: 11em;
  transform: rotate(var(--r));
}

/* humpback, gliding the other way */
.whale { margin: 0 0 6vh; }
.whale svg {
  width: min(1180px, 120vw);
  margin-left: 12vw;
  transform: translateX(calc((.5 - var(--p, .5)) * 22vw));
  will-change: transform;
  filter: none;
}
.whale figcaption { margin: .25rem 24px 0 auto; max-width: 22em; text-align: right; transform: rotate(1.5deg); padding-right: 4vw; }

/* the heading drops letter by letter as you sink past it */
.falling span {
  display: inline-block;
  transform: translateY(calc(var(--i) / var(--n, 8) * clamp(0, (var(--p, .5) - .25) * 2, 1) * .7em));
}

/* Where the browser supports scroll-driven animations, the parallax is tied straight to the
   scroll position on the compositor: no JavaScript, no lag behind the page. main.js only
   steps in for browsers without it. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .pod { view-timeline-name: --pod; }
    .pod svg { animation: pod-drift linear both; animation-timeline: --pod; }
    .whale { view-timeline-name: --whale; }
    .whale svg { animation: whale-drift linear both; animation-timeline: --whale; }
    .falling { view-timeline-name: --fall; }
    .falling span { animation: fall linear both; animation-timeline: --fall; animation-range: cover 25% cover 75%; }
  }
}
@keyframes pod-drift { from { transform: translateX(-14vw); } to { transform: translateX(14vw); } }
@keyframes whale-drift { from { transform: translateX(11vw); } to { transform: translateX(-11vw); } }
@keyframes fall { from { transform: translateY(0); } to { transform: translateY(calc(var(--i) / var(--n, 8) * .7em)); } }

/* MEDSEA, where she works */
.org {
  display: inline-flex;
  align-items: center;
  gap: .8rem;
  margin-top: .5rem;
  color: inherit;
  text-decoration: none;
  font-family: var(--f-display);
  font-size: 1.0625rem;
  line-height: 1.25;
}
.org img { width: 48px; height: 48px; flex: none; border-radius: 50%; }
.org span { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }
.org:hover span { text-decoration-thickness: 2px; }
.write .org { margin-top: 2.5rem; }

/* il viaggio delle balene: an expedition log beside the hydrophone */
.split {
  display: grid;
  grid-template-columns: minmax(0, 34rem) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
  margin: 0 24px 0 var(--col-x);
}
.split .col { margin: 0; }
.hydrophone { margin: 0; max-width: 420px; justify-self: center; }
.hydrophone svg { width: 100%; height: auto; }
.hydrophone figcaption { text-align: center; margin-top: .4rem; }
.log {
  margin: 1.75rem 0 1.25rem;
  padding: 1rem 0 0;
  border-top: 1px solid color-mix(in srgb, currentColor 35%, transparent);
  display: grid;
  gap: .55rem;
}
.log div { display: grid; grid-template-columns: 8.5rem 1fr; gap: 1rem; }
.log dt { font-family: var(--f-note); font-style: var(--note-style); font-size: var(--fs-note-sm); opacity: .85; }
.log dd { margin: 0; }

/* the bottom */
.bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 34rem) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: end;
  margin: 0 24px 0 var(--col-x);
}
.bottom-grid .col { margin: 0; }
.gorgonian { margin: 0; }
.gorgonian svg {
  width: 100%; height: auto;
  -webkit-mask-image: radial-gradient(ellipse 58% 64% at 52% 46%, #000 58%, transparent 100%);
          mask-image: radial-gradient(ellipse 58% 64% at 52% 46%, #000 58%, transparent 100%);
}
.pod .far-one { opacity: .7; }
.gorgonian .fan { fill: var(--gorgo); stroke: var(--gorgo); stroke-linecap: round; transition: filter .9s ease; filter: saturate(0) brightness(.6); }
[data-theme="cianotipia"] .gorgonian .fan { filter: saturate(0) brightness(2.2); }
.gorgonian .fan path { fill: none; }
.gorgonian .glow { opacity: 0; transition: opacity .9s ease; }
.gorgonian.lit .fan { filter: none; }
.gorgonian.lit .glow { opacity: 1; }
.gorgonian figcaption { text-align: right; margin-top: .4rem; }

.torch, .ascend {
  font: inherit;
  font-size: 1rem;
  color: inherit;
  background: transparent;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  padding: .7em 1.2em;
  cursor: pointer;
  transition: background-color .3s ease, color .3s ease;
}
.torch:hover, .ascend:hover { background: color-mix(in srgb, currentColor 14%, transparent); }
.torch.on { background: #fff6e4; color: #1d1a14; border-color: #fff6e4; }

.contact { margin-top: 18vh; }
/* the tag hangs off the line at 42 m */
.tag {
  position: relative;
  margin: 1rem 0 0;
  padding: 1.1rem 1.4rem 1.2rem;
  background: var(--tag-bg);
  color: var(--tag-ink);
  border-radius: 3px;
}
.tag::before {
  content: "";
  position: absolute;
  right: 100%; top: 2rem;
  width: calc(var(--gap) + 2px);
  border-top: 2px solid var(--rope-b);
}
.tag ul { margin: 0; padding: 0; list-style: none; display: grid; gap: .45rem; }
.tag li { line-height: 1.35; }

/* the way back up */
.ascent-zone { padding-bottom: 18vh; }
.resurface { position: relative; z-index: 1; height: 40px; background: var(--sky); }
.resurface .waterline { position: absolute; top: 0; left: 0; }
.resurface .buoy { top: 0; }
.wu-fill, .wub-fill { fill: var(--w0); }
.wu-stroke { fill: none; stroke: var(--sky-ink); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
[data-theme="cianotipia"] .wu-stroke { stroke: none; }

/* around the sea: back on land, on paper */
.land, .ascent {
  position: relative;
  background: var(--sky);
  --ink: var(--sky-ink);
  color: var(--ink);
  --pale: color-mix(in srgb, var(--sky-ink) 12%, transparent);
  --animal: color-mix(in srgb, var(--sky-ink) 12%, transparent);
  --detail: var(--sky-ink);
  --ill-stroke: var(--sky-ink);
}
.land { padding: 12vh 0 4vh; }
.land .ill .board, .land .ill .bag { fill: var(--animal); }
.land .ill .sail { fill: var(--pale); }
.pastimes {
  list-style: none;
  margin: 6vh 24px 0 var(--col-x);
  padding: 0;
  max-width: 60rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: clamp(2rem, 4vw, 3.5rem);
}
.pastimes svg { width: 160px; height: auto; margin-bottom: 1rem; }
.pastimes h3 { margin-bottom: .35rem; }
.pastimes p { margin: 0; }
.write { margin-top: 14vh; }
.links .email { overflow-wrap: break-word; }
.links { display: flex; flex-wrap: wrap; gap: .5rem 1.75rem; font-family: var(--f-display); font-size: var(--fs-lead); }
.ascent { padding: 8vh 0 14vh; }
.small { margin-top: 1.25rem; font-size: .875rem; line-height: 1.5; opacity: .8; }

/* ascent bubbles */
.bubble {
  position: fixed;
  z-index: 35;
  left: var(--x); bottom: -24px;
  width: var(--s); height: var(--s);
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .85);
  background: radial-gradient(circle at 32% 30%, rgba(255,255,255,.7) 0 12%, transparent 30%);
  pointer-events: none;
  animation: rise var(--d) cubic-bezier(.4, 0, .9, .6) forwards;
}
@keyframes rise {
  to { transform: translate(var(--dx), -112vh); opacity: .25; }
}

/* ---------- Direction switcher (proposal tool) ---------- */
.styles {
  position: fixed;
  right: 16px; bottom: 16px;
  z-index: 50;
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
  max-width: min(440px, calc(100vw - 32px));
  padding: 6px;
  background: rgba(248, 250, 249, .94);
  color: #14232c;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 18, 36, .22);
  font: 500 13px/1.25 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
}
.styles-label { padding: 0 8px 0 6px; color: #51616a; font-weight: 400; }
.styles button {
  font: inherit; color: inherit;
  border: 0; background: transparent;
  padding: 7px 10px; border-radius: 8px; cursor: pointer;
}
.styles button:hover { background: rgba(20, 35, 44, .08); }
.styles button[aria-pressed="true"] { background: #14232c; color: #f8faf9; }
.styles-desc { flex-basis: 100%; padding: 4px 6px 2px; color: #51616a; font-weight: 400; }

/* ---------- Load sequence: breaking the surface ---------- */
@media (prefers-reduced-motion: no-preference) {
  .wl-stroke { stroke-dashoffset: 1; animation: draw 1.6s cubic-bezier(.3, .6, .2, 1) .1s forwards; }
  .name-air, .name-water { animation: fade 1.4s ease .35s both; }
  .under, .coast, .coast-note { animation: fade 1.1s ease 1.1s both; }

  /* the surface keeps moving: two swells at different speeds, the buoy riding them */
  .wave-front { animation: swell 16s linear infinite; }
  .wave-back { animation: swell 27s linear infinite reverse; }
  .buoy { animation: fade 1.1s ease 1.1s both, bob 5.3s ease-in-out infinite; }
  .rays { animation: shimmer 11s ease-in-out infinite alternate; }
  .wave, .buoy { will-change: transform; }
  .hero:not(.in-view) :is(.wave, .buoy), .resurface:not(.in-view) :is(.wave, .buoy) { animation-play-state: paused; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes swell { to { transform: translateX(-50%); } }
@keyframes bob {
  0%, 100% { transform: translateY(-2px) rotate(-5deg); }
  50% { transform: translateY(3px) rotate(4deg); }
}
@keyframes shimmer {
  from { transform: translateX(-2%) skewX(-3deg); }
  to   { transform: translateX(2%) skewX(3deg); }
}

/* ---------- Small screens ---------- */
@media (max-width: 760px) {
  :root { --rope-x: 16px; --gap: 22px; --fs-h2: 2.25rem; }
  .bar { padding-left: var(--col-x); padding-right: 16px; }
  .phase {
    position: static;
    width: auto; max-width: none;
    margin: 0 0 .35rem;
    text-align: left;
    transform: none;
  }
  .tick span { display: none; }
  .coast { width: 86vw; right: 2vw; top: calc(var(--wl) - 22vw); height: 22vw; }
  .coast-note { display: none; }
  .facts {
    position: static;
    display: grid; gap: .6rem;
    margin: 0 24px 1.5rem var(--col-x);
  }
  .facts li { position: static; max-width: none; transform: none; }
  .whale svg { width: 150vw; margin-left: 4vw; }
  .whale figcaption, .gorgonian figcaption { text-align: left; margin-left: var(--col-x); transform: none; }
  .bottom-grid, .split { grid-template-columns: 1fr; }
  .log div { grid-template-columns: 7rem 1fr; gap: .75rem; }
  .lang { margin-right: .75rem; }
  .styles { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  .styles-label { display: none; }
  .ascent { padding-bottom: 12vh; }
  .pastimes { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .meadow-layers .sway { animation: none; }
  .pod svg, .whale svg { transform: none; }
  .falling span { transform: translateY(calc(var(--i) / var(--n, 8) * .4em)); }
  .bubble { display: none; }
  .tag, .torch, .ascend, .bar, .gorgonian .fan, .gorgonian .glow { transition: none; }
}
