/* Aluemestaruuskilpailu 2027: ennakkosivu.
   Itsenäinen tyyli. Fontit ovat kansiossa fonts/ (Space Grotesk ja
   Unbounded, SIL Open Font License). */

@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/space-grotesk.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Unbounded";
  src: url("fonts/unbounded.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------- tokens */

:root {
  --bg: #050b18;
  --text: #eaf3ff;
  --muted: rgba(234, 243, 255, 0.64);
  --faint: rgba(234, 243, 255, 0.42);
  --ice: #bfe9ff;
  --teal: #3fe3c2;
  --violet: #8c7cff;
  --glass: rgba(255, 255, 255, 0.055);
  --glass-strong: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.14);
  --font: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-num: "Unbounded", "Space Grotesk", system-ui, sans-serif;
  --radius: 20px;
  --gutter: clamp(20px, 5vw, 64px);
}

/* ---------------------------------------------------------------- reset */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, p, ol { margin: 0; }
a { color: inherit; }
svg { display: block; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

/* ------------------------------------------------------------------ sky */

/* Everything behind the content: a night sky, three drifting aurora bands,
   a faint ice crystal and the snow canvas. Fixed, so it never scrolls away. */
.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(120vmax 70vmax at 75% -20%, #10305c 0%, rgba(16, 48, 92, 0) 60%),
    linear-gradient(180deg, #071327 0%, #050b18 55%, #03070f 100%);
}

.aurora {
  position: absolute;
  inset: -25%;
  filter: blur(70px);
  opacity: 0.6;
}

.aurora__band {
  position: absolute;
  border-radius: 50%;
  mix-blend-mode: screen;
  will-change: transform;
  animation: drift 30s ease-in-out infinite alternate;
}
.aurora__band--1 {
  left: 0;
  top: 12%;
  width: 55vw;
  height: 45vh;
  background: radial-gradient(closest-side, rgba(63, 227, 194, 0.9), rgba(63, 227, 194, 0));
}
.aurora__band--2 {
  right: -5%;
  top: 5%;
  width: 50vw;
  height: 50vh;
  background: radial-gradient(closest-side, rgba(140, 124, 255, 0.8), rgba(140, 124, 255, 0));
  animation-duration: 38s;
  animation-delay: -12s;
}
.aurora__band--3 {
  left: 30%;
  bottom: 0;
  width: 60vw;
  height: 40vh;
  background: radial-gradient(closest-side, rgba(111, 195, 255, 0.7), rgba(111, 195, 255, 0));
  animation-duration: 46s;
  animation-delay: -20s;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(10vw, -8vh, 0) scale(1.2); }
}

.crystal {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 110vmin;
  height: 110vmin;
  color: var(--ice);
  opacity: 0.07;
  transform: translate(-50%, -50%);
  animation: spin 180s linear infinite;
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.snow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.page {
  position: relative;
  z-index: 1;
}

/* ----------------------------------------------------------------- hero */

.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: calc(var(--gutter) + 24px) var(--gutter) var(--gutter);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--teal);
}
.eyebrow__flake {
  width: 14px;
  height: 14px;
  flex: none;
}

.title {
  margin-top: 22px;
  max-width: 12ch;
  font-size: clamp(44px, 10vw, 128px);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.04em;
  text-wrap: balance;
  background: linear-gradient(180deg, #ffffff 0%, #d9f1ff 55%, #8fcfff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  margin-top: 18px;
  font-size: clamp(18px, 2.6vw, 30px);
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--muted);
}

.meta {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.meta__item {
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass);
  font-size: 14px;
  letter-spacing: 0.04em;
}

/* ------------------------------------------------------------ countdown */

.countdown {
  margin-top: clamp(36px, 6vh, 64px);
  width: min(100%, 780px);
}

.countdown__label {
  font-size: 12px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--faint);
}

