:root {
  color-scheme: dark;
  --ink: #05060b;
  --night: #0b1124;
  --paper: #efe9da;
  --muted: #9a9cab;
  --dim: #5a5e70;
  --line: rgba(239, 233, 218, 0.09);
  --amber: #ffb547;
  --amber-glow: rgba(255, 181, 71, 0.35);
  --link-line: rgba(255, 181, 71, 0.55);
  --aura-1: #16224a;
  --aura-2: #1a1230;
  --moon-body: #f4ecd6;
  --moon-halo: rgba(244, 236, 214, 0.35);
  --moon-halo-far: rgba(255, 210, 140, 0.18);
  --headline-1: #fff6df;
  --headline-2: #ffd58f;
  --soft: #c9c6bd;
  --ticker-ink: #cfcabe;
  --panel: rgba(8, 10, 20, 0.5);
  --panel-soft: rgba(11, 17, 36, 0.55);
  --chip: rgba(239, 233, 218, 0.07);
  --chip-ink: #eee8d8;
  --led-off: #1d2133;
  --led-idle: #3a4a3e;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --pad: clamp(1.25rem, 4vw, 3.5rem);
}

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

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

html { background: var(--ink); overflow-x: clip; }

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  color: var(--paper);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--amber); color: var(--ink); }

a { color: inherit; }

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

/* ---------- Atmosphere ---------- */

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(120% 80% at 85% -10%, var(--aura-1) 0%, transparent 55%),
    radial-gradient(90% 60% at 0% 110%, var(--aura-2) 0%, transparent 60%),
    linear-gradient(180deg, var(--night) 0%, var(--ink) 70%);
}

#sky {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
}

.moon {
  --m: clamp(150px, 23vw, 340px);
  position: absolute;
  z-index: -1;
  top: clamp(5rem, 13vh, 9rem);
  right: clamp(-2.5rem, 7vw, 9rem);
  width: var(--m);
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: inset calc(var(--m) * -0.14) calc(var(--m) * 0.06) 0 0 var(--moon-body);
  filter:
    drop-shadow(0 0 30px var(--moon-halo))
    drop-shadow(0 0 120px var(--moon-halo-far));
  transform: rotate(-18deg);
  animation: moon-breathe 9s ease-in-out infinite;
  pointer-events: none;
}

@keyframes moon-breathe {
  0%, 100% { opacity: 0.92; }
  50% { opacity: 1; }
}

.grain {
  position: fixed;
  inset: -50%;
  z-index: 10;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- Top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem var(--pad);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.brand-mark {
  width: 26px;
  height: 26px;
  color: var(--paper);
}

.brand-cursor {
  fill: var(--amber);
  animation: blink 1.1s steps(1) infinite;
}

.clock {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: right;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.theme-toggle {
  display: grid;
  place-items: center;
  flex: none;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.3s, border-color 0.3s, background 0.3s;
}

.theme-toggle:hover {
  color: var(--amber);
  border-color: var(--amber);
}

.theme-toggle svg { width: 15px; height: 15px; }

.theme-toggle-moon { display: none; }

/* The icon shows the appearance you are in; the click swaps it. */
html[data-theme="dark"] .theme-toggle-sun { display: none; }
html[data-theme="dark"] .theme-toggle-moon { display: block; }

.pulse {
  position: relative;
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 10px var(--amber-glow);
}

.pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid var(--amber);
  animation: ping 2.4s cubic-bezier(0.2, 0.6, 0.3, 1) infinite;
}

@keyframes ping {
  from { transform: scale(1); opacity: 0.9; }
  to { transform: scale(3.4); opacity: 0; }
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ---------- Hero ---------- */

main { flex: 1; }

.hero {
  padding: clamp(2.5rem, 9vh, 7rem) var(--pad) clamp(3rem, 8vh, 5rem);
  max-width: 1440px;
  margin: 0 auto;
}

.kicker {
  margin: 0 0 1.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--muted);
}

.kicker::before {
  content: "";
  display: inline-block;
  width: 2.5rem;
  height: 1px;
  margin-right: 1rem;
  vertical-align: middle;
  background: var(--amber);
}

.title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(3.6rem, 12.5vw, 11.5rem);
  line-height: 0.88;
  letter-spacing: -0.025em;
}

