/* ==========================================================================
   Younes Essafouri — research portfolio
   Colours are semantic, borrowed from atmospheric charts:
     mist ............... the page (an overcast, slightly cool sky)
     ink ................ text
     atmo (sea-glass) ... the forecast field
     xai (ultramarine) .. explanations, attributions, links
     target (vermilion) . the forecast location
   ========================================================================== */

/* ---------- fonts (self-hosted, SIL OFL) ---------- */
@font-face { font-family: "Newsreader"; src: url("../fonts/newsreader-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("../fonts/newsreader-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("../fonts/instrument-sans.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face {
  font-family: "IBM Plex Mono"; src: url("../fonts/IBMPlexMono-Regular-Latin1.woff2") format("woff2"); font-weight: 400; font-display: swap;
  unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A, U+201C-201E, U+2020-2022, U+2026, U+2030, U+2039-203A, U+2044, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: "IBM Plex Mono"; src: url("../fonts/IBMPlexMono-Regular-Pi.woff2") format("woff2"); font-weight: 400; font-display: swap;
  unicode-range: U+2000-200D, U+2010-2012, U+2032-2033, U+2070, U+2074-2079, U+2080-2089, U+2190-2199, U+2202, U+2206, U+2248, U+2260, U+2264-2265;
}
@font-face {
  font-family: "IBM Plex Mono"; src: url("../fonts/IBMPlexMono-Medium-Latin1.woff2") format("woff2"); font-weight: 500; font-display: swap;
  unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A, U+201C-201E, U+2020-2022, U+2026, U+2030, U+2039-203A, U+2044, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: "IBM Plex Mono"; src: url("../fonts/IBMPlexMono-Medium-Pi.woff2") format("woff2"); font-weight: 500; font-display: swap;
  unicode-range: U+2000-200D, U+2010-2012, U+2032-2033, U+2070, U+2074-2079, U+2080-2089, U+2190-2199, U+2202, U+2206, U+2248, U+2260, U+2264-2265;
}

/* ---------- tokens ---------- */
:root {
  color-scheme: light;

  --mist: #e8edef;
  --mist-deep: #dde5e8;
  --ink: #0e1a24;
  --ink-2: #34444f;
  --mute: #56656e;
  --rule: rgba(14, 26, 36, 0.13);

  --atmo: #4e8490;
  --atmo-ink: #2b4d57;
  --wash-lo: #d3e0e6;
  --wash-hi: #eef0ea;
  --xai: #2f3fcf;
  --xai-soft: rgba(47, 63, 207, 0.1);
  --target: #e0532a;

  --dusk: #f0e6dd;
  --dusk-deep: #e6d8cb;
  --vinyl: #15171a;

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --gutter: clamp(18px, 4.4vw, 72px);
  --gap: clamp(12px, 1.7vw, 28px);
  --max: 1440px;
  --ease: cubic-bezier(0.22, 0.8, 0.26, 1);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0; background: var(--mist); color: var(--ink);
  font-family: var(--sans); font-size: 17px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
::selection { background: var(--xai); color: #fff; }
:focus-visible { outline: 2px solid var(--xai); outline-offset: 3px; border-radius: 2px; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--ink); color: var(--mist); padding: 10px 14px; font-family: var(--mono); font-size: 13px; text-decoration: none; }
.skip-link:focus { top: 12px; }

.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }

/* links: mono annotations that underline on hover */
.links { display: flex; flex-wrap: wrap; gap: 6px 20px; font-family: var(--mono); font-size: 13px; }
.links a, .links button, .text-link {
  appearance: none; border: 0; background: none; padding: 0 0 1px; cursor: pointer;
  font-family: var(--mono); font-size: 13px; color: inherit; text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px; background-repeat: no-repeat; background-position: 0 100%;
  transition: background-size .35s var(--ease), color .2s;
}
.links a:hover, .links button:hover, .text-link:hover { background-size: 100% 1px; color: var(--xai); }
.text-link::after { content: " →"; }
.label { font-family: var(--mono); font-size: 11.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--mute); font-weight: 400; }

/* ==========================================================================
   HERO — identity over the forecast field
   ========================================================================== */
.hero {
  position: relative;
  height: clamp(640px, 100svh, 940px);
  isolation: isolate;
}
.field-stage {
  position: absolute; inset: 0; z-index: -1;
  --focus-x: .74; --focus-y: .44; --span: 11.5; --interactive-from: .4;
  -webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,.14) 0%, rgba(0,0,0,.22) 24%, #000 52%), linear-gradient(180deg, #000 78%, transparent 100%);
  mask-image: linear-gradient(90deg, rgba(0,0,0,.14) 0%, rgba(0,0,0,.22) 24%, #000 52%), linear-gradient(180deg, #000 78%, transparent 100%);
  -webkit-mask-composite: source-in; mask-composite: intersect;
  touch-action: pan-y;
}
.field-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.field-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.hero-id {
  position: relative; height: 100%;
  display: flex; flex-direction: column; justify-content: center;
  pointer-events: none;
}
.hero-id a, .hero-id button { pointer-events: auto; }
.hero-kicker { margin-bottom: clamp(18px, 3vh, 30px); }
.hero-kicker b { color: var(--ink); font-weight: 400; }
.hero-name {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(3.3rem, 7.4vw, 7.6rem); line-height: .88; letter-spacing: -0.03em;
  margin-left: -0.04em;
}
.hero-field {
  margin-top: clamp(20px, 3vh, 30px);
  font-weight: 500; font-size: clamp(1.25rem, 1.8vw, 1.75rem); line-height: 1.15; letter-spacing: -0.012em;
}
.hero-intro {
  margin-top: 18px; max-width: 36ch;
  font-family: var(--serif); font-size: clamp(1.12rem, 1.42vw, 1.38rem); line-height: 1.38; color: var(--ink-2);
  text-wrap: pretty;
}
.hero-intro em, .about-lead mark { font-style: italic; color: var(--xai); background: none; }
.hero-id .links { margin-top: clamp(24px, 4vh, 40px); }

/* the few controls, bottom-right, over the field */
.field-ui {
  position: absolute; right: max(var(--gutter), calc((100vw - var(--max)) / 2 + var(--gutter))); bottom: clamp(28px, 5vh, 52px);
  width: min(430px, 40vw);
  display: grid; gap: 14px;
}
.toggle { display: flex; gap: 22px; }
.toggle button {
  appearance: none; border: 0; background: none; cursor: pointer; padding: 0 0 6px;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--mute);
  background-image: linear-gradient(var(--ink), var(--ink)); background-size: 0 1.5px; background-repeat: no-repeat; background-position: 0 100%;
  transition: color .3s, background-size .45s var(--ease);
}
.toggle button:hover { color: var(--ink); }
.toggle button[aria-pressed="true"] { color: var(--ink); background-size: 100% 1.5px; }
.toggle button[data-field-view="explanation"] { background-image: linear-gradient(var(--xai), var(--xai)); }
.toggle button[data-field-view="explanation"][aria-pressed="true"] { color: var(--xai); }

