/* ═══════════════════════════════════════════════════════════════
   Josiah Fitness — "Night Program"
   ─── Black base · Electric lime accent · Athletic-editorial
   ═══════════════════════════════════════════════════════════════ */

@import url("https://fonts.googleapis.com/css2?family=Big+Shoulders+Display:wght@500;700;900&family=Hanken+Grotesk:ital,wght@0,300..800;1,400..600&family=JetBrains+Mono:wght@400;500;700&family=Instrument+Serif:ital@0;1&display=swap");

:root {
  /* Palette */
  --ink:        #0a0a0a;       /* base */
  --surface:    #111111;       /* cards one level up */
  --surface-2:  #161616;       /* floating elements */
  --line:       #242424;       /* dividers, borders */
  --line-hot:   #2f2f2f;       /* hover-lit borders */
  --text:       #f5f4ef;
  --text-dim:   #9a9a94;
  --text-faint: #565652;

  /* Signal */
  --lime:       #c6ff3c;
  --lime-soft:  #c6ff3c1a;
  --lime-glow:  0 0 28px #c6ff3c33;
  --blood:      #ff4949;       /* destructive/overload warnings */
  --amber:      #ffb347;       /* deload / rest */

  /* Type */
  --font-display: "Big Shoulders Display", system-ui, sans-serif;
  --font-body:    "Hanken Grotesk", system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, monospace;
  --font-editor:  "Instrument Serif", Georgia, serif;

  /* Rhythm */
  --radius: 4px;
  --radius-lg: 8px;
  --pad: 20px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  background: var(--ink);
  color-scheme: dark;
  overflow-x: clip;       /* stop any child from causing horizontal scroll */
  width: 100%;
}
body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 17.5px;
  line-height: 1.55;
  color: var(--text);
  background: var(--ink);
  background-image:
    radial-gradient(circle at 20% 0%, #1a1a0a 0%, transparent 40%),
    radial-gradient(circle at 85% 100%, #0a1a0a 0%, transparent 35%);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  width: 100%;
  max-width: 100vw;
}
img, svg, video { max-width: 100%; }

/* Grain overlay — cheap SVG noise, 5% opacity */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.5'/></svg>");
  opacity: 0.06;
  mix-blend-mode: overlay;
}

#app { position: relative; z-index: 2; }

/* ─── Typography ────────────────────────────────────────────── */

h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 900; letter-spacing: -0.02em; line-height: 0.95; text-transform: uppercase; overflow-wrap: anywhere; }
.display-xl { font-size: clamp(52px, 13vw, 160px); font-weight: 900; letter-spacing: -0.04em; line-height: 0.85; overflow-wrap: anywhere; }
.display-l  { font-size: clamp(38px, 8.5vw, 88px); font-weight: 900; letter-spacing: -0.03em; line-height: 0.9; overflow-wrap: anywhere; }
.display-m  { font-size: clamp(26px, 5.6vw, 48px); font-weight: 900; letter-spacing: -0.02em; line-height: 0.95; overflow-wrap: anywhere; }
.display-s  { font-size: clamp(20px, 4vw, 28px); font-weight: 700; letter-spacing: -0.01em; line-height: 1; overflow-wrap: anywhere; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.editor {
  font-family: var(--font-editor);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(20px, 2.8vw, 26px);
  line-height: 1.4;
  color: var(--text);
}

.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }

/* ─── Layout primitives ─────────────────────────────────────── */

.page { min-height: 100dvh; display: flex; flex-direction: column; max-width: 100%; }
.pad { padding: var(--pad); }
.wrap { width: 100%; max-width: min(820px, 100%); margin: 0 auto; padding: 0 var(--pad); }
@media (max-width: 400px) {
  :root { --pad: 16px; }
}
.stack > * + * { margin-top: 20px; }
.stack-tight > * + * { margin-top: 8px; }
.stack-loose > * + * { margin-top: 32px; }
.row { display: flex; gap: 12px; align-items: center; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 10px; }
.split { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 520px) { .grid-3 { grid-template-columns: 1fr 1fr; } }

hr.rule { border: none; border-top: 1px solid var(--line); margin: 24px 0; }
hr.rule-hot { border: none; border-top: 2px solid var(--lime); margin: 24px 0; }

/* ─── Top rail (global) ─────────────────────────────────────── */

