/* ============================================================
   Should I Lift? — redesign stylesheet (CSP-safe: no inline, no
   third-party origins, system fonts only). Drop-in replacement
   for web/styles.css.

   Cell colour is still driven entirely by each cell's --t
   (0 = quiet … 1 = busy), set from app.js via the CSSOM — so the
   heat scale and legend re-theme together from the tokens below.
   ============================================================ */
:root {
  color-scheme: dark;

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --maxw: 1120px;

  /* surfaces — pitch black for OLED; cards lift just enough to read as panels */
  --bg:        #000000;
  --bg-2:      #06070a;
  --surface:   #0b0d12;
  --surface-2: #12151c;
  --line:      rgba(255,255,255,0.09);
  --line-2:    rgba(255,255,255,0.16);

  --fg:      #eef0f3;
  --fg-mut:  #aab1bd;
  --fg-dim:  #6f7886;

  /* brand accents — the inverse of Planet Fitness's purple/yellow palette.
     GREEN = the "go / quiet" accent (shares the quiet end of the heat scale).
     BLUE  = brand & structural chrome ONLY (logo, titles, labels) — never used
             for anything that signals busyness, so it can't be read as data. */
  --green:     #5BD872;
  --green-ink: #0c2614;                 /* text on solid green */
  --green-dim: rgba(91,216,114,0.14);
  --blue:      #2E30F9;                 /* true brand blue (exact inverse of PF) */
  --blue-text: #2E30F9;                 /* exact brand blue for text */
  --blue-dim:  rgba(46,48,249,0.18);

  --quiet: #5BD872;
  --busy:  #ff4f3d;

  --r-sm: 8px;
  --r:    14px;
  --r-lg: 20px;
  --cell-radius: 7px;
  --cell-gap: 4px;
  --label-col: 3rem;

  /* Heat scale: hue green(128)→red(2). Lightness & saturation also rise with
     --t so quiet cells recede into the dark field and busy cells glow. */
  --heat-hue-quiet: 130;
  --heat-hue-busy: 4;

  --shadow: 0 1px 0 rgba(255,255,255,0.05) inset, 0 24px 60px -30px rgba(0,0,0,0.75);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--fg);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1100px 640px at 80% -10%, rgba(91,216,114,0.06), transparent 60%),
    radial-gradient(820px 540px at 6% -4%, rgba(46,48,249,0.07), transparent 55%),
    var(--bg);
  min-height: 100vh;
}
.mono { font-family: var(--mono); }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 26px; }

/* ============ TOP BAR ============ */
.topbar {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(14px);
  background: rgba(15,17,21,0.72);
  border-bottom: 1px solid var(--line);
}
.topbar__in { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand__mark { display: flex; align-items: flex-end; gap: 3px; height: 22px; }
.brand__mark i { display: block; width: 6px; border-radius: 2px; background: var(--fg-dim); }
.brand__mark i:nth-child(1) { height: 10px; background: var(--blue-text); }
.brand__mark i:nth-child(2) { height: 16px; background: var(--blue-text); }
.brand__mark i:nth-child(3) { height: 22px; background: var(--green); }
.brand__name { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; color: var(--fg); }
.brand__name b { color: var(--green); font-weight: 700; }
.topbar__spacer { flex: 1; }
.statuschip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 13px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--surface); color: var(--fg-mut);
  font-family: var(--mono); font-size: 12px;
}
.statuschip__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--quiet);
  box-shadow: 0 0 0 3px rgba(54,196,107,0.18); }

/* ============ HERO ============ */
.hero { padding: 38px 0 6px; }
.hero__pick { margin-bottom: 18px; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--fg-dim); }
.hero__grid { margin-top: 16px; display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }

.card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}

.verdict { padding: 28px 30px; position: relative; overflow: hidden;
  display: flex; flex-direction: column; min-height: 230px; }
.verdict__glow { position: absolute; inset: 0; pointer-events: none; opacity: 0.5;
  background: radial-gradient(420px 220px at 100% 0%, var(--vcolor, var(--quiet)), transparent 70%); }
.verdict__top { display: flex; align-items: center; gap: 10px; position: relative; }
.verdict__pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 4px var(--green-dim); animation: pulse 2.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 4px var(--green-dim); } 50% { box-shadow: 0 0 0 8px rgba(91,216,114,0.04); } }
.verdict__kicker { font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--fg-mut); }
.verdict__head { font-size: clamp(32px, 4.6vw, 48px); line-height: 1.02; letter-spacing: -0.025em;
  font-weight: 700; margin: 16px 0 0; position: relative; text-wrap: balance; }
