/* SkiSport - alpine theme.
 *
 * Palette keeps the desktop app's accent (#0b6fb8) so a judge moving between
 * the laptop and a phone sees one product, and puts it on snow: cool neutrals,
 * a night-sky header, and the two gate colours (red/blue) used for accents the
 * way they are used on a slope.
 *
 * Everything is variables at the top: the schedule, the cards and the
 * protocols all draw from the same six colours.
 */
:root {
  --accent: #0b6fb8;
  --accent-dark: #075289;
  --night: #0a2540;
  --night-2: #123b63;
  --ink: #14202c;
  --muted: #5d7288;
  --line: #d6e2ee;
  --bg: #eef4fa;
  --panel: #ffffff;
  --ice: #e3eefb;
  --ok: #16794c;
  --warn: #b45309;
  --gate-red: #d6323d;
  --gate-blue: #1f6fd4;
  --shadow: 0 1px 2px rgba(10, 37, 64, .06), 0 8px 24px rgba(10, 37, 64, .06);
  --radius: 14px;
}

* { box-sizing: border-box; }

/* Filtering hides rows with the `hidden` attribute, and .sched-row/.filters
   set display themselves - an author `display:` beats the UA rule for
   [hidden], so without this every "hidden" row stays on screen. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  /* Keeps the dark footer at the bottom of the window on short pages (the
     login form, an empty schedule) instead of leaving it floating mid-screen. */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------------------------------------------------------------- header */

header.site {
  position: relative;
  background:
    radial-gradient(900px 300px at 78% -40%, rgba(120, 190, 255, .38), transparent 70%),
    linear-gradient(135deg, var(--night), var(--night-2) 55%, var(--accent));
  color: #fff;
  padding: 16px 20px 26px;
}
/* Snow ridge biting into the bottom of the header. Drawn in the page
   background colour so the header looks like sky behind peaks. */
