@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;600;700&family=Space+Mono:wght@400;700&display=swap');

:root {
  color-scheme: dark;
  --bg0: #060914;
  --bg1: #0a1022;
  --panel: rgba(18, 24, 40, 0.68);
  --panel-2: rgba(18, 24, 40, 0.92);
  --border: rgba(255, 255, 255, 0.12);
  --text: rgba(244, 247, 255, 0.96);
  --muted: rgba(244, 247, 255, 0.7);
  --accent: #7dd3fc;
  --accent-2: #fbbf24;
  --shadow: 0 24px 72px rgba(0, 0, 0, 0.58);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body.home {
  margin: 0;
  font-family: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg0), var(--bg1));
  line-height: 1.45;
}

.home-backdrop,
.home-returning-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
}

.home-backdrop {
  background:
    linear-gradient(180deg, rgba(4, 10, 21, 0.46), rgba(4, 10, 21, 0.84)),
    radial-gradient(920px 540px at 18% 14%, rgba(56, 189, 248, 0.2), transparent 62%),
    radial-gradient(820px 620px at 88% 86%, rgba(30, 64, 175, 0.24), transparent 66%),
    url('/media/homepage-alpine-lake.jpg');
  background-size: cover;
  background-position: center center;
  opacity: 1;
  transition: opacity 240ms ease;
}

.home-returning-bg {
  background:
    linear-gradient(165deg, rgba(2, 9, 28, 0.9), rgba(6, 22, 54, 0.88)),
    radial-gradient(920px 540px at 18% 14%, rgba(56, 189, 248, 0.24), transparent 62%),
    radial-gradient(820px 620px at 88% 86%, rgba(30, 64, 175, 0.3), transparent 66%),
    url('/media/winter-panorama-bled.jpg'),
    url('/media/hero-study.jpg');
  background-size: cover;
  background-position: center 28%;
  opacity: 0;
  transition: opacity 240ms ease;
}

body.home::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.03),
      rgba(255, 255, 255, 0.03) 1px,
      transparent 1px,
      transparent 6px
    );
  opacity: 0.08;
  mix-blend-mode: overlay;
}

