/* ═══════════════════════════════════════════════════════════════════
   STUDIO SITE — base styles
   The page is one WebGL canvas; DOM is overlay text only.

   V.37 — the type is the tempo studies' system, nothing else: Helvetica
   Neue 13/1.45, weights 400 and 500, sentence case, hairline rules, square
   32 px buttons, a 60-character measure. The chrome runs on the dark tokens
   (ink on paper, paper being the canvas); the write-up's sheet runs on the
   light ones. One ease for everything.
   ═══════════════════════════════════════════════════════════════════ */
:root {
  --paper: #151514; --ink: #ecece8; --mute: #8d8d87; --faint: #55554f; --line: #262624; --rule: #2e2e2b;
  --sans: "Helvetica Neue", HelveticaNeue, Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(.65, 0, .35, 1);
  --ms: 67px;                                              /* the mark's side (56 × 1.2, V.42) */
  --sl: max(24px, env(safe-area-inset-left, 0px));         /* the page's insets */
  --sr: max(24px, env(safe-area-inset-right, 0px));
  --st: max(22px, env(safe-area-inset-top, 0px));
  --sb: max(20px, env(safe-area-inset-bottom, 0px));
}
@media (max-width: 759px) {
  :root { --ms: 53px; --sl: max(16px, env(safe-area-inset-left, 0px)); --sr: max(16px, env(safe-area-inset-right, 0px)); --st: max(16px, env(safe-area-inset-top, 0px)); --sb: max(16px, env(safe-area-inset-bottom, 0px)); }
}

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

html, body {
  background: #000;
  color: var(--ink);
  font: 13px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  /* kill mobile pull-to-refresh + overscroll bounce/chaining — a hard
     flick used to reach the top edge and reload the page (landing on a
     different image). overscroll-behavior:none keeps the loop seamless. */
  overscroll-behavior: none;
}
@media (max-width: 759px) { html, body { font-size: 15px; } }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

/* hide scrollbar, keep native scroll (same trick as the reference site) */
html { scrollbar-width: none; }
body::-webkit-scrollbar { display: none; }

#gl { position: fixed; inset: 0; z-index: 1; display: block; }

/* native-scroll spacer: gives the page real height to scroll */
#spacer { position: relative; width: 100%; }

