:root {
  --bg: #060608;
  --fg: #e8e8ec;
  --fg-muted: #8a8a96;
  --fg-dim: #5c5c68;
  --crimson: #c81e2b;
  --crimson-glow: rgba(200, 30, 43, 0.45);
  --line: rgba(255, 255, 255, 0.085);
  --line-strong: rgba(255, 255, 255, 0.18);

  --font-serif: "Didot", "Bodoni MT", "Iowan Old Style", "Baskerville", "Georgia", "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html,
body {
  height: 100%;
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Atmospheric layers */
.void-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.65;
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(
    ellipse 68% 60% at 50% 48%,
    rgba(18, 18, 22, 0.12) 0%,
    rgba(6, 6, 8, 0.68) 70%,
    rgba(3, 3, 5, 0.96) 100%
  );
}

/* Main Frame */
.shell {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 1360px;
  margin: 0 auto;
  padding: clamp(1.35rem, 3vw, 2.25rem) clamp(1.25rem, 3.6vw, 2.75rem);
  display: grid;
  grid-template-rows: auto 1fr auto;
}

/* Header */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.brand {
  color: rgba(232, 232, 236, 0.68);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  transition: color 0.25s var(--ease-out);
  white-space: nowrap;
}

.brand:hover,
.brand:focus-visible {
  color: var(--fg);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

/* Header nav appears cleanly on inner pages while Home stays pure like the original */
.header-nav {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  transition: opacity 0.35s var(--ease-out), transform 0.35s var(--ease-out);
}

body[data-current-route="home"] .header-nav {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-3px);
}

.nav-link {
  position: relative;
  color: var(--fg-dim);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 0.2rem 0.05rem;
  transition: color 0.25s var(--ease-out);
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 1px;
  background: var(--crimson);
  opacity: 0;
  transform: scaleX(0.35);
  transition: opacity 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--fg-muted);
}

.nav-link.is-active {
  color: var(--fg);
}

.nav-link.is-active::after {
  opacity: 0.85;
  transform: scaleX(1);
}

.nav-sep {
  color: var(--fg-dim);
  opacity: 0.4;
  font-size: 0.72rem;
  user-select: none;
}

/* Crimson status dot + UTC telemetry */
.telemetry {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  white-space: nowrap;
}

.crimson-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--crimson);
  box-shadow: 0 0 8px var(--crimson-glow);
  animation: dot-breathe 4.2s ease-in-out infinite;
}

.utc-clock {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}

/* Stage */
.stage {
  display: grid;
  place-items: center;
  padding: clamp(2rem, 6vh, 4.5rem) 0;
}

.view {
  grid-area: 1 / 1;
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  opacity: 0;
  filter: blur(8px);
  transform: translateY(8px);
  transition:
    opacity 0.42s var(--ease-out),
    filter 0.42s var(--ease-out),
    transform 0.42s var(--ease-out);
  pointer-events: none;
}

.view.is-active {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
  pointer-events: auto;
}

.view[hidden] {
  display: none;
}

/* Canonical Emblem */
.sigil-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b4b4c0;
}

.sigil-wrap--hero {
  margin-bottom: clamp(1.75rem, 4vh, 2.6rem);
}

.sigil-wrap--compact {
  margin: 0.2rem 0 1.45rem;
}

.sigil--hero {
  width: clamp(92px, 13vw, 118px);
  height: clamp(92px, 13vw, 118px);
  transition: transform 0.8s var(--ease-out);
}

.sigil-outer {
  transform-origin: 70px 70px;
  animation: gentle-drift 75s linear infinite;
}

.sigil-core {
  filter: drop-shadow(0 0 5px var(--crimson-glow));
  animation: dot-breathe 4.2s ease-in-out infinite;
}

.sigil--compact {
  width: 64px;
  height: 64px;
}

@keyframes gentle-drift {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes dot-breathe {
  0%, 100% {
    opacity: 0.65;
  }
  50% {
    opacity: 1;
  }
}

/* Home Typography (matches original screenshot) */
.hero-wordmark {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 6.4vw, 4.15rem);
  font-weight: 400;
  letter-spacing: 0.36em;
  text-indent: 0.36em;
  line-height: 1.1;
  color: var(--fg);
  margin-bottom: 1.55rem;
  white-space: nowrap;
}

.wordmark-dash {
  display: inline-block;
  font-weight: 300;
  opacity: 0.88;
  margin: 0 0.04em;
}

