/* Sam Morgan 2027 — tokens */
:root {
  /* Halyard sits low in its line box (ascent 31 : descent 9 at 26.8px), so a label centred in a pill
     reads low. Measured in Chrome with Halyard loaded: capitals 18px from the top, baseline 14px from
     the bottom. Every pill label is raised by this much to centre the capitals optically. */
  --pill-lift: 0.1em;
  --black: #000000;
  --white: #FFFFFF;
  --yellow: #EDFF21;
  --blue: #0494FC;
  --grey: #8B8B8B;

  /* Theme roles (dark is the default). Light values come from the Figma "_b" components
     (Brand ID > Components: header_colapsed_b, Button_1b, footer_collapsed_b): black titles,
     blue #0494FC accents with white text and rims. See html[data-theme="light"] below. */
  --bg: var(--black);
  --fg: var(--white);
  --accent: var(--yellow);
  --on-accent: var(--black);
  --accent-rim: var(--black);   /* outline on every accent button (pills, clock, footer); black on yellow, matching the Figma project pills */
  --pill-rim: var(--black);     /* rim on project pills and the Contact Home button */
  --font: "halyard-text", "Hanken Grotesk", system-ui, sans-serif;

  /* Glass: one recipe for every glass object on the site (header, hover cards, footers).
     Refraction strength and edge width live in js/glass.js (Glass.PRESET). */
  --glass-fill: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.015) 100%);
  --glass-filter: blur(3px) saturate(180%) brightness(1.05);   /* Nov 19: clear glass that bends (js/glass.js wobble), not frost. Was blur(14px) */
  --glass-rim: rgba(255, 255, 255, 0.45);       /* bright edge line */
  --glass-rim-soft: rgba(255, 255, 255, 0.18);  /* fainter side edges */
  --glass-glow: rgba(255, 255, 255, 0.18);      /* soft light just inside the edge */
  --glass-solid: rgba(24, 24, 24, 0.94);        /* browsers with no backdrop blur */
}

/* Light theme (chosen with the toggle; saved per visitor; never automatic) */
html[data-theme="light"] {
  --bg: var(--white);
  --fg: var(--black);
  --accent: var(--blue);
  --on-accent: var(--white);
  --accent-rim: var(--white);
  --pill-rim: var(--white);
  /* Glass on a white page: the dark-mode white rims vanish, so the edge light turns to soft shade.
     Not specified in Figma; flagged for Sam to confirm. */
  --glass-fill: linear-gradient(180deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0.35) 100%);
  --glass-rim: rgba(0, 0, 0, 0.14);
  --glass-rim-soft: rgba(0, 0, 0, 0.08);
  --glass-glow: rgba(0, 0, 0, 0.05);
  --glass-solid: rgba(245, 245, 245, 0.95);
  color-scheme: light;
}

/* Fallback until Halyard loads (or if Adobe Fonts is unreachable) */
@font-face { font-family: "Hanken Grotesk"; font-weight: 400; font-display: swap;
  src: url("../fonts/hanken-grotesk-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Hanken Grotesk"; font-weight: 500; font-display: swap;
  src: url("../fonts/hanken-grotesk-latin-500-normal.woff2") format("woff2"); }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font-family: var(--font); -webkit-font-smoothing: antialiased; }

