/* Event sites: tokens and primitives shared by every template and component.
 *
 * Components (static/components/*.css) and templates (static/sites/*.css) style
 * with the custom properties below and never with literal colors, so the palette
 * pipeline/theming.py derives from the site config -- light or dark -- reaches
 * everything. The page head overrides these fallbacks with that palette and the
 * font pair; what is written here is what a page without a theme block gets: the
 * warm paper of the trail-run reference.
 *
 * Mobile-first: the 390px phone is the base, widened at 600, 900 and 1100px.
 *
 * Two widths up to 1100px: the page's reading width (--page-max: the hero, text
 * sections, the footer) and, from 900px, a wider one for the photo grid and the
 * chips that filter it (--wide-max, 1440px; see "Wide" below). From 1100px, one:
 * the desktop container (site.desktop.css, which
 * the page links for wide windows only, so a phone neither loads it first nor
 * applies it). */

:root {
  color-scheme: light;

  /* Palette (overridden per event) */
  --bg: #f6f5f2;
  --card: #ffffff;
  --border: #e4e2da;
  --border-strong: #d9d7cf;
  --tile: #e9e7df;
  --ink: #1c1b18;
  --body: #464540;
  --muted: #6b6a64;
  --faint: #8a887f;
  --brand: #2d6a4f;
  --brand-hover: #1b4332;
  --brand-hero: #35503f;
  --brand-pale: #d8e4dd;
  --brand-tint: #eaefec;
  --brand-text: #2d6a4f;
  --accent-text: #2d6a4f;
  --on-brand: #ffffff;
  --on-hero: #ffffff;
  --accent: #2d6a4f;
  --on-accent: #ffffff;
  --live: #3fa34d;
  --error: #9a3412;
  --error-bg: #fdeceb;

  /* Fixed, palette-independent surfaces: photo overlays read on any photo. */
  --scrim: rgba(12, 16, 13, 0.5);
  --scrim-strong: rgba(12, 16, 13, 0.72);
  --on-scrim: #ffffff;
  --on-scrim-soft: rgba(255, 255, 255, 0.82);
  --viewer-bg: #101210;
  --viewer-ink: #ffffff;
  --viewer-control: rgba(255, 255, 255, 0.14);
  --viewer-control-hover: rgba(255, 255, 255, 0.24);
  --badge-bg: rgba(0, 0, 0, 0.7);
  --logo-plate: #ffffff;
  --logo-plate-dark: #16181a;
  --on-logo-plate: #16181a;
  /* The results' "This is you" tag on a guest's own face: the Blisk mark on the brand's
     white plate, whatever the palette (BRAND.md: on a photo, a solid plate). */
  --you-plate: #f2f1ec;
  --on-you-plate: #0e0e0f;
  /* The footer's Blisk mark: the brand's black on a light page, its white on a dark one
     (html.mode-dark below), never a palette color (docs/design/blisk-brand/BRAND.md). A
     template whose footer sits on a band of the other kind sets --platform-mark to the
     other of the two on that band: on a dark band, the white mark. */
  --platform-mark-black: #0e0e0f;
  --platform-mark-white: #f2f1ec;
  --platform-mark: var(--platform-mark-black);

  /* Type (the font pair is set per event) */
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Sora", system-ui, sans-serif;
  --heading-weight: 600;
  --heading-case: none;
  --heading-tracking: normal;
  --title-size: 30px;

  /* Shape and rhythm (templates retune these) */
  --gutter: 20px;
  --page-max: 480px;
  --section-gap: 16px;
  --r-card: 14px;
  --r-tile: 10px;
  --r-thumb: 8px;
  --r-control: 12px;
  --r-button: 14px;
  /* The photo grid's columns are fluid: as many as fit tiles at least --tile-min
     wide (never fewer than two), so 2 on a phone, 4 at 1280px, 5 on a wide screen. */
  --tile-min: 160px;
  --gallery-gap: 6px;
  --wide-max: 1440px;
  --results-cols: 3;
  --hero-min: 300px;
}

html.mode-dark { --platform-mark: var(--platform-mark-white); }

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.5 var(--sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  /* anywhere, not break-word: it also lowers what a grid or flex item can shrink to, so a long
     unbroken word (a compound, a hashtag, a name) wraps instead of pushing the page sideways. */
  overflow-wrap: anywhere;
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: var(--heading-weight);
  text-transform: var(--heading-case);
  letter-spacing: var(--heading-tracking);
}
a { color: var(--brand-text); text-decoration: none; }
a:hover { color: var(--brand-hover); }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