.verdict__head .accent { color: var(--vcolor, var(--quiet)); }
.verdict__sub { margin: 13px 0 0; color: var(--fg-mut); font-size: 15px; max-width: 44ch; position: relative; }
.verdict__sub b { color: var(--fg); font-weight: 600; }
.verdict__foot { margin-top: auto; padding-top: 22px; display: flex; align-items: stretch; gap: 20px; position: relative; }
.stat { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.stat__k { font-family: var(--mono); font-size: 11.5px; color: var(--fg-dim); white-space: nowrap; }
.stat__v { font-family: var(--mono); font-size: 22px; font-weight: 700; line-height: 1; white-space: nowrap; }
.stat__v small { font-size: 12.5px; color: var(--fg-dim); font-weight: 500; }
.stat__rule { width: 1px; background: var(--line); }
/* The live "Currently" chip now lives in the verdict footer; push it to the
   right to fill the space the removed peak stat left. */
.verdict__foot .forecast__live { margin-left: auto; align-self: center; }

/* forecast */
.forecast { padding: 24px 26px; display: flex; flex-direction: column; }
.forecast__h { font-size: 13px; font-weight: 600; color: var(--fg-mut); }
.forecast__row { display: flex; gap: 9px; margin-top: 16px; flex: 1; align-items: flex-end; min-height: 120px; }
.fc { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 9px; }
.fc__n { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--fg-mut); }
.fc__track { width: 100%; height: 96px; display: flex; align-items: flex-end;
  background: rgba(255,255,255,0.03); border-radius: 7px; padding: 4px; }
.fc__bar { width: 100%; border-radius: 5px; min-height: 7px; transition: height 0.5s cubic-bezier(.2,.7,.2,1); }
.fc__t { font-family: var(--mono); font-size: 11px; color: var(--fg-dim); }
.fc--best .fc__n, .fc--best .fc__t { color: var(--green); }
/* forecast pills — equal width (Currently matches Best-window), 38px tall to match
   the COMPARE / 8-WEEK AVERAGE chips. The separator is a centred round dot. */
.forecast__pills { margin-top: 14px; align-self: flex-start;
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 9px; }
.forecast__pill, .forecast__live {
  height: 38px; display: inline-flex; align-items: center; gap: 8px;
  padding: 0 16px; border: none; border-radius: 999px; white-space: nowrap;
  font-size: 12.5px; font-weight: 600; line-height: 1; }
.forecast__pill { color: var(--green-ink); background: var(--green); }
.forecast__live { color: #fff; background: var(--blue); }
.forecast__txt { display: inline-flex; align-items: center; }
.forecast__pill b, .forecast__live b { font-weight: 700; }
.forecast__pill b { color: var(--green-ink); }
.forecast__live b { color: #fff; }
.sep { width: 3px; height: 3px; border-radius: 50%; background: currentColor;
  opacity: 0.55; margin: 0 7px; flex: none; }
.forecast__livedot { width: 7px; height: 7px; border-radius: 50%; background: var(--quiet);
  box-shadow: 0 0 0 3px rgba(54,196,107,0.18); animation: live-blink 1.6s ease-in-out infinite; flex: none; }
@keyframes live-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }
@media (prefers-reduced-motion: reduce) { .forecast__livedot { animation: none; } }

/* ============ SECTION ============ */
.section { padding: 30px 0; }
.sec__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
  margin-bottom: 18px; flex-wrap: wrap; }
.sec__head h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; margin: 0; color: var(--fg); }
.sec__head .chip-blue { margin-bottom: 11px; }
.sec__head p { color: var(--fg-dim); font-size: 13.5px; margin: 4px 0 0; max-width: 56ch; }

/* add-club control (keeps the native <select> — CSP-safe, accessible) */
/* Brand-blue pill: solid #2E30F9 + white text. Used for structural labels so the
   exact brand blue stays legible on black (blue-as-text is too dark to read). */
.chip-blue {
  display: inline-flex; align-items: center; height: 38px; padding: 0 16px;
  background: var(--blue); color: #fff; border-radius: 999px;
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase; white-space: nowrap;
}
/* the small label-style chip used above the section heading matches the Compare chip height */
.sec__head .chip-blue:not([for]) { padding: 0 14px; font-size: 12px; }