.lead { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px; }
.lead input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 20px; margin: 0; background: transparent; cursor: ew-resize; position: relative; display: block;
}
.lead-axis { position: relative; }
.lead-dots {
  position: absolute; inset: 0 6.5px; display: flex; justify-content: space-between; align-items: center; pointer-events: none;
  background: linear-gradient(var(--rule), var(--rule)) 0 50% / 100% 1px no-repeat;
}
.lead-dots i { width: 3px; height: 3px; border-radius: 50%; background: var(--atmo-ink); }
.lead input[type="range"]::-webkit-slider-runnable-track { height: 20px; background: transparent; }
.lead input[type="range"]::-moz-range-track { height: 20px; background: transparent; }
.lead input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 13px; height: 13px; margin-top: 3.5px; position: relative;
  border-radius: 50%; border: 1.5px solid var(--xai); background: var(--mist); box-shadow: 0 0 0 3px var(--xai-soft);
}
.lead input[type="range"]::-moz-range-thumb {
  width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid var(--xai); background: var(--mist); box-shadow: 0 0 0 3px var(--xai-soft);
}
.lead output { font-family: var(--mono); font-size: 12.5px; color: var(--ink); min-width: 10ch; text-align: right; }
.lead output span { color: var(--mute); }
.field-cap { font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.field-cap em { font-family: var(--serif); font-size: 1.1rem; color: var(--ink); }
.field-cap .hint { display: block; margin-top: 4px; font-family: var(--mono); font-size: 11px; color: var(--mute); }
.field-cap button {
  appearance: none; border: 0; background: none; padding: 0; cursor: pointer; color: var(--xai);
  font-family: var(--mono); font-size: 11px; text-decoration: underline; text-underline-offset: 3px; margin-left: 6px;
}
.hint-touch { display: none; }
@media (hover: none) { .hint-touch { display: inline; } .hint-pointer { display: none; } }
html:not(.js) .field-ui .toggle, html:not(.js) .field-ui .lead, html:not(.js) .field-cap .hint { display: none; }

/* ==========================================================================
   THE FLOW — one continuous column after the hero
   ========================================================================== */
.flow { padding-top: clamp(40px, 7vw, 110px); }
.flow-row {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 8fr) minmax(0, 2fr);
  column-gap: var(--gap);
}
.flow-row > .label { padding-top: 6px; }
.flow-row + .flow-row { margin-top: clamp(72px, 10vw, 150px); }

