/* ─────────────────────────────────────────────────────────────────────────────
   rides-board.css — the ranked-rides board at /parks/{park}/rides

   The idea: a wait time is a physical length of queue, so the page draws it as
   one. Every ride is a bar whose width is the line you would stand in, shortest
   at the top. The table stays a real table underneath (screen readers and
   crawlers get proper rows, headers and a caption) and CSS grid does the rest.

   Prefix: rb-  ·  Owns nothing outside .rb.
   ───────────────────────────────────────────────────────────────────────────── */

/* One visible ring for every interactive thing on the page. Keyboard users get the
   same affordance whether they land on a chip, a ride name or a footer link. */
.rb :where(a, button):focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 2px;
}

.rb {
  --rb-short: oklch(78% 0.155 155);   /* a line you can just join */
  --rb-mid:   oklch(82% 0.135 86);    /* candlelight gold, the house accent */
  --rb-long:  oklch(67% 0.205 8);     /* fireworks rose, used only for pain */
  --rb-none:  oklch(58% 0.040 282);   /* closed or not posting */
  --rb-track: oklch(32% 0.048 278);
  --rb-edge:  oklch(38% 0.050 278);

  max-width: 1180px;
  margin-inline: auto;
  padding-inline: var(--space-md);
  padding-bottom: var(--space-3xl);
}

/* ── Hero ─────────────────────────────────────────────────────────────────── */

.rb-hero {
  position: relative;
  isolation: isolate;
  margin-inline: calc(var(--space-md) * -1);
  padding: clamp(28px, 7vw, 72px) var(--space-md) 0;
  display: flex;
  flex-direction: column;
  gap: clamp(28px, 5vw, 52px);
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 12% 0%, oklch(38% 0.10 300 / 0.55), transparent 62%),
    radial-gradient(90% 80% at 88% 18%, oklch(44% 0.09 26 / 0.34), transparent 58%),
    linear-gradient(180deg, oklch(26% 0.055 280), oklch(21% 0.045 278));
}

.rb-hero-in { position: relative; max-width: 46rem; }

/* ── The wait horizon ──────────────────────────────────────────────────────
   One column per ride, in land order, height set by the wait posted right now.
   It is the page's data drawn as a skyline, and it lives below the type so it
   can never sit behind a word of it. Server-rendered, so it works with no JS. */

.rb-horizon {
  display: flex;
  align-items: flex-end;
  gap: clamp(2px, 0.5vw, 6px);
  height: clamp(96px, 17vh, 168px);
  /* Full bleed across the hero. The type stays inset, the data spans the block,
     which is what makes it read as a horizon rather than an inset chart. */
  margin-inline: calc(var(--space-md) * -1);
  /* A hairline of ground for the columns to stand on. */
  border-bottom: 1px solid oklch(58% 0.040 282 / 0.45);
}

.rb-col {
  position: relative;
  flex: 1 1 0;
  min-width: 2px;
  height: var(--h, 5%);
  border-radius: 2px 2px 0 0;
  transform-origin: bottom;
  background: linear-gradient(180deg, var(--col-hi, transparent), var(--col-lo, transparent));
  transition: height 800ms cubic-bezier(0.22, 1, 0.36, 1);
  animation: rb-rise 900ms cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 24ms);
}

/* The glowing cap is what makes it read as light rather than a bar chart. */
.rb-col::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--col-cap, transparent);
  box-shadow: 0 0 12px 1px var(--col-cap, transparent);
}

.rb-col[data-band="short"] {
  --col-hi: oklch(78% 0.155 155 / 0.42);
  --col-lo: oklch(78% 0.155 155 / 0.02);
  --col-cap: oklch(84% 0.155 155);
}
.rb-col[data-band="mid"] {
  --col-hi: oklch(82% 0.135 86 / 0.42);
  --col-lo: oklch(82% 0.135 86 / 0.02);
  --col-cap: oklch(88% 0.135 86);
}
.rb-col[data-band="long"] {
  --col-hi: oklch(67% 0.205 8 / 0.46);
  --col-lo: oklch(67% 0.205 8 / 0.02);
  --col-cap: oklch(74% 0.205 8);
}
.rb-col[data-band="none"] {
  --col-hi: oklch(58% 0.040 282 / 0.26);
  --col-lo: oklch(58% 0.040 282 / 0.02);
  --col-cap: oklch(62% 0.040 282 / 0.7);
}

@keyframes rb-rise {
  from { transform: scaleY(0); opacity: 0; }
  to   { transform: scaleY(1); opacity: 1; }
}

.rb-back {
  display: inline-block;
  font-family: var(--label);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  margin-bottom: var(--space-lg);
}
.rb-back:hover, .rb-back:focus-visible { color: var(--gold); border-bottom-color: currentColor; }

