/* ==========================================================================
   Roberto Stifano - portfolio design system
   --------------------------------------------------------------------------
   One shared stylesheet for every page. Everything reusable lives in the
   :root variables below, so you can change the look in one place.

   COLOUR (max three tones, plus neutrals)
     --color-ink           Tone 1, deep blue. Headings, body text, dark band.
     --color-ink-soft      Muted text. Still passes contrast on white and sky.
     --color-blue          Mid blue for highlights, e.g. job titles on work cards.
     --color-sky           Tone 2, light blue. Soft backgrounds, gradients.
     --color-sky-light     A paler sky for subtle washes.
     --color-apricot       Tone 3, accent. Decoration only, never text on white.
     --color-apricot-deep  Stronger apricot for small things: the menu dot.
     --color-apricot-light Paler apricot, the end of the apricot section gradient.
     --color-white         Base background.
     --color-mist          Off-white for alternate sections.
     --color-line          Borders and dividers.

   GRADIENTS
     --gradient-dawn         Hero background: sky top left, apricot top right.
     --gradient-placeholder  Image placeholders on cards.
     --gradient-journey      The line linking the work cards (blue = earlier, apricot = now).
     --gradient-apricot      Apricot company sections on the My Work page.
     --gradient-night        The dark footer band.

   FONTS
     --font-heading  Inter Tight (stored in /fonts), for headings.
     --font-body     Inter (stored in /fonts), for everything else.

   FONT SIZES (fluid: they grow smoothly from phone to desktop)
     --text-sm, --text-base, --text-lg, --text-xl, --text-2xl, --text-hero

   SPACING SCALE
     --space-2xs ... --space-2xl  Gaps inside components.
     --space-section              Vertical space between page sections.

   SHAPE AND LAYOUT
     --radius-sm/md/lg/pill  Corner rounding. All 0 (square) by design.
     --max-width             Widest the content gets on big screens.
     --gutter                Side padding (16px on phones, grows on desktop).

   DEPTH AND MOTION
     --shadow-card, --shadow-card-hover  Card shadows.
     --ease-out, --duration              Timing for hovers and reveals.
   ========================================================================== */


/* --------------------------------------------------------------------------
   1. Fonts (self-hosted, so no calls to Google when the site loads)
   -------------------------------------------------------------------------- */
@font-face {
  font-family: "Inter";
  src: url("fonts/inter-variable.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter Tight";
  src: url("fonts/inter-tight-variable.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}


/* --------------------------------------------------------------------------
   2. Design tokens (the variables). TRY ME: change a colour here and every
      page updates.
   -------------------------------------------------------------------------- */
:root {
  /* Colour */
  --color-ink: #0E2A47;
  --color-ink-soft: #4A5F78;
  --color-blue: #1D5C9E;       /* mid blue: highlights like job titles (6.6:1 on white) */
  --color-sky: #CFE3F7;
  --color-sky-light: #EAF3FC;
  --color-apricot: #FFD9A8;
  --color-apricot-deep: #F2A65A;
  --color-apricot-light: #FFEBD1;
  --color-white: #FFFFFF;
  --color-mist: #F6F9FC;
  --color-line: #DCE5EE;

  /* Gradients */
  --gradient-dawn:
    radial-gradient(60% 70% at 0% 0%, var(--color-sky) 0%, transparent 70%),
    radial-gradient(50% 60% at 100% 0%, var(--color-apricot) 0%, transparent 70%),
    linear-gradient(180deg, var(--color-sky-light) 0%, var(--color-white) 100%);
  --gradient-placeholder: linear-gradient(135deg, var(--color-sky-light) 0%, var(--color-sky) 100%);
  --gradient-journey: linear-gradient(180deg, var(--color-sky) 0%, var(--color-ink-soft) 50%, var(--color-apricot-deep) 100%);
  --gradient-apricot: linear-gradient(180deg, var(--color-apricot) 0%, var(--color-apricot-light) 100%);
  --gradient-night:
    radial-gradient(70% 90% at 50% 0%, #1E4673 0%, transparent 70%),
    var(--color-ink);

  /* Fonts */
  --font-heading: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Font sizes */
  --text-sm: clamp(0.875rem, 0.85rem + 0.1vw, 0.9375rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.6vw, 1.375rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.4vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.5rem + 2.4vw, 3.25rem);
  --text-hero: clamp(2.5rem, 1.6rem + 4.5vw, 5.5rem);

  /* Spacing */
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  --space-2xl: 6rem;
  --space-section: clamp(4rem, 3rem + 5vw, 8rem);

  /* Shape and layout */
  /* Square corners by design: it reads more professional and matches the
     cut-corner buttons. TRY ME: give these values (e.g. 0.5rem, 1rem,
     1.75rem, 999px) to bring rounded corners back everywhere at once. */
  --radius-sm: 0;
  --radius-md: 0;
  --radius-lg: 0;
  --radius-pill: 0;
  --max-width: 72rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);

  /* Depth and motion */
  --shadow-card: 0 1px 2px rgb(14 42 71 / 0.06), 0 12px 32px rgb(14 42 71 / 0.08);
  --shadow-card-hover: 0 2px 4px rgb(14 42 71 / 0.08), 0 20px 48px rgb(14 42 71 / 0.14);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --duration: 400ms;
}


/* --------------------------------------------------------------------------
   3. Base: sensible defaults for every page
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--color-white);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Visible focus for keyboard users, on everything that can be focused */
:focus-visible {
  outline: 3px solid var(--color-ink);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Hidden until a keyboard user tabs to it, then jumps past the menu */
.skip-link {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  z-index: 100;
  padding: var(--space-xs) var(--space-sm);
  background: var(--color-ink);
  color: var(--color-white);
  border-radius: var(--radius-sm);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* Hidden on screen but still read out by screen readers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}


/* --------------------------------------------------------------------------
   4. Layout helpers
   -------------------------------------------------------------------------- */

/* Centres content and keeps it from getting too wide */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: var(--space-section);
}

.section--mist {
  background: var(--color-mist);
}

/* Intro that runs the full width of the page (Recent work) */
.section-intro.section-intro--wide {
  max-width: none;
}

/* Small label above a section title */
.eyebrow {
  margin-bottom: var(--space-sm);
  color: var(--color-ink-soft);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-header {
  margin-bottom: var(--space-lg);
}

.section-title {
  font-size: var(--text-2xl);
}

.section-intro {
  max-width: 38rem;   /* about 75 characters a line, comfortable to read */
  margin-top: var(--space-sm);
  color: var(--color-ink-soft);
  font-size: var(--text-lg);
}


/* --------------------------------------------------------------------------
   5. Site header and navigation
   The header is see-through, so it sits on the hero gradient and feels part
   of it. On phones the name and menu stack; on wider screens they share a row.
   -------------------------------------------------------------------------- */
.site-header {
  position: relative;
  z-index: 10;
}

/* Header layout: name top left with the language switcher just under it,
   menu top right (on phones: name, languages, then the menu) */
.site-header__inner {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "name"
    "lang"
    "nav";
  align-items: center;
  gap: var(--space-2xs) var(--space-lg);
  padding-block: var(--space-md);
}

.site-name { grid-area: name; justify-self: start; }
.lang-switch { grid-area: lang; justify-self: start; }
.site-nav { grid-area: nav; margin-top: var(--space-xs); }

.site-name {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.site-nav__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs) var(--space-md);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Top-level menu links only (the dropdown links are styled below) */
.nav-item > a {
  position: relative;
  display: inline-block;
  padding-block: var(--space-2xs);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
}

/* Underline that grows from the left on hover */
.nav-item > a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration) var(--ease-out);
}

.nav-item:hover > a::after,
.nav-item > a[aria-current="page"]::after {
  transform: scaleX(1);
}

/* The little notification dot on "My Work" */
.nav-dot {
  position: absolute;
  top: 0;
  right: -0.6rem;
  width: 0.45rem;
  height: 0.45rem;
  background: var(--color-apricot-deep);
  border-radius: 50%;
}

.nav-dot::before,
.nav-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--color-apricot-deep);
  opacity: 0;
  animation: ping 4s var(--ease-out) infinite;   /* TRY ME: a longer time = slower waves */
}
.nav-dot::after { animation-delay: 1.3s; }        /* second wave: the echo */


/* Language switcher: EN · ES · IT, current language bold and underlined */
.lang-switch ul {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lang-switch li + li::before {
  content: "·";
  padding-inline: var(--space-xs);
  color: var(--color-ink-soft);
}

.lang-switch a {
  color: var(--color-ink-soft);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-underline-offset: 0.3em;
}

.lang-switch a:hover {
  color: var(--color-ink);
  text-decoration: underline;
}

.lang-switch a[aria-current="true"] {
  color: var(--color-ink);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

/* Dropdown under "My Work".
   Hidden by default; appears when the menu item is hovered, or when anything
   inside it has keyboard focus (:focus-within), so it works without a mouse
   and without JavaScript. Keyboard users tab through My Work, then the three
   companies. On touch screens the first tap opens it. */
.nav-item--dropdown {
  position: relative;
}

.dropdown {
  position: absolute;
  top: calc(100% + 0.6rem);
  left: calc(-1 * var(--space-sm));
  z-index: 20;
  min-width: 12rem;
  margin: 0;
  padding: var(--space-xs) 0;
  list-style: none;
  border: 1px solid var(--color-line);
  border-top: 3px solid var(--color-apricot-deep);
  background: var(--color-white);
  box-shadow: var(--shadow-card);
  /* Hidden by being see-through and not clickable. The links stay in the
     keyboard tab order, and focusing one makes the menu appear. */
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition:
    opacity var(--duration) var(--ease-out),
    transform var(--duration) var(--ease-out);
}

/* Invisible bridge over the small gap, so the menu doesn't close while the
   mouse travels from "My Work" down to the list */
.dropdown::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 0.8rem;
}

.nav-item--dropdown:hover .dropdown,
.nav-item--dropdown:focus-within .dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.dropdown a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  transition: background-color var(--duration) var(--ease-out);
}

/* Small arrow that slides in on hover */
.dropdown a::after {
  content: "\2192";
  opacity: 0;
  transform: translateX(-4px);
  transition:
    opacity var(--duration) var(--ease-out),
    transform var(--duration) var(--ease-out);
}

.dropdown a:hover,
.dropdown a:focus-visible {
  background: var(--color-sky-light);
}

.dropdown a:hover::after,
.dropdown a:focus-visible::after {
  opacity: 1;
  transform: none;
}

.dropdown a:focus-visible {
  outline-offset: -3px;
}


/* --------------------------------------------------------------------------
   6. Buttons
   Every button is a rectangle with two corners cut off ("chamfer").
   The coloured shape is drawn on a layer behind the text (::before), so the
   keyboard focus outline is never clipped. Variants only change colours,
   through two local variables: --button-bg and --button-text.
   -------------------------------------------------------------------------- */
.button {
  --cut: 0.7em;                      /* TRY ME: size of the cut corners */
  --button-bg: var(--color-ink);
  --button-text: var(--color-white);

  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.85em 1.5em;
  color: var(--button-text);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  transition: transform var(--duration) var(--ease-out);
}

.button::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--button-bg);
  clip-path: polygon(
    var(--cut) 0, 100% 0,
    100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%,
    0 100%, 0 var(--cut)
  );
  transition: background-color var(--duration) var(--ease-out);
}

.button:hover {
  transform: translateY(-2px);
}

/* Dark blue with white text (the default look) */
.button--primary {
  --button-bg: var(--color-ink);
  --button-text: var(--color-white);
}

/* Apricot with dark text. Contrast about 10:1, well above the 4.5:1 minimum. */
.button--accent {
  --button-bg: var(--color-apricot);
  --button-text: var(--color-ink);
}

.button--accent:hover {
  --button-bg: var(--color-apricot-deep);
}

/* White with dark text, for use on the dark footer */
.button--light {
  --button-bg: var(--color-white);
  --button-text: var(--color-ink);
}

.button .arrow {
  transition: transform var(--duration) var(--ease-out);
}

.button:hover .arrow {
  transform: translateX(3px);
}


/* --------------------------------------------------------------------------
   7. Hero
   The playful part: soft blurred colour shapes drift slowly behind the text,
   with a few tiny floating dots. No images, all CSS.
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--gradient-dawn);
}

/* Soft white fade at the bottom, so the hero melts into the page */
.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  z-index: -1;
  height: 30%;
  background: linear-gradient(180deg, transparent, var(--color-white));
  pointer-events: none;
}

/* The drifting shapes */
.hero__orb {
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.7;
  pointer-events: none;
  will-change: transform;   /* draw the blur once, then just move it */
}

.hero__orb--sky {
  top: 10%;
  left: -10%;
  width: 28rem;
  height: 28rem;
  background: var(--color-sky);
  animation: drift-a 22s ease-in-out infinite alternate;
}

.hero__orb--apricot {
  top: -5%;
  right: -8%;
  width: 24rem;
  height: 24rem;
  background: var(--color-apricot);
  animation: drift-b 26s ease-in-out infinite alternate;
}

.hero__orb--deep {
  bottom: 0;
  right: 25%;
  width: 20rem;
  height: 20rem;
  background: #A9CBEE;
  opacity: 0.5;
  animation: drift-a 30s ease-in-out infinite alternate-reverse;
}

/* Tiny floating dots */
.hero__dots {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.hero__dots span {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-ink);
  opacity: 0.15;
  animation: float 9s ease-in-out infinite;
}

.hero__dots span:nth-child(1) { top: 22%; left: 72%; animation-delay: 0s; }
.hero__dots span:nth-child(2) { top: 58%; left: 86%; animation-delay: -2s; width: 4px; height: 4px; }
.hero__dots span:nth-child(3) { top: 34%; left: 92%; animation-delay: -4s; background: var(--color-apricot-deep); opacity: 0.6; }
.hero__dots span:nth-child(4) { top: 76%; left: 64%; animation-delay: -6s; width: 4px; height: 4px; }
.hero__dots span:nth-child(5) { top: 14%; left: 48%; animation-delay: -3s; width: 5px; height: 5px; }

/* Phones and tablets: the text runs almost edge to edge, so the dots
   gather in the empty band between the menu and "Project Manager"
   (same height on every phone) instead of landing on words. */
@media (max-width: 63.99rem) {
  .hero__dots span:nth-child(1) { top: 172px; left: 80%; }
  .hero__dots span:nth-child(2) { top: 204px; left: 93%; }
  .hero__dots span:nth-child(3) { top: 188px; left: 66%; }
  .hero__dots span:nth-child(4) { top: 228px; left: 86%; }
  .hero__dots span:nth-child(5) { top: 166px; left: 52%; }
}

.hero__content {
  /* Bottom padding was --space-section (8rem); with the next section's own
     top padding that made a ~16rem gap. Now 4rem + 8rem. */
  padding-block: var(--space-xl) var(--space-xl);
}

.hero__title {
  max-width: 16ch;
  font-size: var(--text-hero);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.035em;
}

/* Second line of the headline in the softer colour */
.hero__title .soft {
  color: var(--color-ink-soft);
}

.hero__lead {
  max-width: 34rem;
  margin-top: var(--space-md);
  color: var(--color-ink-soft);
  font-size: var(--text-lg);
}

.hero__status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  margin-top: var(--space-md);
  padding: var(--space-2xs) var(--space-sm);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  background: rgb(255 255 255 / 0.6);
  font-size: var(--text-sm);
}

.status-dot {
  position: relative;
  width: 0.5rem;
  height: 0.5rem;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--color-apricot-deep);
}

.status-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--color-apricot-deep);
  animation: ping 2.4s var(--ease-out) infinite;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}


