/* Theme layer: dark tokens, the pull-cord lamp, icons. Loaded after styles.css. */

:root {
  --sheet: var(--card);
  --grid: rgba(91, 124, 250, 0.1);
  --mock-edge: #cfc7b8;
  --live: #1f9d55;
}

/* Dark: warm charcoal, the sketch becomes chalk on a board */
:root[data-theme="dark"] {
  --paper: #131210;
  --paper-2: #1c1a17;
  --card: #1b1916;
  --ink: #f2ede3;
  --ink-2: #d8d2c6;
  --muted: #a39d91;
  --line: rgba(242, 237, 227, 0.12);
  --accent: #ff6b35;
  --blue: #7d97ff;
  --wa: #1a8a51;
  --wa-hover: #21a462;
  --graphite: #ebe5d8;
  --glass: rgba(27, 25, 22, 0.72);
  --glass-strong: rgba(27, 25, 22, 0.9);
  --soft: #3b3833;
  --shadow-rgb: 0, 0, 0;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 30px 60px -30px rgba(0, 0, 0, 0.7);
  --sheet: #171a18;
  --grid: rgba(235, 229, 216, 0.06);
  --mock-edge: #0b0a09;
  --live: #3ecf7e;
  color-scheme: dark;
}
/* no-JS fallback follows the OS */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --paper: #131210; --paper-2: #1c1a17; --card: #1b1916; --ink: #f2ede3; --ink-2: #d8d2c6; --muted: #a39d91;
    --line: rgba(242, 237, 227, 0.12); --accent: #ff6b35; --blue: #7d97ff; --graphite: #ebe5d8;
    --glass: rgba(27, 25, 22, 0.72); --glass-strong: rgba(27, 25, 22, 0.9); --soft: #3b3833; --shadow-rgb: 0, 0, 0;
    --sheet: #171a18; --grid: rgba(235, 229, 216, 0.06); --mock-edge: #0b0a09; --live: #3ecf7e;
    color-scheme: dark;
  }
}

