/* ---- Tokens ---- */
:root {
  --red: #f0525a;
  --red-glow: rgba(240,82,90,0.15);
  --bg: #f8f7f4;
  --bg-card: #ffffff;
  --text: #0e0d0c;
  --text-muted: #6b6663;
  --border: rgba(0,0,0,0.09);
  --border-strong: rgba(0,0,0,0.18);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.07);
}
[data-theme="dark"],
[data-theme="auto"] { /* overridden by media query below */ }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0b0a;
    --bg-card: #161513;
    --text: #f0ede8;
    --text-muted: #877e78;
    --border: rgba(255,255,255,0.07);
    --border-strong: rgba(255,255,255,0.14);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
  }
}
[data-theme="dark"] {
  --bg: #0c0b0a;
  --bg-card: #161513;
  --text: #f0ede8;
  --text-muted: #877e78;
  --border: rgba(255,255,255,0.07);
  --border-strong: rgba(255,255,255,0.14);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
}

/* ---- Skip link ---- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  background: var(--red);
  color: #fff;
  padding: 0.6rem 1.25rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  z-index: 9999;
  transition: top 0.1s;
}
.skip-link:focus { top: 0; }

/* ---- Screen-reader only ---- */
.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;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  transition: background 0.35s, color 0.35s;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
a { color: inherit; }
img, svg { display: block; }

/* ---- Nav ---- */
nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2.5rem;
  height: 60px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  transition: background 0.35s, border-color 0.35s;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}
.nav-brand-svg {
  width: 28px;
  height: 28px;
  color: var(--red);
}
.nav-brand-name {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
}
.nav-links a {
  font-size: 0.8125rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-muted);
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--red); }
.theme-btn {
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.theme-btn:hover { color: var(--red); border-color: var(--red); }
.theme-btn:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
.nav-brand:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 2px; }
.nav-links a:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
.icon-sun, .icon-moon { transition: opacity 0.2s; }
[data-theme="dark"] .icon-sun,
[data-theme="auto"] .icon-sun { opacity: 1; }
[data-theme="dark"] .icon-moon,
[data-theme="auto"] .icon-moon { opacity: 0; position: absolute; }
[data-theme="light"] .icon-sun { opacity: 0; position: absolute; }
[data-theme="light"] .icon-moon { opacity: 1; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { opacity: 1; }
  :root:not([data-theme="light"]) .icon-moon { opacity: 0; position: absolute; }
}
@media (max-width: 600px) {
  nav { padding: 0 1.25rem; }
  .nav-links li:not(:last-child) { display: none; }
}

/* ---- Hero ---- */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 2rem 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 50%, black 20%, transparent 70%);
  mask-image: radial-gradient(ellipse 90% 70% at 50% 50%, black 20%, transparent 70%);
  pointer-events: none;
}
.hero-glow {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 640px;
  height: 640px;
  background: radial-gradient(circle, var(--red-glow) 0%, transparent 65%);
  pointer-events: none;
}
.hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hero-logo-wrap {
  width: 108px;
  height: 108px;
  margin-bottom: 2.5rem;
  animation: logoIn 0.9s cubic-bezier(0.16,1,0.3,1) both;
  color: var(--red);
}
.hero-eyebrow {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 1.25rem;
  animation: fadeUp 0.7s 0.15s cubic-bezier(0.16,1,0.3,1) both;
}
.hero-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(2.6rem, 6vw, 5rem);
  font-weight: normal;
  line-height: 1.12;
  letter-spacing: -0.025em;
  max-width: 780px;
  margin-bottom: 1.5rem;
  animation: fadeUp 0.7s 0.25s cubic-bezier(0.16,1,0.3,1) both;
}
.hero-title em {
  font-style: italic;
  color: var(--red);
}
.hero-sub {
  font-size: 1.0625rem;
  color: var(--text-muted);
  max-width: 440px;
  line-height: 1.75;
  margin-bottom: 2.5rem;
  animation: fadeUp 0.7s 0.35s cubic-bezier(0.16,1,0.3,1) both;
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--red);
  color: #fff;
  text-decoration: none;
  padding: 0.8rem 2rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  animation: fadeUp 0.7s 0.45s cubic-bezier(0.16,1,0.3,1) both;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(240,82,90,0.35);
  background: #e8404a;
}
.btn-primary svg { transition: transform 0.2s; }
.btn-primary:hover svg { transform: translateX(3px); }
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  color: var(--text);
  text-decoration: none;
  padding: 0.8rem 2rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--text);
  transition: transform 0.2s, border-color 0.2s, color 0.2s;
  animation: fadeUp 0.7s 0.55s cubic-bezier(0.16,1,0.3,1) both;
}
.btn-secondary:hover {
  transform: translateY(-2px);
  border-color: var(--red);
  color: var(--red);
}
.btn-secondary svg { transition: transform 0.2s; }
.btn-secondary:hover svg { transform: translateX(3px); }
.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

/* ---- Footer ---- */
footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.footer-copy,
.footer-loc {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.footer-copy { letter-spacing: 0.1em; text-transform: uppercase; }

/* ---- Keyframes ---- */
@keyframes logoIn {
  from { opacity: 0; transform: scale(0.82) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Focus styles ---- */
.btn-primary:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.btn-secondary:focus-visible,
.view-toggle:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