.rail {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
  padding: 14px var(--pad);
  background: rgba(10,10,10, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  max-width: 100%;
  min-width: 0;
}
.rail > * { min-width: 0; }
.rail-mark {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text);
  flex: 0 0 auto;
  white-space: nowrap;
}
.rail-mark span { color: var(--lime); }
.rail-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  display: flex;
  gap: 10px;
  align-items: center;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
}
.rail-meta .rail-date { white-space: nowrap; }
@media (max-width: 420px) {
  .rail-meta .rail-date { display: none; }
}

/* ─── Mode pill ─────────────────────────────────────────────── */

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--line-hot);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--surface);
}
.pill.hot {
  border-color: var(--lime);
  color: var(--lime);
  background: var(--lime-soft);
}
.pill.warm { border-color: var(--amber); color: var(--amber); }
.pill .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }

/* ─── Buttons ───────────────────────────────────────────────── */

.btn {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 22px;
  min-height: 48px;
  border: 1px solid var(--line-hot);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 120ms cubic-bezier(.2,.9,.2,1.2),
              background-color 120ms linear,
              border-color 120ms linear,
              box-shadow 200ms linear;
}
.btn:hover { border-color: var(--text-dim); background: #181818; }
.btn:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--lime);
  color: var(--ink);
  border-color: var(--lime);
  box-shadow: var(--lime-glow);
}
.btn-primary:hover { background: #d6ff4a; border-color: #d6ff4a; }

.btn-ghost {
  background: transparent;
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--text-dim); }

.btn-sm { padding: 8px 14px; min-height: 36px; font-size: 12px; letter-spacing: 0.08em; }