/* Lenis smooth scroll (from lenis.css) */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: clip; }
.lenis.lenis-smooth iframe { pointer-events: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Intro ---------- */
.intro {
  position: relative;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: var(--bg);
}

/* 1920x1080 artboard, scaled to fit the viewport (set by JS as --s) */
.stage {
  position: absolute;
  left: 50%; top: 50%;
  width: 1920px; height: 1080px;
  transform: translate(-50%, -50%) scale(var(--s, 0.5));
  transform-origin: 50% 50%;
}

.layer { position: absolute; inset: 0; pointer-events: none; will-change: transform; }
.obj { position: absolute; display: block; will-change: transform, opacity; }

.photo img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.words { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.words text {
  font-family: var(--font);
  font-weight: 500;
  font-size: 150px;
  letter-spacing: -7.5px;            /* -5% */
  /* --flash (0..1) is the brief accent flash as a word pops in (js/intro.js) */
  fill: color-mix(in srgb, var(--accent) calc(var(--flash, 0) * 100%), var(--fg));
}
.words text.hl { fill: var(--accent); }
.words text.small {
  font-weight: 400;
  font-size: 26px;
  letter-spacing: -1.3px;
}

/* ---------- Glass header ----------
   Figma: Website Design > Components > header_colapsed_a (1920x207) / header_expanded_a (1920x1023).
   Contents sit on a 1920x1023 artboard scaled by --hs. The panel height (--hh, artboard px)
   animates 207 -> 1023 to expand; js/header.js drives the states (hidden / collapsed / expanded). */
.hdr {
  position: fixed; left: 0; right: 0; top: 0;
  --hh: 207;
  height: calc(var(--hh) * 1px * var(--hs, 0.5));
  overflow: hidden;            /* nav links stay clipped while collapsed */
  z-index: 100;
  visibility: hidden;          /* JS shows it once it's placed above the screen */
}
.hdr[inert] { pointer-events: none; }
.hdr-glass {
  position: absolute; inset: 0;
  border-radius: 0 0 calc(50px * var(--hs, 0.5)) calc(50px * var(--hs, 0.5));
  /* Clear glass: almost no fill, so the page shows through softened (Figma fill is 1%). */
  background: var(--glass-fill);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  /* Edge light: a bright rim along the bottom and sides, fading inward, like the Figma glass edge */
  box-shadow:
    inset 0 -1.5px 0 var(--glass-rim),
    inset 0 -18px 30px -18px var(--glass-glow),
    inset 1.5px 0 0 var(--glass-rim-soft),
    inset -1.5px 0 0 var(--glass-rim-soft);
}
/* Chrome / Edge: bend the edges first, then the same blur (js/glass.js adds .refract) */
.hdr-glass.refract {
  backdrop-filter: var(--refract) var(--glass-filter);
}
.hdr-art {
  position: absolute; top: 0; left: 50%;
  width: 1920px; height: 1023px;
  transform: translateX(-50%) scale(var(--hs, 0.5));
  transform-origin: 50% 0;
}
.hdr-art p { margin: 0; }
.hdr a { color: inherit; text-decoration: none; }

.hdr-badge {
  position: absolute; left: 174px; top: 66px; width: 145px; height: 79px;
  display: flex; align-items: center; justify-content: center;
}
.hdr .hdr-badge { color: var(--on-accent); }
/* Logo animation canvas: larger than the badge because the chrome version grows past it.
   Hover is still measured on the badge's own 145x79 box. */
.hdr-logo {
  position: absolute; left: -48.8px; top: -36.8px; width: 241.9px; height: 152.2px;
  pointer-events: none; visibility: hidden;
}
.hdr-badge.logo-ready .hdr-logo { visibility: visible; }
.hdr-badge.logo-ready svg, .hdr-badge.logo-ready span { visibility: hidden; }
.hdr-badge svg { position: absolute; inset: 0; fill: var(--accent); }
.hdr-badge span {
  position: relative;
  font-weight: 500; font-size: 63.78px; letter-spacing: -6.38px; line-height: 1;
  padding-right: 6px; /* offsets the trailing letter-spacing so S-M sits centered */
}

.hdr-title {
  position: absolute; left: 668px; top: 48px; transform: translateX(-50%);
  font-weight: 500; font-size: 80px; letter-spacing: -4px; line-height: 111px;
  color: var(--fg); white-space: nowrap;
}

.hdr-clock {
  position: absolute; left: 1231px; top: 69px; width: 515px; height: 59px;
  background: var(--accent); border: 1px solid var(--accent-rim); border-radius: 40.7px;
  color: var(--on-accent);
  font-weight: 300; font-size: 26px; letter-spacing: -1.3px; line-height: 57px;
  font-variant-numeric: tabular-nums;
  /* Day, date and time share the pill's width, so a long day ("Wednesday") can never run into the
     date. js/header.js shortens the month, then the day, if a long combination still wouldn't fit. */
  display: flex; justify-content: space-between; gap: 22px; padding: 0 30px; box-sizing: border-box; margin: 0;
}
.hdr-clock span { flex: none; transform: translateY(calc(-1 * var(--pill-lift))); white-space: nowrap; }

.hdr-nav a {
  position: absolute; left: 167px;
  font-weight: 500; font-size: 150px; letter-spacing: -7.5px; line-height: 168px;
  color: var(--fg);
  transition: color 0.15s;
}
.hdr-nav a:nth-child(1) { top: 178px; }
.hdr-nav a:nth-child(2) { top: 355px; }
.hdr-nav a:nth-child(3) { top: 532px; }
.hdr-nav a:nth-child(4) { top: 709px; }
.hdr-nav a:hover, .hdr-nav a:focus-visible { color: var(--accent); }
.hdr a:focus-visible, .hdr button:focus-visible { outline: 3px solid var(--blue); outline-offset: 6px; border-radius: 8px; }

/* Menu / Close button: touch screens only (no hover there). Sits between the title and the clock. */
.hdr-menu {
  display: none;
  position: absolute; left: 1000px; top: 69px; width: 190px; height: 59px;
  border: 1px solid var(--fg); border-radius: 40.7px; background: transparent;
  color: var(--fg); font: 300 26px/57px var(--font); letter-spacing: -1.3px;
  padding: 0 0 calc(2 * var(--pill-lift)); line-height: calc(57px - 2 * var(--pill-lift));
  cursor: pointer;
}
@media (hover: none) { .hdr-menu { display: block; } }

/* ---------- Intro hover cards ----------
   Figma: Intro Statement_v5_alt_a. Triggers and cards live on 1920x1080 artboards that match the stage. */
.artboard {
  position: absolute; left: 50%; top: 50%;
  width: 1920px; height: 1080px;
  transform: translate(-50%, -50%) scale(var(--s, 0.5));
  transform-origin: 50% 50%;
  pointer-events: none;
}
.itrig {
  position: absolute; padding: 0; margin: 0; border: 0; border-radius: 18px;
  background: transparent; color: transparent; font-size: 1px; overflow: hidden;
  cursor: pointer; pointer-events: auto;
  visibility: hidden;          /* shown once its word has appeared */
}
.itrig.is-live { visibility: visible; }
.itrig:focus-visible { outline: 6px solid var(--blue); outline-offset: 8px; }

.icard {
  position: absolute;
  visibility: hidden; opacity: 0;
  pointer-events: none;        /* hidden cards never catch the pointer */
  clip-path: url(#wiiClip);    /* the ID badge shape */
  /* Same glass as the header */
  background: var(--glass-fill);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
}
.icard.refract { backdrop-filter: var(--refract) var(--glass-filter); }
.icard.is-open { pointer-events: auto; }
/* The text block (as wide as its longest hand-set line) sits dead centre in the glass, with about
   80px of glass on every side: the cards are sized to their copy. */
.icard p {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: max-content; max-width: 86%; margin: 0;
  font-weight: 300; font-size: 38.386px; letter-spacing: -1.919px; line-height: 1.4;
  color: var(--fg);
  text-wrap: balance;   /* line breaks are set by hand in index.html (measured in Halyard); this evens out any fallback wrap */
}
/* Edge light along the badge outline */
.icard-rim { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
/* No outline on the cards (Sam, Oct 30): the glass edge comes from the refraction only. */
.icard-rim { display: none; }

/* Small screens: the artboard text would be too small to read, so the open card becomes a sheet
   along the bottom of the screen (js/cards.js adds .compact). */
.icards { z-index: 3; }   /* above the scroll cue */
.icards.compact { left: 0; top: 0; width: 100%; height: 100%; transform: none; }
.icards.compact .icard {
  left: max(16px, env(safe-area-inset-left, 0px)) !important;
  right: max(16px, env(safe-area-inset-right, 0px));
  top: auto !important;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  width: auto !important; height: auto !important;
  clip-path: none; border-radius: 22px;
  padding: 18px 20px;
}
.icards.compact .icard p {
  position: static; transform: none; width: auto; max-width: none;
  font-size: 16px; letter-spacing: -0.01em; line-height: 1.45;
}
.icards.compact .icard p br { display: none; }   /* the bottom sheet wraps on its own */
.icards.compact .icard-rim { display: none; }
.icards.compact .icard.refract { backdrop-filter: var(--glass-filter); } /* map is sized for the artboard card */

/* No backdrop blur at all (older browsers): solid enough to read */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .hdr-glass, .icard { background: var(--glass-solid); }
}

/* Scroll cue */
.cue {
  position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  color: var(--grey); font-size: 13px; letter-spacing: 0.02em;
  opacity: 0;
}
.cue i {
  display: block; width: 1px; height: 36px; background: var(--grey);
  transform-origin: top; animation: cue 1.8s ease-in-out infinite;
}
@keyframes cue {
  0%   { transform: scaleY(0); opacity: 1; }
  60%  { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1); opacity: 0; }
}

/* Placeholder for the project selection section */
.next {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
}
.next-label { color: var(--grey); font-size: 26px; letter-spacing: -0.05em; margin: 0; }

@media (prefers-reduced-motion: reduce) {
  .cue i { animation: none; }
}

/* ---------- Page transition (js/transition.js) ----------
   Black screen with a 4x3 grid of channel tiles (the ID badge shape), each with the S-M logo
   pressed in. Measured from the Wii reference at 1920 wide: tiles 371x209, gaps 34 across, 20 down.
   --k scales the grid so it fits the screen; portrait screens get 3 columns. */
.tx {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: start center;   /* grid sits high, as on the Wii (87 down at 1080) */
  background: #000;
  visibility: hidden; opacity: 0;
  pointer-events: none;
}
.tx.is-on { pointer-events: auto; }
.tx-grid {
  --k: min(calc(100vw / 1920), calc(100vh / 1080));
  display: grid;
  grid-template-columns: repeat(4, calc(371 * var(--k)));
  grid-auto-rows: calc(209 * var(--k));
  column-gap: calc(34 * var(--k)); row-gap: calc(20 * var(--k));
  margin-top: calc(87 * var(--k) + (100vh - 1080 * var(--k)) / 2);
}
.tx-tile {
  display: flex; align-items: center; justify-content: center;
  clip-path: url(#wiiClip);
  background: #2d2d2d;
  opacity: 0; visibility: hidden;
}
/* The logo is pressed into the tile: a shade darker, with a faint lit lower edge */
.tx-tile b {
  font-weight: 500; font-size: calc(58 * var(--k)); letter-spacing: -0.1em; line-height: 1;
  padding-right: 0.1em;  /* offsets the trailing letter-spacing so S-M sits centred */
  color: #191919;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.07), 0 -1px 0 rgba(0, 0, 0, 0.4);
}
@media (max-aspect-ratio: 1/1) {
  .tx-grid {
    --k: calc((100vw - 48px) / (3 * 371 + 2 * 34));
    grid-template-columns: repeat(3, calc(371 * var(--k)));
    margin-top: calc((100vh - 4 * 209 * var(--k) - 3 * 20 * var(--k)) / 2);   /* portrait: centred */
  }
}
/* Arriving from another page: covered from the very first paint (set in each page's <head>) */
html.tx-in .tx { visibility: visible; opacity: 1; }
html.tx-in .tx-tile { visibility: visible; opacity: 1; }

/* ---------- Project selection (Figma: ProjectSelection_v1a, Composer frame 619:177; js/project-scroll.js) ----------
   Full bleed, first on the page (Sam, Nov 15). A 1920x1080 artboard scaled to fit (--ps), pinned to
   the bottom of the screen so the glass strip (y831 to 1080) always sits on the bottom edge. The strip
   and its blurred copy of the object run the full width of any screen. Title at x112 / y836, pills
   at y925. The old badge outline and breakout layer are gone (home-v1 branch has them). */
.ps { position: relative; height: 100vh; height: 100svh; overflow: hidden; background: var(--bg); }
.ps-stage {
  position: absolute; left: 50%; bottom: 0;
  width: 1920px; height: 1080px;
  transform: translateX(-50%) scale(var(--ps, 0.5));
  transform-origin: 50% 100%;
}
.ps canvas { position: absolute; display: block; will-change: transform; }
/* Name and role (Figma S-M_DetailText, 26), fixed at the top corners while the projects are pinned.
   x96 / right edge 1824 / y432 on the 1920 artboard (Figma ProjectSelection_v2). The shadow keeps them readable over light media. */
.ps-who {
  /* Centred top to bottom on the screen at any window size (Sam, Nov 17); sides stay on the x96 / x1824 margins */
  position: absolute; z-index: 3; left: 0; right: 0; top: 50%; transform: translateY(-50%);
  padding: 0 calc(50% - 864px * var(--ps, 0.5)); display: flex; justify-content: space-between;
  font-weight: 300; font-size: max(13px, calc(26px * var(--ps, 0.5))); letter-spacing: -0.05em; line-height: 1;
  color: var(--fg); pointer-events: none;
  text-shadow: 0 1px 2px color-mix(in srgb, var(--bg) 55%, transparent), 0 0 18px color-mix(in srgb, var(--bg) 45%, transparent);
}
.ps-clip { position: absolute; inset: 0; }
.ps-objs { position: absolute; inset: 0; }
/* Same glass as the header and footers, built directly: Chrome samples backdrop-filter from the
   wrong place inside a scaled, clipped box, so the panel blurs its own copy of the objects with the
   shared glass filter instead. The blur is divided by the stage scale to match on-screen glass. */
/* The card (Sam, Nov 18): same size as the header (207 artboard px, full width, 50 corner radius on
   the inside edge), and hidden below the screen until the pointer nears the bottom (js/project-scroll.js
   drives --drop: 0 = up, 1 = down). Its blurred copy of the object moves the other way so it stays
   lined up with the real one. The strip is 4920 wide; the clip trims it to the screen, with the corners. */
.ps-glass {
  position: absolute; left: -1500px; top: 873px; width: 4920px; height: 207px;   /* wider than any screen */
  overflow: hidden; background: var(--bg);
  --edge: max(0px, calc(2460px - 50vw / var(--ps, 0.5)));
  clip-path: inset(0 var(--edge) 0 var(--edge) round 50px 50px 0 0);
  transform: translateY(calc(var(--drop, 0) * 230px));
}
.ps-glass-objs { position: absolute; inset: 0; filter: blur(calc(3px / var(--ps, 0.5))) saturate(170%) brightness(1.08); transform: translateY(calc(var(--drop, 0) * -230px)); }
.ps-glass::after {
  content: ""; position: absolute; inset: 0;
  background: var(--glass-fill);
  /* the rim now comes from the liquid glass surface (.lg-rim), kept faint here (Sam, Nov 15) */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.36), inset 0 18px 30px -18px var(--glass-glow);   /* 1px lit top edge */
}
/* Light catching the panel's top edge, following the pointer while it's over the frame
   (after Compass "Liquid Glass": reflections that respond to the pointer). Text and artwork untouched. */
.ps-glass::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(18% 1px at var(--mx, 50%) 0, rgba(255, 255, 255, 0.35), transparent),   /* softer now the cursor is always over it */
    radial-gradient(26% 90px at var(--mx, 50%) 0, rgba(255, 255, 255, 0.08), transparent 70%);
  opacity: 0; transition: opacity 0.25s ease;
}
.ps.is-rotating .ps-glass::before { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .ps-glass::before { transition: none; } }
.ps-info { position: absolute; inset: 0; pointer-events: none; transform: translateY(calc(var(--drop, 0) * 230px)); }
/* Name and pills sit in the 207 card where they sat in the old 249 strip, centred (both +21) */
.ps-name {
  position: absolute; left: 112px; top: 852px; margin: 0;
  font-weight: 500; font-size: 152.17px; letter-spacing: -0.05em; line-height: normal;
  color: color-mix(in srgb, var(--accent) calc(var(--flash, 0) * 100%), var(--fg));   /* pop-in flash */
  white-space: nowrap; transition: color 0.2s;
}
.ps:has(.ps-go:hover) .ps-name { color: var(--accent); }   /* the card is the link: the name lights up */
.ps:has(.ps-go:hover) .ps-glass::before { opacity: 1; }
/* Pills (Sam, Nov 16, option B): one line at y925, right edge on x1824 (under "Motion Art Director"),
   26px apart. Same height and styling on every pill; only the width changes, with the word. */
.ps-tags { position: absolute; right: 96px; top: 946px; margin: 0; padding: 0; list-style: none; display: flex; gap: 26px; }
.ps-tags li {
  height: 58.8px; box-sizing: border-box; display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--on-accent); border: 1px solid var(--pill-rim); border-radius: 40.7px;
  font-weight: 300; font-size: 26.8px; letter-spacing: -0.05em; white-space: nowrap;
  padding: 0 44px calc(2 * var(--pill-lift));   /* 44px each side; the bottom padding centres the capitals (see --pill-lift) */
}
.ps-link {
  position: absolute; left: -1500px; top: -2000px; width: 4920px; height: 3080px;   /* the whole screen */
  cursor: pointer;       /* moving turns the object (the .ps-cue badge says so); a click opens the project, like the card */
  touch-action: pan-y;   /* vertical swipes scroll the page natively; sideways ones turn the object */
}
/* The card's link: the 207 strip, riding with the glass */
.ps-go {
  position: absolute; left: -1500px; top: 873px; width: 4920px; height: 207px; z-index: 2;
  transform: translateY(calc(var(--drop, 0) * 230px));
}
.ps-go:not([href]) { cursor: default; }
.ps.is-gone .ps-link { cursor: default; }   /* the last project has slid out: nothing to click */
.ps-go:focus-visible { outline: none; }
.ps-go:focus-visible::after {
  content: ""; position: absolute; top: 8px; bottom: 0;
  left: max(8px, calc(2460px - 50vw / var(--ps, 0.5) + 8px)); right: max(8px, calc(2460px - 50vw / var(--ps, 0.5) + 8px));
  border: calc(4px / var(--ps, 0.5)) solid var(--blue); border-bottom: 0; border-radius: 44px 44px 0 0;
}
/* Keyboard rotate control: same area as the frame, takes no pointer input, shows a ring when focused */
.ps-rot { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; pointer-events: none; }
.ps-rot:focus { outline: none; }
.ps-rot:focus-visible { box-shadow: 0 0 0 calc(4px / var(--ps, 0.5)) var(--blue); }
/* Rotation cue: glass badge beside the pointer while it is over the frame (js/project-scroll.js).
   An orbit icon instead of left/right arrows, which read as "click to go to the next project". */
