/* ═══════════════════════════════════════════════════════════════════════
   MODERN TIMES — COMING SOON
   ───────────────────────────────────────────────────────────────────────
   Monochrome, cinematic, one screen. Colours live as tokens so the theme
   switch flips a single attribute and everything follows — including the
   logo, which is a black SVG turned white by filter rather than a second
   file that can drift out of sync with the first.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── 1. Tokens ─────────────────────────────────────────────────────────
   Light is the base so no colour has its only definition inside a media
   query. Dark is stated twice on purpose: once for the visitor who never
   touches the switch (system preference) and once for the visitor who
   did (data-theme), so the switch wins in both directions. */

:root {
  --bg: #f3f0e9; /* paper */
  --bg-deep: #e6e1d6;
  --fg: #0a0a0a; /* ink */
  --fg-soft: #3d3b36;
  --muted: #7a776f;
  --line: rgba(10, 10, 10, 0.16);
  --line-soft: rgba(10, 10, 10, 0.08);
  --surface: rgba(10, 10, 10, 0.045);

  /* The logo file is near-black artwork. brightness(0) crushes whatever is
     inside it to flat black; adding invert(1) flips that to flat white. */
  --logo-filter: brightness(0);
  --gear-stroke: rgba(10, 10, 10, 0.19);
  --gear-stroke-strong: rgba(10, 10, 10, 0.3);
  --dust: 10, 10, 10;
  --spot: rgba(10, 10, 10, 0.055);
  --grain-opacity: 0.34;
  --vignette: rgba(10, 10, 10, 0.14);
  --glow: rgba(255, 255, 255, 0.85);

  --knob: linear-gradient(180deg, #fffdf7, #e9e5da);

  --font-display: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-body: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0a;
    --bg-deep: #000000;
    --fg: #f3f0e9;
    --fg-soft: #cfcbc1;
    --muted: #8a8a86;
    --line: rgba(243, 240, 233, 0.16);
    --line-soft: rgba(243, 240, 233, 0.07);
    --surface: rgba(243, 240, 233, 0.055);
    --logo-filter: brightness(0) invert(1);
    --gear-stroke: rgba(243, 240, 233, 0.16);
    --gear-stroke-strong: rgba(243, 240, 233, 0.28);
    --dust: 243, 240, 233;
    --spot: rgba(243, 240, 233, 0.06);
    --grain-opacity: 0.24;
    --vignette: rgba(0, 0, 0, 0.55);
    --glow: rgba(243, 240, 233, 0.75);
  }
}

:root[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-deep: #000000;
  --fg: #f3f0e9;
  --fg-soft: #cfcbc1;
  --muted: #8a8a86;
  --line: rgba(243, 240, 233, 0.16);
  --line-soft: rgba(243, 240, 233, 0.07);
  --surface: rgba(243, 240, 233, 0.055);
  --logo-filter: brightness(0) invert(1);
  --gear-stroke: rgba(243, 240, 233, 0.16);
  --gear-stroke-strong: rgba(243, 240, 233, 0.28);
  --dust: 243, 240, 233;
  --spot: rgba(243, 240, 233, 0.06);
  --grain-opacity: 0.24;
  --vignette: rgba(0, 0, 0, 0.55);
  --glow: rgba(243, 240, 233, 0.75);
}

/* ── 2. Reset & shell ─────────────────────────────────────────────────── */

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

html {
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  /* Without an explicit column the grid sizes to its widest item, and the
     marquee track is deliberately max-content — wider than the screen. The
     page then centred inside that overflow instead of inside the window. */
  grid-template-columns: minmax(0, 1fr);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  /* The switch should feel like the room lights changing, not like a new
     page. Everything else inherits currentColor, so this covers the lot. */
  transition:
    background-color 0.55s var(--ease),
    color 0.55s var(--ease);
}

::selection {
  background: var(--fg);
  color: var(--bg);
}

:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
  border-radius: 2px;
}

a {
  color: inherit;
}

/* ── 3. Ambient layers ────────────────────────────────────────────────── */

/* Drifting dust. Painted by JS; sits under everything. */
.dust {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* A soft light that follows the pointer — the reason the page feels alive
   when nothing is animating. Coordinates come from main.js as --mx/--my. */
.spotlight {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    38rem 38rem at var(--mx, 50%) var(--my, 42%),
    var(--spot),
    transparent 70%
  );
  transition: background 0.15s linear;
}