header.site::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 26px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 60' preserveAspectRatio='none'%3E%3Cpath fill='%23eef4fa' d='M0 60V46L100 30L180 46L280 22L380 44L480 26L580 48L680 28L780 46L880 24L980 44L1080 30L1200 44V60Z'/%3E%3C/svg%3E") bottom/100% 100% no-repeat;
  pointer-events: none;
}
header.site a { color: #fff; text-decoration: none; }
.bar { max-width: 1120px; margin: 0 auto; display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 21px; letter-spacing: .4px; }
.brand svg { display: block; }
.bar nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.bar nav a, .bar nav button {
  padding: 7px 12px; border-radius: 8px; opacity: .92; font: inherit;
}
.bar nav a:hover, .bar nav button:hover { background: rgba(255, 255, 255, .16); opacity: 1; }
.bar nav button { background: none; border: none; color: #fff; cursor: pointer; }

main { max-width: 1120px; width: 100%; margin: 26px auto 64px; padding: 0 20px; flex: 1 0 auto; }
h1 { font-size: 28px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -.2px; }
h2 { font-size: 21px; margin: 34px 0 12px; letter-spacing: -.2px; }
.sub { color: var(--muted); margin: 0 0 22px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

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

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  margin-bottom: 26px;
  padding: 34px 30px 120px;
  color: #fff;
  background:
    radial-gradient(700px 260px at 15% 0%, rgba(140, 205, 255, .35), transparent 70%),
    linear-gradient(160deg, var(--night), #16456f 60%, #1c5f93);
  box-shadow: var(--shadow);
}
.hero__inner { position: relative; z-index: 2; max-width: 720px; }
.hero h1 { font-size: 34px; margin: 0 0 10px; }
.hero__lead { color: #cfe4f7; margin: 0 0 22px; font-size: 17px; max-width: 560px; }
.hero__cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }

/* Layered ridges + falling snow, both purely decorative. */
.hero__peaks { position: absolute; left: 0; right: 0; bottom: -1px; z-index: 1; pointer-events: none; }
.hero__peaks svg { display: block; width: 100%; height: 190px; }
.hero__snow {
  position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: .75;
  background-image:
    radial-gradient(2.2px 2.2px at 18% 12%, #fff, transparent),
    radial-gradient(1.6px 1.6px at 64% 28%, rgba(255,255,255,.9), transparent),
    radial-gradient(2px 2px at 84% 8%, rgba(255,255,255,.8), transparent),
    radial-gradient(1.4px 1.4px at 36% 62%, rgba(255,255,255,.75), transparent),
    radial-gradient(1.8px 1.8px at 92% 48%, rgba(255,255,255,.7), transparent);
  background-size: 320px 320px, 260px 260px, 400px 400px, 220px 220px, 300px 300px;
  animation: snowfall 26s linear infinite;
}
@keyframes snowfall {
  to {
    background-position: 40px 320px, -30px 260px, 25px 400px, -20px 220px, 15px 300px;
  }
}

.stats { display: flex; gap: 26px; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.stat { min-width: 92px; }
.stat b { display: block; font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat span { color: #a9c9e4; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; }

/* countdown to the next start - the numbers tick in JS */
.countdown { margin: 4px 0 0; }
.cd-units { display: flex; gap: 8px; flex-wrap: wrap; }
.cd-unit {
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 10px;
  padding: 8px 12px;
  min-width: 62px;
  text-align: center;
  backdrop-filter: blur(2px);
}
.cd-unit b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.cd-unit span { font-size: 11px; color: #a9c9e4; text-transform: uppercase; letter-spacing: .5px; }
.hero__next { margin: 26px 0 0; }
.hero__next .meta { color: #a9c9e4; }
.hero__next a { color: #fff; }

/* -------------------------------------------------------------- controls */

.btn {
  display: inline-block; padding: 10px 18px; border-radius: 10px;
  background: var(--accent); color: #fff; text-decoration: none;
  border: none; font: inherit; cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}
.btn:hover { background: var(--accent-dark); transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn.ghost:hover { background: var(--ice); }
.hero .btn.ghost { color: #fff; border-color: rgba(255, 255, 255, .5); }
.hero .btn.ghost:hover { background: rgba(255, 255, 255, .14); }

.tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; white-space: nowrap; }
.tag.open { background: #d9f5e6; color: var(--ok); }
.tag.closed { background: #e5ecf3; color: var(--muted); }
.tag.live { background: #ffe6e6; color: var(--gate-red); font-weight: 600; }
.tag.done { background: #e5ecf3; color: var(--muted); }

/* Discipline badge, coloured the way gates are on a slope. */
.disc {
  display: inline-block; min-width: 34px; text-align: center;
  padding: 3px 8px; border-radius: 7px;
  font-size: 12px; font-weight: 700; letter-spacing: .5px;
  background: var(--ice); color: var(--accent-dark);
}
.disc--SL { background: #fde4e6; color: #a51b25; }
.disc--GS { background: #dce9fd; color: #10499b; }
.disc--SG { background: #d8f1ee; color: #0d6259; }
.disc--DH { background: #e6e2fb; color: #40308f; }
.disc--AC { background: #fbeed8; color: #8a5a08; }
.disc--PAR { background: #e9e9ee; color: #3c4351; }

/* --------------------------------------------------------- season strip */

.season-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.season-head h2 { margin-bottom: 0; }
.season-pick { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.season-pick a {
  padding: 5px 12px; border-radius: 999px; text-decoration: none;
  border: 1px solid var(--line); color: var(--muted); background: var(--panel); font-size: 14px;
}
.season-pick a.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.strip { padding: 26px 26px 16px; }
.strip__rail {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ice), #c9defa);
  margin: 34px 0 30px;
}
.strip__dot {
  position: absolute; top: 50%;
  width: 18px; height: 18px; margin: -9px 0 0 -9px;
  border-radius: 50%;
  border: 3px solid var(--panel);
  background: var(--accent);
  box-shadow: 0 1px 4px rgba(10, 37, 64, .3);
  cursor: pointer;
  transition: transform .15s ease;
}
.strip__dot:hover, .strip__dot:focus-visible { transform: scale(1.35); outline: none; }
.strip__dot--past { background: #9fb3c8; }
.strip__dot--live { background: var(--gate-red); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(214, 50, 61, .5); }
  50% { box-shadow: 0 0 0 9px rgba(214, 50, 61, 0); }
}
.strip__tip {
  position: absolute; bottom: 22px; transform: translateX(-50%);
  background: var(--night); color: #fff; font-size: 13px;
  padding: 7px 11px; border-radius: 9px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .12s ease;
  z-index: 3;
}
.strip__tip.on { opacity: 1; }
.strip__ends { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }

/* ------------------------------------------------------------- filtering */

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 0 0 6px; }
.chip {
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 14px; cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.filters input[type=search] {
  flex: 1 1 220px; min-width: 180px;
  padding: 8px 13px; font: inherit; font-size: 15px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink);
}
.filters input[type=search]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.filter-note { color: var(--muted); font-size: 14px; margin: 10px 2px 0; }

/* -------------------------------------------------------------- schedule */

.month { margin-top: 22px; }
.month__head {
  display: flex; align-items: center; gap: 12px;
  font-weight: 700; text-transform: capitalize; color: var(--night);
  margin-bottom: 10px;
}
.month__head::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.sched-row {
  display: grid;
  grid-template-columns: 66px 1fr auto;
  gap: 16px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 8px;
  scroll-margin-top: 20px;
  transition: box-shadow .15s ease, transform .15s ease;
}
.sched-row:hover { box-shadow: var(--shadow); transform: translateX(2px); }
.sched-row--past { border-left-color: #a9bccf; opacity: .8; }
.sched-row--live { border-left-color: var(--gate-red); }
.sched-row.flash { animation: flash 1.4s ease; }
@keyframes flash {
  0%, 60% { background: #fff8d8; }
  100% { background: var(--panel); }
}
.date-box {
  text-align: center; background: var(--ice); border-radius: 10px; padding: 6px 4px;
  line-height: 1.1;
}
.date-box b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; color: var(--night); }
.date-box span { font-size: 12px; color: var(--muted); text-transform: uppercase; }
.sched-row h3 { margin: 0 0 3px; font-size: 17px; }
.sched-row h3 a { color: var(--ink); text-decoration: none; }
.sched-row h3 a:hover { color: var(--accent); }
.sched-row .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sched-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.sched-actions .btn { padding: 8px 14px; font-size: 15px; }

/* ----------------------------------------------------------------- cards */

.card-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
  border-top: 3px solid var(--accent);
}
.card h3 { margin: 0 0 6px; font-size: 18px; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--accent); }
.meta { color: var(--muted); font-size: 14px; }

/* ---------------------------------------------------------------- tables */

/* Wide protocols scroll inside their own box; the page itself never scrolls
   sideways on a phone. */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { padding: 9px 11px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: var(--ice); font-weight: 600; color: var(--night); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:hover td { background: #f6faff; }

/* ----------------------------------------------------------------- forms */

form.stacked label { display: block; font-weight: 600; margin-bottom: 4px; }
form.stacked .field { margin-bottom: 16px; }
form.stacked input[type=text], form.stacked input[type=date],
form.stacked input[type=email], form.stacked input[type=password],
form.stacked input[type=number], form.stacked select, form.stacked textarea {
  width: 100%; padding: 10px 12px; font: inherit; font-size: 16px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
form.stacked input:focus, form.stacked select:focus, form.stacked textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}
form.stacked .checkbox { display: flex; gap: 10px; align-items: flex-start; }
form.stacked .checkbox input { margin-top: 4px; }
form.stacked .checkbox label { font-weight: 400; }
.help { color: var(--muted); font-size: 14px; margin-top: 4px; }
.errors { color: #b91c1c; font-size: 14px; margin-top: 4px; }
.msg { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; }
.msg.success { background: #d9f5e6; color: var(--ok); }
.msg.warning { background: #fef3c7; color: var(--warn); }
.msg.error { background: #fee2e2; color: #b91c1c; }

footer.site {
  position: relative;
  color: #b9cfe4; font-size: 14px; text-align: center;
  background: linear-gradient(160deg, var(--night), var(--night-2));
  padding: 46px 20px 26px;
  margin-top: 40px;
}
footer.site::before {
  content: "";
  position: absolute; left: 0; right: 0; top: -1px; height: 24px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 60' preserveAspectRatio='none'%3E%3Cpath fill='%23eef4fa' d='M0 0H1200V16L1080 34L980 14L880 32L780 12L680 34L580 16L480 36L380 14L280 32L180 12L80 30L0 14Z'/%3E%3C/svg%3E") top/100% 100% no-repeat;
}
footer.site a { color: #dbe9f7; }

@media (max-width: 720px) {
  main { padding: 0 14px; }
  h1 { font-size: 23px; }
  .hero { padding: 26px 20px 96px; border-radius: 16px; }
  .hero h1 { font-size: 26px; }
  .hero__peaks svg { height: 130px; }
  /* Two columns on a phone: the date keeps its own column, the actions drop
     to a line of their own. Top-aligned, or a two-line title pushes the date
     box down to the middle of the card. */
  .sched-row { grid-template-columns: 56px 1fr; align-items: start; }
  .sched-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .filters input[type=search] { flex: 1 1 100%; }
  .bar nav { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .hero__snow, .strip__dot--live { animation: none; }
  .btn:hover, .sched-row:hover { transform: none; }
  .sched-row.flash { animation: none; background: #fff8d8; }
}