/* ─── Cards ─────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
}
.card-hot { border-color: var(--lime); box-shadow: var(--lime-glow); }

/* Exercise card */
.ex-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 20px 18px;
  position: relative;
  overflow: hidden;
  transition: border-color 150ms linear, transform 120ms cubic-bezier(.2,.9,.2,1.2);
}
.ex-card.done {
  border-color: var(--lime);
  background: linear-gradient(180deg, var(--surface), #131a0a);
}
.ex-card .ex-num {
  position: absolute;
  top: 10px; right: 14px;
  font-family: var(--font-mono);
  font-size: 42px;
  font-weight: 500;
  color: #1f1f1f;
  letter-spacing: -0.04em;
  line-height: 1;
  pointer-events: none;
}
.ex-card.done .ex-num { color: #2a3d12; }
.ex-card .ex-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 22px;
  letter-spacing: -0.01em;
  line-height: 1.05;
  text-transform: uppercase;
  padding-right: 60px;
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}
.ex-card .ex-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ex-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 8px;
  background: #1c1c1c;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--text);
}
.ex-chip.lime { border-color: var(--lime); color: var(--lime); background: var(--lime-soft); }
.ex-card .ex-cues {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 12px;
  line-height: 1.45;
}
.ex-card .ex-why {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 6px;
  line-height: 1.4;
  font-style: italic;
}
.ex-card .ex-video {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.ex-card .ex-video::before { content: "▶"; color: var(--lime); }
.ex-card .ex-video:hover { color: var(--lime); }

/* Set log rows */
.set-grid {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: grid;
  gap: 8px;
}
.set-row {
  display: grid;
  grid-template-columns: 40px repeat(3, 1fr);
  gap: 8px;
  align-items: center;
}
.set-row.header {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.set-row input[type="number"],
.set-row input[type="text"] {
  width: 100%;
  padding: 10px 8px;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
  text-align: center;
}
.set-row input:focus { outline: none; border-color: var(--lime); box-shadow: 0 0 0 1px var(--lime); }
.set-row .idx { color: var(--text-faint); font-family: var(--font-mono); font-size: 13px; text-align: center; }

/* Difficulty slider */
.diff {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.diff-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.diff-label .val { color: var(--lime); font-size: 20px; font-weight: 700; letter-spacing: 0; }
.diff-buttons { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.diff-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--ink);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 10px 0;
  border-radius: 3px;
  cursor: pointer;
  transition: all 120ms linear;
}
.diff-btn:hover { border-color: var(--text-dim); color: var(--text); }
.diff-btn.selected {
  background: var(--lime);
  color: var(--ink);
  border-color: var(--lime);
  font-weight: 700;
}

/* ─── Inputs ────────────────────────────────────────────────── */

label.field {
  display: block;
}
.field-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.field input[type="text"],
.field input[type="number"],
.field input[type="password"],
.field textarea {
  width: 100%;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  transition: border-color 120ms linear, box-shadow 120ms linear;
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--lime);
  box-shadow: 0 0 0 1px var(--lime);
}
.field textarea { min-height: 120px; resize: vertical; font-family: var(--font-body); line-height: 1.5; }

/* Pill selectors (for questionnaire single/multi) */
.pill-select {
  display: grid;
  gap: 10px;
}
.pill-opt {
  display: block;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 140ms ease-out;
  position: relative;
}
.pill-opt:hover { border-color: var(--text-dim); background: #171717; }
.pill-opt.selected {
  border-color: var(--lime);
  background: linear-gradient(180deg, var(--surface), #131a0a);
  box-shadow: inset 0 0 0 1px var(--lime);
}
.pill-opt .label {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--text);
}
.pill-opt .caption {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
  line-height: 1.4;
}
.pill-opt.selected .label { color: var(--lime); }

/* Pill grid (tight multi-pill) */
.pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pill-tag {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  cursor: pointer;
  transition: all 140ms ease-out;
}
.pill-tag:hover { border-color: var(--text-dim); }
.pill-tag.selected {
  background: var(--lime);
  border-color: var(--lime);
  color: var(--ink);
  font-weight: 700;
}

/* ─── Progress bar (top of questionnaire) ───────────────────── */

.progress {
  height: 3px;
  background: var(--line);
  position: relative;
  overflow: hidden;
}
.progress-fill {
  position: absolute; top: 0; left: 0; bottom: 0;
  background: var(--lime);
  transition: width 300ms cubic-bezier(.2,.9,.2,1.1);
  box-shadow: var(--lime-glow);
}

/* ─── Workout calendar grid (block view) ────────────────────── */

.cal {
  display: grid;
  grid-template-columns: 72px 1fr;
  border-top: 1px solid var(--line);
}
.cal-week {
  padding: 16px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
}
.cal-week .big {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 900;
  color: var(--text);
  line-height: 0.85;
}
.cal-days {
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr;
}
.cal-day {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  transition: background-color 100ms linear;
}
.cal-day:last-child { border-bottom: none; }
.cal-day:hover { background: #171717; }
.cal-day.done { background: linear-gradient(180deg, var(--surface), #131a0a); }
.cal-day.today { box-shadow: inset 3px 0 0 var(--lime); }
.cal-day .d-num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
}
.cal-day .d-theme {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--text);
}
.cal-day.done .d-theme { color: var(--lime); }
.cal-day .d-status {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  align-self: center;
}

/* ─── Deposit tiles ─────────────────────────────────────────── */

.deposit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.deposit-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: all 140ms ease-out;
  text-align: left;
  font-family: var(--font-body);
  color: inherit;
  appearance: none;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.deposit-tile:hover { border-color: var(--lime); }
.deposit-tile .d-label {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
  line-height: 1.05;
}
.deposit-tile .d-today {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 10px;
}
.deposit-tile .d-today .n { color: var(--lime); font-size: 14px; }

/* ─── View transitions ──────────────────────────────────────── */

.view-enter { opacity: 0; transform: translateY(10px); }
.view-in { animation: viewIn 440ms cubic-bezier(.2,.9,.2,1.1) forwards; }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Utility ───────────────────────────────────────────────── */

.text-right { text-align: right; }
.text-center { text-align: center; }
.u-hide { display: none !important; }
.u-mt-0 { margin-top: 0 !important; }
.u-mt-s { margin-top: 8px !important; }
.u-mt-m { margin-top: 16px !important; }
.u-mt-l { margin-top: 32px !important; }

/* Toast */
.toast {
  position: fixed; bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-2);
  border: 1px solid var(--lime);
  color: var(--text);
  padding: 12px 18px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 160ms linear, transform 160ms ease-out;
  z-index: 100;
  box-shadow: var(--lime-glow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Loading bar while AI generates */
.loader-wrap {
  min-height: 60vh;
  display: grid;
  place-items: center;
}
.loader {
  text-align: center;
}
.loader .label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 20px;
}
.loader .line {
  width: 240px;
  height: 2px;
  background: var(--line);
  margin: 0 auto;
  overflow: hidden;
  position: relative;
}
.loader .line::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 40%;
  background: var(--lime);
  box-shadow: var(--lime-glow);
  animation: load-sweep 1.4s cubic-bezier(.4,0,.2,1) infinite;
}
@keyframes load-sweep {
  0%   { left: -40%; }
  100% { left: 100%; }
}

/* Details text */
.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 18px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  letter-spacing: 0.04em;
}
.kv dt { color: var(--text-faint); text-transform: uppercase; }
.kv dd { margin: 0; color: var(--text); }

/* Footer small print */
.footer {
  margin-top: 60px;
  padding: 20px var(--pad) 40px;
  text-align: center;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
