/* ==========================================================================
   BenchBot — "Ice" design system
   Light, calm and consumer-facing. Replaces the previous dark arena theme.
   Token values mirror the design doc so they stay traceable to it.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@500;600;700;800&family=Barlow:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Brand */
  --bb-accent: #0B6FA4;
  --bb-accent-hover: #095B87;
  --bb-tint: #E8F3FA;
  --bb-ring: rgba(11, 111, 164, 0.10);

  /* Surfaces */
  --bb-page: #F2F4F8;
  --bb-surface: #FFFFFF;
  --bb-subtle: #F7F9FC;
  --bb-ink: #0B1120;          /* also the dark panel background */
  --bb-ink-text: #A9B7CB;     /* body text on the dark panel */
  --bb-ink-accent: #6FC9F0;   /* accent on the dark panel */

  /* Borders */
  --bb-border: #DDE3EC;
  --bb-border-soft: #E6EBF2;
  --bb-border-field: #C9D2E0;
  --bb-border-row: #EEF1F6;

  /* Text */
  --bb-text: #0B1120;
  --bb-text-2: #4F5B72;
  --bb-text-3: #6B7893;
  --bb-text-4: #8B95A8;

  /* Status */
  --bb-success: #0F7A4A;
  --bb-success-bg: #E4F5EC;
  --bb-warn: #8A5200;
  --bb-warn-bg: #FDF1DE;
  --bb-error: #B3261E;
  --bb-error-bg: #FDECEA;

  /* Radii */
  --bb-pill: 999px;
  --bb-card-lg: 18px;
  --bb-card: 16px;
  --bb-card-sm: 14px;
  --bb-field: 12px;
  --bb-field-sm: 10px;

  /* Type */
  --font-display: Archivo, system-ui, sans-serif;
  --font-body: Barlow, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Elevation */
  --bb-shadow-lg: 0 18px 40px rgba(11, 17, 32, 0.08);
  --bb-shadow: 0 10px 24px rgba(11, 17, 32, 0.05);

  /* Layout */
  --bb-max: 1280px;
  --bb-gutter: 40px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bb-page);
  color: var(--bb-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* height:auto matters as much as max-width: an <img> carrying width/height
   attributes (which every one should, so the browser can reserve its box
   before the file arrives) otherwise keeps its literal attribute HEIGHT while
   max-width shrinks the width, and renders stretched until something fixes it
   — a layout shift the size of the image. */
img { max-width: 100%; height: auto; }

a {
  color: var(--bb-accent);
  text-decoration: none;
}
a:hover { color: var(--bb-accent-hover); }

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--bb-text);
  letter-spacing: -0.03em;
  margin: 0;
}

.hidden { display: none !important; }
.mono { font-family: var(--font-mono); }
.text-2 { color: var(--bb-text-2); }
.text-3 { color: var(--bb-text-3); }

/* Visible focus everywhere — the design's rings are decorative, these are real */
:where(a, button, input, select, [tabindex]):focus-visible {
  outline: 2px solid var(--bb-accent);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--bb-max);
  margin: 0 auto;
  padding: 0 var(--bb-gutter);
}

