/* PopiCon shared token base, loaded first by every host (public, admin, registration, kiosk).
   Source: the 07-01 design system,
   .planning/features/v02/07-design-system-and-palettes/artifacts/07-01-design-system-and-presets.html
   0. Fonts  1. Structural tokens  2. Default color tokens  3. Reset and base  4. Base primitives.
   Rule: color literals appear only in the --pc-color-* and --pc-shadow-* definitions below
   (enforced by DesignTokenGuardTests). Everything else reads var(--pc-*). The published palette
   (admin /palettes) is emitted after this file by <PaletteStyle /> and overrides the color tokens,
   so a palette change is one admin click and a font change is one line here. */

/* 0. Fonts: self-hosted (no font CDN), licence in ../fonts/OFL.txt. A browser downloads a face
   only when an element uses it, so the staff hosts never fetch Knewave. */
@font-face { font-family: "Knewave"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/knewave-400.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/poppins-600.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/poppins-700.woff2") format("woff2"); }

/* 1. Structural tokens */
:root {
  /* Display face: public wordmark, hero and public headings at 24px and up only. Knewave has
     weight 400 only, so display text always sets font-weight: 400 (no synthetic bold). */
  --pc-font-display: "Knewave", "Permanent Marker", "Arial Black", sans-serif;
  /* Labels: buttons, nav, kickers, dates. Staff hosts read --pc-font-heading, so they get Poppins. */
  --pc-font-label: "Poppins", "Helvetica Neue", Arial, sans-serif;
  --pc-font-heading: var(--pc-font-label);
  --pc-font-body: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --pc-font-mono: ui-monospace, Menlo, Consolas, monospace;

  --pc-text-sm: 0.875rem;
  --pc-text-base: 1rem;
  --pc-text-lg: 1.25rem;
  --pc-text-xl: 1.5rem;
  --pc-text-2xl: 2rem;
  --pc-text-3xl: clamp(2.5rem, 1.5rem + 4vw, 4.5rem);
  --pc-leading: 1.5;
  --pc-tracking-label: 0.06em;

  --pc-radius-sm: 3px;
  --pc-radius-md: 6px;
  --pc-radius-lg: 10px;
  --pc-radius-pill: 999px;
  --pc-border-width: 2px;
  --pc-border-width-thick: 4px;
  --pc-offset: 5px; /* hard offset shadow on game-box tiles and cards */

  --pc-space-1: 0.25rem;
  --pc-space-2: 0.5rem;
  --pc-space-3: 0.75rem;
  --pc-space-4: 1rem;
  --pc-space-5: 1.5rem;
  --pc-space-6: 2rem;
  --pc-space-7: 3rem;
  --pc-space-8: 4rem;

  --pc-target: 2.75rem; /* 44px minimum touch target */
  --pc-container: 80rem;
  --pc-focus-width: 3px;
  --pc-focus-offset: 3px;
  /* Elements with a hard offset shadow move the ring past the shadow, so the ring sits on the
     page background instead of on the shadow (TD-033 b). */
  --pc-focus-offset-shadow: calc(var(--pc-offset) + var(--pc-focus-offset));
}

/* 2. Default color tokens = the popicon-tte preset (PalettePresets.cs; TokenDefaults_EqualTheTtePreset) */
:root {
  color-scheme: light;
  --pc-color-bg: #ffffff;
  --pc-color-bg-alt: #fafafa;
  --pc-color-surface: #fafafa;
  --pc-color-text: #000000;
  --pc-color-text-muted: #595959;
  --pc-color-primary: #2a6496;
  --pc-color-on-primary: #ffffff;
  --pc-color-accent: #d52716;
  --pc-color-on-accent: #ffffff;
  --pc-color-link: #2a6496;
  --pc-color-border: #8a8a8a;
  --pc-color-border-subtle: #eeeeee;
  --pc-color-focus: #240392;
  --pc-color-ok: #146c2e;
  --pc-color-warn: #8a5a00;
  --pc-color-danger: #b42318;
  /* Fixed structural colors that never follow a palette: QR codes, a camera preview, logo plates,
     the dragon icon square and the modal scrim. The title shadow is the PopiCon banner color on every
     palette (organizers 2026-10-24: the banner color, not the primary). */
  --pc-color-title-shadow: #fbd021;
  --pc-color-qr-bg: #ffffff;
  --pc-color-qr-ink: #000000;
  --pc-color-camera-bg: #000000;
  --pc-color-logo-bg: #ffffff;
  --pc-color-scrim: color-mix(in srgb, #000000 55%, transparent);
  --pc-shadow-sm: 0 0 0 1px color-mix(in srgb, var(--pc-color-border) 30%, transparent);
  --pc-shadow-md: 0 4px 16px color-mix(in srgb, var(--pc-color-border) 28%, transparent);
}

/* 3. Reset and base */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--pc-color-bg); color: var(--pc-color-text); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--pc-font-body);
  font-size: var(--pc-text-base);
  line-height: var(--pc-leading);
  background: var(--pc-color-bg);
  color: var(--pc-color-text);
}
h1, h2, h3 { font-family: var(--pc-font-heading); line-height: 1.2; margin: 0; }
h1 { font-size: min(calc(1.375rem + 1.5vw), 2.5rem); }
h2 { font-size: min(calc(1.325rem + 0.9vw), 2rem); }
h3 { font-size: min(calc(1.3rem + 0.6vw), 1.75rem); }
h4 { font-size: min(calc(1.275rem + 0.3vw), 1.5rem); }
h1, h2, h3, h4, h5, h6 { color: var(--pc-color-text); }
/* Blazor FocusOnNavigate moves focus to the h1 for screen readers; no ring for that programmatic focus. */
h1[tabindex="-1"]:focus, main[tabindex="-1"]:focus { outline: none; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: var(--pc-color-link); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
[hidden] { display: none !important; }

:focus-visible {
  outline: var(--pc-focus-width) solid var(--pc-color-focus);
  outline-offset: var(--pc-focus-offset);
}

/* Links inside running text are underlined, not identified by color alone (WCAG 1.4.1). */
main p a, main li a { text-decoration: underline; }

/* 4. Base primitives */
.pc-container { width: 100%; max-width: var(--pc-container); margin-inline: auto; padding-inline: var(--pc-space-4); }
.pc-section { padding-block: var(--pc-space-6); }
.pc-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;
}
/* Form honeypot: off screen for people, still in the form for bots. */
.pc-hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