.overlay { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.overlay > * { pointer-events: auto; }
/* the chrome arrives with the work, once the opening has run (js/intro.js) */
.overlay { transition: opacity .75s ease-out; }
html.intro .overlay { opacity: 0; pointer-events: none; }
html.intro .overlay > * { pointer-events: none; }
html.intro .metro { opacity: 0; pointer-events: none; }

/* ═══ the mark: the square turns, the word stays level ═══
   It turns with the motion (steady on auto-drift, fast on a quick scroll);
   a click opens the write-up, and the sheet grows out of it. */
.metro {
  position: fixed; left: var(--sl); top: var(--st);
  width: var(--ms); height: var(--ms);
  z-index: 40;   /* above the overlay (10) and the Works bed (30): top left on every screen */
  display: grid; place-items: center;
  transform-origin: center; transition: transform .2s ease-out, opacity .75s ease-out;
  user-select: none; -webkit-user-select: none;
}
.metro .sq { position: absolute; inset: 0; background: var(--ink); will-change: transform; transition: background .3s ease-out; }
.metro span {
  position: relative; z-index: 1; pointer-events: none;
  color: var(--paper); font-weight: 700; font-size: 13px; letter-spacing: .02em; line-height: 1;   /* the site's own size */
  transition: color .3s ease-out;
}
@media (hover: hover) { .metro:hover { transform: scale(.95); } }
/* on the sheet the mark is ink on paper: the square goes black, the word stays readable */
.about-open .metro .sq { background: #151514; }
.about-open .metro span { color: #ecece8; }

/* ═══ the navigation: words with a hairline round them, no box. The colour
   follows the imagery under each word (app.js samples the canvas): light on
   dark work, ink on light work. ═══ */
.nav, .index-btn, .sound-btn, .view-btn, .about-x, .detail-x, .wb-close, .wb-toggle button {
  display: inline-flex; align-items: center; justify-content: center;
  height: 32px; padding: 0 10px;
  font-size: 11px; line-height: 1; letter-spacing: .02em; white-space: nowrap;
  color: var(--ink); background: transparent; border: 1px solid rgba(236, 236, 232, .28); border-radius: 999px;
  padding: 0 13px;
  transition: color .45s ease-out, border-color .45s ease-out, opacity .3s ease-out;
}
.nav.dark { color: #111; border-color: rgba(17, 17, 17, .22); }
@media (hover: hover) { .nav:hover, .wb-close:hover, .wb-toggle button:hover { border-color: rgba(236, 236, 232, .6); } .nav.dark:hover { border-color: rgba(17, 17, 17, .5); } }
@media (max-width: 759px) { .nav, .index-btn, .sound-btn, .view-btn, .about-x, .detail-x, .wb-close, .wb-toggle button { height: 40px; } }

/* top-right: Close (inside a project) · Works */
.top { position: absolute; right: var(--sr); top: var(--st); display: flex; gap: 4px; }
/* the ×: two hairlines, so it is centred to the pixel; it fades and settles in when a project opens */
.detail-x { position: relative; width: 32px; padding: 0; border-radius: 50%; font-size: 0; }
.detail-x::before, .detail-x::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 11px; height: 1px; background: currentColor;
  transform: translate(-50%, -50%) rotate(45deg);
}
.detail-x::after { transform: translate(-50%, -50%) rotate(-45deg); }
.detail-x { opacity: 0; transform: scale(.7); pointer-events: none; transition: opacity .5s var(--ease), transform .5s var(--ease), color .45s ease-out, border-color .45s ease-out; }
.detail-x.show { opacity: 1; transform: scale(1); pointer-events: auto; }
@media (max-width: 759px) { .detail-x { width: 40px; } }
/* Sound sits in the top row with Works; a 6 px square marks it on */
.sound-btn.on::before { content: ''; width: 6px; height: 6px; margin-right: 8px; background: currentColor; }
/* View — dive into the project in view, straight from the landing — bottom centre */
/* the project's title, bottom centre, in sentence case: the way in besides the cover itself — the word alone, no hairline */
.view-btn { position: absolute; left: 50%; bottom: var(--sb); transform: translateX(-50%); border-color: rgba(236, 236, 232, .16); }   /* a faint stroke: it is a thing to press */
.view-btn.dark { border-color: rgba(17, 17, 17, .14); }
.view-btn[hidden] { display: none; }

/* ═══ the opening (js/intro.js, from tempo study A1) ═══ */
.intro-layer { position: fixed; inset: 0; z-index: 50; overflow: hidden; cursor: pointer; }
.intro-layer .ld { position: absolute; background: var(--ink); transform-origin: center; will-change: transform, opacity; }
.intro-layer .ldw {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  color: var(--paper); font-weight: 700; letter-spacing: .02em; line-height: 1; white-space: nowrap;
  will-change: transform, opacity;
}
.intro-layer .nm {
  position: absolute; top: 50%; margin-top: -.5em;
  font-size: 13px; line-height: 1; color: var(--mute); white-space: nowrap; will-change: transform, opacity;
}
.intro-layer .nm.l { right: calc(50% + var(--ms) / 2 + 20px); }
.intro-layer .nm.r { left: calc(50% + var(--ms) / 2 + 20px); }

/* ═══ the write-up: a sheet of paper that grows out of the mark (js/about.js, from tempo study B1) ═══
   The sheet runs on the light tokens: paper on paper, ink #111, the contact line in mute. */
.about-host { position: fixed; inset: 0; z-index: 35; pointer-events: none; }   /* above the bed (30), below the mark (40) */
.about {
  --paper: #ecece8; --ink: #151514; --mute: rgba(21, 21, 20, .6);
  position: absolute; inset: 0; z-index: 5; pointer-events: none; overflow: hidden;
  will-change: transform, opacity, clip-path;
}
.about.on { pointer-events: auto; }
.about-sheet { position: absolute; left: 0; top: 0; background: var(--paper); will-change: transform, clip-path, opacity; }
.about-sheet.full { width: 100%; height: 100%; }
.about-info {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(60ch, calc(100% - var(--sl) - var(--sr)));
  color: var(--ink);
}
.about-info p { margin: 0; max-width: 60ch; }
.about-info p + p { margin-top: 1em; }
.about-info .ct { margin-top: 1.4em; color: var(--ink); }   /* the label in ink, the address in mute, as the study */
.about-info .ct a { color: var(--mute); }
.about-info .ct a:hover { color: var(--ink); }
.about-info .ln { opacity: 0; will-change: transform, opacity; }
.about-x { display: none; }   /* the mark or Esc closes it, as in the study */
@media (max-width: 599px) {
  .about-info { left: var(--sl); right: var(--sr); top: calc(var(--st) + var(--ms) + 36px); transform: none; width: auto; }
}

/* ═══ inside a project: a scrim rises from the bottom so the copy reads over the image ═══ */
.scrim {
  position: absolute; left: 0; right: 0; bottom: 0; height: min(36vh, 340px); pointer-events: none;
  background: linear-gradient(to top, rgba(0, 0, 0, .78) 0%, rgba(0, 0, 0, .5) 38%, rgba(0, 0, 0, 0) 100%);
  opacity: 0; transition: opacity .6s ease-out;
}
body.in-project .scrim { opacity: 1; }
.detail { position: absolute; left: calc(var(--sl) + 32px); bottom: calc(var(--sb) + 36px); max-width: 44ch; font-size: 11px; line-height: 1.45; color: var(--mute); }   /* 56 px from the left and from the bottom alike */
.detail[hidden] { display: none; }
.detail-meta { display: block; font-weight: 500; color: var(--ink); }
.detail-desc { margin-top: 0; }
@media (max-width: 759px) { .detail { left: calc(var(--sl) + 20px); right: calc(var(--sr) + 20px); max-width: none; bottom: calc(var(--sb) + 20px); } }   /* 36 px alike on a phone */

/* the rest of the controls stay hidden on the public site (V.36); the keyboard still works (G — effects panel) */
.lens-btn, .hint, .version, .beat-dot { display: none; }
.lens-btn { position: absolute; left: var(--sl); bottom: var(--sb); }
.hint { position: absolute; right: var(--sr); bottom: var(--sb); font-size: 11px; color: var(--faint); }
.version { position: absolute; right: var(--sr); top: calc(var(--st) + 40px); font-size: 11px; color: var(--faint); }
.beat-dot { position: absolute; right: var(--sr); top: calc(var(--st) + 44px); width: 9px; height: 9px; border-radius: 50%; background: var(--ink); opacity: .25; }

/* ═══ WORKS BED — global nav overlay (built by js/worksbed.js) ═══ */
.works-bed { position: fixed; inset: 0; z-index: 30; background: #000; }
.works-bed[hidden] { display: none; }
.wb-gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 1; cursor: default; }
.wb-cap {
  position: absolute; left: 50%; bottom: var(--sb); transform: translateX(-50%); z-index: 6; pointer-events: none;
  display: inline-flex; align-items: center; height: 32px; padding: 0 13px;
  font-size: 11px; line-height: 1; letter-spacing: .02em; color: var(--ink);
  opacity: 0; transition: opacity .25s; white-space: nowrap;
}
.wb-cap .yr { margin-left: 8px; color: var(--mute); font-variant-numeric: tabular-nums; }
.wb-hint { display: none; }
@media (max-width: 759px) { .wb-cap { height: 40px; } }
.wb-toggle { position: absolute; left: 50%; bottom: var(--sb); transform: translateX(-50%); z-index: 9; display: flex; gap: 4px; }
.wb-toggle button { color: var(--mute); }
.wb-toggle button.on { color: var(--ink); border-color: currentColor; }
.wb-hint { position: absolute; right: var(--sr); top: calc(var(--st) + 44px); z-index: 9; font-size: 11px; color: var(--faint); text-align: right; }
.wb-close { position: absolute; right: var(--sr); top: var(--st); z-index: 10; }
.wb-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 20; }
.wb-flash.go { animation: wbFlash .55s ease; }
@keyframes wbFlash { 0% { opacity: 0.72; } 100% { opacity: 0; } }
