/* ==========================================================================
   HOGLINE — "Night Ice" design system
   One stylesheet. No frameworks. The house rings are the brand.
   ========================================================================== */

@font-face {
  font-family: "Barlow Condensed";
  src: url("/assets/fonts/barlow-condensed-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Barlow Condensed";
  src: url("/assets/fonts/barlow-condensed-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* --- night ice palette --- */
  --ice-0: #070b12;            /* rink at lights-out */
  --ice-1: #0b1220;            /* page background */
  --ice-2: #101a2c;            /* raised surface */
  --ice-3: #16233b;            /* hover surface */
  --frost: #e8eef7;            /* primary text */
  --frost-dim: #93a3ba;        /* secondary text */
  --frost-faint: #5b6b84;      /* hints, meta */
  --hairline: rgba(148, 190, 255, 0.14);
  --hairline-strong: rgba(148, 190, 255, 0.28);

  /* --- the house --- */
  --house-blue: #2f6fc2;       /* 12-foot ring */
  --house-blue-hi: #7db3ef;
  --house-red: #d8432f;        /* 4-foot ring — hammer, LIVE, danger */
  --button-white: #f4f7fb;     /* the button (center) */
  --sweep-cyan: #63d7e6;       /* skip's broom tape — focus & live accents */

  /* --- type --- */
  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-body: Seravek, "Gill Sans Nova", Ubuntu, Calibri, "DejaVu Sans", source-sans-pro, sans-serif;

  --radius: 10px;
  --radius-lg: 16px;
  --pad: 1rem;
  --speed: 180ms;
}

/* --- reset-ish --- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--frost);
  background:
    /* pebble: the droplet texture flooded onto every sheet before play */
    radial-gradient(rgba(180, 214, 255, 0.028) 1px, transparent 1.3px),
    radial-gradient(rgba(180, 214, 255, 0.018) 1px, transparent 1.3px),
    /* cold glow falling from the arena lights */
    radial-gradient(80rem 40rem at 50% -12rem, rgba(47, 111, 194, 0.16), transparent 60%),
    linear-gradient(var(--ice-1), var(--ice-0) 85%);
  background-size: 22px 22px, 22px 22px, auto, auto;
  background-position: 0 0, 11px 11px, 0 0, 0 0;
  background-attachment: fixed;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.015em;
  line-height: 1.1;
  margin: 0 0 0.6em;
  text-wrap: balance;
}
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); text-transform: uppercase; }
h2 { font-size: 1.35rem; text-transform: uppercase; color: var(--frost-dim); }

a { color: var(--sweep-cyan); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code { color: var(--sweep-cyan); background: var(--ice-2); padding: 0.1em 0.4em; border-radius: 6px; }
.muted { color: var(--frost-dim); }

:focus-visible {
  outline: 2px solid var(--sweep-cyan);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ==========================================================================
   Brand — the house, drawn in pure CSS
   ========================================================================== */
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--frost); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 50%;
  background:
    radial-gradient(circle,
      var(--button-white) 0 18%,          /* the button */
      var(--house-red) 18% 40%,           /* four-foot */
      var(--ice-2) 40% 52%,               /* eight-foot */
      var(--house-blue) 52% 88%,          /* twelve-foot */
      transparent 88%);
  box-shadow: 0 0 0 1px var(--hairline), 0 0 18px rgba(47, 111, 194, 0.35);
  flex: none;
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
/* the hog line itself: a red rule the brand sits behind */
.topbar {
  display: flex; align-items: center; gap: 1.75rem;
  padding: 0.8rem 1.5rem;
  background: color-mix(in srgb, var(--ice-1) 82%, transparent);
  border-bottom: 1px solid var(--hairline);
  position: sticky; top: 0; backdrop-filter: blur(10px); z-index: 10;
}
.topbar::after {
  content: "";
  position: absolute; inset: auto 0 -1px 0; height: 2px;
  background: linear-gradient(90deg, var(--house-red) 0 5.5rem, transparent 5.5rem);
  opacity: 0.9;
}

.topnav { display: flex; gap: 1.4rem; flex: 1; }
.topnav a {
  font-family: var(--font-display);
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--frost-dim);
  padding: 0.2rem 0;
  border-bottom: 2px solid transparent;
}
.topnav a:hover { color: var(--frost); text-decoration: none; border-bottom-color: var(--sweep-cyan); }
.logout-form { margin: 0; }

