/* Altim — Shiny/bslib bridge stylesheet
 * Drop this in your app's www/ folder and link it from the theme (see
 * shiny/README.md). It re-expresses the design-system tokens + component visual
 * language as plain CSS + Bootstrap-class overrides, so your EXISTING Shiny
 * widgets (buttons, cards, inputs, DT tables, value boxes) pick up the look
 * without rewriting them. No React, no build step.
 *
 * Source of truth: this design system's tokens/ + R/theme.R in the app repo.
 */

/* ---- 1. Tokens (mirror of tokens/*.css, flattened to one :root) ---------- */
:root {
  /* accents — colour is MEANING (query/climb vs match/descent) */
  --ry-query: #d1495b;  --ry-match: #3a7ca5;  --ry-flat: #e0a458;
  --ry-ink: #1f2933;    --ry-navy: #21295c;
  --ry-page: #f6f7f9;   --ry-surface: #ffffff;  --ry-none: #9aa0a6;

  --ry-hair: rgba(31,41,51,0.07);
  --ry-hair-strong: rgba(31,41,51,0.12);
  --ry-line: rgba(31,41,51,0.15);
  --ry-ink-70: rgba(31,41,51,0.70);
  --ry-ink-60: rgba(31,41,51,0.60);

  --terrain-climb: var(--ry-query);
  --terrain-descent: var(--ry-match);
  --terrain-flat: var(--ry-flat);
  --terrain-none: var(--ry-none);

  /* match-quality buckets + aliases used by the How-it-works page */
  --match-very: var(--ry-query);  --match-similar: var(--ry-match);
  --match-loose: var(--ry-flat);  --match-weak: var(--ry-none);
  --surface-card: var(--ry-surface);  --text-muted: var(--ry-ink-70);  --radius-pill: 999px;
  --text-faint: var(--ry-ink-60);

  --zone-1:#9ecae1; --zone-2:#74c476; --zone-3:#fdd0a2; --zone-4:#fc9272; --zone-5:#de2d26;

  --radius-input: 0.5rem;  --radius-box: 0.6rem;  --radius-card: 0.65rem;  --radius-hero: 0.75rem;
  --shadow-card: 0 1px 2px rgba(31,41,51,0.05), 0 6px 18px rgba(31,41,51,0.06);
  --shadow-hero: 0 1px 2px rgba(31,41,51,0.05), 0 10px 30px rgba(31,41,51,0.10);

  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

/* ---- 2. Page + cards (matches R/theme.R's bs_add_rules) ------------------- */
body { background-color: var(--ry-page); }

.card {
  border: none;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--ry-hair);
  font-weight: 600; font-size: 0.875rem; color: var(--ry-ink);
  padding-top: 0.7rem; padding-bottom: 0.7rem;
}
.value-box, .bslib-value-box { box-shadow: none; border-radius: var(--radius-box); }

/* ---- 3. Buttons ----------------------------------------------------------- */
.btn { border-radius: var(--radius-input); font-weight: 600; }
.btn-primary   { background-color: var(--ry-query);  border-color: var(--ry-query); }
.btn-primary:hover { filter: brightness(0.93); background-color: var(--ry-query); border-color: var(--ry-query); }
.btn-secondary { background-color: var(--ry-match);  border-color: var(--ry-match); }
.btn-secondary:hover { filter: brightness(0.93); background-color: var(--ry-match); border-color: var(--ry-match); }
.btn-light { background:#fff; box-shadow: var(--shadow-card); border-color: transparent; }

/* ---- 4. Inputs ------------------------------------------------------------ */
.form-control, .form-select, .selectize-input {
  border-radius: var(--radius-input);
  border-color: var(--ry-line);
}
.form-control:focus, .form-select:focus, .selectize-input.focus {
  border-color: var(--ry-match);
  box-shadow: 0 0 0 3px rgba(58,124,165,0.15);
}

/* ---- 4b. Custom-segment draw footer (readout left, actions right) -------- */
.custom-draw-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 4px 4px 2px;
}
.custom-draw-readout { flex: 1 1 320px; min-width: 0; }
.custom-draw-readout .help-block,
.custom-draw-readout p { margin-bottom: 0; }
.custom-draw-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}
/* neutralise Shiny's default checkbox form-group margins so it baselines with the button */
.custom-draw-check .form-group,
.custom-draw-check .shiny-input-container,
.custom-draw-check .checkbox { margin-bottom: 0; }
.custom-draw-check .checkbox { margin-top: 0; }
.custom-draw-check label { margin-bottom: 0; white-space: nowrap; font-size: 0.9rem; }
.custom-draw-actions .btn-primary { white-space: nowrap; }