.controls { display: flex; align-items: center; gap: 10px; }
.controls .chip-blue { margin: 0; }
.controls__select {
  appearance: none; -webkit-appearance: none;
  font: inherit; font-size: 13px; font-weight: 500;
  height: 38px; margin: 0; line-height: 1.2; vertical-align: middle;
  color: var(--fg); background: var(--surface);
  border: 1px solid var(--line-2); border-radius: 999px;
  padding: 9px 34px 9px 15px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--fg-mut) 50%), linear-gradient(135deg, var(--fg-mut) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.controls__select:hover { border-color: rgba(255,255,255,0.28); }
.controls__select:disabled { opacity: 0.45; cursor: default; }
.hint { color: var(--fg-dim); font-size: 12.5px; margin: 10px 0 0; }

/* ============ HEATMAP CARD ============ */
.heatmap-card { padding: 22px 22px 18px; }
.heatmap-card + .heatmap-card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head__l { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.card-title { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.card-remove { width: 30px; height: 30px; flex: none; line-height: 1; font-size: 17px;
  color: var(--fg-dim); background: transparent; border: 1px solid var(--line-2);
  border-radius: 8px; cursor: pointer; transition: 0.15s; }
.card-remove:hover { color: var(--fg); border-color: var(--fg-mut); }

.legend { display: flex; align-items: center; gap: 11px; }
.legend__label { font-family: var(--mono); font-size: 11px; color: var(--fg-dim);
  letter-spacing: 0.05em; text-transform: uppercase; }
.legend__bar { width: 150px; height: 9px; border-radius: 5px;
  background: linear-gradient(to right,
    hsl(130 45% 26%), hsl(130 55% 42%), hsl(60 70% 50%), hsl(28 80% 52%), hsl(4 82% 54%)); }

/* Grid: label column + 24 hour columns; header reuses the template. */
.heatmap { display: grid; grid-template-columns: var(--label-col) repeat(24, minmax(0, 1fr));
  gap: var(--cell-gap); align-items: center; }
.hm-corner { }
.hm-hour, .hm-day { font-size: 10.5px; color: var(--fg-dim); text-align: center;
  font-family: var(--mono); font-variant-numeric: tabular-nums; }
.hm-day { text-align: right; padding-right: 0.5rem; color: var(--fg-mut); font-weight: 500; }
.hm-day--today { color: var(--green); font-weight: 700; }

.cell {
  position: relative; aspect-ratio: 1 / 1; border-radius: var(--cell-radius);
  display: grid; place-items: center;
  background: hsl(
    calc(var(--heat-hue-quiet) + (var(--heat-hue-busy) - var(--heat-hue-quiet)) * var(--t, 0))
    calc(42% + 40% * var(--t, 0))
    calc(23% + 30% * var(--t, 0))
  );
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.cell:hover { transform: scale(1.12); box-shadow: 0 8px 20px -8px rgba(0,0,0,0.8); z-index: 5; cursor: default; }
.cell--empty { background: rgba(255,255,255,0.025); }
.cell--now { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--green); }
.cell__val { font-family: var(--mono); font-size: 11.5px; font-weight: 600; line-height: 1;
  color: rgba(255,255,255,0.92); text-shadow: 0 1px 1.5px rgba(0,0,0,0.45);
  font-variant-numeric: tabular-nums; }
.cell--now .cell__nowtag { position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: 8px; font-weight: 700; letter-spacing: 0.06em;
  background: var(--green); color: var(--green-ink); padding: 1px 4px; border-radius: 4px; }

/* ===== Diagonal reveal: cells pop in one-by-one on first load / when a club is added ===== */
@keyframes hm-cell-in {
  from { opacity: 0; transform: scale(0.12); }
  55%  { opacity: 1; }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes hm-label-in {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}
.heatmap--reveal .cell {
  animation: hm-cell-in 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
  animation-delay: var(--d, 0ms);
}
.heatmap--reveal .hm-hour,
.heatmap--reveal .hm-day {
  animation: hm-label-in 0.3s ease backwards;
  animation-delay: var(--d, 0ms);
}
/* Primed state: while a grid is out of view it's held empty (cells hidden) so
   when it scrolls back into view it animates from blank instead of flashing. */
.heatmap--armed .cell,
.heatmap--armed .hm-hour,
.heatmap--armed .hm-day { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .heatmap--reveal .cell,
  .heatmap--reveal .hm-hour,
  .heatmap--reveal .hm-day { animation: none; }
  .heatmap--armed .cell,
  .heatmap--armed .hm-hour,
  .heatmap--armed .hm-day { opacity: 1; }
}

.meta { color: var(--fg-dim); font-family: var(--mono); font-size: 11.5px; margin: 14px 0 0; }
.empty { color: var(--fg-dim); padding: 1.5rem 0; text-align: center; }

/* ============ FOOTER ============ */
.disclaimer { border-top: 1px solid var(--line); margin-top: 30px; padding: 26px 0 46px;
  color: var(--fg-dim); font-size: 12.5px; line-height: 1.6; }
.disclaimer .mono { display: inline; }

@media (max-width: 900px) {
  .hero__grid { grid-template-columns: 1fr; }
}

/* Stack the verdict stats as label → value rows on narrow screens so the
   nowrap labels (e.g. "vs. this club's peak") can't collide. */
@media (max-width: 520px) {
  .verdict__foot { flex-direction: column; align-items: stretch; gap: 12px; padding-top: 18px; }
  .stat { flex-direction: row; justify-content: space-between; align-items: baseline; gap: 14px; }
  .stat__k { white-space: normal; }
  .stat__v { font-size: 20px; }
  .stat__rule { display: none; }
  .verdict__foot .forecast__live { margin-left: 0; align-self: flex-end; }
}

@media (max-width: 640px) {
  :root { --label-col: 2.3rem; --cell-gap: 2px; }
  .wrap { padding: 0 16px; }
  /* Fixed-width cells so values (incl. 3 digits) always fit; the grid then
     overflows its width and becomes a horizontal swipe instead of squashing
     the numbers. Only the matrix scrolls, via the .heatmap-scroll wrapper. */
  .heatmap { grid-template-columns: var(--label-col) repeat(24, 26px); }
  .heatmap-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 6px; }
  .hm-hour { font-size: 9px; }
  .cell__val { font-size: 11px; }
}