/* --------------------------------------------------------------------------
   8. Work cards (one per company)
   -------------------------------------------------------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  margin: 0;
  padding: 0;
  list-style: none;
}

.work-card {
  height: 100%;
}

.work-card__link {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  background: var(--color-white);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  transition:
    transform var(--duration) var(--ease-out),
    box-shadow var(--duration) var(--ease-out);
}

.work-card__link:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}

/* A card with nowhere to link to (Goldsmiths): no lift or zoom on hover */
.work-card__link--static:hover {
  transform: none;
  box-shadow: var(--shadow-card);
}

.work-card__link--static:hover .placeholder-image {
  transform: none;
}

.work-card__media {
  overflow: hidden;
  aspect-ratio: 4 / 3;
}

/* Grey-blue block standing in for a real image */
.placeholder-image {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: var(--gradient-placeholder);
  color: var(--color-ink-soft);
  font-size: var(--text-sm);
  transition: transform 700ms var(--ease-out);
}

/* Each card's placeholder leans a slightly different way */
.card-grid > li:nth-child(2) .placeholder-image { background: linear-gradient(200deg, var(--color-sky-light), var(--color-sky)); }
.card-grid > li:nth-child(3) .placeholder-image { background: linear-gradient(160deg, var(--color-sky), var(--color-sky-light) 60%, var(--color-apricot)); }
.card-grid > li:nth-child(4) .placeholder-image { background: linear-gradient(45deg, var(--color-sky-light), var(--color-sky)); }

.work-card__link:hover .placeholder-image,
.work-card__link:hover img {
  transform: scale(1.04);
}

.work-card__body {
  display: grid;
  gap: var(--space-xs);
  padding: var(--space-md);
}

.work-card__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  font-size: var(--text-xl);
}

.work-card__arrow {
  font-size: var(--text-lg);
  transition: transform var(--duration) var(--ease-out);
}

.work-card__link:hover .work-card__arrow {
  transform: translate(3px, -3px);
}

.work-card__role {
  color: var(--color-blue);
  font-size: var(--text-sm);
  font-weight: 700;
}

.work-card__summary {
  color: var(--color-ink-soft);
}


/* ---- Flip card: the picture turns over on hover to show a photo ----
   Only the image area flips; the text below stays put. The logo and the
   photo sit in the same spot, the photo starts turned away.
   Hovering the picture (mouse), keyboard focus, or a tap on cards that
   aren't links turns it over. TRY ME: change 700ms for a faster or slower flip */
.work-card--flip .work-card__media {
  overflow: visible;          /* lets the turning picture stay whole mid-flip */
  perspective: 1200px;
}

.work-card--flip {
  cursor: pointer;
}

.work-card__flip {
  display: grid;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 700ms var(--ease-out);
}

.work-card__flip > img {
  grid-area: 1 / 1;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.work-card__flip > .work-card__back {
  transform: rotateY(180deg);
}

.work-card__flip > div.work-card__back {
  grid-area: 1 / 1;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Curio's back: its images fade one into the next, on black, shown whole.
   Each image shows for 3 seconds; with 6 images the loop is 18 seconds.
   To add an image: add an <img> in index.html, add a line below with the
   next delay (+3s), and set the loop to 3s x the number of images. */
.curio-reel {
  position: relative;
  overflow: hidden;
  background: #000;
}

.work-card__media .curio-reel img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  animation: curio-reel 15s linear infinite;   /* TRY ME: 6 pictures x 2.5 s */
}

.work-card__media .curio-reel img:nth-child(2) { animation-delay: 2.5s; }
.work-card__media .curio-reel img:nth-child(3) { animation-delay: 5s; }
.work-card__media .curio-reel img:nth-child(4) { animation-delay: 7.5s; }
.work-card__media .curio-reel img:nth-child(5) { animation-delay: 10s; }
.work-card__media .curio-reel img:nth-child(6) { animation-delay: 12.5s; }
.work-card__media .curio-reel img:first-child { opacity: 1; }

/* Visible for a sixth of the loop (one image in six) */
@keyframes curio-reel {
  0% { opacity: 0; }
  3%, 16.7% { opacity: 1; }
  20%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .work-card__media .curio-reel img { animation: none; }
}

/* No zoom on flipping pictures: the turn is the effect */
.work-card--flip .work-card__link:hover img {
  transform: none;
}

.work-card--flip .work-card__link:hover .work-card__back {
  transform: rotateY(180deg);
}

/* Only hovering the picture itself turns it, not the text below */
@media (hover: hover) {
  .work-card--flip .work-card__media:hover .work-card__flip {
    transform: rotateY(180deg);
  }
}

.work-card--flip:focus-within .work-card__flip,
.work-card--flip:focus .work-card__flip {
  transform: rotateY(180deg);
}

.work-card--flip:focus-visible {
  outline: 2px solid var(--color-ink);
  outline-offset: 4px;
}

/* Reduced motion: the picture swaps to the photo instantly, no turning */
@media (prefers-reduced-motion: reduce) {
  .work-card__flip {
    transition: none;
  }
}

/* Small label at the top of each card: years or stage */
.work-card__step {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--color-ink-soft);
  font-size: var(--text-sm);
}



/* --------------------------------------------------------------------------
   8b. Journey: the line that links the work cards
   Phone: the line runs down the left, cards sit to its right.
   Desktop: the line runs down the middle, cards zig-zag either side and
   overlap in height, so each one starts partway down the previous one.
   Each card gets a diamond marker on the line and a short connector.
   -------------------------------------------------------------------------- */
.journey {
  --journey-gap: 2rem;   /* space between the line and the cards */
  --marker: 0.75rem;     /* size of the diamond markers */
  --marker-top: 2rem;    /* how far down each card its marker sits */

  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  padding-left: var(--journey-gap);
}

/* The line itself: cool blue at the top (earlier), warm apricot at the end (now) */
.journey::before {
  content: "";
  position: absolute;
  top: var(--marker-top);
  bottom: var(--space-lg);
  left: 0;
  width: 2px;
  background: var(--gradient-journey);
}

.journey__item {
  position: relative;
}

/* Diamond marker on the line */
.journey__item::before {
  content: "";
  position: absolute;
  top: calc(var(--marker-top) - var(--marker) / 2);
  left: calc(-1 * var(--journey-gap) - var(--marker) / 2 + 1px);
  z-index: 1;
  width: var(--marker);
  height: var(--marker);
  border: 2px solid var(--color-ink);
  background: var(--color-white);
  transform: rotate(45deg);
}

/* The latest stop (last card, Antavo) gets a filled apricot marker */
.journey__item:last-child::before {
  border-color: var(--color-apricot-deep);
  background: var(--color-apricot-deep);
}

/* Dashed connector from the line to the card */
.journey__item::after {
  content: "";
  position: absolute;
  top: var(--marker-top);
  left: calc(-1 * var(--journey-gap));
  width: var(--journey-gap);
  border-top: 1px dashed var(--color-ink-soft);
}

@media (min-width: 52rem) {
  .journey {
    --journey-gap: 3rem;
    gap: 0;
    padding-left: 0;
  }

  .journey::before {
    left: calc(50% - 1px);
  }

  .journey__item {
    width: calc(50% - var(--journey-gap));
  }

  /* Overlap: each card starts partway down the previous one.
     TRY ME: closer to 0% = less overlap, more vertical space. */
  .journey__item + .journey__item {
    margin-top: -18%;
  }

  .journey__item:nth-child(even) {
    margin-left: auto;
  }

  /* Left-hand cards: marker and connector on their right side */
  .journey__item:nth-child(odd)::before {
    left: calc(100% + var(--journey-gap) - var(--marker) / 2);
  }

  .journey__item:nth-child(odd)::after {
    left: 100%;
  }
}


/* --------------------------------------------------------------------------
   8c. My Work page: hero with the stepped career path
   -------------------------------------------------------------------------- */
.work-hero {
  display: grid;
  gap: var(--space-xl);
  align-items: center;
  padding-block: var(--space-xl) var(--space-section);
}

.work-hero__title {
  font-size: var(--text-hero);
  letter-spacing: -0.035em;
}

.work-hero__lead {
  max-width: 30rem;
  margin-top: var(--space-md);
  color: var(--color-ink-soft);
  font-size: var(--text-lg);
}

/* The box the path is drawn in. Steps are placed by percentage inside it,
   using --x and --y set on each step in the HTML. */
.career-path {
  --marker: 0.85rem;
  position: relative;
  width: 100%;
  max-width: 32rem;
  aspect-ratio: 5 / 4;
}

.career-path__line {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.career-path__steps {
  margin: 0;
  padding: 0;
  list-style: none;
}

.career-step {
  position: absolute;
  left: var(--x);
  top: var(--y);
}

/* Diamond marker, same as the home page journey */
.career-step::before {
  content: "";
  position: absolute;
  left: calc(var(--marker) / -2);
  top: calc(var(--marker) / -2);
  width: var(--marker);
  height: var(--marker);
  border: 2px solid var(--color-ink);
  background: var(--color-white);
  transform: rotate(45deg);
}

/* Latest step: filled apricot */
.career-step--now::before {
  border-color: var(--color-apricot-deep);
  background: var(--color-apricot-deep);
}

/* Label sits to the right of the marker... */
.career-step__label {
  position: absolute;
  left: 1.25rem;
  top: 0;
  display: grid;
  transform: translateY(-50%);
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  white-space: nowrap;
  text-decoration: none;
  transition: color var(--duration) var(--ease-out);
}

/* ...or below it, where the line leaves to the right (Curio) */
.career-step--below .career-step__label {
  left: 0;
  top: 1rem;
  justify-items: center;
  transform: translateX(-50%);
  text-align: center;
}

.career-step__label:hover {
  color: var(--color-ink-soft);
}

.career-step__num {
  color: var(--color-ink-soft);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0;
}


/* --------------------------------------------------------------------------
   8d. Company sections (My Work page). Alternate apricot and white.
   -------------------------------------------------------------------------- */
.company {
  padding-block: var(--space-section);
  scroll-margin-top: var(--space-md); /* small gap when jumped to from the menu */
}

.company--apricot {
  background: var(--gradient-apricot);
}

.company--white {
  background: var(--color-white);
}

.company__inner {
  display: grid;
  gap: var(--space-xl);
}

.company__name {
  font-size: var(--text-2xl);
}

.company__desc {
  max-width: 30rem;
  margin-top: var(--space-sm);
  color: var(--color-ink-soft);
  font-size: var(--text-lg);
}

/* The 2x2 grid: Projects | KPIs / Value | Skills, with lines between */
.facts {
  --facts-line: rgb(14 42 71 / 0.2);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));   /* never wider than half */
  margin: 0;
  padding: 0;
  list-style: none;
}

.facts li {
  display: grid;
  align-content: start;
  gap: var(--space-xs);
  padding: var(--space-md);
  overflow-wrap: anywhere;   /* very long words break rather than spill out */
}

/* Number and list boxes size themselves to fit, so they never break words */
.facts .fact-stat,
.facts .fact-list {
  overflow-wrap: normal;
}

/* A box with a small label over a short quote, opened by an apricot quote mark */
.facts .fact-quote {
  container-type: inline-size;
}

.facts .fact-quote__text {
  position: relative;
  margin: 0;
  padding-top: 1.6rem;
}

.facts .fact-quote__text::before {
  content: "\201C";
  position: absolute;
  top: -0.35rem;
  left: -0.05em;
  color: var(--color-apricot-deep);
  font-family: var(--font-heading);
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1;
}

.facts .fact-quote__text p {
  color: var(--color-ink);
  font-family: var(--font-heading);
  font-size: min(var(--text-lg), 11cqi);
  font-weight: 600;
  line-height: 1.3;
}

/* Dots that "type" themselves out one by one, then start again (still going) */
.typing-dots span:nth-child(1) { animation: type-dot-1 1.8s steps(1) infinite; }
.typing-dots span:nth-child(2) { animation: type-dot-2 1.8s steps(1) infinite; }
.typing-dots span:nth-child(3) { animation: type-dot-3 1.8s steps(1) infinite; }

/* A box that leads with a big number, label centred beside it */
/* Label sits beside the number when there's room (centred on it), and
   wraps underneath when the box is too narrow (wide figures, phones) */
.facts .fact-stat {
  container-type: inline-size;   /* lets the number size itself to this box */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: start;
  gap: var(--space-xs) var(--space-sm);
}

.fact-stat p {
  margin: 0;
}

.facts .fact-stat__number {
  font-family: var(--font-heading);
  /* As big as possible, but never wider than its box on its own line
     (cqi = 1% of the box width). TRY ME: change 34cqi / 6.5rem */
  font-size: clamp(2.25rem, 34cqi, 6.5rem);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--color-ink);
}

.facts .fact-stat__label {
  flex: 0 1 7rem;
  min-width: 0;
  max-width: 11ch;
  color: var(--color-ink);
  font-size: min(var(--text-lg), 13cqi);   /* a touch smaller in very narrow boxes */
  font-weight: 600;
  line-height: 1.25;
}

/* A box with a small label over a short bold list (e.g. integrations) */
/* The quote itself is the link to its source (opens in a new tab) */
.facts .fact-quote__link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--color-line);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: text-decoration-color 0.2s ease;
}

.facts .fact-quote__link:hover {
  text-decoration-color: var(--color-apricot-deep);
}

.facts .fact-quote__arrow {
  margin-left: 0.25em;
  color: var(--color-apricot-deep);
  font-size: 0.8em;
}

/* A word instead of a number (e.g. "Waterloo"): sized to fit its box */
.facts .fact-stat .fact-stat__number--word {
  font-size: clamp(1.4rem, 19cqi, 3.75rem);
}

/* Star after a rating (e.g. 4.8 ★) */
.fact-stat__star {
  width: 0.62em;
  height: 0.62em;
  margin-left: 0.06em;
  fill: var(--color-apricot-deep);
  vertical-align: 0.05em;
}

.facts .fact-list__label {
  color: var(--color-ink-soft);
  font-size: min(var(--text-sm), 11.5cqi);   /* a touch smaller in very narrow boxes */
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.facts .fact-list,
.facts .fact-quote {
  container-type: inline-size;
}

.facts .fact-list__items {
  color: var(--color-ink);
  font-family: var(--font-heading);
  font-size: min(var(--text-xl), 17cqi);   /* a touch smaller in very narrow boxes */
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.facts li:nth-child(odd) {
  border-right: 1px solid var(--facts-line);
}

.facts li:nth-child(-n + 2) {
  border-bottom: 1px solid var(--facts-line);
}

.facts h3 {
  font-size: var(--text-lg);
}

.facts p {
  color: var(--color-ink-soft);
}


/* --------------------------------------------------------------------------
   9. Logo strip ("Selected teams and clients")
   -------------------------------------------------------------------------- */
.logo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--color-line);
  border-left: 1px solid var(--color-line);
}

.logo-grid li {
  display: grid;
  place-items: center;
  min-height: 7rem;
  padding: var(--space-md);
  border-right: 1px solid var(--color-line);
  border-bottom: 1px solid var(--color-line);
  background: var(--color-white);
  transition: background-color var(--duration) var(--ease-out);
}

.logo-grid li:hover {
  background: var(--color-sky-light);
}

/* Brand logos: one colour (ink), balanced by size, full strength on hover */
.brand-logo {
  width: auto;
  max-width: 70%;
  height: 2rem;
  object-fit: contain;
  opacity: 0.7;
  transition: opacity var(--duration) var(--ease-out);
}

.logo-grid li:hover .brand-logo {
  opacity: 1;
}

/* Wide wordmarks get less height, the tall PUMA mark more, so they look even */
/* TRY ME: each height is tuned so the eight look equally strong */
.brand-logo--f1-arcade { height: 2.1rem; }
.brand-logo--guardian { height: 2.35rem; }
.brand-logo--calvin-klein { height: 1.55rem; }
.brand-logo--financial-times { height: 1.3rem; }
.brand-logo--c-and-a { height: 2.1rem; }
.brand-logo--wsj { height: 1.15rem; }
.brand-logo--puma { height: 2.7rem; }
.brand-logo--the-atlantic { height: 2.1rem; }