.title > span { display: block; }

.title em {
  font-style: italic;
  background: linear-gradient(100deg, var(--headline-1) 0%, var(--headline-2) 45%, var(--amber) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-right: 0.08em;
  text-shadow: 0 0 60px rgba(255, 181, 71, 0.15);
}

.hero-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3rem;
  margin-top: clamp(2.5rem, 6vh, 4.5rem);
  align-items: end;
}

@media (min-width: 960px) {
  .hero-row {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    gap: clamp(3rem, 6vw, 6rem);
  }
}

.lede {
  margin: 0 0 2.25rem;
  max-width: 40ch;
  font-size: clamp(0.95rem, 1.1vw, 1.05rem);
  line-height: 1.75;
  color: var(--soft);
}

.status {
  max-width: 340px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.status-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.7rem;
  color: var(--muted);
}

.status-state { color: var(--amber); }

.dots::after {
  content: "";
  animation: dots 1.6s steps(4) infinite;
}

@keyframes dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}

.bar {
  position: relative;
  height: 2px;
  background: var(--line);
  overflow: hidden;
}

.bar span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 68%;
  background: linear-gradient(90deg, rgba(255, 181, 71, 0), var(--amber));
  box-shadow: 0 0 12px var(--amber-glow);
}

.bar span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85), transparent);
  transform: translateX(-100%);
  animation: sweep 2.8s ease-in-out infinite;
}

@keyframes sweep {
  to { transform: translateX(100%); }
}

.status--live {
  display: block;
  color: inherit;
  text-decoration: none;
}

.status--live .status-head { display: flex; }
.status--live .bar { display: block; }
.status--live .bar span { width: 100%; }

.status-title {
  display: block;
  margin-top: 0.9rem;
  font-family: var(--serif);
  font-size: 1.45rem;
  font-style: italic;
  line-height: 1.15;
  text-transform: none;
  letter-spacing: 0;
  color: var(--paper);
  transition: color 0.3s;
}

.status--live:hover .status-title { color: var(--amber); }

.status--live + .status--live { margin-top: 2rem; }

/* ---------- Terminal ---------- */

.terminal {
  margin: 0;
  border-radius: 14px;
  /* A window into the night in both themes, so it carries its own palette. */
  --term-ink: #dcd8cd;
  --term-muted: #9a9cab;
  --term-dim: #5a5e70;
  --term-accent: #ffb547;
  background: linear-gradient(180deg, rgba(18, 22, 40, 0.72), rgba(8, 10, 20, 0.82));
  border: 1px solid var(--line);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.4),
    0 40px 80px -30px rgba(0, 0, 0, 0.8),
    0 0 120px -40px rgba(255, 181, 71, 0.18);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow: hidden;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.6s;
}

.terminal:hover {
  transform: translateY(-4px);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.4),
    0 50px 90px -30px rgba(0, 0, 0, 0.85),
    0 0 140px -30px rgba(255, 181, 71, 0.28);
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.72rem;
  color: var(--term-dim);
}

.lights { display: inline-flex; gap: 6px; }

.lights i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2a2e3e;
}