.pc-skip {
  position: absolute; left: var(--pc-space-3); top: -4rem; z-index: 100;
  min-height: var(--pc-target); display: inline-flex; align-items: center;
  padding: 0 var(--pc-space-5);
  background: var(--pc-color-primary); color: var(--pc-color-on-primary);
  font-family: var(--pc-font-label); font-weight: 700; border-radius: var(--pc-radius-sm); text-decoration: none;
}
.pc-skip:focus { top: var(--pc-space-3); }

/* Buttons: square-cornered blocks with a text-colored border; the primary one carries a hard offset shadow. */
.pc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--pc-space-2);
  min-height: var(--pc-target); min-width: var(--pc-target); padding: var(--pc-space-2) var(--pc-space-5);
  font: 700 var(--pc-text-base)/1.2 var(--pc-font-label); text-transform: uppercase; letter-spacing: var(--pc-tracking-label);
  text-align: center; text-decoration: none; cursor: pointer;
  color: var(--pc-color-text); background: var(--pc-color-surface);
  border: var(--pc-border-width) solid var(--pc-color-text); border-radius: var(--pc-radius-sm);
}
.pc-btn:hover { text-decoration: underline; text-underline-offset: 0.2em; }
.pc-btn--primary { background: var(--pc-color-primary); color: var(--pc-color-on-primary); box-shadow: 3px 3px 0 var(--pc-color-text); }
.pc-btn--primary:focus-visible { outline-offset: var(--pc-focus-offset-shadow); }

/* Staff header (kiosk) */
.pc-header { background: var(--pc-color-bg); border-bottom: var(--pc-border-width) solid var(--pc-color-border); }
.pc-header__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--pc-space-3); min-height: 4rem; }
.pc-wordmark { display: inline-flex; align-items: center; min-height: var(--pc-target); font-family: var(--pc-font-heading); font-weight: 800; font-size: var(--pc-text-lg); color: var(--pc-color-text); text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .pc-btn { border: 2px solid CanvasText; }
}

/* Blazor's error bar, shown by blazor.web.js when a circuit fails. */
#blazor-error-ui { display: none; position: fixed; inset-inline: 0; bottom: 0; z-index: 1000; padding: var(--pc-space-3) var(--pc-space-5); background: var(--pc-color-surface); color: var(--pc-color-text); border-top: 2px solid var(--pc-color-danger); }
#blazor-error-ui .dismiss { position: absolute; right: var(--pc-space-4); top: var(--pc-space-3); cursor: pointer; }
