/* ========================================================================
   Fonts
   ======================================================================== */
@font-face {
  font-family: "Creato Display";
  src: url("../fonts/creato/CreatoDisplay-BlackItalic.otf") format("opentype");
  font-weight: 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Creato Display";
  src: url("../fonts/creato/CreatoDisplay-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Creato Display";
  src: url("../fonts/creato/CreatoDisplay-MediumItalic.otf") format("opentype");
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Begies";
  src: url("../fonts/begies/Begies Italic.otf") format("opentype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Begies";
  src: url("../fonts/begies/Begies.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ========================================================================
   Base
   ======================================================================== */
:root {
  --ink: #f4efe6;
  --ink-dim: rgba(244, 239, 230, 0.62);
  --bg: #0a0805;
  --card-bg: rgba(18, 14, 10, 0.48);
  --card-border: rgba(255, 247, 232, 0.18);
  --card-glow: rgba(0, 0, 0, 0.85);
  --title-fs: clamp(7rem, 22vw, 20rem);
  --subtitle-fs: clamp(1.1rem, 2.4vw, 2.1rem);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Creato Display", system-ui, sans-serif;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100svh;
  overflow-x: hidden;
  position: relative;
}

/* give us a tall scroll track during the title-phase; JS resets this on transition-complete */
#scroll-spacer {
  height: 260vh;
  pointer-events: none;
}

/* ========================================================================
   Animated shader-mimic gradient for title text
   ======================================================================== */
@keyframes shaderShift {
  0%   { stop-color: #0a1628; }
  25%  { stop-color: #1565c0; }
  50%  { stop-color: #42a5f5; }
  75%  { stop-color: #b3d9f7; }
  100% { stop-color: #e8f4fd; }
}
@keyframes shaderShiftWarm {
  0%   { stop-color: #1a0a05; }
  25%  { stop-color: #FD7543; }
  50%  { stop-color: #FFCF25; }
  75%  { stop-color: #ffb347; }
  100% { stop-color: #fff5e6; }
}

/* ========================================================================
   Shader canvas (now a div; ShaderMount injects a <canvas> inside it)
   ======================================================================== */
#shader-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  /* background is rendered by the ShaderMount canvas inside */
}
/* ensure ShaderMount's canvas always fills the container */
#shader-canvas canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
  z-index: 0 !important; /* override paper-design's z-index: -1 */
}

/* ========================================================================
   Layer 1: SVG dark overlay — mask punches holes for text + star.
   Same engine as lumo-layer so holes are pixel-perfect.
   ======================================================================== */
#cutout-layer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  z-index: 2;
  overflow: visible;
  opacity: 0;
  transition: opacity 0.5s ease;
  will-change: opacity;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

/* ========================================================================
   Layer 2: desaturation — grey text directly in SVG, saturation blend drains
   colour from the text-shaped shader holes left by layer 1.
   Star is absent here so it keeps full colour.
   ======================================================================== */
#lumo-layer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
  overflow: visible;
  mix-blend-mode: saturation;
  opacity: 0;
  transition: opacity 0.5s ease;
  will-change: opacity;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

/* Reveal overlay layers only after fonts are ready and positions are calculated */
body.ready #cutout-layer,
body.ready #lumo-layer {
  opacity: 1;
}

#mask-text-iskra,
#lumo-iskra,
#cutout-iskra {
  font-size: var(--title-fs);
  letter-spacing: -0.04em;
}
#mask-text-design,
#lumo-design,
#cutout-design {
  font-size: var(--subtitle-fs);
  letter-spacing: 0.22em;
}

/* Star paths — transformed via JS */
#mask-star,
#lumo-star-cut,
#cutout-star,
#star-outline {
  transform-box: fill-box;
  transform-origin: center;
}

/* ========================================================================
   Star outline SVG — hidden; kept in DOM for future dev use
   ======================================================================== */
#star-outline-svg { display: none; }



/* ========================================================================
   Text drag handles (iskra + design lines)
   ======================================================================== */
.text-handle {
  position: fixed;
  z-index: 10;
  cursor: grab;
  box-sizing: border-box;
  border: 1px dashed rgba(255, 180, 60, 0.45);
  border-radius: 2px;
  pointer-events: auto;
  transition: border-color 0.2s;
}
.text-handle:hover { border-color: rgba(255, 180, 60, 0.85); }
.text-handle span {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  white-space: nowrap;
  letter-spacing: .08em;
  color: rgba(255, 180, 60, 0.55);
  font-family: sans-serif;
  pointer-events: none;
}

/* ========================================================================
   Scroll hint
   ======================================================================== */
#scroll-hint {
  position: fixed;
  left: 50%;
  bottom: 4vh;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--ink-dim);
  font-family: "Begies", serif;
  font-style: italic;
  font-size: 0.82rem;
  letter-spacing: 0.32em;
  text-transform: lowercase;
  opacity: 0;
  transition: opacity 0.6s ease;
}
#scroll-hint svg { animation: bob 1.6s ease-in-out infinite; }
@keyframes bob {
  0%, 100% { transform: translateY(0); opacity: 0.6; }
  50%      { transform: translateY(4px); opacity: 1; }
}
body.ready #scroll-hint { opacity: 1; }
body.menu-phase #scroll-hint { opacity: 0; pointer-events: none; }

/* ========================================================================
   Cards stage
   ======================================================================== */
#cards-stage {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  /* bottom padding matches card's bottom inset so stage never clips text */
  padding: 4vh 4vw 44vmin;
}

/* Cards sit in the upper portion of the screen, above the visible wheel arc.
   Visible arc = 1/3 of 120vmin = 40vmin → give it 44vmin clearance + some air. */
.card {
  pointer-events: none;
  position: absolute;
  inset: 4vh 0 44vmin 0;
  margin: auto;
  width: min(520px, 82vw);
  height: fit-content;
  padding: 2.2rem 2.4rem;
  color: var(--ink);
  opacity: 0;
  transform: translate3d(0, 20px, 0);
  will-change: transform, opacity;
  /* Whisper-faint dark halo hugging the glyphs — just enough to lift the
     text off the moving shader without reading as a shadow. */
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.4), 0 0 3px rgba(0, 0, 0, 0.4);
}

.card h3 {
  margin: 0 0 0.6rem;
  font-family: "Creato Display", sans-serif;
  font-weight: 900;
  font-style: italic;
  font-size: clamp(1.6rem, 2.4vw, 2.2rem);
  letter-spacing: -0.02em;
  color: var(--ink);
  position: relative;
  z-index: 1;
  /* The 900-weight stroke has ~2x the ink area of the 400 body text, so the
     inherited .card text-shadow piles up far denser here. Drop the tight inner
     layer and lower the alpha so the halo matches the body's perceived weight.
     Kept at ~0.6x the body alpha (body 0.4 → 0.24) so the two stay balanced. */
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.24);
}
.card p, .card li, .card a {
  font-family: "Creato Display", sans-serif;
  font-weight: 400;
  font-size: clamp(0.95rem, 1.05vw, 1.05rem);
  line-height: 1.55;
  color: var(--ink);
  position: relative;
  z-index: 1;
}
/* #cards-stage and .card are pointer-events:none (click-through overlay);
   links must opt back in so they're actually clickable, same pattern as
   .radial-label re-enabling events under #radial-menu. */
.card a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--ink-dim); padding-bottom: 1px; pointer-events: auto; }
.card a:hover { border-bottom-color: var(--ink); }
.card ul { list-style: none; padding: 0; margin: 0.4rem 0 0; display: grid; gap: 0.55rem; }
.card .eyebrow {
  font-family: "Begies", serif;
  font-style: italic;
  font-size: 0.8rem;
  letter-spacing: 0.28em;
  text-transform: lowercase;
  color: var(--ink-dim);
  position: relative;
  z-index: 1;
  margin-bottom: 0.8rem;
}