/* ==========================================================================
   Layout
   ========================================================================== */
.page { max-width: 64rem; margin: 0 auto; padding: 2.25rem 1.5rem 4rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head h1 { margin: 0; }

.centered {
  display: grid; place-items: center;
  min-height: 100dvh; padding: 1.5rem;
}

.card {
  background: linear-gradient(180deg, var(--ice-2), color-mix(in srgb, var(--ice-2) 70%, var(--ice-1)));
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.8);
  animation: glide-in 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes glide-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ==========================================================================
   Buttons — big enough for cold hands
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 1.02rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--frost);
  background: var(--ice-3);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
  padding: 0.6rem 1.25rem;
  min-height: 44px;
  cursor: pointer;
  transition: transform var(--speed), box-shadow var(--speed), background var(--speed);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); background: color-mix(in srgb, var(--ice-3) 80%, var(--house-blue)); }
.btn:active { transform: translateY(0) scale(0.99); }
.btn-primary {
  background: linear-gradient(180deg, var(--house-blue), color-mix(in srgb, var(--house-blue) 75%, #0b1220));
  border-color: color-mix(in srgb, var(--house-blue) 60%, white 10%);
  box-shadow: 0 10px 24px -12px rgba(47, 111, 194, 0.8);
}
.btn-primary:hover { background: linear-gradient(180deg, color-mix(in srgb, var(--house-blue) 85%, white), var(--house-blue)); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--frost-dim); }
.btn-ghost:hover { color: var(--frost); background: var(--ice-2); }

/* ==========================================================================
   Forms
   ========================================================================== */
.stack { display: flex; flex-direction: column; gap: 0.45rem; }
.stack label {
  font-family: var(--font-display);
  text-transform: uppercase; letter-spacing: 0.12em;
  font-size: 0.86rem; color: var(--frost-dim);
  margin-top: 0.8rem;
}
.stack input {
  font: inherit; color: var(--frost);
  background: var(--ice-1);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
  padding: 0.65rem 0.85rem;
  min-height: 44px;
  transition: border-color var(--speed), box-shadow var(--speed);
}
.stack input:focus {
  outline: none;
  border-color: var(--sweep-cyan);
  box-shadow: 0 0 0 3px rgba(99, 215, 230, 0.18);
}
.stack .btn { margin-top: 1.3rem; }
.form-narrow { max-width: 26rem; }
.form-error {
  color: #ffb4a8;
  background: color-mix(in srgb, var(--house-red) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--house-red) 45%, transparent);
  border-left: 3px solid var(--house-red);
  border-radius: var(--radius);
  padding: 0.65rem 0.9rem;
}

/* ==========================================================================
   Login
   ========================================================================== */
.login-card { width: min(24rem, 100%); text-align: center; }
.login-brand { justify-content: center; }
.login-brand .brand-mark { width: 54px; height: 54px; }
.login-brand .brand-name { font-size: 2.1rem; }
.tagline { color: var(--frost-faint); margin-top: 0.2rem; letter-spacing: 0.02em; }
.login-card form { text-align: left; }

/* ==========================================================================
   Tables — scoreboard bones
   ========================================================================== */
.table { width: 100%; border-collapse: collapse; }
.table th {
  font-family: var(--font-display);
  font-weight: 600; font-size: 0.88rem;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--frost-faint);
  text-align: left; padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--hairline-strong);
}
.table td { padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--hairline); font-variant-numeric: tabular-nums; }
.table tbody tr { transition: background var(--speed); }
.table tbody tr:hover { background: color-mix(in srgb, var(--ice-3) 55%, transparent); }
.empty-state { color: var(--frost-faint); padding: 2.5rem 0; text-align: center; font-style: italic; }

