/*
 * The einlass.digital theme over Blazor Blueprint.
 *
 * Tokens copied from docs/brand-guide.md, not from memory. If brand direction changes, re-sync that
 * document from the Claude Design project and update these from it.
 *
 * Loaded after blazorblueprint.css. Blueprint's own rules live in cascade layers, so everything
 * unlayered here wins over them regardless of specificity — that is what lets a `class` on a
 * Blueprint component restyle it. Element defaults go into `@layer base` on purpose: unlayered,
 * `h1 { color: ink }` would beat every utility and make the heading on the dark hero invisible.
 *
 * The scanner's status colours are deliberately NOT in this file. They are reserved for the gate and
 * live in Einlass.Digital.Web.Gate; BrandRulesTests fails the build if one appears anywhere else.
 */

:root {
  --brand-50: #e3f2ea;
  --brand-500: #0a7a4c;
  --brand-700: #075c39;

  --ink-900: #101512;
  --ink-600: #4a544d;
  --ink-450: #5a645c; /* labels on surface-2 */
  --ink-400: #69736b; /* only on card / surface */

  --hairline: #c3ccc6; /* lines only, never text */
  --surface: #f5f8f6;
  --surface-2: #e7ede9;
  --card-white: #ffffff;
  --on-brand: #ffffff;
  --ink-on-dark: rgba(255, 255, 255, 0.65);
  --line: rgba(16, 21, 18, 0.09);

  --radius-card: 20px;
  --radius-ctrl: 12px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 2px rgba(16, 21, 18, 0.04), 0 22px 44px -32px rgba(16, 21, 18, 0.24);
  --ease-out: cubic-bezier(0.2, 0, 0, 1);
  --duration-fast: 120ms;

  --font-display-family: 'Bricolage Grotesque', Georgia, serif;
  --font-ui-family: 'Schibsted Grotesk', system-ui, sans-serif;

  /*
   * A club's own colour, set per club page. Defaults to the brand so an unbranded club still looks
   * deliberate. Co-branding grows inward: an accent on a club page only, never a platform header, a
   * primary button, a focus ring or a scanner status.
   */
  --club-accent: var(--brand-500);

  /* ---- Blueprint's theme variables (shadcn names), mapped onto the brand ---- */
  --background: var(--surface);
  --foreground: var(--ink-900);
  --card: var(--card-white);
  --card-foreground: var(--ink-900);
  --popover: var(--card-white);
  --popover-foreground: var(--ink-900);
  --primary: var(--brand-500);
  --primary-foreground: var(--on-brand);
  --secondary: var(--surface-2);
  --secondary-foreground: var(--ink-900);
  --muted: var(--surface-2);
  --muted-foreground: var(--ink-450);
  --accent: var(--surface-2);
  --accent-foreground: var(--ink-900);
  /*
   * Not red. The guide reserves red for "invalid" at the turnstile and forbids it for destructive
   * actions in the back office, so anything Blueprint would paint destructive is ink instead.
   */
  --destructive: var(--ink-600);
  --destructive-foreground: var(--on-brand);
  --border: var(--hairline);
  --input: var(--hairline);
  --ring: var(--brand-500);
  --radius: var(--radius-ctrl);
  --font-sans: var(--font-ui-family);
}

/* ------------------------------------------------------------------------------------ base ---- */