/* ========================================================================
   Radial menu
   ======================================================================== */
#radial-menu {
  position: fixed;
  left: 50%;
  /* Wheel diameter is clamped so it doesn't bloat on 4K displays nor shrink
     past usefulness on small laptops. Bottom offset derives from the diameter
     via golden-ratio: 1/φ ≈ 0.618 hidden, 1/φ² ≈ 0.382 visible above edge.
     Single source of truth (--wheel-d) so resizing stays consistent. */
  --wheel-d: clamp(420px, 120vmin, 1100px);
  width: var(--wheel-d);
  height: var(--wheel-d);
  bottom: calc(-0.618 * var(--wheel-d));
  transform: translateX(-50%) translateY(calc(var(--lift, 0) * 1px));
  min-width: 320px;
  min-height: 320px;
  /* no max-width cap — labels need to bleed past viewport edges on wide screens */
  z-index: 6;
  pointer-events: none; /* re-enabled on children that need it */
  overflow: visible;
  opacity: 0;
  transition: opacity 0.5s ease;
}
#radial-menu[hidden] { display: none; }
body.menu-phase #radial-menu { opacity: 1; }

/* Rotating inner wrapper — JS drives rotate() on this */
#radial-wheel {
  position: absolute;
  inset: 0;
  transform-origin: 50% 50%;
}