.section { padding: 64px 0; }
.section-tight { padding: 40px 0; }
.section-white {
  background: var(--bb-surface);
  border-top: 1px solid var(--bb-border);
  border-bottom: 1px solid var(--bb-border);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.stack { display: flex; flex-direction: column; }

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */

.nav {
  height: 68px;
  background: var(--bb-surface);
  border-bottom: 1px solid var(--bb-border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.nav-inner {
  height: 100%;
  max-width: var(--bb-max);
  margin: 0 auto;
  padding: 0 var(--bb-gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--bb-text);
}
.nav-brand img { height: 30px; width: auto; display: block; }
.nav-brand span {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.01em;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 30px;
}
.nav-links a {
  font-size: 14.5px;
  color: var(--bb-text-2);
}
.nav-links a:hover { color: var(--bb-text); }
.nav-links a.active {
  font-weight: 600;
  color: var(--bb-text);
  border-bottom: 2px solid var(--bb-accent);
  padding-bottom: 3px;
}
/* The nav CTA is a filled button: `.nav-links a` outranks `.btn-primary`
   (0,1,1 vs 0,1,0), so without this the pill renders grey-on-blue. */
.nav-links a.nav-cta,
.nav-links a.nav-cta:hover { color: #FFFFFF; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.2;
  padding: 15px 28px;
  border-radius: var(--bb-pill);
  border: 1px solid transparent;
  cursor: pointer;
  text-align: center;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-primary { background: var(--bb-accent); color: #FFFFFF; }
.btn-primary:hover { background: var(--bb-accent-hover); color: #FFFFFF; }
.btn-secondary {
  background: var(--bb-surface);
  color: var(--bb-text);
  border-color: var(--bb-border-field);
}
.btn-secondary:hover { background: var(--bb-subtle); color: var(--bb-text); }
.btn-dark { background: var(--bb-ink); color: #FFFFFF; }
.btn-dark:hover { background: #1A2438; color: #FFFFFF; }
.btn-on-dark { background: #FFFFFF; color: var(--bb-ink); }
.btn-on-dark:hover { background: #E9EEF6; color: var(--bb-ink); }
.btn-ghost {
  background: transparent;
  color: var(--bb-text-2);
  padding: 15px 8px;
}
.btn-ghost:hover { color: var(--bb-text); }
.btn-sm { font-size: 14.5px; padding: 10px 20px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* --------------------------------------------------------------------------
   Cards & panels
   -------------------------------------------------------------------------- */

.card {
  background: var(--bb-surface);
  border: 1px solid var(--bb-border);
  border-radius: var(--bb-card);
  padding: 26px 28px;
}
.card-sm { border-radius: var(--bb-card-sm); padding: 18px 20px; }
.card-subtle { background: var(--bb-subtle); border-color: var(--bb-border-soft); }
.card-raised { box-shadow: var(--bb-shadow-lg); }

.panel-dark {
  background: var(--bb-ink);
  border-radius: var(--bb-card-lg);
  padding: 28px 32px;
  color: #FFFFFF;
}
.panel-dark p { color: var(--bb-ink-text); }
.panel-dark h2,
.panel-dark h3 { color: #FFFFFF; }
.panel-dark .eyebrow { color: var(--bb-ink-accent); }

/* --------------------------------------------------------------------------
   Pills / badges
   -------------------------------------------------------------------------- */

.pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 5px 11px;
  border-radius: var(--bb-pill);
  white-space: nowrap;
}
.pill-accent { color: var(--bb-accent); background: var(--bb-tint); }
.pill-success { color: var(--bb-success); background: var(--bb-success-bg); }
.pill-warn { color: var(--bb-warn); background: var(--bb-warn-bg); }
.pill-lg { font-size: 12.5px; padding: 7px 14px; }

.eyebrow {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bb-accent);
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 7px; }
.field label,
.form-label {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14.5px;
  color: var(--bb-text);
}
.field-hint {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--bb-text-3);
}

.input,
select.input,
textarea.input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 16.5px;
  color: var(--bb-text);
  background: var(--bb-surface);
  border: 1px solid var(--bb-border-field);
  border-radius: var(--bb-field);
  padding: 14px 16px;
  appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input::placeholder { color: var(--bb-text-4); }
.input:focus {
  border-color: var(--bb-accent);
  box-shadow: 0 0 0 4px var(--bb-ring);
  outline: none;
}
.input[type="date"] { font-family: var(--font-mono); font-size: 15px; }

/* Native select needs its own chevron once appearance is stripped */
select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%238B95A8' stroke-width='1.6' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.form-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Segmented control — arrival offset */
.segmented { display: flex; gap: 8px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  flex: 1;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--bb-text-2);
  background: var(--bb-surface);
  border: 1px solid var(--bb-border-field);
  border-radius: var(--bb-field-sm);
  padding: 12px 0;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.segmented input:checked + label {
  color: #FFFFFF;
  background: var(--bb-accent);
  border-color: var(--bb-accent);
}
.segmented input:focus-visible + label {
  outline: 2px solid var(--bb-accent);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Messages
   -------------------------------------------------------------------------- */

.alert {
  border-radius: var(--bb-card-sm);
  padding: 14px 18px;
  font-size: 15px;
  line-height: 1.5;
}
.alert p { margin: 0; }
.alert-error {
  color: var(--bb-error);
  background: var(--bb-error-bg);
  border: 1px solid #F5C9C5;
}
.alert-info {
  color: var(--bb-text);
  background: var(--bb-subtle);
  border: 1px solid var(--bb-border-soft);
}
/* For a step the user must still take — not an error, but not dismissible
   either. Same token pair as .pill-warn so the two read as one signal. */
.alert-warn {
  color: var(--bb-warn);
  background: var(--bb-warn-bg);
  border: 1px solid #F0D9B4;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--bb-border-field);
  border-top-color: var(--bb-accent);
  border-radius: 50%;
  animation: bb-spin 0.7s linear infinite;
}
@keyframes bb-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   Results — desktop table
   -------------------------------------------------------------------------- */

.results {
  background: var(--bb-surface);
  border: 1px solid var(--bb-border);
  border-radius: var(--bb-card);
  overflow: hidden;
}
.results-head {
  padding: 20px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--bb-border-soft);
}
.results-head h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
}
.results-meta { font-size: 14.5px; color: var(--bb-text-3); }
.results-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.table-scroll { overflow-x: auto; }

table.games {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}
table.games th {
  text-align: left;
  padding: 12px 28px;
  background: var(--bb-subtle);
  border-bottom: 1px solid var(--bb-border-soft);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--bb-text-3);
  white-space: nowrap;
}
table.games td {
  padding: 15px 28px;
  border-bottom: 1px solid var(--bb-border-row);
  font-size: 15px;
  color: var(--bb-text);
  vertical-align: middle;
}
table.games td.mono {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--bb-text-2);
  white-space: nowrap;
}
table.games tr:last-child td { border-bottom: none; }

/* Results — mobile cards (same data, rendered by ui.js) */
.game-cards {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
}
.game-card {
  background: var(--bb-surface);
  border: 1px solid var(--bb-border);
  border-radius: var(--bb-card-sm);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.game-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.game-card-when {
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: var(--bb-text-2);
}
.game-card-teams {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16.5px;
  color: var(--bb-text);
}
.game-card-teams .at { color: var(--bb-text-4); font-weight: 500; }
.game-card-venue { font-size: 14.5px; color: var(--bb-text-2); }
.game-card-venue.empty { color: var(--bb-text-4); }

/* --------------------------------------------------------------------------
   Funnel (subscribe / connect / success)
   -------------------------------------------------------------------------- */

.funnel {
  max-width: 560px;
  margin: 0 auto;
  padding: 40px 20px 72px;
  /* Reserve the viewport below the 68px nav. setup.html opens on a one-line
     loading card and swaps in a form or the activate page once the API
     answers; without this the footer sits right under that card and leaps
     off the bottom of the screen when the real state lands — a layout shift
     Cloudflare measured at 0.36. Keeping the footer below the fold in BOTH
     states means nothing on screen moves. */
  min-height: calc(100vh - 68px);
}
.funnel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.step-label { font-size: 13px; color: var(--bb-text-3); }
.progress {
  height: 3px;
  background: #E1E7F0;
  border-radius: var(--bb-pill);
  overflow: hidden;
  margin-bottom: 28px;
}
.progress-bar {
  height: 100%;
  background: var(--bb-accent);
  border-radius: var(--bb-pill);
}
.progress-bar.done { background: var(--bb-success); }

.funnel h1 {
  font-weight: 700;
  font-size: 34px;
  line-height: 1.08;
  letter-spacing: -0.035em;
}
.funnel .lede {
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--bb-text-2);
  margin: 8px 0 0;
}

.price-row {
  background: var(--bb-subtle);
  border: 1px solid var(--bb-border-soft);
  border-radius: var(--bb-card-sm);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.price-row .price {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  color: var(--bb-text);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.footer {
  padding: 30px 0;
  background: var(--bb-surface);
  border-top: 1px solid var(--bb-border);
}
.footer-inner {
  max-width: var(--bb-max);
  margin: 0 auto;
  padding: 0 var(--bb-gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--bb-text-3);
}
.footer-links { display: flex; gap: 22px; flex-wrap: wrap; }
.footer-links a { color: var(--bb-text-3); }
.footer-links a:hover { color: var(--bb-text); }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  :root { --bb-gutter: 20px; }

  .section { padding: 44px 0; }
  .grid-2,
  .grid-3,
  .form-grid-4,
  .form-grid-3 {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .nav { height: 56px; }
  .nav-brand img { height: 24px; }
  .nav-brand span { font-size: 16px; }
  /* Only the CTA stays in the bar on small screens — the rest live in the footer */
  .nav-links { gap: 14px; }
  .nav-links a:not(.nav-cta) { display: none; }

  .card { padding: 20px; }
  .panel-dark { padding: 24px 22px; }
  .funnel h1 { font-size: 29px; }

  /* Swap the table for cards */
  .table-scroll { display: none; }
  .game-cards { display: flex; }

  .results-head { padding: 16px 18px; }
  .results-actions { margin-left: 0; width: 100%; }

  .footer-inner { flex-direction: column; align-items: flex-start; }
}
