:root {
  --bg-top: #0b1220;
  --bg-bottom: #1a2438;
  --horizon: #2c3e5a;
  --mountain-back: #1f2a3f;
  --mountain-mid: #182238;
  --mountain-front: #0e1626;
  --text: #e6ecf5;
  --text-soft: #9aa6b8;
  --text-faint: #6a7388;
  --accent: #7fb3ff;
  --card-bg: rgba(255, 255, 255, 0.04);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-bg-hover: rgba(255, 255, 255, 0.07);
  --card-border-hover: rgba(127, 179, 255, 0.35);
  --max-width: 720px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html,
body {
  height: 100%;
}

html {
  background-color: var(--bg-top);
  background-image: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 60%, var(--horizon) 100%);
  background-attachment: fixed;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter",
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ---------------- Scene (sky + mountains) ---------------- */

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

.stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 12% 18%, rgba(255, 255, 255, 0.6) 50%, transparent 51%),
    radial-gradient(1px 1px at 27% 9%, rgba(255, 255, 255, 0.35) 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 41% 22%, rgba(255, 255, 255, 0.55) 50%, transparent 51%),
    radial-gradient(1px 1px at 58% 14%, rgba(255, 255, 255, 0.3) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 71% 28%, rgba(255, 255, 255, 0.65) 50%, transparent 51%),
    radial-gradient(1px 1px at 84% 11%, rgba(255, 255, 255, 0.4) 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 92% 24%, rgba(255, 255, 255, 0.5) 50%, transparent 51%),
    radial-gradient(1px 1px at 8% 32%, rgba(255, 255, 255, 0.3) 50%, transparent 51%),
    radial-gradient(1px 1px at 35% 36%, rgba(255, 255, 255, 0.4) 50%, transparent 51%),
    radial-gradient(1px 1px at 64% 38%, rgba(255, 255, 255, 0.3) 50%, transparent 51%);
  background-size: 100% 60%;
  background-repeat: no-repeat;
  opacity: 0.9;
  animation: twinkle 8s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}

.cloud {
  position: absolute;
  height: 30px;
  width: 220px;
  background: radial-gradient(
    ellipse at center,
    rgba(255, 255, 255, 0.06) 0%,
    rgba(255, 255, 255, 0) 70%
  );
  filter: blur(6px);
}

.cloud-1 {
  top: 22%;
  left: -25%;
  animation: drift 140s linear infinite;
}

.cloud-2 {
  top: 36%;
  left: -25%;
  width: 320px;
  height: 36px;
  opacity: 0.7;
  animation: drift 190s linear infinite;
  animation-delay: -60s;
}

@keyframes drift {
  from { transform: translateX(0); }
  to   { transform: translateX(160vw); }
}

.mountains {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 55vh;
  transition: transform 0.1s linear;
}

.layer-back  { fill: var(--mountain-back);  height: 50vh; bottom: 5vh; opacity: 0.85; }
.layer-mid   { fill: var(--mountain-mid);   height: 45vh; bottom: 2vh; opacity: 0.95; }
.layer-front { fill: var(--mountain-front); height: 40vh; bottom: 0;   opacity: 1; }

/* ---------------- Layout ---------------- */

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(24px, 6vw, 56px) clamp(20px, 5vw, 32px);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(36px, 6vw, 56px);
}

.hero {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: clamp(20px, 8vh, 80px);
}

.eyebrow {
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
}

h1 {
  font-size: clamp(2.4rem, 7vw, 3.6rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.tagline {
  font-size: clamp(1rem, 2.2vw, 1.15rem);
  color: var(--text-soft);
  max-width: 38ch;
}

/* ---------------- Links grid ---------------- */

.links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  color: var(--text);
  text-decoration: none;
  transition:
    background 0.4s var(--ease),
    border-color 0.4s var(--ease),
    transform 0.4s var(--ease);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.card:hover,
.card:focus-visible {
  background: var(--card-bg-hover);
  border-color: var(--card-border-hover);
  transform: translateY(-2px);
  outline: none;
}

.card .icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  fill: var(--text-soft);
  transition: fill 0.4s var(--ease), transform 0.4s var(--ease);
}

.card:hover .icon,
.card:focus-visible .icon {
  fill: var(--accent);
}

.card-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.card-title {
  font-size: 1rem;
  font-weight: 500;
}

.card-sub {
  font-size: 0.85rem;
  color: var(--text-faint);
}

.arrow {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--text-faint);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease), stroke 0.4s var(--ease);
}

.card:hover .arrow,
.card:focus-visible .arrow {
  opacity: 1;
  stroke: var(--accent);
  transform: translate(2px, -2px);
}

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

footer {
  margin-top: auto;
  padding-top: 16px;
  font-size: 0.85rem;
  color: var(--text-faint);
  text-align: center;
}

.footer-link {
  color: var(--text-soft);
  text-decoration: none;
  border-bottom: 1px dashed var(--text-faint);
  transition: color 0.4s var(--ease), border-color 0.4s var(--ease);
}

.footer-link:hover,
.footer-link:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent);
  outline: none;
}

/* ---------------- Prose pages (e.g. /marvin) ---------------- */

.prose {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 56ch;
}

.prose p {
  color: var(--text-soft);
  font-size: 1.05rem;
  line-height: 1.65;
}

.prose p strong {
  color: var(--text);
  font-weight: 500;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 24px;
  color: var(--text-faint);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.4s var(--ease), transform 0.4s var(--ease);
  width: max-content;
}

.back-link:hover,
.back-link:focus-visible {
  color: var(--accent);
  transform: translateX(-2px);
  outline: none;
}

/* ---------------- Reveal animations ---------------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 0.8s var(--ease),
    transform 0.8s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
}
