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

:root {
  --serif: 'EB Garamond', serif;
  --sans: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', system-ui, sans-serif;
  --mono: 'Space Mono', monospace;
  --ink: #0a0a0a;
  --ground: #f7f6f2;   /* hub background — light, so the (mostly dark) samples stand off it. Keep in step with HUB_GROUND in main.js */
  --paper: #f0eee8;
  --paper-dim: rgba(240, 238, 232, 0.55);
  --paper-faint: rgba(240, 238, 232, 0.22);
}

html, body {
  font-family: var(--mono);
  background: var(--ground);
  color: var(--paper);
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  cursor: pointer;
}

/* ─────────────────────────────────────────
   Tiles — one mounted interaction each, always laid out at full
   viewport size. Hidden behind the canvas until the thumbnail has
   expanded to fullscreen, then shown in place of it.
   ───────────────────────────────────────── */
#tiles {
  position: fixed;
  inset: 0;
  z-index: 0;
}
.tile {
  position: absolute;
  inset: 0;
  overflow: hidden;
  visibility: hidden;
}
.tile.is-live { visibility: visible; }

#webgl {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
}

/* Fullscreen hand-off: the canvas fades off the live tile beneath it.
   Coming back is instant (no transition on the base rule) so the fresh
   still replaces the live tile within one frame. */
#webgl.dim {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

/* ─────────────────────────────────────────
   Thumbnail labels — one per plane
   ───────────────────────────────────────── */
/* The labels you see are drawn in WebGL (main.js, "Label planes") so they can
   bend with the list. These elements are kept out of sight: they carry the
   text for screen readers, and their styles below are what the drawn labels
   are set in — change the type here. */
#thumbs {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  visibility: hidden;
}
.thumb-label {
  position: absolute;
  transform: translate(-50%, 0);
  transition: opacity 0.4s ease;
  will-change: transform, opacity;
  color: var(--ink);   /* labels sit on the light hub ground */
}
.thumb-label .name {
  font-family: var(--sans);
  font-size: clamp(1.6rem, 3.6vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  white-space: nowrap;
}
/* On a wide screen the label spans its thumbnail: the name sits on the
   thumbnail's left edge and the paragraph on its right. */
.thumb-label {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2.5rem;
}
/* A short paragraph: what the interaction does, then what it's built with. */
.thumb-label .sub {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: -0.01em;
  word-break: keep-all;
  flex: 0 1 30em;
  color: rgba(10, 10, 10, 0.58);
  margin-top: 0.45rem;   /* lines its first line up with the name's cap height */
}
@media (max-width: 720px) {
  /* No room for two columns: stacked and centred. */
  .thumb-label { display: block; text-align: center; }
  .thumb-label .sub { font-size: 14px; margin-top: 0.5rem; }
}

/* ─────────────────────────────────────────
   Editorial — shown once a tile reaches fullscreen
   ───────────────────────────────────────── */
#editorial {
  position: fixed;
  left: 2rem;
  bottom: 2rem;
  z-index: 6;
  max-width: 480px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(20px);
  /* Hiding (default state): fast cubicOut */
  transition: opacity 0.1s cubic-bezier(0.33, 1, 0.68, 1),
              transform 0.1s cubic-bezier(0.33, 1, 0.68, 1);
}
#editorial.visible {
  opacity: 1;
  transform: translateY(0);
  /* Entering: 0.6s cubicOut */
  transition: opacity 0.6s cubic-bezier(0.33, 1, 0.68, 1),
              transform 0.6s cubic-bezier(0.33, 1, 0.68, 1);
}
#editorial .ed-name {
  font-family: var(--sans);
  font-weight: 600;
  font-size: clamp(2rem, 4.2vw, 3rem);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--paper);
  margin-bottom: 1.3rem;
}
#editorial .ed-body {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.5;
  letter-spacing: -0.005em;
  color: var(--paper-dim);
}

/* ─────────────────────────────────────────
   Close button — solid black circle, white ✕.
   GSAP-driven elastic spring; CSS just sets the visual base.
   ───────────────────────────────────────── */
#close-btn {
  position: fixed;
  top: 32px;
  right: 36px;
  z-index: 10;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: #000;
  color: #fff;
  font-family: var(--mono);
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: scale(0);
}

/* ─────────────────────────────────────────
   List counter — which interaction is at the centre
   ───────────────────────────────────────── */
.site-foot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: space-between;
  padding: 24px 32px;
  font-family: var(--sans); font-size: 14px; font-weight: 500; letter-spacing: -0.01em; font-variant-numeric: tabular-nums;
  /* White + difference: reads dark on the light ground, light over a dark thumbnail. */
  color: #fff; mix-blend-mode: difference;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.site-foot span { opacity: 0.55; }
.site-foot .count b { font-weight: 400; }
.site-foot .count { opacity: 1; }

/* While an interaction is opening, open, or closing, the counter steps out. */
body.is-open .site-foot { opacity: 0; }

@media (max-width: 720px) {
  .site-foot { padding: 18px 20px; font-size: 11px; }
}