.hero-tagline {
  font-family: var(--font-mono);
  font-size: clamp(0.68rem, 1.25vw, 0.78rem);
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  color: var(--fg-dim);
  text-transform: uppercase;
}

.hero-divider {
  width: 38px;
  height: 1px;
  background-color: rgba(255, 255, 255, 0.14);
  margin: clamp(2.1rem, 5vh, 3.2rem) 0 clamp(1.85rem, 4.5vh, 2.75rem);
}

.home-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1.75rem, 5.5vw, 4.25rem);
  flex-wrap: wrap;
}

.home-nav-link {
  position: relative;
  color: var(--fg-dim);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.26em;
  text-indent: 0.26em;
  text-transform: uppercase;
  padding: 0.35rem 0.15rem;
  transition: color 0.28s var(--ease-out);
}

.home-nav-link::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -2px;
  width: 14px;
  height: 1px;
  background-color: var(--crimson);
  opacity: 0;
  transform: translateX(-50%) scaleX(0.3);
  transition: opacity 0.28s var(--ease-out), transform 0.28s var(--ease-out);
}

.home-nav-link:hover,
.home-nav-link:focus-visible {
  color: var(--fg);
}

.home-nav-link:hover::after,
.home-nav-link:focus-visible::after {
  opacity: 0.85;
  transform: translateX(-50%) scaleX(1);
}

/* Inner Page Typography */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-bottom: 1.25rem;
}

.headline {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 4.5vw, 2.75rem);
  font-weight: 400;
  letter-spacing: 0.03em;
  line-height: 1.22;
  color: var(--fg);
  margin-bottom: 0.95rem;
}

.subcopy {
  font-size: clamp(0.92rem, 1.6vw, 1.02rem);
  font-weight: 400;
  line-height: 1.6;
  color: var(--fg-muted);
  max-width: 44ch;
}

/* Contact row */
.contact-row {
  margin-top: 1.45rem;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  justify-content: center;
}

.contact-email {
  color: var(--fg);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--line-strong);
  transition: color 0.22s var(--ease-out), border-color 0.22s var(--ease-out);
}

.contact-email:hover,
.contact-email:focus-visible {
  color: #ffffff;
  border-bottom-color: var(--crimson);
}

.copy-btn {
  appearance: none;
  background: transparent;
  color: var(--fg-dim);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.28rem 0.58rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    color 0.2s var(--ease-out),
    border-color 0.2s var(--ease-out),
    background-color 0.2s var(--ease-out);
}

.copy-btn:hover,
.copy-btn:focus-visible {
  color: var(--fg);
  border-color: var(--line-strong);
  background-color: rgba(255, 255, 255, 0.035);
}

.copy-btn.is-copied {
  color: var(--fg);
  border-color: rgba(200, 30, 43, 0.6);
  background-color: rgba(200, 30, 43, 0.1);
}

/* Footer: hidden on Home to keep the exact sparse original frame, visible on inner pages */
.bottom-bar {
  border-top: 1px solid var(--line);
  padding-top: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-dim);
  transition: opacity 0.35s var(--ease-out);
}

body[data-current-route="home"] .bottom-bar {
  opacity: 0;
  border-top-color: transparent;
  pointer-events: none;
}

/* Focus & Accessibility */
:focus-visible {
  outline: 1px solid rgba(232, 232, 236, 0.45);
  outline-offset: 4px;
  border-radius: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Mobile Responsiveness */
@media (max-width: 680px) {
  body[data-current-route="home"] .header-nav {
    display: none;
  }

  .top-bar {
    flex-wrap: wrap;
    justify-content: space-between;
    row-gap: 0.85rem;
  }

  .top-bar-right {
    gap: 1rem;
  }

  body:not([data-current-route="home"]) .top-bar {
    flex-direction: column;
    align-items: center;
  }

  body:not([data-current-route="home"]) .top-bar-right {
    flex-direction: column;
    gap: 0.65rem;
  }

  .hero-wordmark {
    letter-spacing: 0.24em;
    text-indent: 0.24em;
  }

  .hero-tagline {
    letter-spacing: 0.18em;
    text-indent: 0.18em;
    line-height: 1.6;
  }

  .home-nav {
    gap: 1.35rem 2rem;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .sigil-outer,
  .sigil-core,
  .crimson-dot {
    animation: none;
  }

  .view {
    transition: opacity 0.15s linear;
    filter: none;
    transform: none;
  }
}