.ps-cue {
  position: fixed; left: 0; top: 0; z-index: 90; pointer-events: none;
  display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 10px;
  border-radius: 999px; border: 1px solid var(--glass-rim);
  background: var(--glass-fill); -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter);
  color: var(--fg); font-weight: 300; font-size: 15px; letter-spacing: -0.03em; line-height: 1; white-space: nowrap;
  opacity: 0; transition: opacity 0.2s ease;
}
.ps-cue svg { width: 22px; height: 22px; flex: none; }
.ps-cue span { padding-bottom: calc(2 * var(--pill-lift)); }
.ps-cue.is-on { opacity: 1; }
@media (hover: none) { .ps-cue { display: none; } }
@media (prefers-reduced-motion: reduce) { .ps-cue { transition: none; } }
/* Keyboard users get the same words, at the top left of the frame, while the rotate control has focus */
.ps-hint {
  position: absolute; left: 168px; top: 108px; margin: 0; pointer-events: none;
  font-weight: 300; font-size: 26px; letter-spacing: -0.05em; line-height: 1;
  color: var(--grey); opacity: 0; transition: opacity 0.2s ease;
}
.ps-rot:focus-visible ~ .ps-hint { opacity: 1; }
.ps.compact .ps-hint { display: none; }
/* Project dots (js/project-scroll.js; Compass dot pagination): stacked in the gap right of the frame
   (artboard x1823 to 1920), centred on the frame. Sizes are real screen px (divided by the stage scale). */