/* Apricot dot after a section title (e.g. "From Hospitality to Tech") */
.title-dot {
  display: inline-block;
  width: 0.28em;
  height: 0.28em;
  margin-left: 0.18em;
  border-radius: 50%;
  background: var(--color-apricot-deep);
  vertical-align: 0.24em;   /* centred on the capital letters */
}

/* Slow blink: for "in progress" titles */
.title-dot--blink {
  animation: dot-blink 2.4s ease-in-out infinite;
}

/* Book titles in italics */
.idea-card__title cite {
  font-style: italic;
}

.logo-placeholder {
  width: 7rem;
  height: 2rem;
  border-radius: var(--radius-sm);
  background: var(--color-line);
}


/* --------------------------------------------------------------------------
   10. "Working on / thinking about" cards
   -------------------------------------------------------------------------- */
.idea-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Cards share the same rows (tag, title, line) through subgrid, so the
   lines under the titles start at the same height in every card */
.idea-grid > li {
  display: grid;
  grid-row: span 3;
  grid-template-rows: subgrid;
}

.idea-card {
  display: grid;
  grid-row: span 3;
  grid-template-rows: subgrid;
  row-gap: var(--space-sm);
  align-content: start;
  height: 100%;
  padding: var(--space-md);
  border: 1px dashed var(--color-ink-soft);
  border-radius: var(--radius-md);
  background: rgb(255 255 255 / 0.7);
}

.idea-card__tag {
  justify-self: start;
  padding: var(--space-2xs) var(--space-xs);
  border-radius: var(--radius-pill);
  background: var(--color-apricot);
  font-size: var(--text-sm);
  font-weight: 500;
}

.idea-card__title {
  font-size: var(--text-lg);
}

.idea-card p {
  color: var(--color-ink-soft);
}


/* --------------------------------------------------------------------------
   11. Footer (the dark "night" band, on every page)
   -------------------------------------------------------------------------- */
.site-footer {
  background: var(--gradient-night);
  color: var(--color-white);
}

.site-footer__inner {
  display: grid;
  gap: var(--space-lg);
  padding-block: var(--space-section) var(--space-lg);
}

.site-footer__title {
  max-width: 18ch;
  font-size: var(--text-2xl);
}

.site-footer__lead {
  max-width: 32rem;
  margin-top: var(--space-sm);
  color: #C9D6E5;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-md);
  margin: 0;
  padding: 0;
  list-style: none;
}

.social-links a {
  text-decoration: underline;
  text-decoration-color: rgb(255 255 255 / 0.4);
  text-underline-offset: 0.25em;
  transition: text-decoration-color var(--duration) var(--ease-out);
}

.social-links a:hover {
  text-decoration-color: var(--color-white);
}

/* LinkedIn and mail icons in the footer: square outline buttons */
.social-icon {
  display: inline-grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border: 1px solid rgb(255 255 255 / 0.5);
  color: var(--color-white);
  transition:
    background-color var(--duration) var(--ease-out),
    color var(--duration) var(--ease-out),
    transform var(--duration) var(--ease-out);
}

.social-icon:hover {
  background: var(--color-white);
  color: var(--color-ink);
  transform: translateY(-2px);
}

.social-icon__svg {
  width: 1.3rem;
  height: 1.3rem;
  fill: currentColor;
}

.social-icon__svg--line {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

/* Logos fill the card image area (they're already 4:3) */
.work-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 700ms var(--ease-out);
}

.site-footer :focus-visible {
  outline-color: var(--color-white);
}

.site-footer__bottom {
  padding-top: var(--space-md);
  border-top: 1px solid rgb(255 255 255 / 0.15);
  color: #C9D6E5;
  font-size: var(--text-sm);
}


/* --------------------------------------------------------------------------
   12. Placeholder pages (empty pages until we build them)
   -------------------------------------------------------------------------- */
.page-intro {
  padding-block: var(--space-xl) var(--space-section);
}

.page-intro__title {
  font-size: var(--text-hero);
  letter-spacing: -0.035em;
}

.page-intro p {
  max-width: 34rem;
  margin-top: var(--space-md);
  color: var(--color-ink-soft);
  font-size: var(--text-lg);
}


/* --------------------------------------------------------------------------
   15. Passion page: its own colour identity (agreed exception to the
       three-tone rule). The scenery is in images/passion-*.svg; the car is
       drawn in passion.html and coloured here.
   -------------------------------------------------------------------------- */
.theme-passion {
  --race-red: #D7263D;        /* TRY ME: the car colour */
  --race-red-dark: #B01E31;   /* car shading */
  --track-grey: #3A3F47;      /* tarmac, car details */
  --race-sky-top: #8FC1EC;
  --race-sky-bottom: #E3F1FC;
  --race-red-soft: #F6C9CE;   /* soft red tint, replaces apricot glows on this page */
  --race-pace: 1;             /* TRY ME: 2 = half speed, 0.5 = twice as fast */

  /* Same dawn gradient as the rest of the site, with soft red instead of apricot */
  --gradient-dawn:
    radial-gradient(60% 70% at 0% 0%, var(--color-sky) 0%, transparent 70%),
    radial-gradient(50% 60% at 100% 0%, var(--race-red-soft) 0%, transparent 70%),
    linear-gradient(180deg, var(--color-sky-light) 0%, var(--color-white) 100%);

  background:
    var(--gradient-dawn) top / 100% 48rem no-repeat,
    var(--color-white);
}

.race-hero {
  padding-block: var(--space-md) var(--space-xl);
}

/* Flat-screen TV around the scene. Kept subtle: thin bezel, faint sheen. */
.tv {
  --bezel: clamp(6px, 0.9vw, 12px);   /* TRY ME: bezel thickness */
  position: relative;
  padding: var(--bezel);
  background: #12161C;
  box-shadow: var(--shadow-card-hover);
}

/* Faint diagonal glass reflection over the screen */
.tv::after {
  content: "";
  position: absolute;
  inset: var(--bezel);
  pointer-events: none;
  background: linear-gradient(
    115deg,
    rgb(255 255 255 / 0.14) 0%,
    rgb(255 255 255 / 0.04) 35%,
    transparent 36%
  );
}

/* Tiny power light on the bottom edge */
.tv__light {
  position: absolute;
  bottom: calc(var(--bezel) / 2 - 1.5px);
  right: calc(var(--bezel) * 2);
  width: 3px;
  height: 3px;
  background: var(--color-apricot-deep);
}

/* Channel 1: the race. (Its size comes from .tv__screen, section 16.) */
.race-scene {
  background: linear-gradient(180deg, var(--race-sky-top), var(--race-sky-bottom));
}

/* Each scenery layer repeats its drawing from left to right.
   The endless scroll: every layer is one tile (--tile-w) wider than the
   screen and slides left by exactly one tile, then starts again. The drawing
   repeats seamlessly, so the restart is invisible.
   --tile-w = layer height x the drawing's width-to-height ratio.
   --speed  = how long one tile takes to pass. Shorter = faster. */
.race-layer {
  position: absolute;
  left: 0;
  width: calc(100% + var(--tile-w));
  background-repeat: repeat-x;
  background-size: var(--tile-w) 100%;
  will-change: transform;
  animation: race-scroll calc(var(--speed) * var(--race-pace)) linear infinite;
}

/* Slowest: far away */
.race-layer--clouds {
  --tile-w: calc(var(--scene-h) * 0.26 * 900 / 140);
  --speed: 60s;
  top: 4%;
  height: 26%;
  background-image: url("images/passion-clouds.svg");
}

/* Medium */
.race-layer--stands {
  --tile-w: calc(var(--scene-h) * 0.48 * 480 / 220);
  --speed: 4s;
  bottom: 34%;
  height: 48%;
  background-image: url("images/passion-stands.svg");
}

/* Fastest: closest to the car */
.race-layer--track {
  --tile-w: calc(var(--scene-h) * 0.34 * 240 / 120);
  --speed: 0.8s;
  bottom: 0;
  height: 34%;
  background-image: url("images/passion-track.svg");
}

/* The car sits on the track, a little left of centre */
.race-car {
  position: absolute;
  bottom: 4%;
  left: 42%;
  width: clamp(9rem, 34%, 22rem);
  height: auto;
  overflow: visible; /* lets the speed streaks trail out behind */
  transform: translateX(-50%);
  animation: car-bounce calc(0.35s * var(--race-pace)) ease-in-out infinite alternate;
}

/* Speed streaks: faint white lines that stream off the back and fade */
.speed-lines rect {
  fill: rgb(255 255 255 / 0.55);
  animation: streak calc(0.5s * var(--race-pace)) linear infinite;
}

.speed-lines rect:nth-child(2) { animation-delay: calc(-0.2s * var(--race-pace)); }
.speed-lines rect:nth-child(3) { animation-delay: calc(-0.35s * var(--race-pace)); }

/* Wheels spin around their own centre */
.car-wheel {
  transform-box: fill-box;
  transform-origin: center;
  animation: wheel-spin calc(0.3s * var(--race-pace)) linear infinite;
}