@layer base {
  html {
    background: var(--surface);
    color: var(--ink-600);
    font-family: var(--font-ui-family);
    -webkit-text-size-adjust: 100%;
  }

  body {
    margin: 0;
    min-height: 100dvh;
    line-height: 1.55;
  }

  h1,
  h2,
  h3 {
    font-family: var(--font-display-family);
    color: var(--ink-900);
    font-weight: 700;
    letter-spacing: -0.015em;
    margin: 0;
  }

  p,
  ul,
  ol,
  dl,
  dd {
    margin: 0;
  }

  ul.plain,
  ol.plain {
    list-style: none;
    padding: 0;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  button,
  input,
  select,
  textarea {
    font: inherit;
  }
}

/* Never removed, only restyled — a volunteer on a phone may be navigating by keyboard. */
:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

/*
 * On a control that is itself filled with brand green or ink, the green ring lands on a background
 * of the same colour and disappears. Those controls get a light ring instead.
 */
.ring-on-brand:focus-visible,
.btn-ink:focus-visible {
  outline-color: var(--card-white);
}

/* ----------------------------------------------------------------------------- type scale ---- */
/*
 * The scale the brand guide leaves open (§4/§7), recorded there as "defined in code". The two
 * largest steps clamp, so a phone gets a headline that fits its column without a breakpoint.
 */
.text-hero { font-family: var(--font-display-family); font-size: clamp(2.25rem, 1.6rem + 2.8vw, 3.25rem); line-height: 1.02; letter-spacing: -0.035em; font-weight: 800; }
.text-display { font-family: var(--font-display-family); font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.25rem); line-height: 1.06; letter-spacing: -0.03em; font-weight: 800; }
.text-title { font-family: var(--font-display-family); font-size: 1.375rem; line-height: 1.15; letter-spacing: -0.02em; font-weight: 700; }
.text-heading { font-size: 1.0625rem; line-height: 1.25; letter-spacing: -0.01em; font-weight: 700; }
.text-body { font-size: 1rem; line-height: 1.55; }
.text-body-sm { font-size: 0.875rem; line-height: 1.5; }
.text-label { font-size: 0.8125rem; line-height: 1.35; font-weight: 600; }
.text-caption { font-size: 0.75rem; line-height: 1.35; }
.text-xl { font-size: 1.25rem; line-height: 1.3; }
.text-2xl { font-family: var(--font-display-family); font-size: 1.5rem; line-height: 1.2; font-weight: 700; }
.text-3xl { font-size: 1.875rem; line-height: 1.15; }
.text-5xl { font-size: 3rem; line-height: 1.05; }

.font-display { font-family: var(--font-display-family); }
.fw-semibold { font-weight: 600; }
.fw-bold { font-weight: 700; }
.fw-extrabold { font-weight: 800; }
.uppercase { text-transform: uppercase; letter-spacing: 0.06em; }
.center { text-align: center; }
.right { text-align: right; }
.break-all { word-break: break-all; }

/* Tabular figures, so a column of prices and counts lines up. */
.nums { font-variant-numeric: tabular-nums; }