.ps-dots {
  /* level with the name row, which sits in the middle of the screen. The stage is 1080 tall and sits on
     the bottom edge, so the screen's middle is 1080 - half the screen height, in artboard px (Nov 17) */
  position: absolute; left: 1860px; top: calc(1080px - 50svh / var(--ps, 0.5)); transform: translate(-50%, -50%);
  display: flex; flex-direction: column; --step: calc(24px / var(--ps, 0.5));
}
.ps-dot {
  width: var(--step); height: var(--step); padding: 0; border: 0; background: none; cursor: pointer;
  display: grid; place-items: center; -webkit-tap-highlight-color: transparent;
}
.ps-dot::before {
  content: ""; width: calc(7px / var(--ps, 0.5)); height: calc(7px / var(--ps, 0.5)); border-radius: 50%;
  background: var(--fg); opacity: 0.3; transition: opacity 0.15s;
}
.ps-dot:hover::before { opacity: 0.6; }
.ps-dot:focus-visible { outline: calc(2px / var(--ps, 0.5)) solid var(--blue); outline-offset: calc(-2px / var(--ps, 0.5)); border-radius: 50%; }
.ps-dots::after {
  content: ""; position: absolute; left: 50%; top: calc(var(--step) / 2); pointer-events: none;
  width: calc(7px / var(--ps, 0.5)); height: calc(16px / var(--ps, 0.5)); border-radius: calc(4px / var(--ps, 0.5));
  background: var(--accent);
  transform: translate(-50%, -50%) translateY(calc(var(--pos, 0) * var(--step)));
}
.ps.compact .ps-dots { display: none; }
@media (prefers-reduced-motion: reduce) { .ps-hint { transition: none; } }
.ps-link:focus-visible { outline: none; }
.ps-link:focus-visible::after {
  content: ""; position: absolute; inset: 0; border: 6px solid var(--blue); border-radius: 160px;
}
/* Phones: the artboard gets small, so the name and pills move below the frame at readable sizes
   (sizes divided by the stage scale so they come out in real screen px) */