/* Film grain. Static noise moved a few pixels per frame reads as grain;
   a still tile reads as a dirty screen. */
.grain {
  position: fixed;
  inset: -150%;
  z-index: 3;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 0.7s steps(1) infinite;
  will-change: transform;
}

@keyframes grain-shift {
  0% {
    transform: translate(0, 0);
  }
  20% {
    transform: translate(-6%, 3%);
  }
  40% {
    transform: translate(4%, -5%);
  }
  60% {
    transform: translate(-3%, -2%);
  }
  80% {
    transform: translate(5%, 4%);
  }
  100% {
    transform: translate(0, 0);
  }
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 45%, transparent 42%, var(--vignette) 100%);
}

/* ── 4. Top bar ───────────────────────────────────────────────────────── */

.topbar {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(0.75rem, 2vh, 1.5rem) clamp(1rem, 4vw, 2.5rem);
}

.topbar__mark {
  font-size: 0.62rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  animation: fade-in 1.2s var(--ease) 0.4s both;
}

/* The switch. Rail sunk, knob raised, icons fixed above it — the knob
   slides underneath them, so the active icon always sits on the pale disc
   and the other one on the bare rail. */
.theme-sw {
  position: relative;
  flex: none;
  display: inline-block;
  width: 66px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.22);
  transition:
    border-color 0.2s ease,
    background-color 0.4s var(--ease);
  animation: fade-in 1.2s var(--ease) 0.4s both;
}

.theme-sw:hover {
  border-color: var(--fg);
}

.theme-sw__knob {
  position: absolute;
  top: 50%;
  left: 3px;
  width: 28px;
  height: 28px;
  margin-top: -14px;
  border-radius: 999px;
  background: var(--knob);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 4px 10px rgba(0, 0, 0, 0.25);
  /* Slight overshoot: a knob that stops dead reads as a swapped image,
     this one reads as something that moved. */
  transition: transform 0.34s cubic-bezier(0.34, 1.42, 0.64, 1);
}

[data-theme="dark"] .theme-sw__knob {
  transform: translateX(30px);
}

.theme-sw:active .theme-sw__knob {
  width: 33px;
}

[data-theme="dark"] .theme-sw:active .theme-sw__knob {
  transform: translateX(25px);
}

/* Centred on each knob position, measured: the rail is 64 inside, the knob
   28 with 3 of margin, so the two centres land on 17 and 47. */
.theme-sw__ic {
  position: absolute;
  top: 50%;
  z-index: 1;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  color: var(--muted);
  transition:
    color 0.2s ease,
    transform 0.34s cubic-bezier(0.34, 1.42, 0.64, 1);
}

.theme-sw__ic--sun {
  left: 17px;
}

.theme-sw__ic--moon {
  left: 47px;
}

/* The active icon sits on the pale knob, so it needs its own colour — the
   rail's grey would disappear against it. */
:root:not([data-theme="dark"]) .theme-sw__ic--sun {
  color: #c07a12;
  transform: scale(1.12);
}

[data-theme="dark"] .theme-sw__ic--moon {
  color: #4d55c9;
  transform: scale(1.12);
}

/* ── 5. Stage ─────────────────────────────────────────────────────────── */

.stage {
  position: relative;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-width: 0;
  /* Vertical rhythm is measured in vh, not vw: this page has to fit one
     screen, and a laptop at 1440x900 is wide and short. */
  padding: clamp(0.5rem, 2vh, 1.5rem) clamp(1.25rem, 5vw, 2.5rem) clamp(1rem, 3vh, 2.5rem);
  gap: clamp(0.5rem, 1.6vh, 1.1rem);
}

/* ── 5a. The emblem: logo inside its machinery ────────────────────────── */

