/* Self-hosted so the share-image canvas draws with them (and nothing loads from a third party). */
@font-face { font-family: "Alfa Slab One"; font-weight: 400; font-display: swap; src: url(fonts/alfa-slab-one-400.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url(fonts/barlow-400.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url(fonts/barlow-500.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url(fonts/barlow-600.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url(fonts/barlow-condensed-600.woff2) format("woff2"); }
/* RSS Panthers: black, white and the logo's red; slab type after the wordmark. Single centred widget, arrows step through the season. */
:root {
  --floor: #0b0b0b;
  --card: #171717;
  --line: #2b2b2b;
  --ink: #ffffff;
  --muted: #a3a3a3;
  --plate: #ffffff;                         /* white tile behind crests, so every logo shows */
  --glow-home: rgba(227, 36, 43, .55);      /* neon glow around the frames */
  --glow-away: rgba(255, 255, 255, .35);
  --frame-home: var(--red);                 /* Panthers' tile */
  --frame-away: #ffffff;
  --red: #e3242b;        /* the panther's red, from the club logo */
  --win: #4fc27a;
  --loss: #4a4a4a;
  --slab: "Alfa Slab One", Rockwell, Georgia, serif;   /* echoes the PANTHERS wordmark */
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Barlow", "Helvetica Neue", Arial, sans-serif;
  /* The widget never scrolls: sizes follow the window height (dvh; vh where dvh is unknown) and
     shrink on short screens, down to about 560px tall. */
  --tile: clamp(72px, 13.5vh, 112px);
  --tile: clamp(72px, 13.5dvh, 112px);
  --gap: clamp(8px, 1.8vh, 16px);
  --gap: clamp(8px, 1.8dvh, 16px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: var(--floor);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.4;
  padding: clamp(10px, 2.5vh, 24px) 16px;
  padding: clamp(10px, 2.5dvh, 24px) 16px;
}
/* minmax(0, 1fr): the one-row chip list must not widen the column to fit all its chips. */
.wrap { max-width: 420px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); }

header { display: flex; align-items: center; justify-content: center; gap: 12px; position: relative; }
/* The club logo: 136px on a tall window, shrinking quickly with the height (tile 112px → 136px,
   72px → 48px) so the page still fits; on phone-width screens at most 72px. */
.crest { width: clamp(48px, calc((var(--tile) - 72px) * 2.2 + 48px), 136px); height: auto; aspect-ratio: 1; display: block; }
@media (max-width: 480px) {
  .crest { width: clamp(48px, calc((var(--tile) - 72px) * .6 + 48px), 72px); }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.chip {
  font: 600 13px/1 var(--body); color: var(--muted); background: transparent;
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; cursor: pointer;
}
.chip[aria-pressed="true"] { color: var(--ink); background: var(--red); border-color: var(--red); }
/* One row of chips; the rest open from "Lisää" in a panel over the card. */
.filters { position: relative; min-width: 0; }
/* The padding (and matching negative margin) leaves room for the focus ring inside overflow: hidden. */
.chip-row { display: flex; gap: 8px; flex-wrap: nowrap; overflow: hidden; padding: 4px; margin: -4px; }
.chip { flex: none; white-space: nowrap; }
.chip-more { display: inline-flex; gap: 6px; align-items: center; }
.chip-more[aria-expanded="true"] { color: var(--ink); border-color: var(--muted); }
.more-panel {
  position: absolute; z-index: 5; top: calc(100% + 8px); left: 0; right: 0;
  display: flex; flex-wrap: wrap; gap: 8px; padding: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .55);
}
.more-panel[hidden] { display: none; }

.card {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  /* Roomy inside; shrinks with the window height like everything else. */
  padding: clamp(22px, calc(var(--gap) * 2.25), 36px) 28px; display: grid; gap: calc(var(--gap) * 1.6);
  border-top: 4px solid var(--red);
}
.card::before {
  content: ""; position: absolute; inset: 0 0 auto auto; width: 140px; height: 140px;
  background: repeating-linear-gradient(135deg, var(--red) 0 10px, transparent 10px 22px);
  opacity: .12; transform: translate(40px, -40px) rotate(0deg); pointer-events: none;
}
/* Always as tall as a two-line series chip (12px × 1.2 × 2 + 12px padding), so a long series such as
   "U14 POJAT VALKOINEN A/B SS" does not make this card taller than the next one. */
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 41px; }
.top-right { display: flex; align-items: center; gap: 6px; position: relative; } /* above the corner stripes */
.share-btn {
  width: 32px; height: 32px; margin: -6px -8px -6px 0; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer;
}
.share-btn:hover { color: var(--ink); background: var(--line); }
.state {
  font: 600 12px/1.2 var(--body); text-transform: uppercase; letter-spacing: .1em; color: var(--red);
  width: min-content; /* one word per line: "URHEILUTALOLLA / PELATAAN" always on two lines */
}
.series {
  font: 600 12px/1.2 var(--body); color: var(--ink); background: var(--line); border-radius: 6px; padding: 6px 8px;
  text-align: right;
}

.when { display: flex; align-items: baseline; gap: 14px; }
.date { font: 400 calc(var(--tile) * .36)/1 var(--slab); text-transform: uppercase; }
.time { font: 600 calc(var(--tile) * .29)/1 var(--display); color: var(--red); font-variant-numeric: tabular-nums; }

/* Sides align at the top so both logo tiles sit on one line even when a name wraps to two lines;
   vs / score is centred on the tiles, not on the taller block. */
.teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 10px; }
.teams > .vs, .teams > .score { height: var(--tile); display: grid; place-items: center; }
.side { display: grid; justify-items: center; gap: 8px; text-align: center; }
/* Both crests sit on equal white tiles whose frames glow like neon: red (home), white (away). */
.slot { height: var(--tile); display: grid; place-items: center; }
.plate {
  display: grid; place-items: center; border-radius: calc(var(--tile) * .16);
  background: var(--plate); border: 3px solid var(--frame-away);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .4), 0 0 calc(var(--tile) * .2) var(--glow-away);
}
.plate { width: var(--tile); height: var(--tile); }
/* The red frame and glow always mark Panthers, on whichever side it plays. */
.plate.panthers {
  border-color: var(--frame-home);
  box-shadow: 0 0 0 1px rgba(227, 36, 43, .5), 0 0 calc(var(--tile) * .2) var(--glow-home);
}
.plate img { display: block; width: calc(var(--tile) * .8); height: calc(var(--tile) * .8); object-fit: contain; }
/* Always two lines tall, so the card keeps its height whether a name wraps or not. */
.team { font: 400 17px/1.1 var(--slab); text-transform: uppercase; text-wrap: balance; min-height: 2.2em; }
.vs { font: 600 14px/1 var(--body); color: var(--muted); }
.score {
  font: 400 38px/1 var(--slab); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.result {
  justify-self: center; font: 600 12px/1 var(--body); text-transform: uppercase; letter-spacing: .08em;
  padding: 6px 8px; border-radius: 6px; color: var(--floor);
}
.result.w { background: var(--win); } .result.l { background: var(--loss); color: var(--ink); } .result.d { background: var(--muted); }

/* Venue, and the ticket link on the same line: a game with tickets is no taller than one without.
   The row is as tall as the link, so it does not grow when one appears. */
.foot-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 34px; }
.venue { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 14px; min-width: 0; }
.tickets {
  flex: none; font: 600 14px/1 var(--body); color: var(--ink); text-decoration: none;
  background: var(--red); border-radius: 999px; padding: 10px 14px;
}
.tickets:hover { filter: brightness(1.1); }
.venue svg { flex: none; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  font: 600 15px/1 var(--body); border-radius: 10px; padding: 12px 14px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--ink); text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn.primary { background: var(--red); border-color: var(--red); color: var(--ink); flex: 1; justify-content: center; }
.btn:disabled { opacity: .6; cursor: default; }
.btn:hover { border-color: var(--red); }
.btn.primary:hover { filter: brightness(1.1); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

.nav { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.nav .pos { text-align: center; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.arrow {
  width: clamp(36px, calc(var(--tile) * .4), 44px); height: clamp(36px, calc(var(--tile) * .4), 44px);
  border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); font-size: 20px; cursor: pointer;
}
.arrow:disabled { opacity: .35; cursor: default; }

dialog {
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 18px;
  padding: 16px; width: min(440px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(0,0,0,.7); }
.dlg { display: grid; gap: 12px; }
.dlg h2 { margin: 0; font: 400 22px/1 var(--slab); text-transform: uppercase; }
.dlg img { width: 100%; border-radius: 10px; border: 1px solid var(--line); display: block; }
.dlg .preview { max-height: 60vh; overflow: auto; }
.dlg p { margin: 0; color: var(--muted); font-size: 13px; }
.formats { display: flex; gap: 8px; }

.tags { margin: 0; text-align: center; font: 600 15px/1.4 var(--body); color: var(--ink); }
.foot { margin: 0; color: var(--muted); font-size: 12px; text-align: center; }
@media (prefers-reduced-motion: no-preference) {
  .card { transition: opacity .15s; }
  .card.swap { opacity: .4; }
}
.notice { color: var(--muted); text-align: center; margin: 0; }
.notice.error { color: var(--ink); }
.badge {
  position: absolute; top: 0; right: 0; font: 600 11px/1 var(--body); text-transform: uppercase; letter-spacing: .08em;
  border: 1px dashed var(--muted); color: var(--muted); border-radius: 999px; padding: 6px 9px;
}