.terminal-title {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.log {
  list-style: none;
  margin: 0;
  padding: 1.1rem 1.2rem 1.3rem;
  height: calc(10 * 1.9em + 2.4rem);
  font-size: clamp(0.7rem, 0.85vw, 0.8rem);
  line-height: 1.9;
  overflow: hidden;
}

.log li {
  display: grid;
  grid-template-columns: 3.4em 9.5em minmax(0, 1fr);
  gap: 0.9em;
  white-space: nowrap;
  animation: line-in 0.35s ease-out both;
}

.log .t { color: var(--term-dim); }
.log .s { color: var(--term-muted); }
.log .m { color: var(--term-ink); overflow: hidden; text-overflow: ellipsis; }
.log .ok { color: var(--term-accent); }
.log .awin { color: #ff7a26; }

.log .caret {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: -0.15em;
  background: var(--term-accent);
  animation: blink 1s steps(1) infinite;
}

@keyframes line-in {
  from { opacity: 0; transform: translateY(4px); }
}

@media (max-width: 560px) {
  .log { height: auto; min-height: calc(10 * 1.7em * 2 + 2.4rem); line-height: 1.7; }
  .log li {
    grid-template-columns: 3.4em minmax(0, 1fr);
    row-gap: 0;
    margin-bottom: 0.35em;
  }
  .log .m { grid-column: 2; white-space: normal; }
}

/* ---------- Ticker ---------- */

.ticker {
  border-block: 1px solid var(--line);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.ticker-track {
  display: flex;
  width: max-content;
  animation: marquee 48s linear infinite;
}

.ticker:hover .ticker-track { animation-play-state: paused; }

.ticker ul {
  display: flex;
  margin: 0;
  padding: 1.1rem 0;
  list-style: none;
}

.ticker li {
  display: flex;
  align-items: center;
  font-family: var(--serif);
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  font-style: italic;
  color: var(--ticker-ink);
  white-space: nowrap;
}

.ticker li::after {
  content: "✦";
  margin: 0 2.2rem;
  font-family: var(--mono);
  font-style: normal;
  font-size: 0.6em;
  color: var(--amber);
}

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

/* ---------- Ad slot (Awin) ---------- */

@property --spin {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

.ad {
  --awin-orange: #ff6600;
  --awin-red: #e61f26;
  --awin-yellow: #fab418;
  --awin-violet: #5b3fd6;
  --awin-purple: #371d81;
  /* The creative is a dark card in both themes. */
  --ad-ink: #efe9da;
  --ad-muted: #9a9cab;
  --ad-accent: #ffb547;
  padding: clamp(2.5rem, 7vh, 4.5rem) var(--pad);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ad-label {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 0 0 0.9rem;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--dim);
}

.ad-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--dim);
}

.ad-network {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.3s;
}

.awin-logo {
  height: 22px;
  width: auto;
  margin-top: -3px;
  color: var(--paper);
  overflow: visible;
  transition: filter 0.4s;
}

.ad-network:hover { color: var(--paper); }

.ad-network:hover .awin-logo {
  filter: drop-shadow(0 0 8px rgba(255, 102, 0, 0.55));
}

.ad-slot {
  position: relative;
  width: 100%;
  max-width: 728px;
  height: 90px;
  border-radius: 10px;
}

@media (max-width: 760px) {
  .ad-slot { max-width: 320px; height: 100px; }
}

/* Awin flame glow behind the card */
.ad-slot::before {
  content: "";
  position: absolute;
  inset: 30% 12% -30%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 102, 0, 0.32), rgba(230, 31, 38, 0.18) 45%, rgba(55, 29, 129, 0.2) 70%, transparent);
  filter: blur(28px);
  opacity: 0.55;
  transition: opacity 0.5s;
  pointer-events: none;
}

.ad-slot:hover::before { opacity: 1; }

.ad-creative {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  height: 100%;
  padding: 0 1.6rem;
  border: 1px solid transparent;
  border-radius: inherit;
  background:
    radial-gradient(120% 160% at 100% 50%, rgba(255, 102, 0, 0.1), transparent 55%) padding-box,
    linear-gradient(180deg, #11142a, #090b16) padding-box,
    conic-gradient(
      from var(--spin),
      rgba(239, 233, 218, 0.08) 0deg 200deg,
      var(--awin-purple) 245deg,
      var(--awin-violet) 270deg,
      var(--awin-red) 310deg,
      var(--awin-orange) 335deg,
      var(--awin-yellow) 352deg,
      rgba(239, 233, 218, 0.08) 360deg
    ) border-box;
  text-decoration: none;
  animation: spin 7s linear infinite;
  transition: box-shadow 0.4s, transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@keyframes spin {
  to { --spin: 360deg; }
}

.ad-creative:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 50px -24px rgba(255, 102, 0, 0.55);
  animation-duration: 3s;
}

.ad-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.ad-brand {
  font-family: var(--serif);
  font-size: 1.6rem;
  line-height: 1.1;
  color: var(--ad-ink);
}

.ad-brand em { color: var(--ad-accent); }

.ad-text {
  font-size: 0.74rem;
  line-height: 1.5;
  color: var(--ad-muted);
}

.ad-cta {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ad-accent);
}

