/* ============================================================
   Moore Performance — Fuelling Calculator
   Dark, mobile-first. Brand: pink #FC5BB9 / magenta #ED008C on
   charcoal. Pink→magenta gradient on headings, buttons, stats.
   ============================================================ */

:root {
  /* Brand core */
  --pink: #fc5bb9;
  --magenta: #ed008c;
  --pink-deep: #c0006f;

  /* Dark UI (from brief) */
  --bg: #1a1c1e;
  --card: #26292b;
  --card-2: #2c2f31;
  --line: #3a3e41;
  --text: #f2f2f4;
  --muted: #9aa0a6;

  /* Discipline accents */
  --swim: #1c9bd1;
  --bike: #ed008c;
  --run: #e8631a;

  --grad: linear-gradient(100deg, var(--pink) 0%, var(--magenta) 100%);

  --radius: 14px;
  --radius-sm: 10px;
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Barlow Condensed", "Barlow", system-ui, sans-serif;
}

* { box-sizing: border-box; }

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

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

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 16px 64px;
}

a { color: var(--pink); }

/* ---- Header / brand ---- */
.site-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0 18px;
}
.site-header .logo { height: 46px; width: auto; flex: 0 0 auto; }

/* ---- Install banner (PWA) ---- */
.install-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 14px;
  padding: 10px 12px;
  background: linear-gradient(100deg, rgba(237, 0, 140, 0.16), rgba(252, 91, 185, 0.05));
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}
.install-banner[hidden] { display: none; }
.install-text { flex: 1 1 auto; color: var(--text); }
.install-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.install-btn {
  border: none;
  background: var(--grad);
  color: #fff;
  font: inherit;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
}
.install-dismiss {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  padding: 6px 8px;
  cursor: pointer;
}
.install-dismiss:hover { color: var(--text); }

/* ---- Hero ---- */
.hero { margin: 6px 0 22px; }
.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.9rem, 6.5vw, 2.6rem);
  line-height: 1.05;
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p { color: var(--muted); margin: 0; max-width: 56ch; }

/* ---- Cards ---- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 16px;
}
.card > h2 {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: 1.05rem;
  margin: 0 0 14px;
  color: var(--text);
}

/* ---- Form ---- */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field > label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}
.hint { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); }

input[type="number"],
input[type="text"],
select {
  width: 100%;
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  padding: 12px 12px;
  border-radius: var(--radius-sm);
  appearance: none;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(252, 91, 185, 0.18);
}
select {
  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='%239aa0a6' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Split time entry (hours + minutes) — no colon to type on mobile */
.time-pick { display: flex; align-items: center; gap: 8px; }
.time-pick input { width: 4.5rem; text-align: center; }
.time-pick span { color: var(--muted); font-size: 0.9rem; }

/* Segmented toggles (radio pills) */
.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 4px;
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  text-align: center;
  padding: 9px 6px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  user-select: none;
}
.seg input:checked + label {
  background: var(--grad);
  color: #fff;
}
.seg input:focus-visible + label {
  box-shadow: 0 0 0 3px rgba(252, 91, 185, 0.3);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: none;
  border-radius: var(--radius-sm);
  padding: 15px 18px;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
}
.btn-primary { background: var(--grad); color: #fff; font-size: 1.05rem; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--pink); color: var(--pink); }

.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px; }

/* ---- Results ---- */
#results[hidden] { display: none; }
.results-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin: 28px 0 14px;
  flex-wrap: wrap;
}
.results-head h2 {
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: 1.4rem;
  margin: 0;
}
.results-head .sub { color: var(--muted); font-size: 0.9rem; }

/* Stat cards */
.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}
.stat .k {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}
.stat .v {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.1rem;
  line-height: 1.05;
  margin: 4px 0 2px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat .v .u { font-size: 0.95rem; -webkit-text-fill-color: var(--muted); color: var(--muted); }
.stat .t { font-size: 0.82rem; color: var(--muted); }

/* Timeline table */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.timeline {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 520px;
}
table.timeline th,
table.timeline td {
  text-align: left;
  padding: 10px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.timeline th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}
table.timeline td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.timeline .win { font-weight: 600; white-space: nowrap; }
table.timeline .cue { color: var(--muted); min-width: 200px; }
table.timeline tr:last-child td { border-bottom: none; }

.leg-tag {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 999px;
  margin-top: 4px;
  color: #fff;
}
.leg-swim { background: var(--swim); }
.leg-bike { background: var(--bike); }
.leg-run { background: var(--run); }

.mix-line {
  margin: 14px 0 0;
  padding: 12px 14px;
  background: var(--card-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  font-size: 0.92rem;
}

/* Coaching note */
.coach-note {
  border-left: 3px solid var(--magenta);
  background: linear-gradient(100deg, rgba(237, 0, 140, 0.10), rgba(252, 91, 185, 0.03));
}
.coach-note h2 { margin-bottom: 6px; }
.coach-note .lead { font-weight: 600; color: var(--pink); margin: 0 0 6px; }
.coach-note p.body { margin: 0; color: var(--text); }

/* CTA funnel */
.cta {
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  background-image: radial-gradient(120% 120% at 50% 0%, rgba(237,0,140,0.16), transparent 60%);
}
.cta h2 {
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: 1.35rem;
  margin: 0 0 6px;
}
.cta p { color: var(--muted); margin: 0 auto 16px; max-width: 46ch; }
.cta .btn { max-width: 320px; margin: 0 auto; }

/* Disclaimer + footer */
.disclaimer {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.55;
  margin: 18px 2px;
}
.site-footer {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.85rem;
}
.site-footer .logo { height: 34px; width: auto; }
.site-footer a { text-decoration: none; }
.site-footer .links { margin-left: auto; display: flex; gap: 16px; }

/* ---- Responsive ---- */
@media (min-width: 560px) {
  .stats { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 380px) {
  .seg label { font-size: 0.82rem; padding: 9px 3px; }
}

/* ---- Print / save-to-PDF ---- */
@media print {
  :root { --bg: #fff; --card: #fff; --card-2: #fff; --text: #111; --muted: #555; --line: #ccc; }
  body { background: #fff; color: #111; font-size: 12px; }
  .wrap { max-width: none; padding: 0; }
  .no-print, form#fuel-form, .cta, .btn-row, .hero p, .results-head .sub { display: none !important; }
  .hero h1, .stat .v {
    -webkit-text-fill-color: initial; color: var(--magenta);
    background: none;
  }
  /* Logo is white text — keep it on a dark plate so it prints visibly. */
  .site-header { background: #2c2f31; padding: 10px 14px; border-radius: 8px; display: inline-block;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .site-footer .logo { display: none; }
  .card, .stat { break-inside: avoid; border: 1px solid #ccc; box-shadow: none; }
  table.timeline { min-width: 0; font-size: 11px; }
  table.timeline th, table.timeline td { padding: 5px 6px; }
  .table-scroll { overflow: visible; }
  .coach-note { background: none; }
  .leg-tag { color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a[href]::after { content: ""; }
}