.ps.compact .ps-info {
  inset: auto; left: 96.5px; top: calc(996px + 18px / var(--ps)); width: 1727px;
  display: flex; flex-direction: column; gap: calc(10px / var(--ps));
}
.ps.compact .ps-name { position: static; font-size: calc(34px / var(--ps)); line-height: 1.1; }
.ps.compact .ps-tags { position: static; gap: calc(6px / var(--ps)); flex-wrap: wrap; }
.ps.compact .ps-tags li { width: auto; height: calc(30px / var(--ps)); padding: 0 calc(12px / var(--ps)) calc(2 * var(--pill-lift)); font-size: calc(13px / var(--ps)); border-radius: calc(15px / var(--ps)); }

/* Light theme: the header plays the blue logo sequence (img/logo-light, js/header.js),
   and the portrait sits in the blue frame (Sam's container_LIGHTMODE export) */
.photo img.frame-light, .m-photo img.frame-light { display: none; }
html[data-theme="light"] .photo img.frame-dark, html[data-theme="light"] .m-photo img.frame-dark { display: none; }
html[data-theme="light"] .photo img.frame-light, html[data-theme="light"] .m-photo img.frame-light { display: block; }

/* ---------- Theme toggle (js/theme.js) ----------
   A switch in the style of the Compass toggle (52 x 24 track, 28 x 16 pill knob, 4 inset, 0.3s slide),
   in the site's glass and colours. Off = dark (knob left, moon), on = light (knob right, sun, accent track).
   Sits in the header's free right-hand corner (artboard x1833, y98), fixed so it stays reachable.
   Pressing stretches the knob a little, like iOS. */