.ad-arrow {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(255, 181, 71, 0.4);
  border-radius: 50%;
  font-size: 0.9rem;
  letter-spacing: 0;
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1), border-color 0.4s, color 0.4s;
}

.ad-creative:hover .ad-arrow {
  transform: translateX(3px);
  border-color: transparent;
  background: linear-gradient(258deg, var(--awin-orange) 17%, #e8352a 67%, #e02a26 84%);
  color: #fff;
}

@media (max-width: 760px) {
  .ad-creative { padding: 0 1rem; gap: 0.8rem; }
  .ad-brand { font-size: 1.3rem; }
  .ad-text { font-size: 0.66rem; }
  .ad-cta-label { display: none; }
  .ad-label { gap: 0.6rem; letter-spacing: 0.18em; }
}

/* ---------- Footer ---------- */

.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding: 1.5rem var(--pad) 2rem;
  border-top: 1px solid var(--line);
  font-size: 0.72rem;
  color: var(--dim);
}

.footer p { margin: 0; }

.footer-link {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.3s;
}

.footer-link:hover { color: var(--amber); }

.rack {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
}

.rack-label {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.62rem;
}

.leds { display: inline-flex; gap: 5px; }

.leds i {
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: var(--led-off);
  transition: background 0.15s, box-shadow 0.15s;
}

.leds i.on {
  background: var(--amber);
  box-shadow: 0 0 6px var(--amber-glow);
}

.leds i.idle { background: var(--led-idle); }

/* ---------- Entrance ---------- */

.reveal {
  animation: reveal 1.1s cubic-bezier(0.2, 0.7, 0.1, 1) both;
  animation-delay: calc(var(--d, 0) * 120ms + 150ms);
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(28px);
    filter: blur(8px);
  }
}

@media (max-width: 560px) {
  .clock-extra { display: none; }
  .title { font-size: clamp(3.6rem, 21vw, 6rem); }
  .kicker::before { display: block; margin-bottom: 1rem; }
  .moon { --m: 130px; top: 5.5rem; right: 0.5rem; }
}

/* ---------- Light theme (dawn) ---------- */

html[data-theme="light"] {
  color-scheme: light;
  --ink: #f6f1e5;
  --night: #fdf9f0;
  --paper: #171922;
  --muted: #5c5f6d;
  --dim: #8a8b95;
  --line: rgba(23, 25, 34, 0.14);
  --amber: #9c5708;
  --amber-glow: rgba(156, 87, 8, 0.28);
  --link-line: rgba(156, 87, 8, 0.45);
  --aura-1: #fdf3dc;
  --aura-2: #efe4cf;
  --moon-body: #ffd98d;
  --moon-halo: rgba(255, 190, 110, 0.5);
  --moon-halo-far: rgba(255, 150, 60, 0.22);
  --headline-1: #7a3f05;
  --headline-2: #b06a0d;
  --soft: #41434e;
  --ticker-ink: #3a3c46;
  --panel: rgba(255, 255, 255, 0.6);
  --panel-soft: rgba(255, 255, 255, 0.45);
  --chip: rgba(23, 25, 34, 0.06);
  --chip-ink: #2b2d36;
  --led-off: #d9d1bd;
  --led-idle: #b3bda3;
}

/* Stars read as dust on paper: the light theme keeps the empty dawn sky. */
html[data-theme="light"] #sky { display: none; }

html[data-theme="light"] .grain { opacity: 0.035; }

/* The moon becomes a low morning sun. */
html[data-theme="light"] .moon {
  background: radial-gradient(circle at 34% 32%, #fff4d6 0%, #ffe1a6 46%, #f5b767 100%);
  box-shadow: none;
  transform: none;
}

/* Terminal chrome stays dark in both themes - it is a window into the night. */
html[data-theme="light"] .terminal {
  background: linear-gradient(180deg, #171b2e, #090b16);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition: none !important;
  }
  .ticker-track { flex-wrap: wrap; width: auto; }
  .ticker-track ul[aria-hidden] { display: none; }
  .ticker ul { flex-wrap: wrap; justify-content: center; }
}