.emblem {
  position: relative;
  display: grid;
  place-items: center;
  width: min(70vw, 31svh, 26rem);
  aspect-ratio: 1;
  /* The gear rings are mostly empty space at the bottom, so the words below
     are pulled up into them rather than sitting under a band of nothing. */
  margin-bottom: clamp(-3.5rem, -6vh, -1rem);
  /* Tilt follows the pointer; main.js writes --rx/--ry in degrees. */
  transform: perspective(1100px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.45s var(--ease);
}

.emblem__gears {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  opacity: 0;
  animation: gears-in 2s var(--ease) 0.5s forwards;
}

@keyframes gears-in {
  from {
    opacity: 0;
    transform: scale(0.86);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.gear {
  fill: none;
  stroke: var(--gear-stroke);
  stroke-width: 1.15;
  transform-origin: 0 0; /* viewBox is centred on 0,0 */
}

.gear--hub {
  stroke: var(--gear-stroke-strong);
}

/* Three rings, alternating direction — meshed gears turn against each
   other, and same-direction rings would read as a wobble instead. */
.gear-ring--1 {
  animation: spin 64s linear infinite;
  transform-origin: 0 0;
}
.gear-ring--2 {
  animation: spin 41s linear infinite reverse;
  transform-origin: 0 0;
}
.gear-ring--3 {
  animation: spin 26s linear infinite;
  transform-origin: 0 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Ticks around the outside, like a machine dial. */
.tick {
  stroke: var(--gear-stroke);
  stroke-width: 1;
  stroke-linecap: round;
}

.emblem__logo {
  position: relative;
  z-index: 1;
  width: 74%;
  height: auto;
  filter: var(--logo-filter);
  user-select: none;
  /* Held back until the gears have started, then wiped in. */
  opacity: 0;
  animation: logo-in 1.5s var(--ease) 0.25s forwards;
  transition: filter 0.55s var(--ease);
}

@keyframes logo-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.94);
    filter: var(--logo-filter) blur(14px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: var(--logo-filter) blur(0);
  }
}

/* ── 5b. Type ─────────────────────────────────────────────────────────── */

.eyebrow {
  margin: 0;
  font-size: clamp(0.56rem, 1.6vw, 0.7rem);
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--muted);
  padding-left: 0.34em; /* optical: tracking adds a trailing gap */
}

.headline {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: min(clamp(2.75rem, 11vw, 7rem), 13svh);
  line-height: 0.94;
  letter-spacing: -0.02em;
}

/* One span per letter, injected by main.js, each on its own delay. */
.headline__char {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.42em) rotate(3deg);
  animation: char-in 1.1s var(--ease) forwards;
  animation-delay: var(--d, 0s);
}

.headline__char--space {
  width: 0.26em;
}

@keyframes char-in {
  to {
    opacity: 1;
    transform: none;
  }
}

/* The manifesto. The one still moment on a page that is otherwise always
   moving, so nothing here animates after it has arrived. */
.creed {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  max-width: 30rem;
}

.creed__text {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: min(clamp(1rem, 2.6vw, 1.45rem), 3.4svh);
  line-height: 1.45;
  letter-spacing: 0.005em;
  color: var(--fg-soft);
  text-wrap: balance;
}

/* ── 5c. The pending indicator ────────────────────────────────────────── */

.press {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  width: min(100%, 22rem);
  margin-top: clamp(0.35rem, 1.4vh, 1rem);
}

/* Indeterminate on purpose. A percentage would be a promise about a date
   we do not have; a shuttle that keeps travelling says "running" instead. */
.press__rail {
  position: relative;
  width: 100%;
  height: 1px;
  background: var(--line-soft);
  overflow: hidden;
}

.press__shuttle {
  position: absolute;
  inset-block: 0;
  left: 0;
  width: 38%;
  background: linear-gradient(90deg, transparent, var(--fg), transparent);
  animation: shuttle 3.4s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

@keyframes shuttle {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(370%);
  }
}

.press__status {
  display: flex;
  align-items: baseline;
  margin: 0;
  min-height: 1.2em;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.press__label::after {
  /* The typing caret — a hairline that blinks while the text is written. */
  content: "";
  display: inline-block;
  width: 1px;
  height: 0.95em;
  margin-left: 0.22em;
  background: currentColor;
  vertical-align: -0.08em;
  animation: caret 1s steps(1) infinite;
}

@keyframes caret {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

/* ── 5d. Contact ──────────────────────────────────────────────────────── */

.contact {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  margin-top: clamp(0.6rem, 2.2vh, 1.75rem);
}

.contact__lead {
  font-size: 0.58rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
}

.contact__row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
}

.contact__mail {
  position: relative;
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 5vw, 2.1rem);
  letter-spacing: -0.01em;
  text-decoration: none;
  padding-bottom: 0.06em;
}