.theme-toggle {
  --w: max(52px, calc(104px * var(--hs, 0.5)));
  --h: calc(var(--w) * 24 / 52);
  --kw: calc(var(--w) * 28 / 52); --kh: calc(var(--h) * 16 / 24); --in: calc(var(--w) * 4 / 52);
  position: fixed; z-index: 101;
  top: calc(98px * var(--hs, 0.5) - var(--h) / 2);
  left: calc(50% + 873px * var(--hs, 0.5) - var(--w) / 2);
  width: var(--w); height: var(--h); padding: 0;
  border: 1px solid var(--glass-rim); border-radius: 999px;
  background: var(--glass-fill);
  -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.tt-knob {
  position: absolute; top: 50%; left: calc(var(--in) - 1px);
  width: var(--kw); height: var(--kh); margin-top: calc(var(--kh) / -2);
  display: grid; place-items: center; border-radius: 999px;
  background: var(--fg); color: var(--bg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), scale 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.tt-knob svg { width: calc(var(--kh) * 0.72); height: calc(var(--kh) * 0.72); display: block; }
.tt-knob .sun { display: none; }
html[data-theme="light"] .theme-toggle { background: var(--accent); border-color: var(--accent-rim); }
html[data-theme="light"] .tt-knob { transform: translateX(calc(var(--w) - var(--kw) - 2 * var(--in))); background: #fff; color: var(--accent); }
html[data-theme="light"] .tt-knob .sun { display: block; }
html[data-theme="light"] .tt-knob .moon { display: none; }
.theme-toggle:active .tt-knob { scale: 1.12 1.06; }
.theme-toggle:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .theme-toggle, .tt-knob { transition: none; } }
@media (max-width: 820px) {
  .theme-toggle { top: calc(207px * var(--hs, 0.2) + 10px); left: auto; right: max(12px, env(safe-area-inset-right, 0px)); }
}

/* ---------- Home contact: last beat of the sign-off (Figma Contact_page_v2, 682:421; 1920 x 1174) ----------
   Every size is the Figma number times --u (one Figma px at this window width). The yellow (blue in
   light mode) rim is img/contact-rim.svg used as a mask, so it follows the theme accent.
   Previous version: tools/copy-archive/home-contact-before-v2.* */
.hc {
  --u: calc(100vw / 1920);
  position: relative; height: calc(1174 * var(--u)); overflow: hidden; background: var(--bg); color: var(--fg);
}
.hc p { margin: 0; }
.hc a { color: inherit; text-decoration: none; }
.hc a:focus-visible { outline: 3px solid var(--blue); outline-offset: 6px; border-radius: 8px; }
.hc-card { position: absolute; left: 50%; top: calc(326 * var(--u));   /* Nov 19 Figma: centred top to bottom (was 154) */ width: calc(959 * var(--u)); height: calc(522 * var(--u)); transform: translateX(-50%); }
.hc-rim {
  position: absolute; inset: 0; background: var(--accent);
  -webkit-mask: url(../img/contact-rim.svg) center / 100% 100% no-repeat;
          mask: url(../img/contact-rim.svg) center / 100% 100% no-repeat;
}
.hc-hi, .hc-email { position: absolute; left: 0; right: 0; text-align: center; letter-spacing: -0.05em; line-height: 1.4; white-space: nowrap; }
.hc-hi { top: calc(101 * var(--u)); font-weight: 300; font-size: calc(40 * var(--u)); }
.hc-email { top: calc(175 * var(--u)); font-weight: 500; font-size: calc(80 * var(--u)); transition: color 0.15s; }
.hc-email:hover { color: var(--accent); }
.hc-btns {
  position: absolute; left: 0; right: 0; top: calc(390 * var(--u)); margin: 0; padding: 0; list-style: none;
  display: flex; justify-content: center; gap: calc(65 * var(--u));
}
.hc-btns a {
  width: calc(228 * var(--u)); height: calc(58.8 * var(--u)); box-sizing: border-box;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--on-accent); border: 1px solid var(--pill-rim); border-radius: 40.7px;
  font-weight: 300; font-size: calc(26 * var(--u)); letter-spacing: -0.05em; white-space: nowrap;
  padding-bottom: calc(2 * var(--pill-lift)); transition: scale 0.15s;
}
.hc-btns a:hover { scale: 1.04; }
.hc-name {
  /* Nov 19 Figma: a centred 150 line at the bottom, level with the credits (was full-bleed 364) */
  position: absolute; left: 0; top: calc(964 * var(--u)); width: 100%; text-align: center;
  font-weight: 500; font-size: calc(150 * var(--u)); letter-spacing: -0.05em; line-height: 1.4;
  color: var(--accent); white-space: nowrap; pointer-events: none;
}
.hc-credit, .hc-mail { position: absolute; top: calc(1104 * var(--u)); z-index: 1; font-weight: 300; font-size: calc(26 * var(--u)); letter-spacing: -0.05em; line-height: 1.4; white-space: nowrap; }
.hc-credit { left: calc(26 * var(--u)); }
.hc-mail { right: calc(25 * var(--u)); }
.hc-mail:hover { color: var(--accent); }
/* The glass Home footer (css/case.css) on the home page uses the same Figma-pixel unit */
body[data-page="home"] .cs-foot, body[data-page="home"] .cs-foot-space { --u: calc(min(100vw, 1920px) / 1920); }
/* Here the glass comes up over the bottom of the contact (Figma Contact_page_v2): the spacer only marks
   where it triggers and overlaps the last 207 Figma px instead of adding blank page below. */
body[data-page="home"] .cs-foot-space { margin-top: calc(-207 * var(--u)); position: relative; pointer-events: none; }
/* Narrow windows keep the same composition; only the small type and pills stop shrinking. */
@media (max-width: 1100px) {
  .hc-btns a { width: auto; min-width: calc(228 * var(--u)); height: max(30px, calc(58.8 * var(--u))); padding: 0 14px calc(2 * var(--pill-lift)); font-size: max(13px, calc(26 * var(--u))); }
  .hc-credit, .hc-mail { font-size: max(12px, calc(26 * var(--u))); }
}

/* ---------- Liquid glass surface (after Compass "Liquid Glass", Sam Nov 16; js/glass.js Glass.surface) ----------
   On top of every glass: a thin light rim (bright top-left fading to a faint bottom-right), a faint
   rainbow dispersion ring where the edge splits the light, and a soft shine that follows the pointer.
   The refraction itself is js/glass.js (lens + edge bend). */
.lg-rim, .lg-disp, .lg-shine { position: absolute; inset: 0; z-index: 2; border-radius: inherit; pointer-events: none; }
.lg-rim, .lg-disp {
  -webkit-mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.lg-rim { padding: 1px; background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), transparent 42%, transparent 72%, rgba(255, 255, 255, 0.25)); }
