/*
 * Page layouts: home hero, game summary, run page, player profile and error page.
 * See docs/design.md.
 */

/* ── Home hero ────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  isolation: isolate;
  margin: -1.5rem calc(50% - 50vw) 3.5rem;
  padding: clamp(3.5rem, 9vw, 7rem) 1rem clamp(3rem, 7vw, 5.5rem);
  overflow: hidden;
  text-align: center;
}

/* Decorative layers, faded out at the bottom so they melt into the sky */
.hero-fx {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  mask-image: linear-gradient(180deg, #000 55%, transparent 100%);
}

.hero-rays {
  position: absolute;
  top: -55%;
  left: 50%;
  width: min(1500px, 200vw);
  aspect-ratio: 1;
  translate: -50% 0;
  background: repeating-conic-gradient(from 0deg, rgba(242, 201, 76, 0.11) 0deg 2.5deg, transparent 2.5deg 11deg);
  mask: radial-gradient(closest-side, #000 0%, rgba(0, 0, 0, 0.55) 35%, transparent 72%);
  animation: rays-spin 160s linear infinite;
  pointer-events: none;
}

.hero-glow {
  position: absolute;
  top: 8%;
  left: 50%;
  width: min(900px, 120vw);
  height: 420px;
  translate: -50% 0;
  background: radial-gradient(closest-side, rgba(242, 201, 76, 0.22), rgba(255, 122, 26, 0.08) 55%, transparent);
  filter: blur(10px);
  pointer-events: none;
}

.hero-temple {
  position: absolute;
  bottom: 2%;
  left: 50%;
  width: min(820px, 96vw);
  aspect-ratio: 600 / 320;
  translate: -50% 0;
  background: linear-gradient(180deg, var(--cs-gold-light), var(--cs-gold-deep));
  mask: url("/assets/img/temple.svg") center / contain no-repeat;
  opacity: 0.075;
  pointer-events: none;
}

.hero-emblem {
  display: block;
  width: clamp(5.5rem, 12vw, 8rem);
  height: auto;
  margin: 0 auto 1.5rem;
  filter: drop-shadow(0 0 30px rgba(242, 201, 76, 0.45));
  animation: hero-in 1s var(--cs-ease) both, float 6s ease-in-out 1s infinite;
}

.hero .kicker {
  animation: hero-in 1s var(--cs-ease) 0.1s both;
}

.hero-title {
  margin: 0 0 1.25rem;
  font-size: clamp(2.6rem, 9vw, 6.4rem);
  font-weight: 900;
  line-height: 0.98;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  animation: hero-in 1.1s var(--cs-ease) 0.2s both;
}

.hero-title-crash {
  display: block;
  color: #fff;
  text-shadow: 0 0 50px rgba(255, 255, 255, 0.18);
}

.hero-title .text-gold {
  display: block;
  filter: drop-shadow(0 0 30px rgba(242, 201, 76, 0.3));
}

.hero-tagline {
  max-width: 36rem;
  margin: 0 auto 2.25rem;
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  color: var(--cs-muted);
  animation: hero-in 1.1s var(--cs-ease) 0.35s both;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  animation: hero-in 1.1s var(--cs-ease) 0.5s both;
}

.hero-games {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2.5rem;
  animation: hero-in 1.1s var(--cs-ease) 0.65s both;
}

.hero-games .chip {
  color: var(--cs-text);
  backdrop-filter: blur(6px);
}

.hero-games .chip:hover {
  border-color: color-mix(in srgb, var(--cs-accent) 60%, transparent);
  color: #fff;
}

.home-section {
  margin-bottom: 3.5rem;
}

@keyframes rays-spin {
  to { rotate: 360deg; }
}

@keyframes hero-in {
  from {
    opacity: 0;
    translate: 0 1.25rem;
    filter: blur(6px);
  }

  to {
    opacity: 1;
    translate: 0 0;
    filter: blur(0);
  }
}

@keyframes float {
  0%,
  100% { translate: 0 0; }
  50% { translate: 0 -8px; }
}

/* ── Game summary (the banner itself lives in theme.css) ─────────────────── */
.game-rules {
  margin: 0 0 2rem;
}

.rules-toggle > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--cs-glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--cs-text);
  font-size: 0.86rem;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.rules-toggle > summary::-webkit-details-marker {
  display: none;
}

.rules-toggle > summary:hover {
  background: rgba(255, 255, 255, 0.09);
}

.rules-toggle[open] > summary {
  margin-bottom: 0.9rem;
}

.rules {
  color: var(--cs-muted);
}

.rules a {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.rules p:last-child,
.rules ul:last-child {
  margin-bottom: 0;
}

/* ── Run page ─────────────────────────────────────────────────────────────── */
.run-hero {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--cs-glass-border);
}

.run-time {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem 1rem;
  margin: 0.4rem 0 0.6rem;
  font-family: var(--cs-font-mono);
  font-size: clamp(2.6rem, 8vw, 4.75rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  color: #fff;
  text-shadow: 0 0 50px var(--cs-glow);
}

.run-time.is-record {
  text-shadow: none;
  filter: drop-shadow(0 0 28px rgba(242, 201, 76, 0.35));
}

.run-time-method {
  font-family: var(--cs-font-body);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cs-muted);
  -webkit-text-fill-color: var(--cs-muted);
  text-shadow: none;
}

.run-by {
  font-size: 1.05rem;
  color: var(--cs-muted);
}

.run-badges {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4rem;
}

.run-badges .badge {
  font-size: 0.85rem;
}

.theater {
  position: relative;
  border-radius: var(--cs-radius-lg);
  padding: 0.4rem;
  background: linear-gradient(135deg, color-mix(in srgb, var(--cs-accent) 45%, transparent), rgba(255, 255, 255, 0.04) 40%, rgba(242, 201, 76, 0.3));
  box-shadow: 0 40px 80px -40px var(--cs-glow);
}

.video-frame {
  display: block;
  aspect-ratio: 16 / 9;
  width: 100%;
  border: 0;
  border-radius: calc(var(--cs-radius-lg) - 0.35rem);
  background: #000;
}

.video-links {
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.88rem;
  word-break: break-all;
}

.video-links .bi {
  margin-right: 0.35rem;
  color: var(--cs-muted);
}

.spec-list {
  margin: 0;
}

.spec-list > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.1rem;
  border-bottom: 1px solid var(--cs-glass-border);
}