/* Two rules, one line. ::after is the faint rule that is always there, so
   the address reads as a link at rest; ::before is the solid one that draws
   itself left-to-right on hover — the same "something moved" reading as the
   switch knob, rather than an underline that blinks on. */
.contact__mail::after,
.contact__mail::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
}

.contact__mail::after {
  opacity: 0.3;
}

.contact__mail::before {
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s var(--ease);
}

.contact__mail:hover::before,
.contact__mail:focus-visible::before {
  transform: scaleX(1);
}

.contact__mail:hover {
  text-shadow: 0 0 26px var(--glow);
}

.contact__copy {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    color 0.2s ease,
    border-color 0.2s ease,
    background-color 0.2s ease;
}

.contact__copy:hover {
  color: var(--fg);
  border-color: var(--fg);
  background: var(--surface);
}

.contact__copy svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.contact__copy.is-copied {
  color: var(--fg);
  border-color: var(--fg);
}

/* ── 6. Foot ──────────────────────────────────────────────────────────── */

.foot {
  position: relative;
  z-index: 4;
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: clamp(0.6rem, 1.6vh, 1.1rem);
  padding-bottom: clamp(0.75rem, 2vh, 1.5rem);
  animation: fade-in 1.4s var(--ease) 1.3s both;
}

/* Two identical halves scrolling by exactly 50% — the seam never shows. */
.marquee {
  overflow: hidden;
  border-block: 1px solid var(--line-soft);
  padding: 0.7rem 0;
  /* Faded ends, so the words arrive and leave instead of being cut. */
  mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
}

.marquee__track {
  display: flex;
  width: max-content;
  animation: marquee 44s linear infinite;
}

.marquee__item {
  display: inline-flex;
  align-items: center;
  gap: 2.5rem;
  padding-right: 2.5rem;
  font-size: 0.62rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.marquee__sep {
  opacity: 0.45;
}

@keyframes marquee {
  to {
    transform: translateX(-50%);
  }
}

.foot__line {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  margin: 0;
  padding-inline: 1.25rem;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-align: center;
  flex-wrap: wrap;
}

/* ── 7. Shared entrances ──────────────────────────────────────────────── */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  animation: fade-up 1.1s var(--ease) forwards;
  animation-delay: var(--d, 0s);
}

@keyframes fade-up {
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.noscript {
  position: relative;
  z-index: 5;
  padding: 1rem;
  text-align: center;
  font-size: 0.85rem;
}

/* ── 8. Small screens ─────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .emblem {
    /* Still capped by height: a phone held sideways is 390px tall. */
    width: min(86vw, 40svh);
    margin-bottom: -2rem;
  }
}

/* Coarse pointers have no cursor to follow — the spotlight would sit in
   whatever corner was last tapped, which looks like a rendering bug. */
@media (hover: none) {
  .spotlight {
    background: radial-gradient(38rem 38rem at 50% 40%, var(--spot), transparent 70%);
  }
}

/* ── 9. Reduced motion ────────────────────────────────────────────────
   Everything still arrives and the page still reads as "pending" — the
   shuttle keeps travelling, slowly, because it is the one element whose
   whole job is to say work is in progress. What stops is the constant
   ambient churn: grain, gears, marquee, dust. */

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

  .gear-ring--1,
  .gear-ring--2,
  .gear-ring--3 {
    animation: none;
  }

  .marquee__track {
    animation: none;
    transform: translateX(0);
  }

  .press__shuttle {
    animation-duration: 8s;
    animation-timing-function: linear;
  }

  .press__label::after {
    animation: none;
    opacity: 1;
  }

  .emblem {
    transform: none !important;
    transition: none;
  }

  .reveal,
  .headline__char,
  .emblem__logo,
  .emblem__gears,
  .foot,
  .topbar__mark,
  .theme-sw {
    animation-duration: 0.01ms;
    animation-delay: 0ms;
    animation-iteration-count: 1;
  }

  .theme-sw__knob,
  .theme-sw__ic,
  .contact__mail::before {
    transition: none;
  }
}