#radial-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  pointer-events: none;
}

#radial-bg {
  fill: url(#menu-dark-grad);
  stroke: rgba(255, 247, 232, 0.55);
  stroke-width: 0.8;
}

#radial-dividers { display: none; }

#radial-dividers line {
  stroke: rgba(255,247,232,0.12);
  stroke-width: 0.6;
}

#radial-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}
.radial-label {
  position: absolute;
  left: calc(50% + var(--x, 0%));
  top: calc(50% + var(--y, 0%));
  /* translate to centre, then rotate radially outward, then scale */
  transform: translate(-50%, -50%) rotate(var(--r, 0deg)) scale(var(--sc, 1));
  font-family: "Creato Display", sans-serif;
  font-weight: 900;
  font-style: italic;
  color: var(--ink);
  text-transform: lowercase;
  letter-spacing: -0.02em;
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
  /* Scales with --wheel-d so labels stay proportional to the wheel across
     all desktop viewport sizes. Floor + ceiling keep them readable when
     the wheel hits its clamp() bounds. Mobile @media blocks override. */
  font-size: clamp(1.1rem, calc(var(--wheel-d) * 0.020), 1.5rem);
  opacity: 0.5;
  transition: opacity 0.25s ease;
  /* reset button defaults */
  background: none;
  border: none;
  outline: none;
  padding: 0;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
}
.radial-label:hover { opacity: 0.8; }
.radial-label.is-active {
  opacity: 1;
  font-size: clamp(2rem, calc(var(--wheel-d) * 0.035), 3rem);
  letter-spacing: -0.03em;
}

/* ========================================================================
   Mobile — stickers are not rendered below 768px (see stickers.js
   NO_STICKERS_VW). Title sizing is bumped up to fill the freed vertical
   space so the title screen still feels deliberate without stickers.
   ======================================================================== */
@media (max-width: 720px) {
  :root {
    --title-fs:    clamp(6.5rem, 32vw, 12rem);
    --subtitle-fs: clamp(1.4rem, 3.4vw, 2.6rem);
  }
  #radial-menu {
    --wheel-d: clamp(380px, 140vmin, 980px);
    width: var(--wheel-d);
    height: var(--wheel-d);
    bottom: calc(-0.618 * var(--wheel-d));
    min-width: 280px;
    min-height: 280px;
  }
  .card {
    inset: 2vh 0 52vmin 0;
    padding: 1.6rem 1.5rem;
  }
  #cards-stage { padding-bottom: 52vmin; }
  /* 1.5× larger on mobile so labels are comfortably tappable + readable. */
  .radial-label { font-size: 1.35rem; }
  .radial-label.is-active { font-size: 2.1rem; }
}

@media (max-width: 480px) {
  :root {
    --title-fs:    clamp(5rem, 30vw, 9rem);
    --subtitle-fs: clamp(1.15rem, 3vw, 2.1rem);
  }
  #radial-menu {
    --wheel-d: clamp(340px, 160vmin, 800px);
    width: var(--wheel-d);
    height: var(--wheel-d);
    bottom: calc(-0.618 * var(--wheel-d));
    min-width: 260px;
    min-height: 260px;
  }
  .card {
    inset: 2vh 0 56vmin 0;
    padding: 1.2rem 1.1rem;
    width: min(520px, 90vw);
  }
  #cards-stage { padding: 3vh 3vw 56vmin; }
  .card h3 { font-size: clamp(1.3rem, 5vw, 1.8rem); }
  .card p, .card li, .card a { font-size: clamp(0.88rem, 3.5vw, 1rem); }
  /* 1.5× larger on small phones too. */
  .radial-label { font-size: 1.23rem; }
  .radial-label.is-active { font-size: 1.875rem; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  #scroll-hint svg { animation: none; }
}