.lg-disp {
  padding: 3px; filter: blur(0.45px); opacity: 0.18; mix-blend-mode: screen;
  background: conic-gradient(from 115deg, rgba(96, 226, 255, 0.9), rgba(139, 120, 255, 0.65) 16%, transparent 30%,
    rgba(255, 255, 255, 0.95) 45%, rgba(255, 186, 117, 0.7) 58%, rgba(255, 119, 201, 0.65) 72%, transparent 85%, rgba(96, 226, 255, 0.9));
}
.lg-shine {
  background: radial-gradient(60% 120% at var(--shine-x, 25%) var(--shine-y, 15%), rgba(255, 255, 255, 0.14), transparent 60%);
  mix-blend-mode: screen;
}
html[data-theme="light"] .lg-rim { background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(0, 0, 0, 0.06) 42%, transparent 72%, rgba(0, 0, 0, 0.12)); }
html[data-theme="light"] .lg-disp { opacity: 0.12; mix-blend-mode: normal; }
html[data-theme="light"] .lg-shine { background: radial-gradient(60% 120% at var(--shine-x, 25%) var(--shine-y, 15%), rgba(255, 255, 255, 0.45), transparent 60%); mix-blend-mode: normal; }
@media (prefers-reduced-motion: reduce) { .lg-shine { background-position: 25% 15%; } }