.car-body { fill: var(--race-red); }
.car-body-dark { fill: var(--race-red-dark); }
.car-dark { fill: var(--color-ink); }
.car-grey { fill: var(--track-grey); }
.car-floor { fill: #15171A; }
.car-shadow { fill: rgb(0 0 0 / 0.28); }
.car-helmet { fill: var(--race-red); }
.car-white { fill: var(--color-white); }
.car-number { fill: var(--color-white); font-family: var(--font-heading); font-size: 11px; font-weight: 700; }
.tyre { fill: #15171A; }
.tyre-stripe { fill: none; stroke: #4A505A; stroke-width: 1.5; }
.rim { fill: #8A94A3; }
.spokes { stroke: #15171A; stroke-width: 2.5; }
.hub { fill: var(--color-ink); }

/* Passion blocks: Films | Books | F1, with thin lines between */
.passions {
  padding-bottom: var(--space-section);
}

.passion-grid {
  display: grid;
  grid-template-columns: 1fr;
  margin: 0;
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--color-line);
}

.passion-grid > li {
  border-top: 1px solid var(--color-line);
}

.passion-card {
  display: grid;
  gap: var(--space-xs);
  padding-block: var(--space-md) var(--space-lg);
}

.passion-card__media {
  overflow: hidden;
  aspect-ratio: 4 / 3;
  margin-bottom: var(--space-sm);
}

/* Passion placeholders lean towards the soft red */
.theme-passion .placeholder-image {
  background: linear-gradient(135deg, var(--color-sky-light), var(--race-red-soft));
}

.passion-card:hover .placeholder-image {
  transform: scale(1.04);
}

.passion-card__title {
  font-size: var(--text-xl);
}

.passion-card p {
  color: var(--color-ink-soft);
}

/* The wide 4th block: dashed border says "in progress" */
.passion-wide {
  display: grid;
  justify-items: center;
  gap: var(--space-xs);
  margin-top: var(--space-xl);
  padding: var(--space-xl) var(--space-md);
  border: 1px dashed var(--color-ink-soft);
  background: linear-gradient(120deg, var(--color-sky-light), var(--race-red-soft));
  text-align: center;
}

.passion-wide .eyebrow {
  margin-bottom: 0;
}

.passion-wide__title {
  font-size: var(--text-2xl);
}

.passion-wide p:last-child {
  color: var(--color-ink-soft);
}

/* --------------------------------------------------------------------------
   16. Passion TV: channels, static, on-screen label, remote, favourites
   How the switching works:
   - Every channel sits in the same screen, stacked. Each runs the same
     "channel-cycle" animation (visible for one fifth of the loop, hidden for
     the rest), started at a different point, so they take turns. CH 4 uses
     "channel-cycle-long" and stays on for two fifths (14 seconds).
   - The remote is real radio buttons. When CH 1/2/3/4 is picked, CSS (:has)
     stops the cycle and shows only that channel.
   -------------------------------------------------------------------------- */
.tv-set {
  --channel-time: 5s;   /* TRY ME: how long each channel shows */
}

.tv__screen {
  --scene-h: clamp(15rem, 38vw, 30rem);
  position: relative;
  overflow: hidden;
  height: var(--scene-h);
  background: #000;
}

.channel {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  animation: channel-cycle calc(var(--channel-time) * 5) linear infinite;
  animation-delay: var(--ch-delay);
}

.channel--1 { --ch-delay: 0s; }
.channel--2 { --ch-delay: calc(var(--channel-time) * -4); }
.channel--3 { --ch-delay: calc(var(--channel-time) * -3); }
.channel--4 { --ch-delay: calc(var(--channel-time) * -2); animation-name: channel-cycle-long; }   /* CH 4 shows for two slots */

/* "CH 2" label in the corner, shown for the first couple of seconds */
.tv-osd {
  position: absolute;
  top: 7%;
  right: 4%;
  z-index: 6;
  color: #8CFF9E;
  font-family: var(--font-heading);
  font-size: clamp(0.75rem, 1.6vw, 1.15rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-shadow: 0 0 6px rgb(140 255 158 / 0.6), 0 1px 0 #000;
  opacity: 0;
  animation: osd-flash calc(var(--channel-time) * 5) linear infinite;
  animation-delay: var(--ch-delay);
}

/* Burst of static at every switch */
.tv-static {
  position: absolute;
  inset: 0;
  z-index: 7;
  overflow: hidden;
  pointer-events: none;
  background: #7A7A7A url("images/tv-static.svg") 0 0 / 540px 180px;
  opacity: 0;
  animation:
    static-burst calc(var(--channel-time) * 5) linear infinite,
    static-jitter 0.12s steps(1) infinite;
}

/* Bright bar rolling down through the static */
.tv-static::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -30%;
  height: 30%;
  background: linear-gradient(180deg, transparent, rgb(255 255 255 / 0.4), transparent);
  animation: static-roll 0.6s linear infinite;
}

/* Fine scan lines */
.tv-static::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgb(0 0 0 / 0.28) 0 1px, transparent 1px 3px);
}

/* ---- Channel 2: black-and-white drama ---- */
.noir-scene {
  background: radial-gradient(ellipse 60% 70% at 55% 45%, #8E8E8E, #2B2B2B 70%, #111);
}

/* Letterbox bars, top and bottom */
.noir-scene::before,
.noir-scene::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  z-index: 3;
  height: 11%;
  background: #000;
}

.noir-scene::before { top: 0; }
.noir-scene::after { bottom: 0; }

/* Light through venetian blinds on the back wall */
.noir-blinds {
  position: absolute;
  top: 14%;
  right: 10%;
  width: 36%;
  height: 52%;
  background: repeating-linear-gradient(180deg, rgb(255 255 255 / 0.22) 0 9px, transparent 9px 18px);
  transform: skewX(-18deg);
}

.noir-cast {
  position: absolute;
  left: 0;
  bottom: 11%;
  width: 100%;
  height: 80%;
}

.noir-cast path,
.noir-cast circle,
.noir-cast rect { fill: #0B0B0B; }
.noir-cast .noir-floor { fill: #1C1C1C; }

.noir-arm {
  transform-box: fill-box;
  transform-origin: 50% 0;   /* arms swing from the shoulder */
}

.noir-l {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: noir-lean 4s ease-in-out infinite;
}

.noir-l__plead { animation: noir-plead 4s ease-in-out infinite; }
.noir-l__swoon { animation: noir-swoon 4s ease-in-out infinite; }

.noir-r {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  animation: noir-turn 4s ease-in-out infinite;
}

.noir-r__point { animation: noir-point 4s ease-in-out infinite; }

/* Film grain and projector flicker */
.noir-grain {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: url("images/tv-static.svg") 0 0 / 480px 160px;
  opacity: 0.12;
  animation:
    static-jitter 0.3s steps(1) infinite,
    noir-flicker 0.12s steps(2) infinite alternate;
}

.noir-subtitle {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  height: 11%;
  margin: 0;
  color: #F2F2F2;
  font-size: clamp(0.65rem, 1.5vw, 0.95rem);
}

.noir-subtitle span {
  grid-area: 1 / 1;
  opacity: 0;
}

.noir-subtitle__1 { animation: noir-sub-1 4s linear infinite; }
.noir-subtitle__2 { animation: noir-sub-2 4s linear infinite; }

/* ---- Channel 3: awards night ---- */
.awards-scene {
  background:
    linear-gradient(180deg, rgb(0 0 0 / 0.35), transparent 35%),
    repeating-linear-gradient(90deg, #6E0F1D 0 14px, #9C1B2E 14px 28px, #6E0F1D 28px 42px);
}

/* Curtain top (valance) with a gold trim */
.awards-scene::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1;
  height: 12%;
  background: #4F0A15;
  border-bottom: 3px solid #C9971C;
}

/* Stage floor */
.awards-scene::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  height: 26%;
  background: linear-gradient(180deg, #3B2418, #24150E);
}

.spotlight {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 1;
  width: 46%;
  height: 100%;
  background: linear-gradient(180deg, rgb(255 240 200 / 0.45), rgb(255 240 200 / 0.12));
  clip-path: polygon(44% 0, 56% 0, 100% 100%, 0 100%);
  transform-origin: 50% 0;
  animation: spot-sway 5s ease-in-out infinite alternate;
}

.awards-cast {
  position: absolute;
  left: 0;
  bottom: 6%;
  z-index: 2;
  width: 100%;
  height: 80%;
}

.awards-cast .spot-pool { fill: rgb(255 240 200 / 0.35); }
.awards-cast .podium { fill: #2B1A12; }
.awards-cast .podium-top { fill: #5A3826; }
.awards-cast .mic { fill: #222222; }
.awards-cast .suit { fill: #111111; }
.awards-cast .shirt { fill: #FFFFFF; }
.awards-cast .skin { fill: #E0A47C; }
.awards-cast .hair { fill: #2A1A12; }
.awards-cast .gold { fill: #E8B931; }
.awards-cast .gold-dark { fill: #B8860B; }

/* The trophy arm pumps; the other arm waves */
.award-raise {
  transform-box: view-box;
  transform-origin: 220.5px 100px;   /* the shoulder, in drawing units */
  animation: award-pump 0.9s ease-in-out infinite alternate;
}

.award-wave {
  transform-box: fill-box;
  transform-origin: 50% 0;
  animation: award-wave 0.9s ease-in-out infinite alternate;
}

.audience {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  height: 30%;
  background: url("images/passion-audience.svg") bottom / auto 100% repeat-x;
}

/* Camera flashes, each with its own timing (set in the HTML) */
.flash {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 4;
  width: clamp(1.5rem, 5vw, 3.5rem);
  aspect-ratio: 1;
  translate: -50% -50%;
  background: radial-gradient(circle, #FFFFFF 0, rgb(255 255 255 / 0.85) 15%, rgb(255 255 255 / 0) 60%);
  opacity: 0;
  animation: flash var(--d) linear infinite var(--delay);
}

/* ---- Caption and remote under the TV ---- */
.tv-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm) var(--space-md);
  margin-top: var(--space-md);
}

.tv-caption {
  display: grid;
  margin: 0;
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
}

.tv-caption span {
  grid-area: 1 / 1;
  opacity: 0;
  animation: caption-cycle calc(var(--channel-time) * 5) linear infinite;
}

.tv-caption__1 { animation-delay: 0s !important; }
.tv-caption__2 { animation-delay: calc(var(--channel-time) * -4) !important; }
.tv-caption__3 { animation-delay: calc(var(--channel-time) * -3) !important; }
.tv-caption__4 { animation-delay: calc(var(--channel-time) * -2) !important; }
.tv-caption .tv-caption__4 { animation-name: caption-cycle-long; }   /* CH 4: two slots */

/* Remote: Play, Pause, Next as square icon buttons */
.tv-remote {
  display: flex;
  gap: var(--space-xs);
  border-radius: var(--radius-sm);
}

/* Keyboard users focus the hidden controls; show the ring on the remote */
.tv-remote:has(input:focus-visible) {
  outline: 3px solid var(--color-ink);
  outline-offset: 4px;
}

.remote-slot {
  display: grid;
}

.remote-slot > * {
  grid-area: 1 / 1;
}

.remote-btn {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--color-ink);
  background: var(--color-white);
  color: var(--color-ink);
  cursor: pointer;
  user-select: none;
  transition: background-color var(--duration) var(--ease-out), color var(--duration) var(--ease-out);
}

.remote-btn:hover {
  background: var(--color-sky-light);
}

.remote-icon {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

/* "Pressed" look: Play while running, Pause while paused */
.remote-play--on,
.tv-set:has(#tv-pause:checked) .remote-pause {
  background: var(--color-ink);
  color: var(--color-white);
  cursor: default;
}

.tv-set:has(#tv-pause:checked) .remote-pause {
  cursor: pointer;
}

/* Which Play button is showing:
   running on auto = pressed indicator; on a chosen channel = back to auto;
   paused = unpause */
.remote-play { display: none; }
.tv-set:has(#ch-auto:checked):not(:has(#tv-pause:checked)) .remote-play--on,
.tv-set:not(:has(#ch-auto:checked)):not(:has(#tv-pause:checked)) .remote-play--resume,
.tv-set:has(#tv-pause:checked) .remote-play--unpause {
  display: inline-grid;
}

/* Next: on auto, each Next label is visible while "its" channel is on
   (same timing as the channels); on a chosen channel, the matching one shows */
.remote-next {
  visibility: hidden;
  animation: next-cycle calc(var(--channel-time) * 5) linear infinite;
}

.remote-next--1 { animation-delay: 0s; }
.remote-next--2 { animation-delay: calc(var(--channel-time) * -4); }
.remote-next--3 { animation-delay: calc(var(--channel-time) * -3); }
.remote-next--4 { animation-delay: calc(var(--channel-time) * -2); animation-name: next-cycle-long; }

.tv-set:not(:has(#ch-auto:checked)) .remote-next {
  animation: none;
  visibility: hidden;
}

.tv-set:has(#ch-1:checked) .remote-next--1,
.tv-set:has(#ch-2:checked) .remote-next--2,
.tv-set:has(#ch-3:checked) .remote-next--3,
.tv-set:has(#ch-4:checked) .remote-next--4 {
  visibility: visible;
}

/* While paused, Next is greyed out */
.tv-set:has(#tv-pause:checked) .remote-slot--next {
  opacity: 0.35;
  pointer-events: none;
}

/* Pause icon on the TV screen */
.tv-paused {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 8;
  display: none;
  place-items: center;
  width: clamp(3rem, 9vw, 5.5rem);
  aspect-ratio: 1;
  translate: -50% -50%;
  background: rgb(0 0 0 / 0.45);
}

.tv-paused svg {
  width: 45%;
  fill: #FFFFFF;
}

.tv-set:has(#tv-pause:checked) .tv-paused {
  display: grid;
}

/* Picking a channel on the remote: stop the cycle, show only that channel */
.tv-set:not(:has(#ch-auto:checked)) .channel,
.tv-set:not(:has(#ch-auto:checked)) .tv-caption > * {
  animation: none;
  opacity: 0;
  visibility: hidden;
}

.tv-set:not(:has(#ch-auto:checked)) .tv-osd {
  animation: none;
  opacity: 0;
}

.tv-set:has(#ch-1:checked) .channel--1,
.tv-set:has(#ch-2:checked) .channel--2,
.tv-set:has(#ch-3:checked) .channel--3,
.tv-set:has(#ch-4:checked) .channel--4 {
  animation: channel-in 0.8s var(--ease-out);
}

.tv-set:has(#ch-1:checked) .channel--1,
.tv-set:has(#ch-2:checked) .channel--2,
.tv-set:has(#ch-3:checked) .channel--3,
.tv-set:has(#ch-4:checked) .channel--4,
.tv-set:has(#ch-1:checked) .tv-caption__1,
.tv-set:has(#ch-2:checked) .tv-caption__2,
.tv-set:has(#ch-3:checked) .tv-caption__3,
.tv-set:has(#ch-4:checked) .tv-caption__4 {
  opacity: 1;
  visibility: visible;
}

/* ...with a short burst of static and the channel label */
.tv-set:has(#ch-1:checked) .channel--1 .tv-osd,
.tv-set:has(#ch-2:checked) .channel--2 .tv-osd,
.tv-set:has(#ch-3:checked) .channel--3 .tv-osd,
.tv-set:has(#ch-4:checked) .channel--4 .tv-osd {
  animation: osd-once 2.5s linear forwards;
}

.tv-set:has(#ch-1:checked) .tv-static { animation: static-once-1 0.9s linear forwards, static-jitter 0.12s steps(1) infinite; }
.tv-set:has(#ch-2:checked) .tv-static { animation: static-once-2 0.9s linear forwards, static-jitter 0.12s steps(1) infinite; }
.tv-set:has(#ch-3:checked) .tv-static { animation: static-once-3 0.9s linear forwards, static-jitter 0.12s steps(1) infinite; }
.tv-set:has(#ch-4:checked) .tv-static { animation: static-once-4 0.9s linear forwards, static-jitter 0.12s steps(1) infinite; }

/* Pause: freezes everything on the TV */
.tv-set:has(#tv-pause:checked) *,
.tv-set:has(#tv-pause:checked) *::before,
.tv-set:has(#tv-pause:checked) *::after {
  animation-play-state: paused !important;
}

/* ---- Fold-out favourites under Films, Books and F1 ---- */
.favourites {
  margin-top: var(--space-sm);
  border-top: 1px solid var(--color-line);
}

.favourites summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding-top: var(--space-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.favourites summary::-webkit-details-marker {
  display: none;
}

/* A plus sign that turns into a cross when open */
.favourites summary::after {
  content: "+";
  font-size: 1.4em;
  line-height: 1;
  transition: transform var(--duration) var(--ease-out);
}

.favourites[open] summary::after {
  transform: rotate(45deg);
}

.favourites summary:hover {
  color: var(--color-ink-soft);
}

.favourites ol {
  display: grid;
  gap: var(--space-2xs);
  margin: var(--space-sm) 0 0;
  padding-left: 1.25rem;
  color: var(--color-ink-soft);
}

.favourites[open] ol {
  animation: fold-in 0.35s var(--ease-out);
}



/* ---- Gallery: flip through photos with arrows (CSS only) ----
   Hidden radio buttons remember which photo is showing; the arrows are
   labels that tick the previous or next one. Keyboard: Tab to the gallery,
   then use the arrow keys. Works for up to 8 photos.
   TRY ME: change 400ms for a faster or slower fade between photos */
.gallery {
  position: relative;
  display: grid;
}

.gallery__radio {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.gallery__slides {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gallery__slide {
  --on: 0;
  grid-area: 1 / 1;
  overflow: hidden;
  opacity: var(--on);
  transition: opacity 400ms var(--ease-out);
}

.gallery__slide img,
.gallery__slide .placeholder-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Only the arrows for the photo on show are visible */
.gallery__nav {
  display: none;
}

/* Arrows: small, see-through ink squares with a white chevron.
   Half-faded until you hover the photo. TRY ME: change 1.75rem (size) */
.gallery__btn {
  position: absolute;
  top: 50%;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  translate: 0 -50%;
  background: rgb(14 42 71 / 0.35);
  color: var(--color-white);
  opacity: 0.7;
  cursor: pointer;
  transition: opacity var(--duration) var(--ease-out), background var(--duration) var(--ease-out);
}

.gallery:hover .gallery__btn {
  opacity: 1;
}

.gallery__btn:hover {
  background: rgb(14 42 71 / 0.6);
}

.gallery__btn--prev { left: var(--space-xs); }
.gallery__btn--next { right: var(--space-xs); }

/* A bigger invisible tap area around the small arrow, for fingers */
.gallery__btn::before {
  content: "";
  position: absolute;
  inset: -0.5rem;
}

.gallery__btn svg {
  width: 0.9rem;
  height: 0.9rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: square;
}

/* Small dots at the bottom: which photo you're on (also clickable) */
.gallery__dots {
  position: absolute;
  bottom: var(--space-sm);
  left: 50%;
  z-index: 1;
  display: flex;
  gap: 0.4rem;
  translate: -50% 0;
}

.gallery__dots label {
  --on: 0;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: rgb(255 255 255 / calc(0.55 + var(--on) * 0.45));
  box-shadow: 0 0 0 1px rgb(14 42 71 / 0.25);
  scale: calc(1 + var(--on) * 0.3);
  cursor: pointer;
  transition: scale var(--duration) var(--ease-out);
}

/* Keyboard focus on the hidden radios shows on the whole gallery */
.gallery:has(.gallery__radio:focus-visible) {
  outline: 2px solid var(--color-ink);
  outline-offset: 4px;
}

.gallery__radio:nth-of-type(1):checked ~ .gallery__slides > :nth-child(1),
.gallery__radio:nth-of-type(1):checked ~ .gallery__dots > :nth-child(1) { --on: 1; }
.gallery__radio:nth-of-type(1):checked ~ .gallery__nav:nth-of-type(1) { display: contents; }
.gallery__radio:nth-of-type(2):checked ~ .gallery__slides > :nth-child(2),
.gallery__radio:nth-of-type(2):checked ~ .gallery__dots > :nth-child(2) { --on: 1; }
.gallery__radio:nth-of-type(2):checked ~ .gallery__nav:nth-of-type(2) { display: contents; }
.gallery__radio:nth-of-type(3):checked ~ .gallery__slides > :nth-child(3),
.gallery__radio:nth-of-type(3):checked ~ .gallery__dots > :nth-child(3) { --on: 1; }
.gallery__radio:nth-of-type(3):checked ~ .gallery__nav:nth-of-type(3) { display: contents; }
.gallery__radio:nth-of-type(4):checked ~ .gallery__slides > :nth-child(4),
.gallery__radio:nth-of-type(4):checked ~ .gallery__dots > :nth-child(4) { --on: 1; }
.gallery__radio:nth-of-type(4):checked ~ .gallery__nav:nth-of-type(4) { display: contents; }
.gallery__radio:nth-of-type(5):checked ~ .gallery__slides > :nth-child(5),
.gallery__radio:nth-of-type(5):checked ~ .gallery__dots > :nth-child(5) { --on: 1; }
.gallery__radio:nth-of-type(5):checked ~ .gallery__nav:nth-of-type(5) { display: contents; }
.gallery__radio:nth-of-type(6):checked ~ .gallery__slides > :nth-child(6),
.gallery__radio:nth-of-type(6):checked ~ .gallery__dots > :nth-child(6) { --on: 1; }
.gallery__radio:nth-of-type(6):checked ~ .gallery__nav:nth-of-type(6) { display: contents; }
.gallery__radio:nth-of-type(7):checked ~ .gallery__slides > :nth-child(7),
.gallery__radio:nth-of-type(7):checked ~ .gallery__dots > :nth-child(7) { --on: 1; }
.gallery__radio:nth-of-type(7):checked ~ .gallery__nav:nth-of-type(7) { display: contents; }
.gallery__radio:nth-of-type(8):checked ~ .gallery__slides > :nth-child(8),
.gallery__radio:nth-of-type(8):checked ~ .gallery__dots > :nth-child(8) { --on: 1; }
.gallery__radio:nth-of-type(8):checked ~ .gallery__nav:nth-of-type(8) { display: contents; }

/* Posters and covers: shown whole, centred on a clear background,
   framed with a thin ink outline */
.gallery--posters .gallery__slide {
  position: relative;
}

/* TRY ME: change 88% to make the posters bigger or smaller in the box */
.gallery--posters .gallery__slide img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: auto;
  height: 88%;
  translate: -50% -54%;
  border: 2px solid var(--color-ink);
}

/* On the clear background the dots switch to ink */
.gallery--posters .gallery__dots label {
  background: rgb(14 42 71 / calc(0.2 + var(--on) * 0.8));
  box-shadow: none;
}

.gallery--posters .gallery__dots {
  bottom: var(--space-2xs);
}

.passion-card:hover .gallery .placeholder-image {
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .gallery__slide { transition: none; }
}

/* Ferrari fold-out: a short paragraph instead of a list */
.favourites__text {
  margin-top: var(--space-sm);
  color: var(--color-ink-soft);
}


/* ---- How things work: the 4th passion ----
   Four cards in a row (2 x 2 on tablets, stacked on phones). Each has a
   simple line drawing in ink with one apricot dot, like the How I Work flow.
   TRY ME: change the gradient on .system-card__media */
.systems {
  margin-top: var(--space-xl);
}

/* Room between How things work and the Films | Books | F1 row below */
.systems + .passion-grid {
  margin-top: var(--space-2xl);
}

.system-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 640px) {
  .system-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .system-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.system-card {
  display: grid;
  align-content: start;
  gap: var(--space-xs);
}

.system-card__media {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  margin-bottom: var(--space-sm);
  padding: var(--space-md);
  border: 1px solid var(--color-line);
  background: linear-gradient(135deg, var(--color-white), var(--color-sky-light));
}

.system-card__art {
  width: 100%;
  max-width: 14rem;
  height: auto;
  overflow: visible;
}

.system-card__art .art-line {
  fill: none;
  stroke: var(--color-ink);
  stroke-width: 2;
  stroke-linejoin: miter;
}

.system-card__art .art-dots,
.system-card__art .art-fill {
  fill: var(--color-ink);
}

.system-card__art .art-accent {
  fill: var(--color-apricot-deep);
}

.system-card__art .art-tick {
  fill: none;
  stroke: var(--color-white);
  stroke-width: 2;
}

.system-card__title {
  font-size: var(--text-lg);
}

.system-card p {
  color: var(--color-ink-soft);
}

/* The drawing nudges up a little when you hover the card */
.system-card__art {
  transition: transform var(--duration) var(--ease-out);
}

.system-card:hover .system-card__art {
  transform: translateY(-3px);
}


/* ---- CH 4: complex systems, an aircraft turnaround ----
   Seen from above, with a Gantt chart on the right. One run lasts CH 4's
   two slots (--tt-time = 14 seconds), so it starts from the beginning each
   time the channel comes on. Timeline, as % of the run: plane taxis in 3-15;
   bridge 15-19; deboard 18-34; belt loader and bags 18-60; fuel 20-58;
   catering 30-62; clean 34-52; board 52-66; tug and pushback 62-78;
   plane taxis off 80-93; fade and reset 95-100. The Gantt bars fill on the
   same timeline; apricot bars are the critical path. */
.tt-scene { --tt-time: calc(var(--channel-time) * 2); background: #1B2733; }
.tt-scene .tv-osd { right: auto; left: 4%; }   /* keep "CH 4" clear of the chart header */
.tt-cast { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; animation: tt-fade var(--tt-time) linear infinite; }
.tt-cast * { transform-box: fill-box; }
.tt-apron { fill: #3A4652; }
.tt-taxi { fill: #33404C; }
.tt-lead { stroke: #F2C14E; stroke-width: 1.5; }
.tt-stop { stroke: #F2C14E; stroke-width: 3; }
.tt-edge { stroke: #F2C14E; stroke-width: 1; stroke-dasharray: 6 4; }
.tt-centre { stroke: #F2C14E; stroke-width: 1; opacity: .6; }
.tt-terminal { fill: #9FB3C8; }
.tt-bridge rect { fill: #CFD8E2; stroke: #0E2A47; stroke-width: 1; }
.tt-plane-body { fill: #FFFFFF; stroke: #0E2A47; stroke-width: 1.2; }
.tt-engine { fill: #8FA3B8; }
.tt-cockpit { fill: #0E2A47; }
.tt-cab { fill: #0E2A47; }
.tt-v-fuel { fill: var(--color-apricot-deep); }
.tt-v-cater { fill: var(--color-sky); }
.tt-v-belt { fill: #FFFFFF; }
.tt-v-tug { fill: #F2C14E; }
.tt-bag { fill: var(--race-red); }
.tt-panel { fill: var(--color-ink); }
.tt-title { fill: #fff; font: 700 11px var(--font-heading); }
.tt-clock { fill: var(--color-apricot); font: 700 11px var(--font-heading); text-anchor: end; }
.tt-task { fill: #DCE5EE; font: 500 8px var(--font-body); }
.tt-track { fill: #1E3A5A; }
.tt-axis { stroke: #3D5A7A; stroke-width: .6; }
.tt-bar { fill: var(--color-sky); transform-origin: 0 50%; }
.tt-bar--crit { fill: var(--color-apricot-deep); }
.tt-now { stroke: #fff; stroke-width: 1; animation: tt-now var(--tt-time) linear infinite; }
.tt-legend { fill: #9FB3C8; font: 500 7.5px var(--font-body); }
.tt-key { fill: var(--color-apricot-deep); }

.tt-plane { animation: tt-plane var(--tt-time) linear infinite; }
.tt-bridge { animation: tt-bridge var(--tt-time) linear infinite; transform-origin: 50% 0; }
.tt-fuel { animation: tt-fuel var(--tt-time) linear infinite; }
.tt-cater { animation: tt-cater var(--tt-time) linear infinite; }
.tt-belt { animation: tt-belt var(--tt-time) linear infinite; }
.tt-tug { animation: tt-tug var(--tt-time) linear infinite; }
.tt-bag { opacity: 0; animation: tt-bag var(--tt-time) linear infinite; }
.tt-bag--1 { animation-delay: -0.5s; } .tt-bag--2 { animation-delay: -1s; }

@keyframes tt-fade { 0% { opacity: 0; } 2%, 95% { opacity: 1; } 99%, 100% { opacity: 0; } }
/* plane: in from the left 3-15, parked, pushed back 70-78, taxis off to the right along the taxiway 80-93 */
@keyframes tt-plane {
  0%, 3% { transform: translateX(-260px); animation-timing-function: ease-out; }
  15%, 70% { transform: none; animation-timing-function: ease-in-out; }
  78% { transform: translateX(-46px); animation-timing-function: ease-in; }
  84% { transform: translate(-20px, 100px) ; }
  93%, 100% { transform: translate(260px, 100px); }
}
@keyframes tt-bridge { 0%, 15% { transform: scaleY(0); } 19%, 64% { transform: scaleY(1); } 68%, 100% { transform: scaleY(0); } }
@keyframes tt-fuel { 0%, 20% { opacity: 1; transform: none; animation-timing-function: ease-out; } 26%, 50% { opacity: 1; transform: translateY(60px); animation-timing-function: ease-in; } 57% { opacity: 1; transform: translate(-120px, 60px); } 58%, 100% { opacity: 0; transform: translate(-120px, 60px); } }
@keyframes tt-cater { 0%, 30% { transform: translate(60px, 60px); animation-timing-function: ease-out; } 36%, 54% { transform: translate(-20px, -32px); animation-timing-function: ease-in; } 62%, 100% { transform: translate(60px, 60px); } }
@keyframes tt-belt { 0%, 18% { transform: translateY(60px); animation-timing-function: ease-out; } 24%, 60% { transform: translateY(-60px); animation-timing-function: ease-in; } 68%, 100% { transform: translateY(60px); } }
@keyframes tt-bag { 0%, 25% { opacity: 0; transform: none; } 26% { opacity: 1; transform: none; } 31% { opacity: 1; transform: translateY(26px); } 32%, 100% { opacity: 0; transform: translateY(26px); } }
@keyframes tt-tug { 0%, 62% { opacity: 1; transform: translateY(100px); animation-timing-function: ease-out; } 66% { transform: translate(252px, 100px); } 70% { transform: translateX(252px); } 78% { transform: translateX(206px); } 81% { transform: translate(230px, 30px); opacity: 1; } 84%, 100% { transform: translate(230px, 30px); opacity: 0; } }
@keyframes tt-now { 0%, 15% { transform: none; } 80%, 94% { transform: translateX(72px); } 100% { transform: translateX(72px); } }
@keyframes tt-bar-0 { 0%, 18% { transform: scaleX(0); } 34%, 94% { transform: scaleX(1); } 100% { transform: scaleX(1); } }
.tt-bar--0 { animation: tt-bar-0 var(--tt-time) linear infinite; }
@keyframes tt-bar-1 { 0%, 24% { transform: scaleX(0); } 60%, 94% { transform: scaleX(1); } 100% { transform: scaleX(1); } }
.tt-bar--1 { animation: tt-bar-1 var(--tt-time) linear infinite; }
@keyframes tt-bar-2 { 0%, 27% { transform: scaleX(0); } 50%, 94% { transform: scaleX(1); } 100% { transform: scaleX(1); } }
.tt-bar--2 { animation: tt-bar-2 var(--tt-time) linear infinite; }
@keyframes tt-bar-3 { 0%, 36% { transform: scaleX(0); } 54%, 94% { transform: scaleX(1); } 100% { transform: scaleX(1); } }
.tt-bar--3 { animation: tt-bar-3 var(--tt-time) linear infinite; }
@keyframes tt-bar-4 { 0%, 34% { transform: scaleX(0); } 52%, 94% { transform: scaleX(1); } 100% { transform: scaleX(1); } }
.tt-bar--4 { animation: tt-bar-4 var(--tt-time) linear infinite; }
@keyframes tt-bar-5 { 0%, 52% { transform: scaleX(0); } 66%, 94% { transform: scaleX(1); } 100% { transform: scaleX(1); } }
.tt-bar--5 { animation: tt-bar-5 var(--tt-time) linear infinite; }
@keyframes tt-bar-6 { 0%, 70% { transform: scaleX(0); } 78%, 94% { transform: scaleX(1); } 100% { transform: scaleX(1); } }
.tt-bar--6 { animation: tt-bar-6 var(--tt-time) linear infinite; }


/* --------------------------------------------------------------------------
   17. Toto page: hero with portrait, and the places journey
   Flag colours are an agreed exception to the three-tone rule, used only
   in the flag tiles.
   -------------------------------------------------------------------------- */
.toto-hero {
  display: grid;
  gap: var(--space-xl);
  align-items: center;
  padding-block: var(--space-xl) var(--space-lg);   /* closer to My life journey */
}

/* Portrait (vertical) photo frame */
.toto-hero__photo {
  width: 100%;
  max-width: min(24rem, 72%);   /* smaller on phones, so the text shows sooner */
  aspect-ratio: 4 / 5;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.toto-hero__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.toto-hero__title {
  max-width: 16ch;
  font-size: var(--text-hero);
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.toto-hero__lead {
  max-width: 34rem;
  margin-top: var(--space-md);
  color: var(--color-ink-soft);
  font-size: var(--text-lg);
}

/* ---- The places ---- */
.places {
  padding-top: var(--space-lg);
  padding-bottom: max(var(--space-section), 18vh);   /* scroll room so the journey can finish */
  --flag-w: clamp(4.5rem, 10vw, 8rem);      /* TRY ME: flag tile size */
  --icon-space: clamp(3.5rem, 7vw, 6rem);   /* room above the flags for Big Ben and the Sagrada Familia */
  --row-gap: var(--space-xl);
}

.places__list {
  display: grid;
  row-gap: var(--row-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Phone: flag on the left, text on the right, line running down */
.place {
  position: relative;
  display: grid;
  align-content: start;   /* don't stretch shorter columns (keeps texts level) */
  grid-template-columns: var(--flag-w) 1fr;
  column-gap: var(--space-md);
}

.place__mark {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  align-content: start;
  height: calc(var(--icon-space) + var(--flag-w) * 2 / 3);   /* same for every place, so the texts line up */
  padding-top: var(--icon-space);
}

/* The slanted flag tile, the "/ /" from the sketch */
.place__flag {
  position: relative;
  z-index: 1;
  display: block;
  width: var(--flag-w);
  aspect-ratio: 3 / 2;
  transform: skewX(-14deg);
  box-shadow: inset 0 0 0 1px rgb(14 42 71 / 0.18);
}

/* Venezuela on top (its bands run across), Italy below (its bands run down) */
.place--ve-it .place__flag {
  background:
    /* Venezuela's 7 stars: tiny white dots in a half arch on the blue */
    radial-gradient(circle at 35.9% 27.6%, #FFFFFF 0 1.4px, transparent 1.9px),
    radial-gradient(circle at 39.1% 24.1%, #FFFFFF 0 1.4px, transparent 1.9px),
    radial-gradient(circle at 44.1% 21.8%, #FFFFFF 0 1.4px, transparent 1.9px),
    radial-gradient(circle at 50.0% 21.0%, #FFFFFF 0 1.4px, transparent 1.9px),
    radial-gradient(circle at 55.9% 21.8%, #FFFFFF 0 1.4px, transparent 1.9px),
    radial-gradient(circle at 60.9% 24.1%, #FFFFFF 0 1.4px, transparent 1.9px),
    radial-gradient(circle at 64.1% 27.6%, #FFFFFF 0 1.4px, transparent 1.9px),
    linear-gradient(180deg, #FFCC00 0%, #FFCC00 22%, #00247D 42%, #00247D 58%, #CF142B 78%, #CF142B 100%) top / 100% 50% no-repeat,
    linear-gradient(90deg, #009246 0%, #009246 22%, #FFFFFF 42%, #FFFFFF 58%, #CE2B37 78%, #CE2B37 100%) bottom / 100% 50% no-repeat;
}

/* A simplified Union Jack: a soft gradient alone reads as the French flag */
.place--uk .place__flag {
  background:
    linear-gradient(90deg, transparent 45%, #C8102E 45%, #C8102E 55%, transparent 55%),
    linear-gradient(180deg, transparent 40%, #C8102E 40%, #C8102E 60%, transparent 60%),
    linear-gradient(90deg, transparent 41%, #FFFFFF 41%, #FFFFFF 59%, transparent 59%),
    linear-gradient(180deg, transparent 33%, #FFFFFF 33%, #FFFFFF 67%, transparent 67%),
    linear-gradient(to top right, transparent 47.5%, #C8102E 47.5%, #C8102E 50.5%, transparent 50.5%),
    linear-gradient(to bottom right, transparent 47.5%, #C8102E 47.5%, #C8102E 50.5%, transparent 50.5%),
    linear-gradient(to top right, transparent 44%, #FFFFFF 44%, #FFFFFF 56%, transparent 56%),
    linear-gradient(to bottom right, transparent 44%, #FFFFFF 44%, #FFFFFF 56%, transparent 56%),
    #012169;
}

.place--es .place__flag {
  background: linear-gradient(180deg, #AA151B 0%, #AA151B 18%, #F1BF00 38%, #F1BF00 62%, #AA151B 82%, #AA151B 100%);
}

/* Country names: hidden on screen (still read by screen readers).
   Add "places--show-names" to the section to show them. */
.place__name {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.places--show-names .place__name {
  position: static;
  width: auto;
  height: auto;
  margin-top: var(--space-xs);
  overflow: visible;
  clip-path: none;
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: center;
  white-space: normal;
}

/* Big Ben and the Sagrada Familia sit in the space above their flags */
/* Anchored over the flag's top-right corner; they grow out of it */
.place__icon {
  position: absolute;
  bottom: calc(var(--flag-w) * 2 / 3);
  left: calc(50% + var(--flag-w) * 0.42);
  translate: -50% 0;
  height: var(--icon-space);
  transform-origin: 50% 100%;
}

.place__icon--sagrada {
  /* nudged left so it leaves the same small gap before the corner as Big Ben */
  left: calc(50% + var(--flag-w) * 0.42 - var(--icon-space) * 0.1);
  height: calc(var(--icon-space) * 1.05);
}

.place__icon .tower { fill: var(--color-ink); }
.place__icon .clock { fill: #F2C14E; }
.place__icon .hands { fill: none; stroke: var(--color-ink); stroke-width: 1.5; }
.place__icon .window { fill: #1E4673; }
.place__icon .stone { fill: #C9A97A; }
.place__icon .stone-light { fill: #E3CFA8; }
.place__icon .stone-dark { fill: #A88A5E; }
.place__icon .slit,
.place__icon .portal { fill: #5A4632; }
.place__icon .star { fill: var(--color-apricot-deep); }

/* Text under each place, with half-square corners top left and bottom right */
.place__text {
  position: relative;
  align-self: start;
  padding: var(--space-md);
}

/* --frame goes from 0 to 1 as the line arrives (1 by default) */
@property --frame {
  syntax: "<number>";
  inherits: true;
  initial-value: 1;
}

.place__text::before,
.place__text::after {
  content: "";
  position: absolute;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--color-ink);
  opacity: var(--frame);
  transform: scale(var(--frame));
}

.place__text::before {
  top: 0;
  left: 0;
  transform-origin: top left;
  border-right: none;
  border-bottom: none;
}

.place__text::after {
  right: 0;
  bottom: 0;
  transform-origin: bottom right;
  border-top: none;
  border-left: none;
}

.place__title {
  margin-bottom: var(--space-xs);
  font-size: var(--text-lg);
}

.place__text p:last-child {
  color: var(--color-ink-soft);
}

/* The line from one flag to the next (phone: downwards) */
.place:not(:last-child)::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: calc(var(--icon-space) + var(--flag-w) / 3);
  left: calc(var(--flag-w) / 2 - 1.5px);
  width: 3px;
  height: calc(100% + var(--row-gap));
  background: linear-gradient(180deg, var(--color-ink-soft), var(--color-apricot-deep));
  transform-origin: top;
}

/* --------------------------------------------------------------------------
   18. My Work page: How I Work (AI-native flow), Value Delivered, Skills
   -------------------------------------------------------------------------- */
.how-hero {
  padding-block: var(--space-lg) var(--space-section);   /* title sits high, top left */
}

.how-hero__title {
  font-size: var(--text-hero);
  letter-spacing: -0.035em;
  white-space: nowrap;   /* always one line */
}

/* ---- The flow. Phones/tablets: steps stacked, joined by vertical lines.
        Wide screens (64rem+): five steps in a row, joined by horizontal lines. ---- */
.flow {
  --gap: 3.5rem;   /* TRY ME: space between steps (holds the line and the gates) */
  --box-h: 4.5rem;
  --logo: 2rem;    /* TRY ME: size of the tool logos */
  --tools-h: 2rem; /* height of the logo row above the boxes */
  margin: var(--space-xl) 0 0;
  padding: 0;
  list-style: none;
}

.flow__step {
  position: relative;
  display: grid;
  gap: var(--space-sm);
  max-width: 24rem;
}

.flow__box {
  display: grid;
  place-items: center;
  min-height: var(--box-h);
  margin: 0;
  padding: var(--space-sm);
  border: 2px solid var(--color-apricot-deep);   /* apricot frame */
  background: var(--color-ink);                    /* dark box, white text */
  color: var(--color-white);
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

/* Tools: logos only, in a row above the box (names are read out, and show on hover) */
.tools {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tools:empty {
  display: none;   /* phones: no empty gap for steps without tools */
}

/* Each logo is up to --logo wide, and shrinks a little when a step has many */
.tool {
  flex: 0 1 var(--logo);
  min-width: 0;
}

.tool__mark {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--color-line);
  border-radius: 50%;
  background: var(--color-white);
  box-shadow: var(--shadow-card);
  color: var(--color-ink);
  font-family: var(--font-heading);
  font-size: 0.65rem;
  font-weight: 700;
}

/* Every tool logo: just its mark, in ink blue, the same size on a white circle */
.tool__mark--logo img {
  width: 56%;    /* TRY ME: logo size inside the circle */
  height: 56%;
  object-fit: contain;
}

.tool__mark--empty {
  border: 2px dashed var(--color-ink-soft);
  background: transparent;
  box-shadow: none;
  color: var(--color-ink-soft);
}

.flow__desc {
  margin: 0;
  color: var(--color-ink-soft);
  font-size: var(--text-sm);
  line-height: 1.55;
}

/* The line to the next step (phones: downwards), with a travelling apricot dot */
.flow__link {
  position: relative;
  width: 2px;
  height: 3rem;
  margin-left: calc(var(--box-w-half, 1.5rem));
  background: var(--color-ink);
}

.flow__link--gate {
  height: 5rem;
}

.flow__pulse {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 1;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--color-apricot-deep);
  translate: -50% -50%;
  animation: flow-pulse-down 2.6s ease-in-out infinite;
}

.flow__link--gate .flow__pulse {
  animation: gate-pulse-down 4s ease-in-out infinite;
}

/* The human gate: a checkpoint square on the line, ticked on each pass */
.gate {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  justify-items: center;
  gap: 0.2rem;
  translate: -50% -0.8rem;
}

.gate__sign {
  position: relative;
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border: 2px solid var(--color-ink);
  background: var(--color-white);
}

.gate__icon {
  width: 0.85rem;
  height: 0.85rem;
  fill: var(--color-ink);
}

.gate__tick {
  position: absolute;
  top: -0.55rem;
  right: -0.6rem;
  color: var(--color-apricot-deep);
  font-size: 0.9rem;
  font-weight: 800;
  animation: gate-tick 4s ease-in-out infinite;
}

.gate__label {
  position: absolute;
  top: 50%;
  left: calc(100% + 0.6rem);
  translate: 0 -50%;
  color: var(--color-ink-soft);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}

/* Wide screens: five steps in a row. Each step uses the same three rows
   (box, tools, text) through subgrid, so the texts start level. */
@media (min-width: 64rem) {
  .flow {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: var(--tools-h) auto auto;
    gap: var(--space-sm) var(--gap);
  }

  .tools,
  .tools:empty {
    display: flex;
    flex-wrap: nowrap;
  }

  .flow__step {
    grid-row: span 3;
    grid-template-rows: subgrid;
    max-width: none;
  }

  .flow__box {
    height: var(--box-h);
  }

  /* the line sits in the gap to the right of each box */
  .flow__link,
  .flow__link--gate {
    position: absolute;
    top: calc(var(--tools-h) + var(--space-sm) + var(--box-h) / 2 - 1px);   /* middle of the box */
    left: 100%;
    width: var(--gap);
    height: 2px;
    margin: 0;
  }

  .flow__pulse {
    top: 50%;
    left: 0;
    animation-name: flow-pulse-across;
  }

  .flow__link--gate .flow__pulse {
    animation-name: gate-pulse-across;
  }

  .gate {
    translate: -50% -0.8rem;
  }

  .gate__label {
    top: calc(100% + 0.35rem);
    left: 50%;
    translate: -50% 0;
    font-size: 0.7rem;
    line-height: 1.1;
    text-align: center;
    white-space: normal;
    width: 3.2rem;
  }
}

/* ---- Value Delivered: one row per company ---- */
.value {
  background: var(--color-sky-light);   /* one colour for the whole section */
}

.value-rows {
  display: grid;
}

.value-row {
  display: grid;
  gap: var(--space-md);
  padding-block: var(--space-lg);
  border-top: 1px solid rgb(14 42 71 / 0.18);
  scroll-margin-top: var(--space-md);
}

.value-row:last-child {
  border-bottom: 1px solid rgb(14 42 71 / 0.18);
}

.value-row__intro .eyebrow {
  margin-bottom: var(--space-2xs);
}

.value-row__name {
  font-size: var(--text-xl);
}

.value-row__desc {
  margin-top: var(--space-2xs);
  color: var(--color-ink-soft);
}

/* In a row, figures sit side by side with thin lines between them
   (2 x 2 on phones). Number on top, label underneath. */
.facts--row .fact-stat,
.facts--row .fact-list,
.facts--row .fact-quote {
  padding: var(--space-xs) var(--space-md);
}

.facts--row .fact-stat {
  flex-direction: column;
  align-items: flex-start;
}

.facts--row .fact-stat__label {
  flex: none;
  max-width: 14ch;
}

.facts--row .fact-stat__number {
  font-size: clamp(2.25rem, 30cqi, 3.75rem);
}

/* A row with a quote: on phones the quote takes the full width
   (36K | 8, then the quote, then the last figure on its own line) */
.facts--quote li.fact-quote,
.facts--quote li:last-child {
  grid-column: 1 / -1;
  border-right: none;
}

.facts--quote li.fact-quote {
  border-bottom: 1px solid var(--facts-line);
  padding-block: var(--space-md);
}

/* ---- Skills | Case Studies: two halves, split by a line ---- */
.skills-split {
  display: grid;
}

.skills-split__half {
  display: grid;
  align-content: start;
  gap: var(--space-lg);
  padding-block: var(--space-lg);
}

.skills-split__half + .skills-split__half {
  border-top: 1px solid var(--color-ink);
}

/* Skills as square tags */
/* Skills: a tidy grid of equal-width tags, two per row. Tags in the same
   row share one height, so long names wrapping onto two lines stay neat.
   TRY ME: change 2 to 3 for three per row */
.skill-tags {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-xs);
  margin: 0;
  padding: 0;
  list-style: none;
}

.skill-tags li {
  display: flex;
  align-items: center;
  padding: 0.6em 0.8em;
  line-height: 1.3;
  border: 1px solid var(--color-ink);
  color: var(--color-ink);
  font-size: var(--text-sm);
  font-weight: 600;
}

/* Case studies: title and one line each, split by thin lines */
.cases {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--color-line);
}

.case {
  display: grid;
  gap: var(--space-2xs);
  padding-block: var(--space-md);
  border-bottom: 1px solid var(--color-line);
}

.case__title {
  font-size: var(--text-lg);
}

.case__desc {
  color: var(--color-ink-soft);
}


/* ---- Case study panels ----
   Each case study title is a button that opens a panel sliding in from the
   right over the dimmed page (HTML popover: no JavaScript; Esc, the close
   button and a click on the dimmed page close it). */
:root {
  --panel-w: min(46rem, 100vw);
  --panel-pad: clamp(1.25rem, 4vw, 3.5rem);
  --rail-x: 1.25rem;               /* centre line of the step markers */
}

.case-open {
  all: unset;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2xs) var(--space-md);
  align-items: center;
  width: 100%;
  cursor: pointer;
}

.case-open__eyebrow { grid-column: 1; color: var(--color-ink-soft); font-size: var(--text-sm); letter-spacing: 0.08em; text-transform: uppercase; }
.case-open__title { grid-column: 1; color: var(--color-ink); font-family: var(--font-heading); font-size: var(--text-xl); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; text-wrap: balance; }
.case-open__arrow {
  grid-column: 2; grid-row: 1 / span 2;
  display: grid; place-items: center;
  width: 2.75rem; height: 2.75rem;
  border: 1px solid var(--color-ink);
  color: var(--color-ink);
  font-size: 1.25rem;
  transition: background var(--duration) var(--ease-out), color var(--duration) var(--ease-out), translate var(--duration) var(--ease-out);
}
.case-open:hover .case-open__arrow,
.case-open:focus-visible .case-open__arrow { background: var(--color-ink); color: var(--color-white); translate: 4px 0; }
.case-open:focus-visible { outline: 2px solid var(--color-ink); outline-offset: 4px; }

/* ---- The panel ---- */
.cs-panel {
  position: fixed;
  inset: 0 0 0 auto;
  width: var(--panel-w);
  height: 100dvh;
  max-width: 100vw;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--color-line);
  background: var(--color-white);
  color: var(--color-ink);
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: -24px 0 60px rgb(14 42 71 / 0.18);
  translate: 100% 0;
  transition: translate 600ms var(--ease-out), overlay 600ms allow-discrete, display 600ms allow-discrete;
}

.cs-panel:popover-open { translate: 0 0; }
@starting-style { .cs-panel:popover-open { translate: 100% 0; } }

.cs-panel::backdrop {
  background: rgb(14 42 71 / 0);
  transition: background 600ms var(--ease-out), overlay 600ms allow-discrete, display 600ms allow-discrete;
}
.cs-panel:popover-open::backdrop { background: rgb(14 42 71 / 0.45); }
@starting-style { .cs-panel:popover-open::backdrop { background: rgb(14 42 71 / 0); } }

@media (prefers-reduced-motion: reduce) {
  .cs-panel, .cs-panel::backdrop { transition: none; }
}

/* Top bar stays put while the story scrolls */
.cs-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--panel-pad);
  padding-top: max(var(--space-sm), env(safe-area-inset-top, 0px));
  background: rgb(255 255 255 / 0.94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--color-line);
  font-size: var(--text-sm);
  color: var(--color-ink-soft);
}

.cs-close {
  all: unset;
  display: grid; place-items: center;
  width: 2.5rem; height: 2.5rem;
  border: 1px solid var(--color-ink);
  color: var(--color-ink);
  font-size: 1.35rem; line-height: 1;
  cursor: pointer;
  transition: background var(--duration) var(--ease-out), color var(--duration) var(--ease-out);
}
.cs-close:hover, .cs-close:focus-visible { background: var(--color-ink); color: var(--color-white); }
.cs-close:focus-visible { outline: 2px solid var(--color-apricot-deep); outline-offset: 2px; }

.cs-body {
  display: grid;
  gap: var(--space-lg);
  padding: var(--space-lg) var(--panel-pad) var(--space-xl);
}

/* Opening: eyebrow, title with the apricot dot, draft tag */
.cs-intro { display: grid; gap: var(--space-xs); }
.cs-intro .eyebrow { margin: 0; }
.cs-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(2rem, 1.4rem + 2.6vw, 3.25rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.cs-draft {
  justify-self: start;
  padding: 0.2em 0.55em;
  background: var(--color-apricot-light);
  color: var(--color-ink);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.cs-context { margin: 0; max-width: 38rem; color: var(--color-ink-soft); font-size: var(--text-lg); line-height: 1.5; }

/* Key facts, same bold style as Value Delivered */
.cs-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: var(--space-md) 0;
  list-style: none;
  border-block: 1px solid var(--color-line);
}
.cs-facts li { display: grid; gap: 0.3rem; padding-inline: var(--space-sm); min-width: 0; }
.cs-facts li:first-child { padding-left: 0; }
.cs-facts li + li { border-left: 1px solid var(--color-line); }
.cs-facts strong { font-family: var(--font-heading); font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem); font-weight: 700; letter-spacing: -0.04em; line-height: 1; }
.cs-facts span { color: var(--color-ink-soft); font-size: var(--text-sm); line-height: 1.3; }

/* The story: steps down a rail, like the journey line */
.cs-steps {
  position: relative;
  display: grid;
  gap: var(--space-lg);
  margin: 0;
  padding: 0;
  list-style: none;
}
.cs-steps::before {
  content: "";
  position: absolute;
  top: 0.5rem; bottom: 0.5rem;
  left: var(--rail-x);
  width: 1px;
  background: var(--color-sky);
}
.cs-step {
  position: relative;
  display: grid;
  grid-template-columns: calc(var(--rail-x) * 2) minmax(0, 1fr);
  column-gap: var(--space-md);
  align-items: start;
}
.cs-step__marker {
  grid-column: 1;
  position: relative;
  z-index: 1;
  display: grid; place-items: center;
  width: calc(var(--rail-x) * 2); height: calc(var(--rail-x) * 2);
  background: var(--color-white);
  border: 1.5px solid var(--color-ink);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
}
.cs-step__content { grid-column: 2; display: grid; gap: var(--space-xs); min-width: 0; }
.cs-step__label {
  margin: 0;
  padding-top: 0.5rem;
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.cs-step p { margin: 0; max-width: 36rem; color: var(--color-ink); line-height: 1.65; }

/* The lesson: apricot box with a filled diamond marker */
.cs-step--lesson .cs-step__marker {
  background: var(--color-apricot);
  border-color: var(--color-apricot-deep);
}
.cs-step--lesson .cs-step__content {
  padding: var(--space-md);
  background: var(--color-apricot-light);
}
.cs-step--lesson .cs-step__label { padding-top: 0; }

/* Integration diagram: two phases, Insider and Antavo */
.cs-flow {
  display: grid;
  gap: var(--space-sm);
  margin: var(--space-xs) 0 0;
  padding: var(--space-md);
  background: var(--color-sky-light);
  border: 1px solid var(--color-sky);
}
.cs-flow__caption { margin: 0; color: var(--color-ink-soft); font-size: var(--text-sm); letter-spacing: 0.08em; text-transform: uppercase; }
.cs-flow__row {
  display: grid;
  grid-template-columns: auto minmax(2.5rem, 1fr) auto;
  grid-template-areas: "from line to" "meta meta meta";
  align-items: center;
  gap: 0.4rem var(--space-xs);
}
.cs-node {
  padding: 0.45em 0.8em;
  background: var(--color-white);
  border: 1.5px solid var(--color-ink);
  font-family: var(--font-heading);
  font-weight: 700;
}
.cs-node--from { grid-area: from; }
.cs-node--to { grid-area: to; }
.cs-line { grid-area: line; position: relative; height: 2px; background: var(--color-ink); }
.cs-line::after { content: ""; position: absolute; right: -1px; top: 50%; width: 8px; height: 8px; border-top: 2px solid var(--color-ink); border-right: 2px solid var(--color-ink); translate: 0 -50%; rotate: 45deg; }
.cs-line--planned { background: repeating-linear-gradient(90deg, var(--color-ink) 0 6px, transparent 6px 11px); }
.cs-line__dot { position: absolute; top: 50%; left: 0; width: 9px; height: 9px; border-radius: 50%; background: var(--color-apricot-deep); translate: -50% -50%; animation: cs-travel 2.6s var(--ease-out) infinite; }
@keyframes cs-travel { 0% { left: 0; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { left: 100%; opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cs-line__dot { animation: none; left: 50%; } }
.cs-flow__meta { grid-area: meta; display: flex; flex-wrap: wrap; gap: 0.3rem var(--space-xs); align-items: center; font-size: var(--text-sm); color: var(--color-ink-soft); }
.cs-chip { padding: 0.15em 0.5em; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.cs-chip--done { background: var(--color-ink); color: var(--color-white); }
.cs-chip--next { border: 1px dashed var(--color-ink-soft); color: var(--color-ink); }

/* Before/after bars (case 2: chat reply time). The bars grow when the
   panel opens. TRY ME: the after bar's width is 30% (3 of 10 seconds) */
.cs-speed {
  display: grid;
  gap: var(--space-xs);
  margin: var(--space-xs) 0 0;
  padding: var(--space-md);
  background: var(--color-sky-light);
  border: 1px solid var(--color-sky);
}
.cs-speed__row { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr) 3.5rem; align-items: center; gap: var(--space-sm); }
.cs-speed__label { font-size: var(--text-sm); color: var(--color-ink-soft); }
.cs-speed__value { font-family: var(--font-heading); font-weight: 700; text-align: right; }
.cs-speed__track { height: 0.75rem; background: var(--color-white); border: 1px solid var(--color-sky); }
.cs-speed__bar { display: block; height: 100%; transform-origin: 0 50%; }
.cs-speed__bar--before { width: 100%; background: var(--color-ink-soft); }
.cs-speed__bar--after { width: 30%; background: var(--color-apricot-deep); }
.cs-panel:popover-open .cs-speed__bar { animation: cs-grow 900ms var(--ease-out) 400ms both; }
.cs-panel:popover-open .cs-speed__bar--after { animation-delay: 900ms; }
@keyframes cs-grow { from { transform: scaleX(0); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .cs-panel:popover-open .cs-speed__bar { animation: none; } }

/* Converging pieces (case 3: what a release date depended on).
   Five chips on the left, a line from each into one "Release" box. */
.cs-converge {
  display: grid;
  gap: var(--space-sm);
  margin: var(--space-xs) 0;
  padding: var(--space-md);
  background: var(--color-sky-light);
  border: 1px solid var(--color-sky);
}
.cs-converge__grid {
  display: grid;
  grid-template-columns: auto minmax(1.5rem, 1fr) auto;
  grid-template-rows: 0 repeat(5, auto) 0;
  row-gap: 0.4rem;
  align-items: center;
}
.cs-converge__item {
  grid-column: 1;
  position: relative;
  z-index: 1;                 /* sits on top of its line, so each line starts at its own box */
  justify-self: start;
  padding: 0.3em 0.6em;
  background: var(--color-white);
  border: 1px solid var(--color-ink);
  font-size: var(--text-sm);
  font-weight: 600;
}
.cs-converge__line {
  grid-column: 1 / 3;         /* runs from under the box to the Release box */
  height: 2px;
  background: linear-gradient(90deg, var(--color-ink) 0 60%, var(--color-apricot-deep));
}
.cs-converge__release {
  grid-column: 3;
  grid-row: 1 / -1;
  align-self: stretch;
  display: grid;
  place-items: center;
  padding: 0 var(--space-sm);
  background: var(--color-ink);
  color: var(--color-white);
  border-right: 4px solid var(--color-apricot-deep);   /* turned with the text, so it ends up on the left where the lines arrive */
  font-family: var(--font-heading);
  font-weight: 700;
  writing-mode: vertical-rl;
  rotate: 180deg;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Several paragraphs in one step */
.cs-step__content p + p { margin-top: var(--space-xs); }

/* "Next" in the panel footer can open the next case study */

/* End of panel */
.cs-end {
  display: grid;
  justify-items: start;
  gap: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-line);
}
.cs-back { all: unset; cursor: pointer; font-weight: 600; color: var(--color-ink); text-decoration: underline; text-decoration-color: var(--color-line); text-underline-offset: 0.25em; }
.cs-back:hover, .cs-back:focus-visible { text-decoration-color: currentColor; }

@media (max-width: 520px) {
  .cs-facts { grid-template-columns: 1fr; gap: var(--space-sm); padding-block: var(--space-sm); }
  .cs-facts li, .cs-facts li:first-child { padding: 0; }
  .cs-facts li + li { border-left: 0; border-top: 1px solid var(--color-line); padding-top: var(--space-sm); }
  .cs-facts li { grid-template-columns: auto 1fr; align-items: baseline; gap: var(--space-sm); }
  :root { --rail-x: 1rem; }
}

/* --------------------------------------------------------------------------
   13. Wider screens (tablet and up)
   -------------------------------------------------------------------------- */
@media (min-width: 40rem) {
  .logo-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .idea-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 52rem) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .work-hero {
    grid-template-columns: 1fr 1fr;
  }

  .site-header__inner {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "name nav"
      "lang .";
  }

  .site-nav {
    justify-self: end;
    margin-top: 0;
  }

  .toto-hero {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  }

  .value-row {
    grid-template-columns: minmax(0, 3fr) minmax(0, 8fr);
    align-items: center;
  }

  .skills-split {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .skills-split__half {
    padding-block: 0;
  }

  .skills-split__half:first-child {
    padding-right: var(--space-xl);
  }

  .skills-split__half + .skills-split__half {
    padding-left: var(--space-xl);
    border-top: none;
    border-left: 1px solid var(--color-ink);
  }

  /* Every row shares the same columns, so the dividers line up from row
     to row. The third column is wider, for the Bill Gates quote, so it
     runs long rather than tall. TRY ME: change 1.6fr */
  .facts--row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.6fr) minmax(0, 1fr);
  }

  .facts--quote li.fact-quote,
  .facts--quote li:last-child {
    grid-column: auto;
  }

  .facts--quote li.fact-quote {
    padding-block: var(--space-xs);
  }

  .facts--quote .fact-quote__text p {
    font-size: min(1.05rem, 8cqi);
  }

  /* Labels: one size across all columns (narrow and wide), grows with the screen */
  .facts--row .fact-stat__label {
    font-size: clamp(0.95rem, 1.3vw, 1.15rem);
  }

  /* Numbers: one size across all columns too, so the wide column's
     figures (11M, 25) don't look bigger than the rest */
  .facts--row .fact-stat__number {
    font-size: clamp(2rem, 2.8vw, 3rem);
  }

  .facts--row .fact-stat .fact-stat__number--word {
    font-size: clamp(1.4rem, 1.9vw, 1.75rem);
  }

  .facts--row li,
  .facts--row li:nth-child(odd),
  .facts--row li:nth-child(-n + 2) {
    border: none;
  }

  .facts--row li:nth-child(n + 2) {
    border-left: 1px solid var(--facts-line);
  }

  .toto-hero__photo {
    max-width: 24rem;
  }

  /* Places side by side, line running across */
  .places__list {
    grid-template-columns: repeat(3, 1fr);
    column-gap: var(--space-xl);
    row-gap: 0;
  }

  .place {
    grid-template-columns: 1fr;
    row-gap: var(--space-md);
  }

  .place:not(:last-child)::before {
    left: 50%;
    width: calc(100% + var(--space-xl));
    height: 3px;
    background: linear-gradient(90deg, var(--color-ink-soft), var(--color-apricot-deep));
    transform-origin: left;
  }

  /* Three equal columns with a gap; a thin line sits in the middle of each gap */
  .passion-grid {
    grid-template-columns: repeat(3, 1fr);
    column-gap: calc(2 * var(--space-md));
    border-top: 1px solid var(--color-line);
  }

  .passion-grid > li {
    position: relative;
    border-top: none;
  }

  .passion-grid > li + li::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(-1 * var(--space-md));
    width: 1px;
    background: var(--color-line);
  }

  .passion-wide {
    padding-block: var(--space-2xl);
  }

  .company__inner {
    grid-template-columns: 1fr 1.4fr;
    align-items: start;
  }

  .site-footer__inner {
    grid-template-columns: 2fr 1fr;
    align-items: end;
  }

  /* Icons aligned to the right edge (new ones, e.g. Instagram, line up too) */
  .social-links {
    justify-content: flex-end;
  }

  .site-footer__bottom {
    grid-column: 1 / -1;
  }
}


/* --------------------------------------------------------------------------
   14. Animations
   -------------------------------------------------------------------------- */
@keyframes ping {
  0% { inset: 0; opacity: 0.9; }
  85%, 100% { inset: -1.1rem; opacity: 0; }  /* TRY ME: -1.1rem = how far the waves travel */
}

@keyframes drift-a {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(18%, 12%) scale(1.15); }
}

@keyframes drift-b {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-20%, 18%) scale(0.9); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}

@keyframes race-scroll {
  to { transform: translateX(calc(-1 * var(--tile-w))); }
}

@keyframes car-bounce {
  to { transform: translate(-50%, -2px); }
}

@keyframes streak {
  from { transform: translateX(0); opacity: 0.9; }
  to { transform: translateX(-50px); opacity: 0; }
}

@keyframes wheel-spin {
  to { transform: rotate(360deg); }
}

/* Hidden channels are also set to visibility: hidden, so the browser stops
   drawing them (saves battery on phones) */
@keyframes channel-cycle {
  0% { opacity: 1; visibility: visible; transform: scale(1.1); filter: brightness(1.7) contrast(1.2); }
  3.6% { transform: none; filter: none; }
  20% { opacity: 1; visibility: visible; transform: none; filter: none; }
  20.1%, 100% { opacity: 0; visibility: hidden; transform: none; filter: none; }
}

/* CH 4 stays on for two slots (40% of the loop) */
@keyframes channel-cycle-long {
  0% { opacity: 1; visibility: visible; transform: scale(1.1); filter: brightness(1.7) contrast(1.2); }
  3.6% { transform: none; filter: none; }
  40% { opacity: 1; visibility: visible; transform: none; filter: none; }
  40.1%, 100% { opacity: 0; visibility: hidden; transform: none; filter: none; }
}

/* Caption and Next use plain show/hide with the same timing */
@keyframes caption-cycle {
  0%, 20% { opacity: 1; }
  20.1%, 100% { opacity: 0; }
}

@keyframes caption-cycle-long {
  0%, 40% { opacity: 1; }
  40.1%, 100% { opacity: 0; }
}

@keyframes next-cycle {
  0%, 20% { visibility: visible; }
  20.1%, 100% { visibility: hidden; }
}

@keyframes next-cycle-long {
  0%, 40% { visibility: visible; }
  40.1%, 100% { visibility: hidden; }
}

@keyframes osd-flash {
  0%, 7% { opacity: 1; }
  7.4%, 100% { opacity: 0; }
}

@keyframes osd-once {
  0%, 80% { opacity: 1; }
  100% { opacity: 0; }
}

/* About a second of static around each switch (fades in just before,
   holds over the switch, fades out as the new channel tunes in) */
/* Static at each switch: into CH 1, 2, 3 and 4 (at 0%, 20%, 40%, 60%).
   No burst at 80%: CH 4 is still on then (it has two slots). */
@keyframes static-burst {
  0%, 1.8% { opacity: 1; }
  2.6%, 18.8% { opacity: 0; }
  19.2%, 21.8% { opacity: 1; }
  22.6%, 38.8% { opacity: 0; }
  39.2%, 41.8% { opacity: 1; }
  42.6%, 58.8% { opacity: 0; }
  59.2%, 61.8% { opacity: 1; }
  62.6%, 98.8% { opacity: 0; }
  99.2%, 100% { opacity: 1; }
}

@keyframes static-once-1 { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }
@keyframes static-once-2 { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }
@keyframes static-once-3 { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }
@keyframes static-once-4 { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }

/* Jump between the three noise frames at random-looking offsets */
@keyframes static-jitter {
  0% { background-position: 0 0; }
  20% { background-position: -180px -70px; }
  40% { background-position: -360px -20px; }
  60% { background-position: -90px -130px; }
  80% { background-position: -270px -40px; }
  100% { background-position: -450px -110px; }
}

@keyframes static-roll {
  to { top: 100%; }
}

/* A chosen channel "tunes in": slightly zoomed and bright, then settles */
@keyframes channel-in {
  from { transform: scale(1.1); filter: brightness(1.7) contrast(1.2); }
  to { transform: none; filter: none; }
}

@keyframes noir-flicker {
  from { opacity: 0.1; }
  to { opacity: 0.18; }
}

@keyframes noir-point {
  0% { transform: rotate(0); }
  12%, 40% { transform: rotate(75deg); }
  50%, 100% { transform: rotate(0); }
}

@keyframes noir-turn {
  0%, 44% { transform: scaleX(1); }
  50%, 94% { transform: scaleX(-1); }
  100% { transform: scaleX(1); }
}

@keyframes noir-plead {
  0%, 48% { transform: rotate(0); }
  58%, 72% { transform: rotate(-80deg); }
  80%, 100% { transform: rotate(0); }
}

@keyframes noir-swoon {
  0%, 72% { transform: rotate(0); }
  82%, 95% { transform: rotate(165deg); }
  100% { transform: rotate(0); }
}

@keyframes noir-lean {
  0%, 72% { transform: rotate(0); }
  82%, 95% { transform: rotate(-6deg); }
  100% { transform: rotate(0); }
}

@keyframes noir-sub-1 {
  0%, 44% { opacity: 1; }
  46%, 100% { opacity: 0; }
}

@keyframes noir-sub-2 {
  0%, 50% { opacity: 0; }
  52%, 94% { opacity: 1; }
  96%, 100% { opacity: 0; }
}

@keyframes spot-sway {
  from { transform: translateX(-50%) rotate(-3deg); }
  to { transform: translateX(-50%) rotate(3deg); }
}

@keyframes award-pump {
  from { transform: rotate(-6deg); }
  to { transform: rotate(8deg); }
}

@keyframes award-wave {
  from { transform: rotate(10deg); }
  to { transform: rotate(35deg); }
}

@keyframes flash {
  0%, 90% { opacity: 0; transform: scale(0.4); }
  92% { opacity: 1; transform: scale(1); }
  97%, 100% { opacity: 0; transform: scale(1.1); }
}

@keyframes fold-in {
  from { opacity: 0; transform: translateY(-6px); }
}

/* Dots travelling along the lines between steps */
@keyframes flow-pulse-down {
  0% { top: 0; opacity: 0; }
  15%, 85% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

@keyframes flow-pulse-across {
  0% { left: 0; opacity: 0; }
  15%, 85% { opacity: 1; }
  100% { left: 100%; opacity: 0; }
}

/* At a human gate the dot waits for the tick, then carries on */
@keyframes gate-pulse-down {
  0% { top: 0; opacity: 0; }
  10% { opacity: 1; }
  30%, 62% { top: 50%; }
  90% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

@keyframes gate-pulse-across {
  0% { left: 0; opacity: 0; }
  10% { opacity: 1; }
  30%, 62% { left: 50%; }
  90% { opacity: 1; }
  100% { left: 100%; opacity: 0; }
}

@keyframes gate-tick {
  0%, 36% { opacity: 0; transform: scale(0.4); }
  42%, 70% { opacity: 1; transform: none; }
  80%, 100% { opacity: 0; transform: none; }
}

@keyframes type-dot-1 { 0% { opacity: 0; } 25%, 100% { opacity: 1; } }
@keyframes type-dot-2 { 0%, 25% { opacity: 0; } 50%, 100% { opacity: 1; } }
@keyframes type-dot-3 { 0%, 50% { opacity: 0; } 75%, 100% { opacity: 1; } }

@keyframes dot-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.15; }
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: none; }
}

/* Scroll reveal: elements with .reveal fade up as they enter the screen.
   Only in browsers that support scroll-driven animations. Others just show
   the content as normal, so nothing breaks. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .reveal {
      animation: reveal linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 60%;
    }
  }
}

/* Toto places: the journey plays as you scroll through the section.
   Everything shares one scroll range; each piece has its own slot in it:
   Venezuela & Italy lights up (0-8%), line to the UK (10-40%), UK lights up
   and Big Ben grows (40-54%), line to Spain (54-82%), Spain lights up and the
   Sagrada Familia grows (82-96%). Without support, everything simply shows finished. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    /* The journey follows the flags row as it scrolls past.
       TRY ME: a wider range = a slower journey, but the end must still be
       reached before the bottom of the page (cover 60% is safe). */
    .places__list {
      view-timeline: --places block;
    }

    .place__flag,
    .place__text,
    .place__icon,
    .place:not(:last-child)::before {
      animation-duration: auto;
      animation-timing-function: linear;
      animation-fill-mode: both;
      animation-timeline: --places;
      animation-range: cover 0% cover 48%;   /* must finish before the page runs out */
    }

    .place--ve-it .place__flag { animation-name: place-light-1; }
    .place--uk .place__flag { animation-name: place-light-2; }
    .place--es .place__flag { animation-name: place-light-3; }

    .place--ve-it .place__text { animation-name: place-text-1; }
    .place--uk .place__text { animation-name: place-text-2; }
    .place--es .place__text { animation-name: place-text-3; }

    .place__icon--bigben { animation-name: bigben-rise; }
    .place__icon--sagrada { animation-name: sagrada-rise; }

    .place--ve-it::before { animation-name: place-line-1-y; }
    .place--uk::before { animation-name: place-line-2-y; }
  }
}

@media (min-width: 52rem) {
  @supports (animation-timeline: view()) {
    @media (prefers-reduced-motion: no-preference) {
      .place--ve-it::before { animation-name: place-line-1-x; }
      .place--uk::before { animation-name: place-line-2-x; }
    }
  }
}

@keyframes place-light-1 {
  0% { opacity: 0.45; filter: grayscale(1) drop-shadow(0 0 0 rgb(255 214 120 / 0)); }
  8% { opacity: 1; filter: grayscale(0) drop-shadow(0 0 1.4rem rgb(255 214 120 / 0.95)); }
  25%, 100% { opacity: 1; filter: grayscale(0) drop-shadow(0 0 0.5rem rgb(255 214 120 / 0.45)); }
}

@keyframes place-light-2 {
  0%, 40% { opacity: 0.45; filter: grayscale(1) drop-shadow(0 0 0 rgb(255 214 120 / 0)); }
  46% { opacity: 1; filter: grayscale(0) drop-shadow(0 0 1.4rem rgb(255 214 120 / 0.95)); }
  62%, 100% { opacity: 1; filter: grayscale(0) drop-shadow(0 0 0.5rem rgb(255 214 120 / 0.45)); }
}

@keyframes place-light-3 {
  0%, 82% { opacity: 0.45; filter: grayscale(1) drop-shadow(0 0 0 rgb(255 214 120 / 0)); }
  88% { opacity: 1; filter: grayscale(0) drop-shadow(0 0 1.4rem rgb(255 214 120 / 0.95)); }
  100% { opacity: 1; filter: grayscale(0) drop-shadow(0 0 0.5rem rgb(255 214 120 / 0.45)); }
}

/* The text stays readable the whole time; its corner frames draw in when
   the line arrives (faded text was hard to read) */
@keyframes place-text-1 {
  0%, 4% { --frame: 0; }
  14%, 100% { --frame: 1; }
}

@keyframes place-text-2 {
  0%, 42% { --frame: 0; }
  54%, 100% { --frame: 1; }
}

@keyframes place-text-3 {
  0%, 84% { --frame: 0; }
  94%, 100% { --frame: 1; }
}

@keyframes place-line-1-y { 0%, 10% { transform: scaleY(0); } 40%, 100% { transform: scaleY(1); } }
@keyframes place-line-2-y { 0%, 54% { transform: scaleY(0); } 82%, 100% { transform: scaleY(1); } }
@keyframes place-line-1-x { 0%, 10% { transform: scaleX(0); } 40%, 100% { transform: scaleX(1); } }
@keyframes place-line-2-x { 0%, 54% { transform: scaleX(0); } 82%, 100% { transform: scaleX(1); } }

/* Big Ben grows out of the UK flag's corner as the line arrives (40%) */
@keyframes bigben-rise {
  0%, 40% { opacity: 0; transform: translateY(15%) scale(0.15); }
  43% { opacity: 1; }
  54%, 100% { opacity: 1; transform: none; }
}

/* The Sagrada Familia grows out of Spain's flag corner as the line arrives (82%) */
@keyframes sagrada-rise {
  0%, 82% { opacity: 0; transform: translateY(15%) scale(0.15); }
  85% { opacity: 1; }
  96%, 100% { opacity: 1; transform: none; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Respect people who ask their device for less motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  /* The race scene shows as a still frame */
  .race-layer,
  .race-car,
  .car-wheel {
    animation: none !important;
  }

  .speed-lines {
    display: none;
  }

  /* The TV doesn't switch by itself: it shows CH 1 as a still frame.
     The remote still works to change channel (each one a still). */
  .channel,
  .tv-caption span,
  .tv-osd,
  .tv-static,
  .flash,
  .tt-cast,
  .tt-cast * {
    animation: none !important;
  }

  /* CH 4 still frame: the plane at the stand, the chart complete */
  .tt-now {
    transform: translateX(72px);
  }

  .remote-next {
    animation: none !important;
  }

  .tv-set:has(#ch-auto:checked) .channel--1,
  .tv-set:has(#ch-auto:checked) .tv-caption__1 {
    opacity: 1;
    visibility: visible;
  }

  .tv-set:has(#ch-auto:checked) .remote-next--1 {
    visibility: visible;
  }

  .noir-subtitle__1 {
    opacity: 1;
  }

  /* My Work: the flow shows still, gates ticked */
  .flow__pulse,
  .gate__tick {
    animation: none !important;
  }

  .flow__pulse {
    display: none;
  }

  /* The dropdown appears instantly, with no fade */
  .dropdown {
    transition: none !important;
  }
}

/* ===== Case study reading aids =====
   1. Progress: as you scroll the panel, the line between the S T A R L
      squares fills with apricot like a progress bar, and each square turns
      apricot when the fill reaches it (CSS scroll-driven animation).
      Browsers without it (Firefox for now) show the plain line and squares.
   2. "What I learnt" cards: numbered, with a short tag, sliding in as you
      reach them and lifting when you hover. */

/* --- 2. Lesson cards --- */
.cs-lessons { display: grid; gap: var(--space-sm); counter-reset: lesson; }
.cs-lesson {
  position: relative;
  display: grid;
  gap: 0.6rem;
  padding: var(--space-md) var(--space-md) var(--space-md) calc(var(--space-md) + 4px);
  background: var(--color-white);
  counter-increment: lesson;
  transition: translate 300ms var(--ease-out), box-shadow 300ms var(--ease-out);
}
/* apricot bar down the left edge; it thickens on hover */
.cs-lesson::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;                                  /* TRY ME: bar thickness */
  background: var(--color-apricot-deep);
  transition: width 300ms var(--ease-out);
}
.cs-lesson:hover { translate: 0 -3px; box-shadow: 0 10px 24px -14px rgb(14 42 71 / 0.35); }
.cs-lesson:hover::before { width: 8px; }
.cs-lesson__tag {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin: 0;
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.cs-lesson__tag::before {                      /* 01, 02, 03 */
  content: counter(lesson, decimal-leading-zero);
  color: var(--color-apricot-deep);
  font-size: 1.6rem;
  letter-spacing: -0.02em;
  line-height: 1;
}
.cs-lesson:only-child .cs-lesson__tag::before { content: none; }  /* no "01" when there is only one lesson */
.cs-lesson p { margin: 0; color: var(--color-ink-soft); line-height: 1.7; }  /* TRY ME: --color-ink for darker text */

@media (max-width: 40rem) {
  .cs-step--lesson .cs-step__content:has(.cs-lessons) { padding: var(--space-sm); }
  .cs-lesson { padding: var(--space-sm) var(--space-sm) var(--space-sm) calc(var(--space-sm) + 4px); }
}

/* --- Scroll-driven parts (only where supported, never with reduced motion) --- */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    /* progress bar: an apricot copy of the line that grows from the top.
       It starts when the story's top reaches the middle of the panel and is
       full when its bottom reaches the bottom of the panel. */
    .cs-panel .cs-steps { view-timeline: --cs-story block; }
    .cs-panel .cs-steps::after {
      content: "";
      position: absolute;
      top: 0.5rem; bottom: 0.5rem;
      left: calc(var(--rail-x) - 1px);
      width: 3px;                              /* TRY ME: progress bar thickness */
      background: var(--color-apricot-deep);
      transform-origin: top;
      animation: cs-bar linear both;
      animation-timeline: --cs-story;
      animation-range: cover 50vh exit 0%;
    }
    @keyframes cs-bar { from { transform: scaleY(0); } to { transform: scaleY(1); } }

    /* squares fill as the bar reaches them */
    .cs-panel .cs-step__marker {
      animation: cs-fill linear both;
      animation-timeline: view();
      animation-range: cover 40% cover 50%;
    }
    /* the last square (L) fills when the bar is full, even if it never
       reaches the middle of the panel */
    .cs-panel .cs-step:last-child .cs-step__marker {
      animation: cs-fill linear both, cs-fill-end linear both;
      animation-timeline: view(), --cs-story;
      animation-range: cover 40% cover 50%, exit -40px exit 0%;
    }
    @keyframes cs-fill-end {   /* no "from": it starts from whatever the square already shows */
      to { background: var(--color-apricot); border-color: var(--color-apricot-deep); }
    }
    @keyframes cs-fill {
      from { background: var(--color-white); border-color: var(--color-ink); }
      to   { background: var(--color-apricot); border-color: var(--color-apricot-deep); }
    }

    /* lesson cards slide up and fade in as they come into view */
    .cs-panel .cs-lesson {
      animation: cs-card-in ease-out both;
      animation-timeline: view();
      animation-range: entry 0% entry 80%;
    }
    @keyframes cs-card-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
  }
}

/* ===== Previous / Next between case studies (no JavaScript) =====
   Opening a case study from inside another one puts it on top of the
   first (that's how popovers work). So each Previous, Next, × and "Back"
   button comes in versions, and CSS shows the right one depending on
   which panels are open:
   - Next/Previous: if the case you want is already open underneath, the
     button just closes the top panel; otherwise it opens that case.
   - × and Back: close the panel at the bottom of the pile, which closes
     everything above it too, so you always land back on the page.
   data-if-open="x": only shown while panel x is open.
   data-if-closed="x y": hidden while any of those panels is open. */
body:not(:has(#case-antavo:popover-open)) .cs-panel [data-if-open~="case-antavo"],
body:not(:has(#case-curio:popover-open)) .cs-panel [data-if-open~="case-curio"],
body:not(:has(#case-originals:popover-open)) .cs-panel [data-if-open~="case-originals"],
body:has(#case-antavo:popover-open) .cs-panel [data-if-closed~="case-antavo"],
body:has(#case-curio:popover-open) .cs-panel [data-if-closed~="case-curio"],
body:has(#case-originals:popover-open) .cs-panel [data-if-closed~="case-originals"] { display: none !important; }

/* Panels on top of each other: lighter dimming each, so the page behind
   doesn't get darker with every step */
body:has(.cs-panel:popover-open ~ .cs-panel:popover-open) .cs-panel:popover-open::backdrop { background: rgb(14 42 71 / 0.26); }
body:has(.cs-panel:popover-open ~ .cs-panel:popover-open ~ .cs-panel:popover-open) .cs-panel:popover-open::backdrop { background: rgb(14 42 71 / 0.18); }

.cs-pager {
  justify-self: stretch;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}
.cs-pager__link {
  all: unset;
  box-sizing: border-box;
  display: grid;
  align-content: start;
  gap: 0.35rem;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-line);
  cursor: pointer;
  transition: border-color var(--duration) var(--ease-out), background var(--duration) var(--ease-out);
}
.cs-pager__link--next { grid-column: 2; text-align: right; }
.cs-pager__link:hover { border-color: var(--color-ink); background: var(--color-sky-light); }
.cs-pager__link:focus-visible { outline: 2px solid var(--color-apricot-deep); outline-offset: 2px; }
.cs-pager__dir {
  color: var(--color-ink-soft);
  font-size: var(--text-sm);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.cs-pager__title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
@media (max-width: 40rem) {
  .cs-pager { grid-template-columns: 1fr; }
  .cs-pager__link--next { grid-column: auto; }
  .cs-pager__spacer { display: none; }
}

/* Download CV: a quiet text link next to the hero buttons */
.hero__cv {
  align-self: center;
  color: var(--color-ink);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--color-line);
  text-underline-offset: 0.25em;
}
.hero__cv:hover, .hero__cv:focus-visible { text-decoration-color: currentColor; }
.hero__cv-type { color: var(--color-ink-soft); font-weight: 400; font-size: var(--text-sm); }

/* Certification under the skill tags: a small badge with an apricot edge */
.skill-cert {
  display: grid;
  gap: 0.2rem;
  margin: var(--space-md) 0 0;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-ink);
  border-left: 4px solid var(--color-apricot-deep);
}
.skill-cert__label {
  margin: 0;
  color: var(--color-ink-soft);
  font-size: var(--text-sm);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.skill-cert__name { font-family: var(--font-heading); font-size: var(--text-lg); font-weight: 700; letter-spacing: -0.01em; }
.skill-cert__by { color: var(--color-ink-soft); font-size: var(--text-sm); }

/* Several certificates in the badge: one per line, a thin line between */
.skill-cert__list { display: grid; gap: var(--space-sm); margin: 0.2rem 0 0; padding: 0; list-style: none; }
.skill-cert__list li { display: grid; gap: 0.2rem; }
.skill-cert__list li + li { padding-top: var(--space-sm); border-top: 1px solid var(--color-line); }