.c-ink-900 { color: var(--ink-900); }
.c-ink-600 { color: var(--ink-600); }
.c-ink-450 { color: var(--ink-450); }
.c-ink-400 { color: var(--ink-400); }
.c-brand-500 { color: var(--brand-500); }
.c-brand-700 { color: var(--brand-700); }
.c-on-dark { color: var(--ink-on-dark); }
.c-white { color: #ffffff; }

/* ------------------------------------------------------------------------------- layout ---- */

.container { width: 100%; max-width: 42rem; margin-inline: auto; padding-inline: 1.25rem; box-sizing: border-box; }
.container-narrow { max-width: 28rem; margin-inline: auto; }
.container-wide { width: 100%; max-width: 64rem; margin-inline: auto; padding-inline: 1.25rem; box-sizing: border-box; }

.stack-1 > * + * { margin-top: 0.25rem; }
.stack-2 > * + * { margin-top: 0.5rem; }
.stack-3 > * + * { margin-top: 0.75rem; }
.stack-4 > * + * { margin-top: 1rem; }
.stack-5 > * + * { margin-top: 1.25rem; }
.stack-6 > * + * { margin-top: 1.5rem; }
.stack-8 > * + * { margin-top: 2rem; }

.row { display: flex; align-items: center; gap: 0.75rem; }
.row-start { display: flex; align-items: flex-start; gap: 0.75rem; }
.row-baseline { display: flex; align-items: baseline; gap: 0.75rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.row-wrap { flex-wrap: wrap; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.grow { flex: 1 1 auto; }
.shrink-0 { flex-shrink: 0; }
.min-w-0 { min-width: 0; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.py-6 { padding-block: 1.5rem; }

.grid-stats { display: grid; gap: 1rem; }
@media (min-width: 640px) {
  .grid-stats { grid-template-columns: repeat(var(--columns, 3), minmax(0, 1fr)); }
}

/* A form row: stacked on a phone, label-aligned columns from sm up. */
.form-row { display: grid; gap: 0.75rem; }
@media (min-width: 640px) {
  .form-row { grid-template-columns: var(--form-columns, 1fr 10rem auto); align-items: start; }
  .form-row > .form-row__action { padding-top: 1.75rem; }
}

.divider-top { border-top: 1px solid var(--hairline); padding-top: 0.75rem; }

.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;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
  z-index: 30;
  border-radius: var(--radius-ctrl);
  background: var(--card-white);
  padding: 0.625rem 1rem;
  font-weight: 700;
  color: var(--ink-900);
}

/* ---------------------------------------------------------------------------- components ---- */

.e-card {
  background: var(--card-white);
  border: 0;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 1.25rem;
  color: var(--ink-600);
  display: block;
}

.e-card--tight { padding: 0.5rem; }
.e-card--link { transition: box-shadow var(--duration-fast) var(--ease-out); }
.e-card--link:hover { box-shadow: 0 1px 2px rgba(16, 21, 18, 0.06), 0 26px 50px -28px rgba(16, 21, 18, 0.32); }
.e-card--dim { opacity: 0.7; }

.e-badge {
  display: inline-flex;
  align-items: center;
  border: 0;
  border-radius: var(--radius-pill);
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.e-badge--neutral { background: var(--surface-2); color: var(--ink-450); }
.e-badge--brand { background: var(--brand-50); color: var(--brand-700); }
.e-badge--muted { background: var(--surface-2); color: var(--ink-450); text-decoration: line-through; }

/* Buttons: Blueprint's, with the brand's touch sizes and the one extra variant (ink). */
.btn-touch { width: 2.75rem; height: 2.75rem; flex-shrink: 0; border-radius: var(--radius-ctrl); }
.btn-block { width: 100%; }
/* Large enough to hit with a thumb, in gloves, in the cold. */
.btn-lg { min-height: 3.25rem; padding-inline: 1.5rem; font-size: 1.0625rem; font-weight: 700; border-radius: var(--radius-ctrl); }
.btn-ink { background: var(--ink-900); color: #ffffff; }
.btn-ink:hover { background: var(--ink-600); }
.btn-on-dark { color: #ffffff; }
.btn-on-dark:hover { background: rgba(255, 255, 255, 0.1); color: #ffffff; }

/* A link that looks like a primary or secondary button and is a real <a>. */
.link-primary,
.link-secondary {
  display: flex;
  min-height: 3.25rem;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: var(--radius-ctrl);
  padding: 0.75rem 1rem;
  box-sizing: border-box;
  text-align: center;
  font-size: 1.0625rem;
  font-weight: 700;
}

.link-primary { background: var(--brand-500); color: var(--on-brand); }
.link-primary:hover { background: var(--brand-700); }
.link-primary:focus-visible { outline-color: var(--card-white); }
.link-secondary { border: 1px solid var(--hairline); background: var(--card-white); color: var(--ink-900); }
.link-secondary:hover { background: var(--surface-2); }
.link-inline { display: inline-flex; align-items: center; min-height: 2.5rem; font-weight: 600; color: var(--brand-700); }

.callout-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  border-radius: var(--radius-ctrl);
  background: var(--brand-50);
  padding: 0.75rem 0.875rem;
  color: var(--brand-700);
}

.well {
  border-radius: var(--radius-ctrl);
  background: var(--surface);
  padding: 0.625rem 0.75rem;
}

.note {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-ctrl);
  background: var(--surface-2);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--ink-900);
}

.status-note {
  border-radius: var(--radius-ctrl);
  background: var(--surface-2);
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  color: var(--ink-900);
}

.field { display: block; }
.field__label { display: block; margin-bottom: 0.375rem; font-size: 0.875rem; font-weight: 600; color: var(--ink-900); }
.field__hint { display: block; margin-top: 0.375rem; font-size: 0.875rem; color: var(--ink-400); }
.field__error { display: block; margin-top: 0.375rem; font-size: 0.875rem; font-weight: 500; color: var(--ink-900); }

/* A plain input for the one type Blueprint's input does not offer (datetime-local). */
.native-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-ctrl);
  background: var(--card-white);
  padding: 0.5rem 0.75rem;
  min-height: 2.5rem;
  color: var(--ink-900);
}

.busy { display: inline-flex; align-items: center; gap: 0.5rem; }
.loading { padding-block: 2.5rem; text-align: center; font-size: 0.875rem; color: var(--ink-400); }

.empty { padding: 2.5rem; text-align: center; }
.empty__title { font-family: var(--font-display-family); font-size: 1.125rem; color: var(--ink-900); }
.empty__hint { margin-top: 0.25rem; font-size: 0.875rem; color: var(--ink-400); }

.e-skeleton { background: var(--surface-2); border-radius: var(--radius-ctrl); display: block; }
.e-skeleton--card { border-radius: var(--radius-card); }

.hero { background: var(--ink-900); }
.hero__inner { max-width: 42rem; margin-inline: auto; padding: 0.75rem 1.25rem 1.75rem; }

.section-label {
  font-family: var(--font-display-family);
  font-size: 0.8125rem;
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-400);
}

.sticky-bar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 20;
  border-top: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  padding: 0.75rem 1.25rem max(1.25rem, env(safe-area-inset-bottom));
}

