:root {
  --bg: #07080b;
  --fg: #f3f5f8;
  --muted: #a3afbf;
  --dim: #6c7889;
  --accent: #ff7043;
  --font-sans: "Ubuntu", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Ubuntu Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--accent);
  color: #000;
}

/* ---------- ASCII background ---------- */

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg canvas {
  display: block;
  opacity: 0;
  transition: opacity 1.4s ease;
}

.bg canvas.is-ready {
  opacity: 1;
}

/* vignette: keeps the edges calm and the text readable */
.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(7, 8, 11, 0.8) 100%);
}

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

.hero {
  position: relative;
  z-index: 1;
  display: grid;
  place-content: center;
  justify-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding:
    max(24px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  text-align: center;
}

.title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(2rem, 10vw, 6rem);
  font-weight: 700;
  line-height: 1;
  /* compensate the trailing letter-spacing so the word stays centred */
  letter-spacing: 0.06em;
  margin-right: -0.06em;
  text-shadow:
    0 0 2px rgba(7, 8, 11, 0.9),
    0 0 32px rgba(7, 8, 11, 0.95),
    0 0 80px rgba(7, 8, 11, 0.9);
}

.tagline {
  margin: 0.45em 0 0;
  /* compensate trailing letter-spacing so the line stays optically centred */
  margin-right: -0.2em;
  font-family: var(--font-mono);
  font-size: clamp(1rem, 3.6vw, 1.6rem);
  font-weight: 400;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-shadow: 0 0 24px rgba(7, 8, 11, 0.95);
}

.status {
  margin: 1.5em 0 0;
  font-family: var(--font-mono);
  font-size: clamp(0.85rem, 2.4vw, 1.05rem);
  letter-spacing: 0.08em;
  color: var(--dim);
  text-shadow: 0 0 16px rgba(7, 8, 11, 0.95);
}

.caret {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-left: 0.2em;
  vertical-align: -0.18em;
  background: var(--accent);
  animation: blink 1.1s steps(1, end) infinite;
}

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

/* ---------- Background view toggle (ascii | video), added by main.js ---------- */

.view-toggle {
  position: fixed;
  left: max(16px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 2;
  display: flex;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  animation: toggle-in 0.6s ease both;
}

.view-toggle button {
  appearance: none;
  margin: 0;
  border: 0;
  padding: 5px 7px;
  font: inherit;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: transparent;
  text-shadow: 0 0 8px rgba(7, 8, 11, 0.95);
  cursor: pointer;
}

.view-toggle button[aria-pressed="true"] {
  color: var(--fg);
  box-shadow: inset 0 -1px 0 var(--accent);
}

.view-toggle button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

@keyframes toggle-in {
  from { opacity: 0; }
}

/* ---------- 404 ---------- */

.back {
  margin-top: 2.2em;
  font-family: var(--font-mono);
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
  transition: color 0.2s ease;
}

.back:hover,
.back:focus-visible {
  color: var(--accent);
}

.back:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 6px;
}

/* ---------- Accessibility ---------- */

@media (prefers-reduced-motion: reduce) {
  .caret { animation: none; }
  .view-toggle { animation: none; }
  .bg canvas { transition: none; }
}