.rb-kicker {
  margin: 0 0 var(--space-xs);
  font-family: var(--label);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}

.rb-h1 {
  margin: 0 0 var(--space-md);
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2rem, 6.2vw, 3.9rem);
  line-height: 0.98;
  letter-spacing: -0.025em;
  text-wrap: balance;
  color: var(--ink);
}

.rb-lede {
  margin: 0 0 var(--space-xl);
  max-width: 40rem;
  font-size: clamp(1rem, 1.6vw, 1.13rem);
  line-height: 1.6;
  color: var(--ink-soft);
}

/* Stat strip. Tabular figures so the numbers do not jitter as they refresh. */
.rb-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) clamp(20px, 4vw, 44px);
  margin: 0;
}
.rb-stat { margin: 0; }
.rb-stat dt {
  font-family: var(--label);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}
.rb-stat dd {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.7rem, 3.6vw, 2.5rem);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.rb-stat.is-live dd { color: var(--gold); }
.rb-stat .rb-unit {
  font-size: 0.42em;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-left: 5px;
  color: var(--muted);
  vertical-align: 0.55em;
}
.rb-stat-sub {
  margin: 3px 0 0;
  font-size: 12.5px;
  line-height: 1.3;
  color: var(--muted);
  max-width: 15ch;
}
.rb-closed { color: var(--muted) !important; font-size: clamp(1.3rem, 2.6vw, 1.7rem) !important; }

/* ── Answer block ─────────────────────────────────────────────────────────── */

.rb-answer {
  margin: var(--space-xl) 0 var(--space-lg);
  padding: var(--space-md) var(--space-lg);
  border-left: 3px solid var(--gold);
  background: oklch(29% 0.050 277 / 0.55);
  font-size: 1.02rem;
  line-height: 1.65;
  color: var(--ink-soft);
}
.rb-answer strong { color: var(--ink); }

/* ── Controls ─────────────────────────────────────────────────────────────── */

.rb-h2 {
  margin: var(--space-2xl) 0 var(--space-md);
  font-family: var(--display);
  font-size: clamp(1.25rem, 2.6vw, 1.7rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
  text-wrap: balance;
}

.rb-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md) var(--space-xl);
  margin-bottom: var(--space-md);
}
.rb-ctl { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-xs); }
.rb-ctl-label {
  font-family: var(--label);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 2px;
}
.rb-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.rb-chip {
  font-family: var(--label);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--rb-edge);
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}
.rb-chip:hover { color: var(--ink); border-color: var(--rule); }
.rb-chip:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.rb-chip.is-active {
  color: oklch(22% 0.045 278);
  background: var(--gold);
  border-color: var(--gold);
}

.rb-count {
  margin: 0 0 var(--space-sm);
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ── The board ────────────────────────────────────────────────────────────── */

.rb-board { container-type: inline-size; }

.rb-table { width: 100%; border-collapse: collapse; }

/* Header row is laid out on the same grid as the data rows so the columns line
   up while each row stays a flexible grid rather than a rigid table row. */
.rb-table thead tr,
.rb-table tbody tr {
  display: grid;
  grid-template-columns: 2.6rem minmax(11rem, 1.35fr) minmax(7.5rem, 1fr) minmax(6.5rem, 0.8fr) 5.5rem 4rem;
  align-items: center;
  gap: var(--space-sm);
}

.rb-table thead th {
  font-family: var(--label);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 0 0 var(--space-xs);
  border-bottom: 1px solid var(--rb-edge);
}

.rb-table tbody tr {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--hair);
  transition: background-color 160ms ease;
}
/* A class selector beats the user-agent `[hidden] { display: none }` rule, so the
   filtered-out rows need this or they never actually disappear. */
.rb-table thead tr[hidden],
.rb-table tbody tr[hidden] { display: none; }
.rb-table tbody tr:hover { background: oklch(29% 0.050 277 / 0.45); }
.rb-table tbody td,
.rb-table tbody th { padding: 0; text-align: left; font-weight: 400; }