.sticky-bar__inner { max-width: 42rem; margin-inline: auto; display: flex; align-items: center; gap: 1rem; }

.stepper { display: flex; align-items: center; gap: 0.25rem; }
.stepper__value { width: 2rem; text-align: center; font-size: 1.0625rem; font-weight: 700; color: var(--ink-900); }

.date-tile {
  width: 3.125rem;
  flex-shrink: 0;
  border-radius: var(--radius-ctrl);
  background: var(--surface-2);
  padding-block: 0.375rem;
  text-align: center;
}

.date-tile__day { display: block; font-family: var(--font-display-family); font-size: 1.375rem; line-height: 1.15; font-weight: 700; color: var(--ink-900); }
.date-tile__month { display: block; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-450); }

.stat__label { font-size: 0.875rem; color: var(--ink-400); }
.stat__value { font-family: var(--font-display-family); font-size: 1.875rem; line-height: 1.2; color: var(--ink-900); }
.stat__hint { margin-top: 0.125rem; font-size: 0.75rem; color: var(--ink-400); }

.wordmark { display: inline-flex; align-items: center; }
.wordmark__name { font-family: var(--font-display-family); font-weight: 800; letter-spacing: -0.035em; text-transform: lowercase; line-height: 1; }

.monogram {
  display: flex;
  width: 2.75rem;
  height: 2.75rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-ctrl);
  background: var(--surface-2);
  font-family: var(--font-display-family);
  font-size: 0.875rem;
  color: var(--ink-900);
}

.icon-tile {
  display: flex;
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-ctrl);
  background: var(--surface-2);
  color: var(--ink-450);
}

.pill-on-dark {
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.12);
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: #ffffff;
}

/*
 * A QR code has to survive the phone's own rendering. Android's forced-dark can invert an inline SVG
 * and leave a scanner staring at a photo negative, so the well it sits in opts out of both that and
 * any high-contrast remapping.
 */
.qr-well {
  color-scheme: light;
  forced-color-adjust: none;
  background: #ffffff;
  border-radius: var(--radius-ctrl);
  padding: 1rem;
  width: fit-content;
  margin-inline: auto;
}

.table-scroll { overflow-x: auto; }
.data-table { width: 100%; min-width: 34rem; border-collapse: collapse; font-size: 0.875rem; }
.data-table th { padding-bottom: 0.5rem; font-weight: 500; color: var(--ink-400); text-align: left; border-bottom: 1px solid var(--hairline); }
.data-table td { padding-block: 0.5rem; border-bottom: 1px solid var(--hairline); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .num { text-align: right; }

.divided > * + * { border-top: 1px solid var(--hairline); }
.divided > * { padding-block: 0.5rem; }

/* The sign-in / callback frame. */
.auth-frame { min-height: 100dvh; }
.auth-frame__head { background: var(--ink-900); padding: 1rem 1.25rem; }
.auth-frame__head > * { max-width: 28rem; margin-inline: auto; }
.auth-frame__body { max-width: 28rem; margin-inline: auto; padding: 4rem 1.25rem; }

@media (prefers-reduced-motion: no-preference) {
  .e-skeleton { animation: einlass-pulse 1.4s var(--ease-out) infinite; }
}

@keyframes einlass-pulse {
  50% { opacity: 0.55; }
}

/*
 * Printing the fan's tickets is a real affordance — plenty of people bring paper to a ground with no
 * signal. The swipe track clips every panel after the first, so print un-collapses it into a stack,
 * one ticket per page.
 */
@media print {
  [data-print='hide'] { display: none !important; }
  [data-print='tickets'] { display: block !important; overflow: visible !important; }
  [data-print='ticket'] { width: 100% !important; break-inside: avoid; break-after: page; box-shadow: none !important; }
  [data-print='ticket']:last-child { break-after: auto; }
  html, body { background: #ffffff; }
}
