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

:root {
  --background:   #0d0d1a;
  --card:         #1a1a2e;
  --card-hover:   #22223b;
  --accent:       #f59e0b;
  --accent-light: #fbbf24;
  --text-primary: #f0f0f0;
  --text-muted:   #8888aa;
  --border:       #2a2a4a;
  font-size: 100%;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
}

/* ── Hero ─────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  position: relative;
}

/* The full-height hero is a landing-page device: it invites a scroll. On the
   404 page there is nothing to invite — the links out are the point, so they
   stay above the fold. */
.hero-short {
  min-height: 50vh;
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

#d20-icon {
  display: block;
  cursor: pointer;
}

.wordmark {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.1;
}

.accent {
  color: var(--accent);
  transition: color 0.2s ease;
}

.wordmark:hover .accent {
  color: var(--accent-light);
}

.tagline {
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--text-muted);
}

.pitch {
  max-width: 36rem;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.cta {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.6rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text-primary);
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.cta:hover { border-color: var(--accent); background: var(--card-hover); }

.cta-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--background);
}

.cta-primary:hover { background: var(--accent-light); border-color: var(--accent-light); }

/* ── Showcase ─────────────────────────────── */
.showcase {
  padding: 4rem 2rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.showcase-grid {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 2rem;
  align-items: start;
}

.shot { margin: 0; }

.shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
}

.shot figcaption {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.reasons {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 3rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.reasons strong { display: block; color: var(--text-primary); margin-bottom: 0.25rem; }
.reasons a { color: var(--accent); }

.scroll-chevron-wrapper {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
}

/* ── Keyframes ────────────────────────────── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-content {
  animation: fadeInUp 0.6s ease both;
}

@keyframes d20Wiggle {
  0%   { transform: rotate3d(1, 1, 0,  0deg); }
  25%  { transform: rotate3d(1, 1, 0, -15deg); }
  75%  { transform: rotate3d(1, 1, 0,  15deg); }
  100% { transform: rotate3d(1, 1, 0,  0deg); }
}

#d20-icon:hover {
  animation: d20Wiggle 0.4s ease-in-out;
}

@keyframes chevronBounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(8px); }
}

.scroll-chevron {
  animation: chevronBounce 1.5s ease-in-out infinite;
}

/* ── Tools Section ────────────────────────── */
.tools-section {
  padding: 5rem 2rem 4rem;
  max-width: 1200px;
  margin: 0 auto;
}

.tools-heading {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 3rem;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

/* ── Card ──────────────────────────────────── */
.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease,
              border-color 0.2s ease, background 0.2s ease;
}

a.card {
  display: block;
  color: inherit;
  text-decoration: none;
}

.badge.badge-live {
  background: #4ade80;
}

.card.card-live:hover .badge-live {
  background: #86efac;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  padding-right: 5rem; /* prevent title overlapping the badge */
}

.card-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--accent);
  color: #0d0d1a;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* ── Site footer (every page) ───────────────── */
.site-footer {
  text-align: center;
  padding: 2rem 1.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.site-footer nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin-bottom: 0.5rem;
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.25rem 0;
}

.site-footer a:hover,
.site-footer a:focus-visible { color: var(--accent); }

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

@media (pointer: coarse) {
  .site-footer a { padding: 0.6rem 0.25rem; }
}

/* Respect a reduced-motion preference: the stagger, wiggle, and bounce are
   decoration, so they go entirely. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ── Card Hover ────────────────────────────── */
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(245, 158, 11, 0.2);
  border-color: var(--accent);
  background: var(--card-hover);
}

.card:hover .badge {
  background: var(--accent-light);
}

/* ── Card Stagger — fallback when scroll-driven animations aren't supported ── */
.card {
  animation: fadeInUp 0.6s ease both;
}
.card:nth-child(1) { animation-delay: 0.0s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.2s; }
.card:nth-child(4) { animation-delay: 0.3s; }
.card:nth-child(5) { animation-delay: 0.4s; }
.card:nth-child(6) { animation-delay: 0.5s; }

/* ── Scroll-Driven Reveal — Chrome 115+, Safari 18+, Firefox 128+ ── */
/* Overrides the stagger delays above in supporting browsers. */
@supports (animation-timeline: scroll()) {
  .card {
    animation: fadeInUp 0.5s ease both;
    animation-timeline: view();
    animation-range: entry 0% entry 40%;
  }
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 1023px) {
  :root { font-size: 95%; }
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 639px) {
  :root { font-size: 90%; }
  .tools-grid { grid-template-columns: 1fr; }
  .showcase { padding: 3rem 1.25rem 0; }
  .showcase-grid { grid-template-columns: 1fr; }
  .shot-phone { max-width: 320px; margin: 0 auto; }
  .reasons { grid-template-columns: 1fr; gap: 1rem; }
  .wordmark { font-size: 2.4rem; }
}