.rb-rank {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.rb-c-ride { min-width: 0; }
.rb-ride-link {
  display: block;
  font-family: var(--display);
  font-size: clamp(0.98rem, 1.5vw, 1.1rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  text-wrap: balance;
}
.rb-ride-link:hover, .rb-ride-link:focus-visible { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }

.rb-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 5px; }
.rb-land {
  font-family: var(--label);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.rb-tag {
  font-family: var(--label);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.rb-tag-thrill { color: var(--rb-long); }
.rb-tag-kids   { color: var(--rb-short); }
.rb-tag-ll     { color: var(--gold-deep); }

/* The wait bar. --pct is set inline per row from the server, then animated by
   JS on refresh. The value sits beside the fill so it stays legible at any width. */
.rb-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: 26px;
}
.rb-bar-fill {
  flex: 0 0 auto;
  width: var(--pct, 0%);
  max-width: 68%;
  height: 10px;
  border-radius: 2px;
  background: var(--rb-none);
  transition: width 700ms cubic-bezier(0.22, 1, 0.36, 1), background-color 400ms ease;
}
.rb-bar[data-band="short"] .rb-bar-fill { background: var(--rb-short); }
.rb-bar[data-band="mid"]   .rb-bar-fill { background: var(--rb-mid); }
.rb-bar[data-band="long"]  .rb-bar-fill { background: var(--rb-long); }
.rb-bar[data-band="none"]  .rb-bar-fill { background: var(--rb-track); }

.rb-bar-val {
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--ink);
}
.rb-bar[data-band="none"] .rb-bar-val { color: var(--muted); font-weight: 600; }

.rb-bar-ghost .rb-bar-fill { height: 6px; background: var(--rb-track); }
.rb-bar-ghost .rb-bar-val { font-size: 0.86rem; font-weight: 600; color: var(--ink-soft); }

.rb-c-best, .rb-c-height {
  font-family: var(--label);
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}
.rb-c-height { white-space: nowrap; }

/* Land headings injected by the By land sort. */
.rb-landrow td {
  grid-column: 1 / -1;
  padding: var(--space-lg) 0 var(--space-2xs);
}
.rb-landrow { border-bottom: 0 !important; background: none !important; }
.rb-land-h {
  font-family: var(--label);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}

.rb-empty {
  padding: var(--space-2xl) 0;
  text-align: center;
  color: var(--muted);
}

/* ── FAQ + links ──────────────────────────────────────────────────────────── */

.rb-faq { margin-top: var(--space-3xl); }
.rb-faq h2 {
  font-family: var(--display);
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 var(--space-lg);
  color: var(--ink);
}
.rb-faq-item { padding: var(--space-md) 0; border-top: 1px solid var(--hair); }
.rb-faq-item h3 {
  margin: 0 0 var(--space-2xs);
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
}
.rb-faq-item p { margin: 0; line-height: 1.65; color: var(--ink-soft); max-width: 62ch; }

.rb-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-lg);
  margin-top: var(--space-2xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--rb-edge);
}
/* Single-class ink loses to `.prefix a { color: gold }` rules elsewhere, so the
   link colour here is set with :where() at zero specificity on purpose. */
.rb-links :where(a) {
  font-family: var(--label);
  font-size: 14px;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
  border-bottom: 1px solid oklch(82% 0.095 88 / 0.35);
  padding-bottom: 1px;
}
.rb-links :where(a):hover,
.rb-links :where(a):focus-visible { color: var(--gold); border-bottom-color: currentColor; }

.rb-foot {
  margin-top: var(--space-xl);
  font-size: 12px;
  color: var(--muted);
}

/* ── Narrow screens ───────────────────────────────────────────────────────── */

@container (max-width: 760px) {
  /* Drop the two least useful columns, then stack the rest into a compact card
     that still reads top to bottom in the same order as the header row. */
  .rb-table thead { display: none; }
  .rb-table tbody tr {
    grid-template-columns: 2.2rem 1fr minmax(6.5rem, auto);
    grid-template-areas:
      "rank ride wait"
      ".    typ  typ";
    row-gap: var(--space-xs);
    padding: var(--space-md) 0;
  }
  .rb-table tbody tr > .rb-c-rank { grid-area: rank; align-self: start; }
  .rb-table tbody tr > .rb-c-ride { grid-area: ride; }
  .rb-table tbody tr > .rb-c-wait { grid-area: wait; justify-self: end; }
  .rb-table tbody tr > .rb-c-typ  { grid-area: typ; }
  .rb-table tbody tr > .rb-c-best,
  .rb-table tbody tr > .rb-c-height { display: none; }
  .rb-c-wait .rb-bar { flex-direction: row-reverse; }
  .rb-c-wait .rb-bar-fill { max-width: 90px; }
  .rb-bar-ghost::before {
    content: "Typical";
    font-family: var(--label);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .rb-landrow td { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .rb-stats { gap: var(--space-md) var(--space-lg); }
  .rb-stat dd { font-size: 1.6rem; }
  .rb-answer { padding: var(--space-sm) var(--space-md); }
}

/* ── Motion ───────────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .rb-bar-fill { transition: none; }
  .rb-table tbody tr { transition: none; }
  /* The horizon still draws at its true heights, it just arrives without the rise. */
  .rb-col { animation: none; transition: none; }
}