[data-theme="dark"] ::selection { color: #141413; }
/* the hero illustration keeps dark ink on its white egg + screen */
[data-theme="dark"] .canvas { --ink: #141413; background-image: radial-gradient(rgba(242, 237, 227, 0.1) 1px, transparent 1.2px); }
[data-theme="dark"] .cursor__arrow { fill: #f2ede3; stroke: #141413; }
[data-theme="dark"] .feature--framlet .feature__shot { background: radial-gradient(circle at 50% 45%, #3a2418, var(--paper-2) 70%); }
[data-theme="dark"] .feature--voicetext .feature__shot { background: radial-gradient(circle at 50% 45%, #1c2640, var(--paper-2) 70%); }
[data-theme="dark"] .founder__photo,
[data-theme="dark"] .feature__shot img { filter: brightness(0.92); }

/* ---------- icons ---------- */
.i {
  display: inline-block;
  flex: none;
  width: 0.95em;
  height: 0.95em;
  vertical-align: -0.12em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.i--brand { fill: currentColor; stroke: none; }
.link-arrow span,
.place__go { display: inline-flex; align-items: center; }
.founder__links a { display: inline-flex; align-items: center; gap: 0.45rem; }
.founder__links .i { width: 1.05em; height: 1.05em; }
.work-row .ext .i { width: 0.7em; height: 0.7em; vertical-align: 0.15em; color: var(--muted); }
.hand-arrow { width: 0.8em; height: 1.1em; vertical-align: -0.1em; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- the lamp ---------- */
.lamp {
  position: absolute;
  top: calc(100% - 2px);
  right: clamp(2.4rem, 6vw, 3.4rem);
  z-index: -1;
  width: 62px;
  height: 131px;
  padding: 0;
  border: 0;
  background: none;
  cursor: grab;
  pointer-events: none;
  touch-action: none;
  /* never paint above the nav's bottom edge, even while tucked */
  clip-path: inset(2px -100vw -100vh -100vw);
  transition: translate 0.55s var(--ease-out-expo), clip-path 0.55s var(--ease-out-expo);
  -webkit-tap-highlight-color: transparent;
}
.lamp:active { cursor: grabbing; }
.lamp:focus-visible { outline: none; }
.lamp:focus-visible .lamp__shade { stroke: var(--accent); stroke-width: 2.6; }
.lamp__pivot { position: absolute; inset: 0; transform-origin: 50% 0; will-change: transform; }
.lamp svg { position: relative; display: block; width: 100%; height: 100%; overflow: visible; }
.lamp .hit { fill: transparent; pointer-events: all; }

.lamp__wire { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; }
.lamp__cap { fill: var(--ink); }
.lamp__shade { fill: var(--card); stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; transition: fill 0.4s; }
.lamp__stripe { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; }
.lamp__bulb { fill: var(--soft); stroke: var(--ink); stroke-width: 1.4; transition: fill 0.25s; }
.lamp__halo { fill: var(--lamp-core); opacity: 0; transition: opacity 0.4s; }
.lamp__chain { will-change: transform; }
.lamp__links { fill: none; stroke: var(--muted); stroke-width: 1.4; stroke-linecap: round; stroke-dasharray: 0.1 3.4; }
.lamp__bead { fill: var(--accent); stroke: var(--ink); stroke-width: 1.2; }

/* Warm tungsten light (~2700K). Falloff approximates inverse-square: bright core,
   quick drop, long soft tail — so it reads as light, not a flat tint. */
:root {
  --lamp-core: #ffd08a;
  --lamp-warm: 255, 158, 72;
}
.lamp__glow,
.lamp__beam {
  position: absolute;
  left: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.lamp__glow {
  top: 47%;
  width: 360px;
  height: 360px;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(closest-side,
    rgba(var(--lamp-warm), 0.42) 0%,
    rgba(var(--lamp-warm), 0.22) 12%,
    rgba(var(--lamp-warm), 0.1) 28%,
    rgba(var(--lamp-warm), 0.045) 50%,
    rgba(var(--lamp-warm), 0.015) 75%,
    rgba(var(--lamp-warm), 0) 100%);
}
.lamp__beam {
  top: 48%;
  width: min(92vw, 620px);
  height: 78vh;
  translate: -50% 0;
  transform-origin: 50% 0;
  background: radial-gradient(ellipse 50% 100% at 50% 0,
    rgba(var(--lamp-warm), 0.2) 0%,
    rgba(var(--lamp-warm), 0.1) 18%,
    rgba(var(--lamp-warm), 0.045) 42%,
    rgba(var(--lamp-warm), 0.012) 70%,
    rgba(var(--lamp-warm), 0) 100%);
  clip-path: polygon(45.5% 0, 54.5% 0, 100% 100%, 0 100%);
}

/* lit (light theme) */
[data-theme="light"] .lamp__bulb { fill: var(--lamp-core); }
[data-theme="light"] .lamp__halo { opacity: 0.55; }
[data-theme="light"] .lamp__glow { opacity: 1; }
[data-theme="light"] .lamp__beam { opacity: 0.55; }
.nav.is-scrolled .lamp:not(.is-live):not(:hover) .lamp__beam { opacity: 0; }
.lamp.is-lighting .lamp__beam { animation: beam-on 1.6s ease-out both; }
.lamp.is-lighting .lamp__glow { animation: glow-on 1.6s ease-out both; }
.lamp.is-lighting .lamp__bulb { animation: flicker 0.6s steps(1) both; }

.lamp__hint {
  position: absolute;
  top: 52px;
  right: calc(100% + 2px);
  display: inline-flex;
  align-items: flex-start;
  gap: 0.15rem;
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--accent);
  white-space: nowrap;
  rotate: -8deg;
  pointer-events: none;
  transition: opacity 0.3s;
}
.lamp__hint svg { width: 30px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav.is-scrolled .lamp__hint,
.lamp.is-known .lamp__hint { opacity: 0; }

/* tucks up under the nav once you scroll so it never sits on content; hover or a pull lowers it */
.nav.is-scrolled .lamp { translate: 0 -70px; clip-path: inset(72px -100vw -100vh -100vw); }
.nav.is-scrolled .lamp:hover,
.nav.is-scrolled .lamp:focus-visible,
.nav.is-scrolled .lamp.is-live { translate: 0 0; clip-path: inset(2px -100vw -100vh -100vw); }

@keyframes flicker { 0% { fill: var(--soft); } 18% { fill: var(--lamp-core); } 30% { fill: var(--soft); } 48%, 100% { fill: var(--lamp-core); } }
@keyframes beam-on { 0% { opacity: 0; } 10% { opacity: 0.9; } 18% { opacity: 0.2; } 30% { opacity: 1; } 100% { opacity: 0.55; } }
@keyframes glow-on { 0% { opacity: 0; } 10% { opacity: 1; } 18% { opacity: 0.3; } 30%, 100% { opacity: 1; } }

/* theme wipe (View Transitions): the new theme grows out of the lamp */
::view-transition-old(root),
::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

@media (max-width: 960px) {
  .lamp {
    right: 0.4rem;
    width: 44px;
    height: 94px;
  }
  .lamp__hint { top: 58px; font-size: 1.05rem; }
  .lamp__hint svg { width: 24px; height: 18px; }
  .nav.is-scrolled .lamp { translate: 0 -48px; clip-path: inset(50px -100vw -100vh -100vw); }
  .lamp__glow { width: 260px; height: 260px; }
}

@media (prefers-reduced-motion: reduce) {
  .lamp.is-lighting .lamp__beam,
  .lamp.is-lighting .lamp__glow,
  .lamp.is-lighting .lamp__bulb { animation: none; }
}

/* keep the hero note clear of the lamp on wide screens */
@media (min-width: 961px) {
  .note--hero { right: auto; left: 1.5rem; }
}