/* ==========================================================================
   Badges — event status
   ========================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--font-display);
  font-size: 0.82rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
  padding: 0.18rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--hairline-strong);
  color: var(--frost-dim);
}
.badge-published { color: var(--sweep-cyan); border-color: color-mix(in srgb, var(--sweep-cyan) 45%, transparent); }
.badge-completed { color: var(--frost-faint); }
.badge-live {
  color: #ffd9d2;
  background: color-mix(in srgb, var(--house-red) 25%, transparent);
  border-color: color-mix(in srgb, var(--house-red) 60%, transparent);
}
.badge-live::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--house-red);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(216, 67, 47, 0.5); }
  50% { opacity: 0.6; box-shadow: 0 0 0 5px rgba(216, 67, 47, 0); }
}

/* ==========================================================================
   Dashboard
   ========================================================================== */
.stat-row { display: flex; gap: 1rem; flex-wrap: wrap; margin: 1.5rem 0; }
.stat { display: flex; flex-direction: column; min-width: 9rem; padding: 1.1rem 1.4rem; }
.stat-value {
  font-family: var(--font-display);
  font-size: 3rem; font-weight: 600; line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--button-white);
}
.stat-label {
  text-transform: uppercase; letter-spacing: 0.16em;
  font-size: 0.8rem; color: var(--frost-faint); margin-top: 0.35rem;
}

.meta { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1.6rem; margin: 0 0 2rem; }
.meta dt {
  font-family: var(--font-display);
  text-transform: uppercase; letter-spacing: 0.12em;
  font-size: 0.86rem; color: var(--frost-faint); padding-top: 0.1rem;
}
.meta dd { margin: 0; }

/* ==========================================================================
   Error page
   ========================================================================== */
.error-card { width: min(22rem, 100%); text-align: center; }
.error-status {
  font-family: var(--font-display);
  font-size: 4.5rem; font-weight: 600; line-height: 1;
  margin: 0;
  color: var(--house-red);
  text-shadow: 0 0 34px rgba(216, 67, 47, 0.35);
}
.error-message { color: var(--frost-dim); margin: 0.6rem 0 1.4rem; }

/* ==========================================================================
   Portals — one hand, one glove, one glance
   ========================================================================== */
.portal .page { max-width: 30rem; }
.portal-head {
  display: flex; align-items: center; gap: 0.9rem;
  padding: 1.2rem 1.5rem 1rem;
  border-bottom: 1px solid var(--hairline);
}
.portal-head .brand-mark { width: 42px; height: 42px; }
.portal-role {
  font-family: var(--font-display);
  text-transform: uppercase; letter-spacing: 0.2em;
  font-size: 0.85rem; margin: 0;
}
.portal-event { font-size: 1.45rem; margin: 0; }