/* ---- 5. DT tables (thin rules, blue hover — like the prototype) ----------- */
table.dataTable { font-size: 0.85rem; }
table.dataTable thead th {
  border-bottom: 1px solid var(--ry-hair-strong) !important;
  font-weight: 600; color: var(--ry-ink-70);
}
table.dataTable td { border-top: 1px solid rgba(31,41,51,0.05) !important; }
table.dataTable tbody tr:hover { background-color: rgba(58,124,165,0.06); }

/* rys_dt(): monospace right-aligned numerics, sans left-aligned text, blue select */
.rys-dt td.rys-num { font-family: var(--font-mono); text-align: right; white-space: nowrap; }
.rys-dt td.rys-txt { font-family: var(--font-sans); text-align: left; }
.rys-dt thead th { font-weight: 600; color: var(--ry-ink-70); }
.rys-dt tbody tr.selected,
.rys-dt tbody tr.selected td { background-color: rgba(58,124,165,0.10) !important; }
.rys-dt .rys-badge { font-size: 0.72rem; }

/* HR-zone bar (rys_hr_zone_bar) */
.rys-zone-title { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ry-ink-70); margin: 16px 0 8px; }
.rys-zone-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; }
.rys-zone-key { display: flex; justify-content: space-between; margin-top: 7px; font-size: 0.68rem; color: var(--ry-ink-70); }

/* ---- 6. Helper classes for terrain / quality / confidence badges ---------- */
/* Use in R with span(class = "rys-badge rys-badge--climb", "climb"), or build
 * an htmltools helper (see README). */