/* Project strip: the glass refracts a copy of the artwork (so it works in every browser).
   Chrome / Edge: a real lens filter, js/project-scroll.js builds #psLens (edge bend + enlargement).
   Others: the copy is simply enlarged 6% from the middle of the screen. */
html.lg-svg .ps-glass-objs { filter: url(#psLens) blur(calc(3px / var(--ps, 0.5))) saturate(180%) brightness(1.05); }   /* less frost, so the bend reads */
html:not(.lg-svg) .ps-glass-objs { transform: translateY(calc(var(--drop, 0) * -230px)) scale(1.06); transform-origin: 50% 50%; filter: blur(calc(3px / var(--ps, 0.5))) saturate(180%) brightness(1.05); }

/* Gallery start (Sam, Nov 19): home on desktop opens with only the object, name and role. The dots and
   the light/dark switch wait (html.ui-calm, set in index.html) and fade in on the first pointer move. */
html.ui-calm .ps-dots, html.ui-calm .theme-toggle, html.ui-calm .ps-cue { opacity: 0 !important; pointer-events: none; }
html.ui-wake .ps-dots, html.ui-wake .theme-toggle { animation: ui-wake 0.6s ease-out both; }
@keyframes ui-wake { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { html.ui-wake .ps-dots, html.ui-wake .theme-toggle { animation: none; } }