/* each role wears its own colour on the hog line */
.portal-head { position: relative; }
.portal-head::after {
  content: ""; position: absolute; inset: auto 0 -1px 0; height: 3px;
}
.portal-scorer .portal-head::after  { background: var(--house-blue); }
.portal-scorer .portal-role        { color: var(--house-blue-hi, #7db3ef); }
.portal-timer .portal-head::after   { background: var(--sweep-cyan); }
.portal-timer .portal-role          { color: var(--sweep-cyan); }
.portal-team .portal-head::after    { background: var(--button-white); }
.portal-team .portal-role           { color: var(--frost); }
.portal-sponsor .portal-head::after { background: #d9a53f; }
.portal-sponsor .portal-role        { color: #e6bb62; }
.portal-player .portal-head::after  { background: var(--house-red); }
.portal-player .portal-role         { color: #f08a7a; }

/* ==========================================================================
   Management console
   ========================================================================== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
@media (max-width: 46rem) { .grid-2 { grid-template-columns: 1fr; } }
.head-actions { display: flex; align-items: center; gap: 0.75rem; }

.card + .card, .grid-2 + .card, .card + form { margin-top: 1rem; }

.inline-form {
  display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: end;
  margin-top: 1rem;
}
.inline-form input, .inline-form select,
.stack select {
  font: inherit; color: var(--frost);
  background: var(--ice-1);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
  padding: 0.55rem 0.75rem;
  min-height: 44px;
}
.inline-form input:focus, .inline-form select:focus, .stack select:focus {
  outline: none; border-color: var(--sweep-cyan);
  box-shadow: 0 0 0 3px rgba(99, 215, 230, 0.18);
}
.inline-form label {
  display: flex; flex-direction: column; gap: 0.3rem;
  font-family: var(--font-display);
  font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--frost-dim);
}

.chip-list { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; margin: 0.6rem 0; }
.chip {
  font-family: var(--font-display); font-weight: 600; letter-spacing: 0.08em;
  background: var(--ice-3); border: 1px solid var(--hairline-strong);
  border-radius: 999px; padding: 0.25rem 0.9rem;
}
.team-list { list-style: none; padding: 0; margin: 0.6rem 0; display: flex; flex-direction: column; gap: 0.35rem; }

.draw-block { border-top: 1px solid var(--hairline); margin-top: 1.25rem; padding-top: 1rem; }
.draw-block:first-of-type { border-top: 0; margin-top: 0.5rem; padding-top: 0; }
.draw-title { margin-bottom: 0.4rem; }
.score-cell { font-family: var(--font-display); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0.06em; }
.row-actions { text-align: right; }
.btn-danger { color: #f2988a; }
.btn-danger:hover { color: #ffd9d2; background: color-mix(in srgb, var(--house-red) 22%, transparent); }

/* ==========================================================================
   Linescore — the heart of the thing
   ========================================================================== */
.linescore { margin: 1rem 0; }
.linescore .team-col { text-align: left; min-width: 9rem; }
.linescore .end-col { text-align: center; width: 2.2rem; color: var(--frost); }
.linescore thead .end-col, .linescore thead .total-col { color: var(--frost-faint); }
.linescore .total-col {
  text-align: center; width: 3.2rem;
  font-family: var(--font-display); font-weight: 600; font-size: 1.15rem;
  color: var(--button-white);
  border-left: 1px solid var(--hairline-strong);
}
.hammer { color: #e6bb62; font-size: 0.85em; }
.score-entry .stack input, .score-entry .stack select { font-size: 1.15rem; }

/* ==========================================================================
   Portal token issue / QR
   ========================================================================== */
.new-link {
  display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap;
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--radius);
  padding: 1rem; margin: 1rem 0;
  background: color-mix(in srgb, var(--house-blue) 8%, transparent);
}
.qr-wrap svg { display: block; border-radius: 8px; }
.new-link-role {
  font-family: var(--font-display); text-transform: uppercase;
  letter-spacing: 0.12em; font-weight: 600; margin: 0 0 0.3rem;
}
.wrap-anywhere { overflow-wrap: anywhere; }

/* ==========================================================================
   Scorer portal cards + public board
   ========================================================================== */
.game-card { display: block; color: inherit; margin-bottom: 0.9rem; }
.game-card:hover { text-decoration: none; border-color: var(--hairline-strong); transform: translateY(-1px); }
.game-card-head { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; }
.game-card-teams { display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; font-size: 1.1rem; }
.game-card-teams .score-cell { font-size: 1.5rem; }

.board-page .page { max-width: 46rem; }
.board-live-badge { margin-left: auto; }
.board-card { margin-bottom: 1rem; overflow-x: auto; }
.badge-in_progress {
  color: #ffd9d2;
  background: color-mix(in srgb, var(--house-red) 25%, transparent);
  border-color: color-mix(in srgb, var(--house-red) 60%, transparent);
}
.badge-in_progress::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--house-red);
  animation: pulse 1.6s ease-in-out infinite;
}

/* ==========================================================================
   Motion discipline
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 40rem) {
  .topbar { padding: 0.7rem 1rem; gap: 1rem; }
  .topnav { gap: 1rem; }
  .page { padding: 1.5rem 1rem 3rem; }
  .meta { grid-template-columns: 1fr; gap: 0.1rem; }
  .meta dt { margin-top: 0.7rem; }
}