.rys-badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.72rem; font-weight: 600; line-height: 1;
  padding: 0.3rem 0.6rem; border-radius: 999px; white-space: nowrap;
}
.rys-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.9; }
.rys-badge--climb       { color: var(--ry-query); background: color-mix(in srgb, var(--ry-query) 14%, #fff); }
.rys-badge--descent     { color: var(--ry-match); background: color-mix(in srgb, var(--ry-match) 14%, #fff); }
.rys-badge--flat        { color: var(--ry-flat);  background: color-mix(in srgb, var(--ry-flat) 14%, #fff); }
.rys-badge--none        { color: var(--ry-none);  background: color-mix(in srgb, var(--ry-none) 16%, #fff); }
.rys-badge--very-similar{ color: var(--ry-query); background: color-mix(in srgb, var(--ry-query) 14%, #fff); }
.rys-badge--similar     { color: var(--ry-match); background: color-mix(in srgb, var(--ry-match) 14%, #fff); }
.rys-badge--loose       { color: var(--ry-flat);  background: color-mix(in srgb, var(--ry-flat) 14%, #fff); }
.rys-badge--weak        { color: var(--ry-none);  background: color-mix(in srgb, var(--ry-none) 16%, #fff); }

/* ---- 7. Compact stat rows (run-summary card) ------------------------------ */
.rys-stat { display:flex; justify-content:space-between; align-items:baseline; padding:0.4rem 0; }
.rys-stat + .rys-stat { border-top: 1px solid var(--ry-hair); }
.rys-stat__label { font-size: 0.875rem; color: var(--ry-ink-70); }
.rys-stat__value { font-weight: 600; font-size: 0.875rem; color: var(--ry-ink); font-family: var(--font-mono); }

/* ---- 8. Landing hero ("Refined" + features over the photo) ---------------- */
/* Markup (R): div.ry-hero > div.ry-hero__inner >
 *   {div.ry-hero__eyebrow, h1, div.ry-hero__features > div.ry-feat*, div.ry-hero__cta}
 * The "Open the app" button is a normal actionButton with class
 * "btn btn-light btn-lg"; wire it server-side with nav_select(). */
.ry-hero {
  position: relative; overflow: hidden;
  min-height: calc(100vh - 150px);
  border-radius: var(--radius-hero);
  background-color: var(--ry-navy);
  /* layer 1 = diagonal text scrim (fixed); layer 2 = photo.
     Tune ONLY the photo's "40%" to reframe runner vs cyclist. */
  background-image:
    linear-gradient(99deg,
      rgba(15,18,26,0.94) 0%,  rgba(15,18,26,0.88) 34%,
      rgba(15,18,26,0.60) 54%, rgba(15,18,26,0.14) 72%, rgba(15,18,26,0) 84%),
    url("photos/raceyourself_hero_D.png");
  background-size: cover, cover;
  background-position: center, 40% center;
  background-repeat: no-repeat;
  display: flex; flex-direction: column;
  align-items: flex-start; justify-content: flex-start;
  color: #fff; padding: 60px 8% 48px 48px;
  box-shadow: var(--shadow-hero);
}
.ry-hero__inner { max-width: 560px; display: flex; flex-direction: column; height: 100%; }
.ry-hero__eyebrow {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: rgba(255,255,255,0.42); margin-bottom: 16px;
}
.ry-hero h1 em { font-style: normal; color: #7fb3d3; }
.ry-hero h1 {
  font-weight: 800; font-size: clamp(2.2rem, 3.6vw, 3.1rem);
  line-height: 1.05; letter-spacing: -0.025em; margin: 0;
  text-shadow: 0 2px 20px rgba(0,0,0,0.45);
}
/* feature list — borrowed from the "Editorial split", now over the photo */
.ry-hero__features { display: flex; flex-direction: column; gap: 20px; margin: 38px 0 auto; }
.ry-feat { display: flex; gap: 16px; align-items: flex-start; max-width: 460px; }
.ry-feat__icon {
  width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.22); color: #fff;
}
.ry-feat__icon svg { width: 20px; height: 20px; }
.ry-feat__title { font-weight: 700; font-size: 1.02rem; color: #fff; text-shadow: 0 1px 10px rgba(0,0,0,0.6), 0 0 3px rgba(0,0,0,0.5); }
.ry-feat__body  { font-size: 0.9rem; line-height: 1.45; color: rgba(255,255,255,0.85); margin-top: 3px; text-shadow: 0 1px 10px rgba(0,0,0,0.65), 0 0 3px rgba(0,0,0,0.5); }
.ry-hero__sub {
  font-size: 1.02rem;
  line-height: 1.65;
  color: rgba(255,255,255,0.60);
  max-width: 440px;
  margin: 28px 0 44px;
  text-shadow: 0 1px 12px rgba(0,0,0,0.4);
}
.ry-hero__sub strong {
  color: rgba(255,255,255,0.85);
  font-weight: 500;
}
/* Feature icon color tints */
.ry-hero__features .ry-feat:nth-child(1) .ry-feat__icon {
  background: rgba(58,124,165,0.15);
  border-color: rgba(127,179,211,0.3);
  color: #7fb3d3;
}
.ry-hero__features .ry-feat:nth-child(2) .ry-feat__icon {
  background: rgba(209,73,91,0.12);
  border-color: rgba(232,132,143,0.3);
  color: #e8848f;
}
.ry-hero__features .ry-feat:nth-child(3) .ry-feat__icon {
  background: rgba(224,164,88,0.12);
  border-color: rgba(224,164,88,0.3);
  color: #e0a458;
}
.ry-hero__features .ry-feat:nth-child(4) .ry-feat__icon {
  background: rgba(123,94,167,0.12);
  border-color: rgba(123,94,167,0.3);
  color: #a88dc7;
}
.ry-hero__cta { display: flex; gap: 16px; align-items: center; margin-top: 90px;}
.ry-hero__cta .btn-light {
  padding: 0.7rem 1.4rem; font-size: 1rem; box-shadow: var(--shadow-card);
  display: inline-flex; align-items: center; gap: 0.5rem;
}
.ry-hero__link { color:#fff; font-size:0.95rem; font-weight:600; opacity:0.9; cursor:pointer; }
.ry-hero__link:hover { opacity:1; text-decoration: underline; }
@media (max-width: 800px) {
  .ry-hero { padding: 40px 6% 32px 24px; background-position: center, 50% center; }
  .ry-feat__body { display: none; }
}

/* ---- 9. How it works page ------------------------------------------------- */
/* Markup (R): see shiny/how_it_works.R -> rys_how_it_works(). */
.hiw-wrap { max-width: 980px; margin: 0 auto; }
.hiw-band {
  position: relative; overflow: hidden; border-radius: var(--radius-hero);
  background-color: var(--ry-navy);
  background-image:
    linear-gradient(99deg, rgba(15,18,26,0.93) 0%, rgba(15,18,26,0.82) 38%, rgba(15,18,26,0.40) 66%, rgba(15,18,26,0.12) 84%),
    url("photos/raceyourself_hero_D.png");
  background-size: cover, cover; background-position: center, 40% center; background-repeat: no-repeat;
  color: #fff; padding: 48px 48px 44px; box-shadow: var(--shadow-hero);
}
.hiw-band__eyebrow { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: #f0a8b2; margin-bottom: 14px; }
.hiw-band h1 { font-weight: 800; font-size: clamp(2rem, 3.4vw, 2.9rem); line-height: 1.05; letter-spacing: -0.025em; margin: 0; max-width: 640px; text-shadow: 0 2px 20px rgba(0,0,0,0.45); }
.hiw-band__lead { font-size: 1.05rem; line-height: 1.55; color: rgba(255,255,255,0.88); max-width: 560px; margin: 18px 0 0; text-shadow: 0 1px 10px rgba(0,0,0,0.4); }
.hiw-section { margin-top: 40px; }
.hiw-section__kicker { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ry-match); margin-bottom: 14px; }
.hiw-section h2 { font-weight: 800; font-size: 1.5rem; letter-spacing: -0.02em; margin: 0 0 8px; color: var(--ry-ink); }
.hiw-section p.intro { font-size: 1rem; line-height: 1.6; color: var(--text-muted); max-width: 680px; margin: 0 0 24px; }
.hiw-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.hiw-step { background: var(--surface-card); border: 1px solid var(--ry-hair); border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: 26px 24px; display: flex; flex-direction: column; }
.hiw-step__num { width: 34px; height: 34px; border-radius: var(--radius-pill); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.95rem; color: #fff; background: var(--ry-query); margin-bottom: 16px; }
.hiw-step:nth-child(2) .hiw-step__num { background: var(--ry-match); }
.hiw-step:nth-child(3) .hiw-step__num { background: var(--ry-flat); }
.hiw-step h3 { font-weight: 700; font-size: 1.08rem; margin: 0 0 8px; color: var(--ry-ink); }
.hiw-step p { font-size: 0.92rem; line-height: 1.55; color: var(--text-muted); margin: 0; }
.hiw-terrain { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.hiw-terr { background: var(--surface-card); border: 1px solid var(--ry-hair); border-radius: var(--radius-box); padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.hiw-terr__swatch { width: 100%; height: 6px; border-radius: 999px; }
.hiw-terr__name { font-weight: 700; font-size: 0.95rem; color: var(--ry-ink); }
.hiw-terr__desc { font-size: 0.84rem; line-height: 1.45; color: var(--text-muted); }
.hiw-terr__swatch.terr-climb { background: var(--terrain-climb); }
.hiw-terr__swatch.terr-descent { background: var(--terrain-descent); }
.hiw-terr__swatch.terr-flat { background: var(--terrain-flat); }
.hiw-terr__swatch.terr-none { background: var(--terrain-none); }
.hiw-quality { background: var(--surface-card); border: 1px solid var(--ry-hair); border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: 26px 28px; }
.hiw-qrow { display: flex; align-items: center; gap: 16px; padding: 12px 0; }
.hiw-qrow + .hiw-qrow { border-top: 1px solid var(--ry-hair); }
.hiw-qchip { flex-shrink: 0; min-width: 110px; text-align: center; font-weight: 700; font-size: 0.8rem; color: #fff; padding: 5px 12px; border-radius: var(--radius-pill); }
.hiw-qchip.q-very { background: var(--ry-query); }
.hiw-qchip.q-similar { background: var(--ry-match); }
.hiw-qchip.q-loose { background: var(--ry-flat); }
.hiw-qchip.q-weak { background: var(--ry-none); }
.hiw-qrow p { margin: 0; font-size: 0.92rem; line-height: 1.5; color: var(--text-muted); }
.hiw-qrow p strong { color: var(--ry-ink); font-weight: 600; }
.hiw-callout { margin-top: 24px; display: flex; gap: 16px; align-items: flex-start; background: rgba(58,124,165,0.06); border: 1px solid rgba(58,124,165,0.18); border-radius: var(--radius-card); padding: 20px 22px; }
.hiw-callout__icon { width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--ry-match); color: #fff; }
.hiw-callout__icon svg { width: 20px; height: 20px; }
.hiw-callout h3 { margin: 0 0 4px; font-size: 1rem; font-weight: 700; color: var(--ry-ink); }
.hiw-callout p { margin: 0; font-size: 0.92rem; line-height: 1.55; color: var(--text-muted); }
.hiw-cta { margin: 44px 0 8px; display: flex; align-items: center; justify-content: space-between; gap: 24px; background: var(--ry-ink); border-radius: var(--radius-card); padding: 28px 32px; color: #fff; }
.hiw-cta h3 { margin: 0 0 4px; font-size: 1.25rem; font-weight: 800; letter-spacing: -0.01em; }
.hiw-cta p { margin: 0; font-size: 0.95rem; color: rgba(255,255,255,0.7); }

/* How it works — Insights confidence chips (mirror .rys-insight__chip) */
.hiw-ichip {
  flex-shrink: 0; min-width: 110px; text-align: center; display: inline-flex;
  align-items: center; justify-content: center; gap: 0.4rem;
  font-weight: 700; font-size: 0.72rem; letter-spacing: 0.03em; text-transform: uppercase;
  padding: 5px 12px; border-radius: var(--radius-pill);
}
.hiw-ichip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.hiw-ichip.ic-shown      { color: var(--ry-ink-60); background: rgba(154,160,166,0.16); }
.hiw-ichip.ic-confirmed  { color: #1c7c54; background: rgba(28,124,84,0.13); }
.hiw-ichip.ic-tentative  { color: #b9770e; background: rgba(224,164,88,0.20); }
.hiw-ichip.ic-unreliable { color: #a85d2b; background: rgba(168,93,43,0.14); }
.hiw-ichip.ic-sparse     { color: var(--ry-ink-60); background: rgba(154,160,166,0.16); }

/* ============================================================================
   10. Insights tab  —  ported from R/theme.R so the SERVED stylesheet carries
   it too. bslib compiles theme.R's inline sass once and caches it, so edits to
   the inline block may not take effect; this static file is always re-served.
   ============================================================================ */
.rys-ins-wrap { max-width: 1080px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }

/* Page header band: editorial card + 'at a glance' stat strip */
.rys-ins-band {
  background: linear-gradient(180deg, #fbfcfd 0%, var(--ry-surface) 100%);
  border: 1px solid var(--ry-hair); border-radius: var(--radius-hero);
  box-shadow: var(--shadow-card);
  padding: 1.5rem 1.6rem 1.35rem; margin-bottom: 1.1rem;
}
.rys-ins-band__eyebrow { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ry-match); }
.rys-ins-band h1 { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; color: var(--ry-ink); margin: 0.4rem 0 0.5rem; }
.rys-ins-band__lead { color: var(--ry-ink-70); max-width: 64ch; margin: 0; font-size: 0.98rem; line-height: 1.55; }
.rys-ins-stats { display: flex; flex-wrap: wrap; gap: 2rem; margin-top: 1.15rem; padding-top: 1.05rem; border-top: 1px solid var(--ry-hair); }
.rys-ins-stat__n { font-family: var(--font-mono); font-size: 1.4rem; font-weight: 700; color: var(--ry-ink); line-height: 1; }
.rys-ins-stat__l { font-size: 0.74rem; color: var(--ry-ink-60); margin-top: 0.3rem; }

/* Confidence key: makes the honesty system legible at a glance */
.rys-conf-key { background: var(--ry-surface); border: 1px solid var(--ry-hair); border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: 0.95rem 1.1rem; margin-bottom: 1.9rem; }
.rys-conf-key__title { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ry-ink-60); margin-bottom: 0.7rem; }
.rys-conf-key__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.5rem 1.4rem; }
.rys-conf-key__row { display: flex; align-items: baseline; gap: 0.55rem; }
.rys-conf-key__row p { margin: 0; font-size: 0.8rem; color: var(--ry-ink-70); line-height: 1.4; }

/* Section header: index chip + friendlier hierarchy */
.rys-insection { margin: 1.9rem 0; }
.rys-insection__head { display: flex; align-items: flex-start; gap: 0.85rem; margin-bottom: 0.35rem; }
.rys-insection__index { flex-shrink: 0; width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-weight: 700; font-size: 0.82rem; color: #fff; margin-top: 0.12rem; background: var(--ry-none); }
.rys-insection__index--1 { background: var(--ry-match); }
.rys-insection__index--2 { background: var(--ry-query); }
.rys-insection__index--3 { background: #7b5ea7; }
.rys-insection__heads { flex: 1; min-width: 0; }
.rys-insection__kicker { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ry-ink-60); }
.rys-insection__title { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.01em; color: var(--ry-ink); margin: 0.1rem 0 0.2rem; }
.rys-insection__intro { color: var(--ry-ink-70); font-size: 0.9rem; max-width: 64ch; margin: 0 0 0.95rem 3.85rem; }

/* Card head + chip */
.rys-insight__head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; margin-bottom: 0.5rem; }
.rys-insight__title { font-weight: 600; font-size: 0.95rem; color: var(--ry-ink); }
.rys-insight__plot { margin: 0.6rem 0 0.1rem; }
.rys-insight__support { margin-top: 0.7rem; padding-top: 0.5rem; border-top: 1px solid var(--ry-hair); font-size: 0.72rem; color: var(--ry-ink-60); }

/* Confidence accent along the card's top edge (border honours the radius,
   so corners stay rounded and plotly tooltips are never clipped) */
.rys-insight { position: relative; border-top: 3px solid var(--ry-none); transition: box-shadow 0.16s ease, transform 0.16s ease; }
.rys-insight:hover { box-shadow: var(--shadow-hero); transform: translateY(-1px); }
.rys-insight--confirmed  { border-top-color: #1c7c54; }
.rys-insight--tentative  { border-top-color: var(--ry-flat); }
.rys-insight--unreliable { border-top-color: #c2702f; }
.rys-insight--sparse, .rys-insight--shown { border-top-color: var(--ry-hair-strong); }
.rys-insight--thin, .rys-insight--unavailable { background: var(--ry-page); border-top-color: var(--ry-hair-strong); }

.rys-insight__empty { padding: 0.15rem 0 0.1rem; }
.rys-insight__empty-badge { display: inline-block; font-size: 0.72rem; font-weight: 600; color: var(--ry-none); background: rgba(154,160,166,0.18); padding: 0.15rem 0.6rem; border-radius: var(--radius-pill); }
.rys-insight__empty-why { font-size: 0.85rem; color: var(--ry-ink-60); margin: 0.55rem 0 0; }

.rys-insight__chip { display: inline-flex; align-items: center; gap: 0.32rem; font-size: 0.64rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 0.12rem 0.5rem; border-radius: var(--radius-pill); white-space: nowrap; cursor: default; }
.rys-insight__chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.rys-insight__chip--confirmed { color: #1c7c54; background: rgba(28,124,84,0.13); }
.rys-insight__chip--tentative { color: #b9770e; background: rgba(224,164,88,0.20); }
.rys-insight__chip--unreliable { color: #a85d2b; background: rgba(168,93,43,0.14); }
.rys-insight__chip--sparse, .rys-insight__chip--shown { color: var(--ry-ink-60); background: rgba(154,160,166,0.16); }
.rys-insight__takeaway { font-size: 0.92rem; color: var(--ry-ink); line-height: 1.45; margin: 0 0 0.2rem; }
.rys-insight__caption { font-size: 0.76rem; color: var(--ry-ink-60); margin: 0.35rem 0 0; }

/* the technical 'numbers' line: clearly secondary precision, not the headline */
.rys-insight__detail { display: inline-flex; align-items: flex-start; gap: 0.4rem; margin-top: 0.5rem; padding-top: 0.45rem; border-top: 1px dashed var(--ry-hair-strong); width: 100%; font-family: var(--font-mono); font-size: 0.68rem; color: var(--ry-ink-60); }
.rys-insight__detail::before { content: "the numbers"; font-family: var(--font-sans); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; font-size: 0.58rem; color: var(--ry-ink-60); background: var(--ry-page); padding: 0.12rem 0.4rem; border-radius: var(--radius-pill); flex-shrink: 0; white-space: nowrap; }

.rys-t0-controls { display: flex; justify-content: flex-end; margin: -0.2rem 0 0.8rem; }
/* My Data section — download/delete buttons */
.btn-outline-secondary {
  border: 1.5px solid var(--ry-query) !important;
  color: var(--ry-query) !important;
  background: transparent !important;
}
.btn-outline-secondary:hover {
  background: rgba(209,73,91,0.06) !important;
}
.btn-outline-danger {
  border: 1.5px solid var(--ry-query) !important;
  color: var(--ry-query) !important;
  background: transparent !important;
}
.btn-outline-danger:hover {
  background: rgba(209,73,91,0.08) !important;
  color: #b33 !important;
}

/* ---- 11. Onboarding overlay components ----------------------------------- */
.rys-onboard-brand {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  margin-bottom: 24px;
}
.rys-onboard-brand svg { width: 44px; height: 28px; }
.rys-onboard-brand .wordmark {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700; font-size: 1.35rem; letter-spacing: -0.025em;
}
.rys-onboard-brand .wordmark .a { color: #7fb3d3; }
.rys-onboard-brand .wordmark .r { color: rgba(255,255,255,0.9); }

.rys-onboard-card h2 {
  font-size: 1.4rem; font-weight: 700; color: #fff;
  text-align: center; letter-spacing: -0.02em;
  margin: 0 0 10px;
}
.rys-onboard-card .rys-onboard-desc {
  font-size: 0.88rem; line-height: 1.65;
  color: rgba(255,255,255,0.52); text-align: center;
  margin-bottom: 24px;
}
.rys-onboard-card .rys-onboard-desc strong {
  color: rgba(255,255,255,0.78); font-weight: 600;
}

.rys-onboard-steps {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; margin-bottom: 24px;
}
.rys-onboard-step {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.74rem; font-weight: 600;
  color: rgba(255,255,255,0.3);
}
.rys-onboard-step.active { color: #7fb3d3; }
.rys-onboard-step .num {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid currentColor;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.68rem; font-weight: 700;
}
.rys-onboard-step.active .num {
  background: #7fb3d3; border-color: #7fb3d3; color: #0f1218;
}
.rys-onboard-step-line {
  width: 28px; height: 1px; background: rgba(255,255,255,0.12);
}

.rys-onboard-card .form-group { margin-bottom: 16px; }
.rys-onboard-card .form-group > label.control-label { display: none; }
.rys-onboard-card .btn-default,
.rys-onboard-card .input-group .btn {
  background: rgba(255,255,255,0.08) !important;
  border: 2px dashed rgba(255,255,255,0.14) !important;
  border-radius: 12px !important;
  color: rgba(255,255,255,0.7) !important;
  font-weight: 600 !important;
  padding: 12px 18px !important;
  transition: border-color 0.2s !important;
}
.rys-onboard-card .btn-default:hover,
.rys-onboard-card .input-group .btn:hover {
  border-color: #7fb3d3 !important;
  background: rgba(127,179,211,0.06) !important;
}
.rys-onboard-card .form-control[readonly] {
  background: rgba(255,255,255,0.04) !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
  border-radius: 10px !important;
  color: rgba(255,255,255,0.5) !important;
  font-size: 0.85rem !important;
}

.rys-onboard-howto {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px; margin-bottom: 16px;
  overflow: hidden;
}
.rys-onboard-howto summary {
  padding: 12px 16px; font-size: 0.8rem; font-weight: 600;
  color: rgba(255,255,255,0.5); cursor: pointer;
  list-style: none; display: flex; align-items: center; gap: 8px;
}
.rys-onboard-howto summary::-webkit-details-marker { display: none; }
.rys-onboard-howto summary::before { content: "\25B8"; font-size: 0.7rem; transition: transform 0.2s; }
.rys-onboard-howto[open] summary::before { transform: rotate(90deg); }
.rys-onboard-howto .howto-steps {
  padding: 0 16px 14px; font-size: 0.8rem;
  color: rgba(255,255,255,0.42); line-height: 1.7;
}
.rys-onboard-howto .howto-steps strong { color: rgba(255,255,255,0.65); font-weight: 500; }

.rys-onboard-card .rys-onboard-note {
  text-align: center; font-size: 0.76rem;
  color: rgba(255,255,255,0.3); line-height: 1.5;
  margin-top: 14px;
}
.rys-onboard-card .rys-onboard-privacy {
  text-align: center; font-size: 0.7rem;
  color: rgba(255,255,255,0.2); margin-top: 12px;
}

.rys-onboard-card .alert-danger {
  background: rgba(209,73,91,0.15) !important;
  border: 1px solid rgba(209,73,91,0.3) !important;
  border-radius: 8px !important;
  color: #f0a8b2 !important;
  font-size: 0.82rem !important;
}

.rys-onboard-card .progress {
  height: 6px !important; border-radius: 3px !important;
  background: rgba(255,255,255,0.08) !important;
  margin: 20px 0 12px !important;
}
.rys-onboard-card .progress-bar {
  background: linear-gradient(90deg, #7fb3d3, #3a7ca5) !important;
  border-radius: 3px !important;
}
.rys-onboard-card .progress + div { color: rgba(255,255,255,0.55); }
.rys-onboard-card .progress + div + .small { color: rgba(255,255,255,0.28); }

@media (max-width: 800px) {
  .hiw-steps, .hiw-terrain { grid-template-columns: 1fr 1fr; }
  .hiw-cta { flex-direction: column; align-items: flex-start; }
}

/* ═══ What's Next (roadmap) tab ═══ */
.wn-wrap { max-width: 980px; margin: 0 auto; }

.wn-band {
  position: relative; overflow: hidden;
  border-radius: var(--radius-hero);
  background-color: var(--ry-navy);
  background-image:
    linear-gradient(99deg, rgba(15,18,26,0.93) 0%, rgba(15,18,26,0.82) 38%, rgba(15,18,26,0.40) 66%, rgba(15,18,26,0.12) 84%),
    url("photos/raceyourself_hero_D.png");
  background-size: cover, cover;
  background-position: center, 40% center;
  background-repeat: no-repeat;
  color: #fff; padding: 48px 48px 44px; box-shadow: var(--shadow-hero);
}
.wn-band__eyebrow {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: #f0a8b2; margin-bottom: 14px;
}
.wn-band h1 {
  font-weight: 800; font-size: clamp(2rem, 3.4vw, 2.9rem); line-height: 1.05;
  letter-spacing: -0.025em; margin: 0; max-width: 640px; text-shadow: 0 2px 20px rgba(0,0,0,0.45);
}
.wn-band__lead {
  font-size: 1.05rem; line-height: 1.55; color: rgba(255,255,255,0.88);
  max-width: 580px; margin: 18px 0 0; text-shadow: 0 1px 10px rgba(0,0,0,0.4);
}

.wn-section { margin-top: 40px; }
.wn-section__kicker {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ry-match); margin-bottom: 14px;
}
.wn-section h2 { font-weight: 800; font-size: 1.5rem; letter-spacing: -0.02em; margin: 0 0 8px; color: var(--ry-ink); }
.wn-section p.intro { font-size: 1rem; line-height: 1.6; color: var(--text-muted); max-width: 720px; margin: 0 0 24px; }

.wn-roadmap { display: flex; flex-direction: column; gap: 16px; }
.wn-item {
  background: var(--surface-card); border: 1px solid var(--ry-hair); border-radius: var(--radius-card);
  box-shadow: var(--shadow-card); padding: 26px 28px;
  display: grid; grid-template-columns: 56px 1fr auto; gap: 22px; align-items: start;
}
.wn-item__icon { width: 56px; height: 56px; border-radius: 14px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.wn-item__icon svg { width: 26px; height: 26px; }
.wn-item:nth-child(1) .wn-item__icon { background: rgba(58,124,165,0.12); color: var(--ry-match); }
.wn-item:nth-child(2) .wn-item__icon { background: rgba(209,73,91,0.10); color: var(--ry-query); }
.wn-item:nth-child(3) .wn-item__icon { background: rgba(224,164,88,0.14); color: #c98a2e; }
.wn-item:nth-child(4) .wn-item__icon { background: rgba(123,94,167,0.12); color: #8a6db3; }

.wn-item__body { min-width: 0; }
.wn-item__head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.wn-item__head h3 { font-weight: 700; font-size: 1.12rem; margin: 0; color: var(--ry-ink); letter-spacing: -0.01em; }
.wn-item__body p { font-size: 0.94rem; line-height: 1.6; color: var(--text-muted); margin: 0; max-width: 620px; }
.wn-item__body p .hl { color: var(--ry-ink); font-weight: 600; }

.wn-tag {
  flex-shrink: 0; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 4px 10px; border-radius: var(--radius-pill); display: inline-flex; align-items: center; gap: 5px;
}
.wn-tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag-progress { color: #1c7c54; background: rgba(28,124,84,0.12); }
.tag-soon     { color: var(--ry-match); background: rgba(58,124,165,0.12); }
.tag-explore  { color: #b9770e; background: rgba(224,164,88,0.20); }

.wn-item__aud { flex-shrink: 0; font-size: 0.78rem; color: var(--text-faint); text-align: right; max-width: 130px; line-height: 1.4; padding-top: 4px; }
.wn-item__aud strong { display: block; color: var(--text-muted); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 3px; }

.wn-callout {
  margin-top: 28px; display: flex; gap: 16px; align-items: flex-start;
  background: rgba(58,124,165,0.06); border: 1px solid rgba(58,124,165,0.18);
  border-radius: var(--radius-card); padding: 20px 22px;
}
.wn-callout__icon { width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--ry-match); color: #fff; }
.wn-callout__icon svg { width: 20px; height: 20px; }
.wn-callout h3 { margin: 0 0 4px; font-size: 1rem; font-weight: 700; color: var(--ry-ink); }
.wn-callout p { margin: 0; font-size: 0.92rem; line-height: 1.55; color: var(--text-muted); }
.wn-callout a { color: var(--ry-match); font-weight: 600; text-decoration: none; }
.wn-callout a:hover { text-decoration: underline; }

@media (max-width: 800px) {
  .wn-item { grid-template-columns: 48px 1fr; }
  .wn-item__aud { display: none; }
}

/* User Data is reached via the right-side button (user_data_btn), not a left
   tab. The panel must stay a normal (selectable) nav_panel so nav_select() can
   activate it — so we hide only its nav-link here rather than hideTab()-ing it.
   bslib markup: <ul id="nav"> <li> <a data-value="User Data"> (no nav-item/
   nav-link classes), so target the <li> via :has, with an anchor fallback. */
#nav > li:has(> a[data-value="User Data"]) { display: none !important; }
#nav a[data-value="User Data"] { display: none !important; }