.page { max-width: var(--page-max); margin: 0 auto; }
.section { padding: var(--section-gap) var(--gutter); }
.section--tight { padding-top: 8px; padding-bottom: 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.muted { color: var(--muted); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 10; padding: 10px 14px; border-radius: var(--r-control); background: var(--card); color: var(--ink); }
.skip-link:focus { top: 12px; }

/* --- Controls ------------------------------------------------------------ */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--r-button);
  font: 600 17px/1.2 var(--display);
  text-transform: var(--heading-case);
  letter-spacing: var(--heading-tracking);
  cursor: pointer;
  text-align: center;
}
.btn--primary { min-height: 56px; background: var(--brand); color: var(--on-brand); }
.btn--primary:hover { background: var(--brand-hover); color: var(--on-brand); }
.btn--accent { min-height: 56px; background: var(--accent); color: var(--on-accent); }
.btn--accent:hover { color: var(--on-accent); filter: brightness(0.92); }
.btn--outline { min-height: 56px; border: 1px solid var(--brand-text); background: none; color: var(--brand-text); }
.btn--outline:hover { background: var(--brand-tint); color: var(--brand-text); }
.btn--secondary,
.btn--ghost {
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--ink);
  font: 600 14px/1.2 var(--sans);
  text-transform: none;
  letter-spacing: normal;
}
.btn--ghost { min-height: 46px; border-radius: var(--r-control); }
.btn--secondary:hover,
.btn--ghost:hover { background: var(--bg); color: var(--ink); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.6; cursor: default; }

.iconbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  background: var(--card);
  color: var(--ink);
}
.iconbtn:hover { color: var(--ink); background: var(--bg); }

.card {
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
}

.block-title { margin: 0 0 10px; font-size: 15px; line-height: 1.3; color: var(--ink); }

.label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 10px;
}

.empty { padding: 32px var(--gutter); text-align: center; color: var(--muted); }

.notice {
  margin: 0 var(--gutter) 8px;
  padding: 12px 14px;
  border-radius: var(--r-control);
  background: var(--brand-tint);
  font-size: 14px;
  color: var(--body);
}
.notice--error { background: var(--error-bg); color: var(--error); }

.live { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; color: var(--muted); }
.live__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); flex: none; }


/* A private preview says so, above everything, and scrolls away. */
.preview-banner {
  margin: 0;
  padding: 8px var(--gutter);
  background: var(--ink);
  color: var(--bg);
  font: 600 13px/1.4 var(--sans);
  text-align: center;
}

/* Error pages render with these tokens only. */
.error-page { padding: 64px var(--gutter); text-align: center; }
.error-page h1 { margin: 0 0 8px; font-size: 28px; }
/* With no event's palette to follow, an error page follows the visitor's light or dark
   setting: on dark, the Blisk kit's dark surface (black ground, white text, Grey 400). */
@media (prefers-color-scheme: dark) {
  html.error-root { color-scheme: dark; --bg: #0e0e0f; --ink: #f2f1ec; --body: #d6d5cf; --muted: #a3a29c; }
}

@media (min-width: 600px) {
  :root { --gutter: 24px; --page-max: 720px; --gallery-gap: 8px; --results-cols: 3;
          --hero-min: 320px; --title-size: 34px; }
}

@media (min-width: 900px) {
  :root { --gutter: 32px; --page-max: 1000px; --gallery-gap: 10px;
          --tile-min: clamp(200px, 19vw, 240px); --results-cols: 4;
          --hero-min: 360px; --title-size: 40px; }
  .stack { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }

  /* Wide: the gallery (c.gallery) and the chips over it (c.moments, c.sessions) grow
     past the page's reading width to --wide-max, centred on their section, which
     is centred on the page: never narrower than that section, and keeping the
     page's gutter (at least 12px, more than a scrollbar takes from 100vw) at the
     window's edges. A template that sets a gallery in a column of its own keeps it
     there with --wide-max: 0 on the section. */
  .gallery, .moments, .sessions {
    --wide-w: max(100%, min(var(--wide-max), 100vw) - 2 * max(var(--gutter), 12px));
    width: var(--wide-w);
    max-width: none;
    margin-left: calc((100% - var(--wide-w)) / 2);
    margin-right: calc((100% - var(--wide-w)) / 2);
  }
}