.spec-list > div:last-child {
  border-bottom: 0;
}

.spec-list dt {
  font-weight: 500;
  color: var(--cs-muted);
}

.spec-list dd {
  margin: 0;
  text-align: right;
}

/* ── Player profile ───────────────────────────────────────────────────────── */
.player-hero {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem 2rem;
  margin-bottom: 2.5rem;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  overflow: hidden;
  border-radius: var(--cs-radius-lg);
  border: 1px solid rgba(242, 201, 76, 0.22);
  background:
    radial-gradient(60% 120% at 0% 0%, rgba(242, 201, 76, 0.14), transparent 70%),
    color-mix(in srgb, var(--cs-surface) 88%, transparent);
  box-shadow: var(--cs-shadow);
}

.player-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: -3rem;
  bottom: -4rem;
  width: 18rem;
  height: 16rem;
  background: var(--cs-gold-grad);
  mask: url("/assets/img/laurel.svg") center / contain no-repeat;
  opacity: 0.06;
}

.crest {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 6rem;
  height: 6rem;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.12), transparent 60%),
    var(--cs-surface-3);
  box-shadow: 0 0 0 3px var(--cs-bg), 0 0 0 5px var(--cs-gold), 0 0 40px -6px rgba(242, 201, 76, 0.6);
  font-family: var(--cs-font-display);
  font-size: 2.6rem;
  font-weight: 900;
}

.player-name {
  margin: 0 0 0.35rem;
  font-size: clamp(1.8rem, 4.5vw, 2.6rem);
  font-weight: 800;
}

.player-name .flag {
  font-size: 0.6em;
  vertical-align: 0.2em;
  margin-right: 0.6rem;
}

.player-sub {
  color: var(--cs-muted);
}

.stat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-left: auto;
}

.stat-chip {
  min-width: 6.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--cs-radius);
  border: 1px solid var(--cs-glass-border);
  background: rgba(255, 255, 255, 0.04);
  text-align: center;
}

.stat-chip-value {
  display: block;
  font-family: var(--cs-font-mono);
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.1;
  color: #fff;
}

.stat-chip-label {
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cs-faint);
}

.stat-chip.is-gold {
  border-color: rgba(242, 201, 76, 0.35);
  background: rgba(242, 201, 76, 0.07);
}

.stat-chip.is-gold .stat-chip-value {
  background: var(--cs-gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── Error page ───────────────────────────────────────────────────────────── */
.error-page {
  position: relative;
  isolation: isolate;
  padding: clamp(3rem, 10vw, 6rem) 1rem;
  text-align: center;
}

.error-code {
  margin: 0;
  font-family: var(--cs-font-display);
  font-size: clamp(6rem, 22vw, 12rem);
  font-weight: 900;
  line-height: 0.9;
  filter: drop-shadow(0 0 40px rgba(242, 201, 76, 0.3));
}

.error-message {
  margin: 1.25rem auto 2rem;
  max-width: 32rem;
  font-size: 1.15rem;
  color: var(--cs-muted);
}

.error-page pre {
  max-width: 100%;
  margin-top: 2rem;
  text-align: left;
}

/* ── Small screens ────────────────────────────────────────────────────────── */
@media (max-width: 575.98px) {
  .hero {
    margin-bottom: 2.5rem;
  }

  .stat-chips {
    margin-left: 0;
    width: 100%;
  }

  .stat-chip {
    flex: 1;
    min-width: 0;
  }
}