/* publications: a clean list */
.pubs { counter-reset: pub; }
.pub { display: grid; grid-template-columns: 2.2rem minmax(0, 1fr); gap: 0 18px; padding: 26px 0 30px; }
.pub + .pub { border-top: 1px solid var(--rule); }
.pub-venue {
  writing-mode: vertical-rl; transform: rotate(180deg); justify-self: center; align-self: start;
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--mute);
  padding: 8px 4px; white-space: nowrap;
}
.pub-venue.is-accepted { color: var(--xai); background: var(--xai-soft); }
.pub-title { font-family: var(--sans); font-weight: 600; font-size: clamp(1.18rem, 1.7vw, 1.6rem); line-height: 1.2; letter-spacing: -0.014em; text-wrap: pretty; }
.pub-title a { text-decoration: none; }
.pub-title a:hover { color: var(--xai); }
.pub-authors { margin-top: 10px; font-size: 15.5px; color: var(--ink-2); line-height: 1.5; }
.pub-authors b { color: var(--ink); font-weight: 600; }
.pub-meta { margin-top: 4px; font-family: var(--mono); font-size: 12px; color: var(--mute); }
.pub-links { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 4px 0; font-family: var(--mono); font-size: 13px; color: var(--xai); }
.pub-links > * + *::before { content: "/"; color: var(--mute); margin: 0 10px; }
.pub-links a, .pub-links button {
  appearance: none; border: 0; background: none; padding: 0; cursor: pointer; font: inherit; color: var(--xai); text-decoration: none;
}
.pub-links a:hover, .pub-links button:hover { text-decoration: underline; text-underline-offset: 3px; }
.pub.is-talk .pub-title { font-weight: 500; font-size: clamp(1.02rem, 1.3vw, 1.18rem); }

/* footer: contact */
.site-foot { background: var(--dusk); padding-top: clamp(64px, 9vw, 130px); padding-bottom: 28px; }
.foot-mail {
  font-family: var(--serif); font-size: clamp(1.45rem, 3.3vw, 3.1rem); line-height: 1.1; letter-spacing: -0.02em;
  text-decoration: none; overflow-wrap: anywhere;
  background-image: linear-gradient(var(--xai), var(--xai)); background-size: 0% 2px; background-repeat: no-repeat; background-position: 0 100%;
  transition: background-size .5s var(--ease), color .2s;
}
.foot-mail:hover { color: var(--xai); background-size: 100% 2px; }
.site-foot .links { margin-top: 22px; }
.foot-meta {
  margin-top: clamp(48px, 7vw, 96px); padding-top: 16px; border-top: 1px solid var(--rule);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  font-family: var(--mono); font-size: 11.5px; color: var(--mute);
}
.foot-meta svg { width: 11px; height: 11px; vertical-align: -1px; margin-right: 6px; }
.foot-meta a { text-decoration: none; }
.foot-meta a:hover { color: var(--xai); }

.bib { margin-top: 14px; position: relative; }
.bib-copy {
  position: absolute; top: 8px; right: 8px; cursor: pointer;
  font-family: var(--mono); font-size: 11px; color: var(--ink-2);
  background: var(--mist); border: 1px solid var(--rule); border-radius: 2px; padding: 3px 8px;
}
.bib-copy:hover { color: var(--xai); }
.bib[hidden] { display: none; }
.bib pre { margin: 0; padding: 14px 16px; overflow-x: auto; background: var(--mist-deep); font-family: var(--mono); font-size: 12px; line-height: 1.6; }
.bib p { font-size: 15px; color: var(--ink-2); max-width: 64ch; }

/* ==========================================================================
   NAVIGATION — one page, four destinations
   ========================================================================== */
.topnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  transition: background-color .45s var(--ease), box-shadow .45s var(--ease);
}
.topnav-inner { display: flex; align-items: center; gap: 16px; padding-top: 14px; padding-bottom: 12px; }
.topnav-name {
  font-weight: 600; font-size: 14.5px; text-decoration: none; letter-spacing: -0.005em;
  opacity: 0; transform: translateY(-4px); pointer-events: none;
  transition: opacity .4s var(--ease), transform .4s var(--ease);
}
.topnav ul { display: flex; gap: 4px 24px; margin-left: auto; }
.topnav ul a { position: relative; font-size: 14px; color: var(--ink-2); text-decoration: none; padding: 4px 0; transition: color .25s; }
.topnav ul a:hover { color: var(--ink); }
.topnav ul a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1.5px; background: var(--target);
  transform: scaleX(0); transform-origin: left; transition: transform .45s var(--ease);
}
.topnav ul a.is-active { color: var(--ink); }
.topnav ul a.is-active::after { transform: scaleX(1); }
.topnav.is-scrolled {
  background: color-mix(in srgb, var(--mist) 84%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(1.1); backdrop-filter: blur(12px) saturate(1.1);
  box-shadow: 0 1px 0 var(--rule);
}
.topnav.is-scrolled.on-dusk { background: color-mix(in srgb, var(--dusk) 86%, transparent); }
.topnav.is-scrolled .topnav-name { opacity: 1; transform: none; pointer-events: auto; }

.pubs-more { grid-column: 2; margin-top: 12px; padding-left: calc(2.2rem + 18px); }

/* ==========================================================================
   ABOUT — warmer: the page turns from forecast to evening
   ========================================================================== */
.about {
  margin-top: clamp(96px, 13vw, 190px);
  padding-top: clamp(80px, 10vw, 150px);
  background: linear-gradient(180deg, var(--mist) 0, #ede9e5 160px, var(--dusk) 460px, var(--dusk) 100%);
}
.about-intro { display: grid; gap: 22px; }
.about-lead {
  font-family: var(--serif); font-size: clamp(1.5rem, 2.55vw, 2.4rem); line-height: 1.17; letter-spacing: -0.018em;
  max-width: 34ch; text-wrap: pretty;
}
.about-context { font-size: 15.5px; line-height: 1.55; color: var(--ink-2); max-width: 60ch; }
.about-line {
  margin-top: clamp(96px, 12vw, 170px); margin-left: calc((100% - 2 * var(--gap)) / 6 + var(--gap));
  font-family: var(--serif); font-size: clamp(1.6rem, 2.8vw, 2.6rem); line-height: 1.12; letter-spacing: -0.02em;
  max-width: 22ch; text-wrap: balance;
}

/* photographs + the atlas they belong to */
.notes {
  margin-top: clamp(52px, 7vw, 96px);
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: clamp(30px, 3.4vw, 50px);
  align-items: start;
}
.gallery { display: contents; }
.shot--tetouan  { grid-column: 1 / 5;  grid-row: 1 / 3; --ar: 3 / 5.3; }
.shot--lucerne  { grid-column: 5 / 8;  grid-row: 1; --ar: 4 / 5; margin-top: clamp(40px, 6vw, 88px); }
.shot--barcelona{ grid-column: 5 / 8;  grid-row: 2; --ar: 1 / 1; }
.shot--montreux { grid-column: 9 / 12; grid-row: 2; --ar: 3 / 4; margin-top: clamp(20px, 3vw, 44px); }
.atlas          { grid-column: 9 / 13; grid-row: 1; }

.shot { margin: 0; outline: none; --mx: 0; --my: 0; }
.shot-frame {
  overflow: hidden; background: var(--dusk-deep); border-radius: 2px;
  transition: transform .7s var(--ease), box-shadow .7s var(--ease);
}
.shot img {
  width: 100%; aspect-ratio: var(--ar, 4 / 5); object-fit: cover;
  transform: translate3d(calc(var(--mx) * -9px), calc(var(--my) * -9px), 0) scale(1.07);
  transition: transform .9s var(--ease), filter .6s;
  filter: saturate(.9) contrast(.98);
}
.shot:hover .shot-frame, .shot:focus-visible .shot-frame, .shot.is-lit .shot-frame {
  transform: translateY(-6px); box-shadow: 0 22px 40px -26px rgba(60, 35, 20, .55);
}
.shot:hover img, .shot.is-lit img { filter: saturate(1.02) contrast(1); }
.shot:focus-visible .shot-frame { outline: 2px solid var(--xai); outline-offset: 4px; }
.shot figcaption { margin-top: 12px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
.shot-place { position: relative; font-family: var(--serif); font-style: italic; font-size: 1.12rem; line-height: 1.2; }
.shot-place::before {
  content: ""; position: absolute; left: -16px; top: 50%; width: 9px; height: 9px; margin-top: -4px;
  background:
    linear-gradient(var(--target), var(--target)) 50% 0 / 1.3px 100% no-repeat,
    linear-gradient(var(--target), var(--target)) 0 50% / 100% 1.3px no-repeat;
  opacity: 0; transform: scale(.4); transition: opacity .4s, transform .5s var(--ease);
}
.shot:hover .shot-place::before, .shot.is-lit .shot-place::before, .shot:focus-visible .shot-place::before { opacity: 1; transform: none; }
.shot-meta { font-family: var(--mono); font-size: 10.5px; color: var(--mute); letter-spacing: .02em; }

.atlas { margin: 0; }
.atlas-map { display: block; width: 100%; height: auto; overflow: hidden; }
.atlas-land { fill: rgba(255, 255, 255, .5); }
.atlas-lake { fill: var(--dusk); }
.atlas-coast { fill: none; stroke: rgba(14, 26, 36, .42); stroke-width: 1; stroke-linejoin: round; }
.atlas-grat { fill: none; stroke: rgba(14, 26, 36, .2); stroke-width: 1; }
.atlas-route {
  fill: none; stroke: var(--target); stroke-width: 1.1; stroke-dasharray: 1.5 4; stroke-linecap: round;
  opacity: .32; transition: opacity .45s, stroke-width .45s;
}
.atlas-route.is-lit { opacity: 1; stroke-width: 1.6; }
.atlas-pt { cursor: default; }
.atlas-pt path { stroke: var(--ink); stroke-width: 1.2; transition: stroke .35s; }
.atlas-pt circle:not(.atlas-halo) { fill: var(--ink); }
.atlas-pt text, .atlas-home text { font-family: var(--serif); font-style: italic; font-size: 14px; fill: var(--ink-2); }
.atlas-pt text { opacity: .6; transition: opacity .35s; }
.atlas-halo { fill: var(--target); opacity: 0; transform: scale(.3); transform-box: fill-box; transform-origin: center; transition: opacity .45s, transform .6s var(--ease); }
.atlas-pt.is-lit .atlas-halo { opacity: .16; transform: scale(1.35); }
.atlas-pt.is-lit path { stroke: var(--target); }
.atlas-pt.is-lit text { opacity: 1; fill: var(--ink); }
.atlas-home path { stroke: var(--target); stroke-width: 1.6; }
.atlas-home circle { fill: var(--target); }
.atlas-home text { fill: var(--ink); font-size: 15px; }
.atlas figcaption { margin-top: 10px; font-family: var(--mono); font-size: 11px; color: var(--mute); }

/* books and records */
.leisure {
  margin-top: clamp(96px, 12vw, 170px);
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: 72px;
  align-items: end;
}
.shelf { grid-column: 1 / 5; margin: 0; }
.books {
  display: flex; align-items: flex-end; gap: 5px; height: 272px; padding: 0 0 0 6px;
  border-bottom: 2px solid var(--ink);
}
.book {
  position: relative; flex: none; width: var(--w); height: var(--h);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 16px 0 12px;
  background: var(--c); color: var(--t, #f6eee5); border-radius: 2px 2px 0 0; outline: none;
  box-shadow: inset -4px 0 0 rgba(0, 0, 0, .13), inset 3px 0 0 rgba(255, 255, 255, .07);
  transform-origin: 50% 100%; transition: transform .55s var(--ease), box-shadow .55s var(--ease);
}
.book::before, .book::after { content: ""; position: absolute; left: 0; right: 0; height: 1px; background: currentColor; opacity: .28; }
.book::before { top: 34px; } .book::after { bottom: 34px; }
.book-name { writing-mode: vertical-rl; transform: rotate(180deg); font-family: var(--serif); font-style: italic; font-size: 16.5px; white-space: nowrap; }
.book-mark { font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; opacity: .85; }
.book--lean { transform-origin: 0 100%; transform: rotate(-9deg); margin-left: 16px; }
.book:hover, .book:focus-visible { transform: translateY(-14px); box-shadow: inset -4px 0 0 rgba(0,0,0,.13), 0 16px 24px -18px rgba(40, 20, 10, .6); }
.book--lean:hover, .book--lean:focus-visible { transform: translateY(-14px) rotate(-4deg); }
.book:focus-visible { outline: 2px solid var(--xai); outline-offset: 3px; }
.shelf figcaption { margin-top: 16px; display: grid; gap: 8px; }
.shelf-detail { font-family: var(--mono); font-size: 12px; color: var(--ink); min-height: 1.5em; opacity: 0; transition: opacity .3s; }
.shelf-detail.is-on { opacity: 1; }
.shelf-note { font-family: var(--serif); font-style: italic; font-size: 1.08rem; line-height: 1.35; color: var(--ink-2); max-width: 34ch; }

.turntable { grid-column: 6 / 13; margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 clamp(40px, 5vw, 80px); align-items: center; }
.deck { position: relative; width: clamp(210px, 21vw, 290px); aspect-ratio: 1; margin-right: 14%; }
.deck::after {                                   /* a fixed sheen: the light doesn't turn with the record */
  content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: conic-gradient(from 200deg, transparent 0 8%, rgba(255,255,255,.1) 13%, transparent 19% 58%, rgba(255,255,255,.07) 63%, transparent 69%);
}
.record {
  position: absolute; inset: 0; border-radius: 50%; background: var(--vinyl);
  box-shadow: 0 26px 44px -30px rgba(40, 20, 5, .7);
  animation: spin 5.5s linear infinite; animation-play-state: paused;
}
.turntable.is-playing .record { animation-play-state: running; }
@keyframes spin { to { transform: rotate(360deg); } }
.record-grooves { display: block; width: 100%; height: 100%; }
.record-label {
  position: absolute; inset: 33.5%; border-radius: 50%; background: var(--target); color: #fff3ea;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; text-align: center;
}
.record-label span { font-family: var(--serif); font-style: italic; font-size: clamp(12px, 1.05vw, 14.5px); line-height: 1.05; max-width: 80%; }
.record-label small { font-family: var(--mono); font-size: 8.5px; letter-spacing: .1em; opacity: .8; }
.spindle { width: 7px; height: 7px; border-radius: 50%; background: var(--dusk); box-shadow: inset 0 1px 1px rgba(0,0,0,.35); }
.tonearm { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.tonearm-swing { transform-box: view-box; transform-origin: 108px 2px; transform: rotate(-24deg); transition: transform 1.2s var(--ease); }
.turntable.is-playing .tonearm-swing { transform: rotate(0deg); }
.tonearm-arm { fill: none; stroke: #74777c; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tonearm-head, .tonearm-weight { fill: var(--ink); }
.tonearm-base { fill: var(--dusk-deep); stroke: rgba(21, 23, 26, .45); stroke-width: .8; }
.tonearm-pin { fill: var(--ink); }

.tracks-wrap .label { display: block; margin-bottom: 10px; }
.tracks button {
  appearance: none; border: 0; background: none; cursor: pointer; width: 100%; text-align: left; color: var(--ink-2);
  display: grid; grid-template-columns: 2.2em 8.6em minmax(0, 1fr); align-items: center; gap: 14px;
  padding: 11px 0; border-bottom: 1px solid var(--rule);
}
.tracks li:first-child button { border-top: 1px solid var(--rule); }
.tracks .n { font-family: var(--mono); font-size: 11px; color: var(--mute); transition: color .3s; }
.tracks .t { font-family: var(--serif); font-style: italic; font-size: 1.16rem; line-height: 1.1; transition: color .3s; }
.tracks button:hover .t, .tracks button[aria-pressed="true"] .t { color: var(--ink); }
.tracks button[aria-pressed="true"] .n { color: var(--target); }
@property --p { syntax: "<percentage>"; inherits: true; initial-value: 0%; }
.wave {
  position: relative; display: flex; align-items: center; gap: 2px; height: 26px; color: var(--ink);
  --p: 0%;
  -webkit-mask-image: linear-gradient(90deg, #000 var(--p), rgba(0,0,0,.26) var(--p)); mask-image: linear-gradient(90deg, #000 var(--p), rgba(0,0,0,.26) var(--p));
}
.wave i { flex: 1 1 0; min-width: 1.5px; max-width: 3px; height: calc(var(--v) * 100%); background: currentColor; border-radius: 1px; }
.tracks button:hover .wave { color: var(--xai); }
.tracks li.is-playing-track .wave { animation: play 26s linear forwards; }
.tracks li.is-playing-track .wave::after {
  content: ""; position: absolute; top: -3px; bottom: -3px; left: var(--p); width: 1.5px; background: var(--target);
}
@keyframes play { from { --p: 0%; } to { --p: 100%; } }


/* ==========================================================================
   TALKS & TEACHING
   ========================================================================== */
.tt { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 36px clamp(32px, 5vw, 80px); }
.tt-item { padding-top: 18px; border-top: 1px solid var(--rule); }
.tt-kind { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
.tt-title { margin-top: 14px; font-family: var(--serif); font-weight: 400; font-size: clamp(1.35rem, 2vw, 1.8rem); line-height: 1.16; letter-spacing: -0.015em; text-wrap: pretty; }
.tt-teach .tt-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.tt-num { font-size: 2.3em; line-height: .85; letter-spacing: -0.035em; color: var(--ink); }
.tt-rug:empty { display: none; }
.tt-rug { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 6px 5px; max-width: 460px; }
.tt-rug span { display: inline-flex; gap: 2px; }                /* one practical session */
.tt-rug i { width: 1.5px; height: 14px; background: var(--atmo-ink); opacity: .5; }
.tt-where { margin-top: 14px; font-size: 15px; line-height: 1.55; color: var(--ink-2); max-width: 46ch; }

/* ==========================================================================
   PATH — scrolling moves a cursor through the stages
   ========================================================================== */
.path { margin: clamp(88px, 11vw, 150px) 0 0; }
.path .label { display: block; margin-bottom: 26px; }
.path-axis { position: relative; }
.path-stages { position: relative; padding-top: 168px; display: grid; gap: 26px; }
.stage-bar {
  appearance: none; background: none; border: 0; cursor: pointer; padding: 0 0 7px;
  position: absolute; top: calc(var(--lane) * 40px + 4px);
  left: calc((var(--a) - 2022) / 7 * 100%); width: calc((var(--b) - var(--a)) / 7 * 100%);
  border-bottom: 2px solid var(--ink); text-align: left; white-space: nowrap;
  font-family: var(--sans); font-size: 13.5px; line-height: 1.2; color: var(--ink);
  transition: color .45s, border-color .45s, opacity .45s;
}
.stage-bar span { pointer-events: none; }
.stage:not(.is-phd):nth-child(n+2) .stage-bar { border-bottom-width: 1px; font-size: 12.5px; color: var(--ink-2); border-color: var(--ink-2); }
.stage.is-phd .stage-bar {
  color: var(--xai); border-bottom: 2px solid transparent;
  /* lived so far: solid; still ahead: dotted, like a forecast */
  background:
    linear-gradient(var(--xai), var(--xai)) 0 100% / calc((2026.73 - var(--a)) / (var(--b) - var(--a)) * 100%) 2px no-repeat,
    radial-gradient(circle, rgba(47, 63, 207, .5) 0 1px, transparent 1.3px) 0 100% / 5px 2px repeat-x;
}
.path-years { position: absolute; left: 0; right: 0; top: 124px; display: flex; border-top: 1px solid var(--rule); }
.path-years li { flex: 1; padding: 5px 0 0 5px; border-left: 1px solid var(--rule); font-family: var(--mono); font-size: 10.5px; color: var(--mute); }
.path-now {
  position: absolute; top: -8px; height: 148px; left: calc((2026.73 - 2022) / 7 * 100%);
  border-left: 1px solid var(--target); padding-left: 5px; z-index: 1;
  font-family: var(--mono); font-size: 10px; letter-spacing: .06em; color: var(--target);
}
.path-cursor { display: none; }
.stage-copy { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); gap: 2px 24px; align-items: baseline; }
.stage-when { font-family: var(--mono); font-size: 11.5px; color: var(--mute); grid-row: 1 / 3; }
.stage-name { font-family: var(--sans); font-weight: 600; font-size: 15.5px; line-height: 1.3; }
.stage-text { font-family: var(--serif); font-size: 1.2rem; line-height: 1.35; color: var(--ink-2); max-width: 46ch; }

/* scroll-driven, where there is room and motion is welcome */
.path.is-scrolly { height: calc(100vh + 5 * 34vh); }
.path.is-scrolly .path-sticky { position: sticky; top: max(96px, calc(50vh - 230px)); }
.path.is-scrolly .path-stages { display: block; height: 150px; padding-top: 0; margin-bottom: 190px; }
.path.is-scrolly .stage-bar { opacity: .32; }
.path.is-scrolly .stage.is-past .stage-bar { opacity: .75; }
.path.is-scrolly .stage.is-active .stage-bar { opacity: 1; color: var(--xai); border-color: var(--xai); }
.path.is-scrolly .path-cursor {
  display: block; position: absolute; top: -4px; height: 140px; z-index: 2;
  left: calc((var(--cursor, 2022.65) - 2022) / 7 * 100%);
  border-left: 1.5px solid var(--xai);
}
.path.is-scrolly .path-cursor::after {
  content: ""; position: absolute; top: -3px; left: -4.5px; width: 7px; height: 7px; border-radius: 50%; background: var(--xai);
}
.path.is-scrolly .stage-copy {
  position: absolute; top: 176px; width: min(36rem, 100%);
  left: clamp(0%, calc((var(--a) - 2022) / 7 * 100%), calc(100% - 36rem));
  display: block; opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .55s var(--ease), transform .65s var(--ease);
}
.path.is-scrolly .stage.is-active .stage-copy { opacity: 1; transform: none; }
.path.is-scrolly .stage-when { display: block; }
.path.is-scrolly .stage-name { margin-top: 4px; }
.path.is-scrolly .stage-text { margin-top: 10px; font-size: clamp(1.3rem, 1.9vw, 1.7rem); line-height: 1.25; color: var(--ink); }

/* ==========================================================================
   Motion + responsive recompositions
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .record { animation: none !important; }
  .js .stage { opacity: 1 !important; transform: none !important; }
}

@media (max-width: 1100px) {
  .field-stage { --focus-x: .76; --span: 11; }
  .field-ui { width: min(400px, 44vw); }
}

/* stacked: identity, then the field as a full-bleed block, then its controls */
@media (max-width: 899px) {
  .hero { height: auto; display: flex; flex-direction: column; }
  .hero-id { display: contents; pointer-events: auto; }
  .hero-title { order: 1; padding: 78px var(--gutter) 0; }
  .hero-text { order: 4; padding: 30px var(--gutter) 0; }
  .field-stage {
    order: 2; position: relative; inset: auto; z-index: 0; margin-top: 26px;
    height: min(112vw, 640px);
    --focus-x: .64; --focus-y: .36; --span: 10; --interactive-from: 0;
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 8%, #000 92%, transparent 100%);
    mask-image: linear-gradient(180deg, transparent 0%, #000 8%, #000 92%, transparent 100%);
  }
  .field-ui { order: 3; position: static; width: auto; padding-inline: var(--gutter); margin-top: 8px; }
  .flow-row { grid-template-columns: minmax(0, 1fr); }
  .flow-row > .label { margin-bottom: 14px; padding-top: 0; }
  .pubs-more { grid-column: 1; padding-left: 0; }
  .about-line { margin-left: 0; }
  .books { max-width: 440px; }
  .path-scroll { -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent); mask-image: linear-gradient(90deg, #000 82%, transparent); }
  .leisure { grid-template-columns: 1fr; }
  .shelf, .turntable { grid-column: 1; }
  .turntable { grid-template-columns: auto minmax(0, 1fr); }
}

@media (max-width: 699px) {
  .tt { grid-template-columns: minmax(0, 1fr); }
  /* the path turns vertical: one stage after another */
  .stage-bar, .path-years, .path-now, .path-cursor { display: none !important; }
  .path-stages { padding: 0 0 0 20px; margin-left: 4px; border-left: 1px solid var(--rule); gap: 30px; }
  .stage { position: relative; }
  .stage::before { content: ""; position: absolute; left: -24.5px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--mist); border: 1.5px solid var(--ink-2); }
  .stage.is-phd::before { border-color: var(--xai); background: var(--xai); }
  .stage-copy { grid-template-columns: minmax(0, 1fr); }
  .stage-when { grid-row: auto; }
  .js .stage { opacity: 0; transform: translateY(14px); transition: opacity .6s var(--ease), transform .7s var(--ease); }
  .js .stage.is-in { opacity: 1; transform: none; }
  /* photographs become a swipeable strip; the atlas follows along below */
  .notes { display: block; }
  .gallery {
    display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; align-items: flex-start;
    margin-inline: calc(-1 * var(--gutter)); padding: 8px var(--gutter) 4px; scroll-padding-inline: var(--gutter);
    scrollbar-width: none;
  }
  .gallery::-webkit-scrollbar { display: none; }
  .shot { flex: 0 0 74%; scroll-snap-align: start; margin-top: 0 !important; }
  .shot--tetouan { --ar: 3 / 4; }
  .atlas { margin-top: 36px; }
  .turntable { grid-template-columns: 1fr; row-gap: 34px; }
  .deck { width: min(62vw, 250px); }
}

@media (max-width: 599px) {
  body { font-size: 16px; }
  .topnav-name { display: none; }
  .topnav ul { gap: 4px 18px; margin-left: 0; }
  .topnav-inner { justify-content: flex-end; }
  .hero-name { font-size: clamp(3rem, 15.5vw, 4.4rem); }
  .pub { grid-template-columns: 1fr; padding: 22px 0 24px; }
  .pub-venue { writing-mode: horizontal-tb; transform: none; justify-self: start; padding: 2px 6px; margin-bottom: 10px; }
  .pub-venue:not(.is-accepted) { padding-left: 0; }
}