body.home--logged-in {
  background: linear-gradient(180deg, #040b1d, #07122c);
}

body.home--logged-in::before {
  opacity: 0;
}

body.home--logged-in .home-backdrop {
  opacity: 0;
}

body.home--logged-in .home-returning-bg {
  opacity: 1;
}

body.home--logged-in .nav {
  display: none;
}

body.home--logged-in .guest-home {
  display: none;
}

body.home--logged-in .wrap {
  max-width: none;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

body.home:not(.home--logged-in) .wrap {
  max-width: none;
  min-height: calc(100vh - 74px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

a {
  color: inherit;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  z-index: 1000;
}

.skip-link:focus {
  left: 12px;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(14px);
  background: rgba(6, 9, 20, 0.55);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav-inner-minimal {
  justify-content: flex-end;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-link {
  text-decoration: none;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600;
  transition:
    color 220ms ease,
    border-color 220ms ease,
    background-color 220ms ease,
    transform 280ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 280ms cubic-bezier(0.22, 1, 0.36, 1),
    filter 220ms ease;
  will-change: transform;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(18, 24, 40, 0.45);
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.24);
}

.nav-cta {
  color: rgba(10, 16, 34, 0.92);
  background: linear-gradient(135deg, rgba(125, 211, 252, 0.95), rgba(251, 191, 36, 0.9));
  border-color: rgba(255, 255, 255, 0.16);
}

.nav-cta:hover,
.nav-cta:focus-visible {
  color: rgba(10, 16, 34, 0.92);
  filter: brightness(1.04) saturate(1.04);
  transform: translateY(-2px) scale(1.015);
  box-shadow: 0 18px 36px rgba(10, 16, 34, 0.28);
}

.nav-session {
  color: rgba(244, 247, 255, 0.92);
  background: rgba(18, 24, 40, 0.55);
  border-color: rgba(125, 211, 252, 0.34);
}

.wrap {
  width: 100%;
}

.returning-home,
.guest-home {
  display: grid;
  gap: 1.3rem;
  justify-items: center;
  width: min(60rem, calc(100vw - 2rem));
  text-align: center;
  min-height: min(88vh, 52rem);
  align-content: center;
  padding: clamp(1.5rem, 4.6vw, 3rem);
  border-radius: 28px;
  border: 1px solid rgba(125, 211, 252, 0.36);
  background: rgba(3, 11, 31, 0.54);
  box-shadow: 0 26px 92px rgba(0, 0, 0, 0.64);
  backdrop-filter: blur(4px);
}

.returning-home {
  display: none;
}

body.home--logged-in .returning-home:not([hidden]) {
  display: grid;
}

.guest-home {
  min-height: min(74vh, 34rem);
  gap: clamp(1.5rem, 3.4vw, 2.2rem);
}

.returning-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.84rem;
  color: rgba(244, 247, 255, 0.78);
}

.returning-title {
  margin: 0;
  font-size: clamp(4.2rem, 10vw + 0.5rem, 9.1rem);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.02em;
  color: #f5f8ff;
  text-shadow: 0 12px 42px rgba(0, 0, 0, 0.52);
}

.panel-heading {
  margin: 0;
  font-weight: 700;
  line-height: 0.94;
  letter-spacing: -0.045em;
  color: #f7fbff;
  text-wrap: balance;
}

.home-brand-title {
  max-width: 100%;
  font-size: clamp(2.85rem, 7.1vw, 5.9rem);
  white-space: nowrap;
  text-shadow:
    0 18px 46px rgba(0, 0, 0, 0.5),
    0 0 22px rgba(125, 211, 252, 0.16);
}

.returning-actions {
  display: grid;
  width: min(48rem, 100%);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.returning-home .returning-actions {
  width: min(72rem, 100%);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.2rem;
  align-items: stretch;
}

.guest-actions {
  width: min(72rem, 100%);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 3.8rem;
  text-decoration: none;
  border-radius: 14px;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(18, 24, 40, 0.42);
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.welcome-shortcut {
  --shortcut-tint-a: rgba(125, 211, 252, 0.34);
  --shortcut-tint-b: rgba(251, 191, 36, 0.28);
  --shortcut-image: none;
  --shortcut-image-position: center center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  min-height: 7.3rem;
  padding: 1.25rem 1.2rem;
  font-size: 1.08rem;
  line-height: 1.2;
  text-align: center;
  color: rgba(246, 249, 255, 0.98);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
  background-image:
    linear-gradient(180deg, rgba(4, 9, 22, 0.62), rgba(4, 9, 22, 0.82)),
    var(--shortcut-image);
  background-size: cover;
  background-position: center center, var(--shortcut-image-position);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 14px 34px rgba(0, 0, 0, 0.24);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background-image 180ms ease,
    border-color 180ms ease;
}

.welcome-shortcut--english {
  --shortcut-tint-a: rgba(224, 172, 91, 0.38);
  --shortcut-tint-b: rgba(132, 94, 52, 0.26);
  --shortcut-image: url('/media/home-shortcuts/english-shakespeare.jpeg');
  --shortcut-image-position: center 18%;
}

.welcome-shortcut--maths {
  --shortcut-tint-a: rgba(79, 172, 254, 0.42);
  --shortcut-tint-b: rgba(0, 242, 254, 0.24);
  --shortcut-image: url('/media/home-shortcuts/maths-ramanujan.webp');
  --shortcut-image-position: center 18%;
}

.welcome-shortcut--chemistry {
  --shortcut-tint-a: rgba(126, 231, 135, 0.34);
  --shortcut-tint-b: rgba(56, 189, 248, 0.24);
  --shortcut-image: url('/media/home-shortcuts/chemistry-curie.webp');
  --shortcut-image-position: center 22%;
}

.welcome-shortcut--physics {
  --shortcut-tint-a: rgba(147, 197, 253, 0.34);
  --shortcut-tint-b: rgba(96, 165, 250, 0.22);
  --shortcut-image: url('/media/home-shortcuts/physics-einstein.webp');
  --shortcut-image-position: center 12%;
}

.welcome-shortcut--countdown {
  --shortcut-tint-a: rgba(255, 126, 95, 0.38);
  --shortcut-tint-b: rgba(254, 180, 123, 0.26);
  --shortcut-image: url('/media/home-shortcuts/countdown-ymh.jpg');
  --shortcut-image-position: center center;
}

.welcome-shortcut--games {
  --shortcut-tint-a: rgba(102, 126, 234, 0.36);
  --shortcut-tint-b: rgba(118, 75, 162, 0.28);
  --shortcut-image: url('/media/home-shortcuts/games-lorenzo-herrera.jpg');
  --shortcut-image-position: center center;
}

.welcome-shortcut.is-selected {
  background-image:
    linear-gradient(135deg, var(--shortcut-tint-a), var(--shortcut-tint-b)),
    linear-gradient(180deg, rgba(4, 9, 22, 0.22), rgba(4, 9, 22, 0.68)),
    var(--shortcut-image);
  border-color: rgba(255, 255, 255, 0.24);
  color: rgba(248, 250, 255, 0.98);
  box-shadow:
    0 0 24px rgba(255, 255, 255, 0.08),
    0 20px 42px rgba(0, 0, 0, 0.28);
}

.welcome-shortcut:hover,
.welcome-shortcut:focus-visible {
  background-image:
    linear-gradient(135deg, var(--shortcut-tint-a), var(--shortcut-tint-b)),
    linear-gradient(180deg, rgba(4, 9, 22, 0.14), rgba(4, 9, 22, 0.6)),
    var(--shortcut-image);
  border-color: rgba(255, 255, 255, 0.24);
  color: rgba(248, 250, 255, 0.98);
  box-shadow:
    0 0 20px rgba(255, 255, 255, 0.08),
    0 18px 38px rgba(0, 0, 0, 0.26);
  transform: translateY(-2px) scale(1.02);
}

.btn:not(.welcome-shortcut):hover,
.btn:not(.welcome-shortcut):focus-visible {
  border-color: rgba(125, 211, 252, 0.42);
  box-shadow: 0 0 0 4px rgba(125, 211, 252, 0.1);
}

.btn.primary {
  background: linear-gradient(135deg, rgba(125, 211, 252, 0.95), rgba(251, 191, 36, 0.9));
  color: rgba(10, 16, 34, 0.92);
  border-color: rgba(255, 255, 255, 0.16);
}

.btn.primary:hover,
.btn.primary:focus-visible {
  filter: brightness(1.03);
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.1);
}

:focus-visible {
  outline: 3px solid rgba(125, 211, 252, 0.6);
  outline-offset: 3px;
}

@media (max-width: 960px) {
  .returning-home .returning-actions {
    width: min(60rem, 100%);
  }

  .guest-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .returning-home .returning-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .returning-home .welcome-shortcut {
    grid-column: auto;
    min-height: 6rem;
  }

  .guest-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .guest-home,
  .returning-home {
    min-height: auto;
  }
}

@media (max-width: 520px) {
  .returning-home .returning-actions {
    grid-template-columns: 1fr;
  }

  .returning-home .welcome-shortcut {
    min-height: 4.5rem;
    font-size: 0.98rem;
  }

  .home-brand-title {
    font-size: clamp(1.95rem, 8.8vw, 2.5rem);
    white-space: normal;
  }

  .guest-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .nav-inner {
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