.tiles {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.tile {
  padding: 24px 6px 20px;
  border-radius: var(--radius);
  background: var(--glass);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow:
    0 30px 60px -30px rgba(0, 0, 0, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.tile__num {
  display: block;
  font-family: var(--font-num);
  font-weight: 700;
  font-size: clamp(34px, 7.5vw, 80px);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-shadow: 0 0 40px rgba(111, 195, 255, 0.35);
}

.tile__label {
  display: block;
  margin-top: 12px;
  font-size: 11px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
}

/* On the day the tiles give way to one line with a live dot; afterwards
   the dot goes quiet. The state lives on the data-state attribute. */
.status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.status__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 6px rgba(63, 227, 194, 0.18);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  50% { box-shadow: 0 0 0 14px rgba(63, 227, 194, 0); }
}

.status__title {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.status__text {
  max-width: 44ch;
  color: var(--muted);
}

.countdown[data-state="before"] .status { display: none; }
.countdown[data-state="live"] .countdown__label,
.countdown[data-state="live"] .tiles,
.countdown[data-state="after"] .countdown__label,
.countdown[data-state="after"] .tiles { display: none; }
.countdown[data-state="after"] .status__dot {
  background: var(--faint);
  box-shadow: none;
  animation: none;
}

/* -------------------------------------------------------------- actions */

.actions {
  margin-top: 36px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: #fff;
  font-weight: 500;
  font-size: 15px;
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.btn:hover {
  background: var(--glass-strong);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}
.btn--primary {
  background: #fff;
  border-color: #fff;
  color: #06152b;
}
.btn--primary:hover {
  background: #e6f4ff;
  border-color: #e6f4ff;
}
.btn__icon {
  width: 18px;
  height: 18px;
  flex: none;
}

.cue {
  margin-top: auto;
  padding-top: 40px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--faint);
  text-decoration: none;
  transition: color 0.2s ease;
}
.cue:hover { color: var(--text); }
.cue svg {
  width: 16px;
  height: 16px;
  animation: bob 2.2s ease-in-out infinite;
}

@keyframes bob {
  50% { transform: translateY(5px); }
}

/* --------------------------------------------------------------- notice */

.kicker {
  font-size: 12px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--teal);
}

.notice {
  width: min(100% - 2 * var(--gutter), 780px);
  margin: 0 auto;
  padding: clamp(28px, 5vw, 44px);
  border-radius: 28px;
  background: linear-gradient(160deg, rgba(63, 227, 194, 0.14), rgba(140, 124, 255, 0.08) 50%, rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(63, 227, 194, 0.35);
  box-shadow:
    0 0 80px -20px rgba(63, 227, 194, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  text-align: center;
}

.notice__title {
  margin-top: 12px;
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  text-wrap: balance;
}

.notice__url {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px 14px;
}

.notice__link {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--ice);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: rgba(191, 233, 255, 0.4);
  word-break: break-all;
}
.notice__link:hover { text-decoration-color: var(--ice); }

.notice__copy {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: #fff;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.notice__copy:hover { background: var(--glass-strong); }

.notice__text {
  margin: 16px auto 0;
  max-width: 52ch;
  color: var(--muted);
}

/* ----------------------------------------------------------- categories */

.cats {
  width: min(100% - 2 * var(--gutter), 1120px);
  margin: 0 auto;
  padding: clamp(80px, 12vh, 140px) 0 60px;
}

.cats__head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.cats__title {
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.05;
  text-wrap: balance;
}

.cats__grid {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.cat {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  min-height: 150px;
  padding: 22px 22px 20px;
  border-radius: var(--radius);
  background: var(--glass);
  border: 1px solid var(--line);
  transition: transform 0.25s ease, border-color 0.25s ease, background-color 0.25s ease;
}
.cat::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.08) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.8s ease;
}
.cat:hover {
  transform: translateY(-3px);
  border-color: rgba(63, 227, 194, 0.5);
  background: var(--glass-strong);
}
.cat:hover::before { transform: translateX(100%); }

.cat__index {
  font-family: var(--font-num);
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--teal);
}

.cat__name {
  font-size: clamp(20px, 2.2vw, 26px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.cats__note {
  margin-top: 22px;
  font-size: 14px;
  color: var(--faint);
}

/* --------------------------------------------------------------- footer */

.foot {
  width: min(100% - 2 * var(--gutter), 1120px);
  margin: 0 auto;
  padding: 40px 0 48px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 24px;
  font-size: 13px;
  color: var(--faint);
}
.foot a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
}
.foot a:hover { color: #fff; }

/* --------------------------------------------------------------- reveal */

/* Sections below the fold fade up as they come into view. Scoped to .js,
   so without the script everything is simply visible. */
.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  transition-delay: calc(var(--i, 0) * 60ms);
}
.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

/* ----------------------------------------------------------- responsive */

@media (max-width: 560px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { padding: 20px 6px 16px; }
  .tile__num { font-size: clamp(40px, 14vw, 64px); }
  .btn { width: 100%; justify-content: center; }
  .foot { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .aurora__band,
  .crystal,
  .cue svg,
  .status__dot { animation: none !important; }
  .js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .cat,
  .cat::before,
  .btn { transition: none; }
}

@media print {
  .sky,
  .cue,
  .actions,
  .notice__copy { display: none; }
  body {
    background: #fff;
    color: #000;
  }
  .title {
    background: none;
    -webkit-text-fill-color: #000;
    color: #000;
  }
  .tile__num,
  .btn,
  .status__title,
  .notice__title,
  .cats__title { color: #000; }
  .tile,
  .cat,
  .notice { border-color: #999; }
}
