/* TrainCalcs — design system v2 */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700;800&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* surfaces */
  --bg:        #f6f4ee;
  --bg-card:   #ffffff;
  --bg-soft:   #ecebe3;
  --ink:       #0e1610;
  --ink-2:     #1f2a22;
  --muted:     #5b6660;
  --hairline:  rgba(14,22,16,0.08);
  --hairline-s:rgba(14,22,16,0.18);

  /* brand */
  --green:      #1a4a2e;
  --green-deep: #0f3320;
  --green-soft: #d8e4d8;
  --green-tint: #eaf0e7;

  /* metric accent */
  --amber:      #e08a3c;
  --amber-deep: #b86a23;
  --amber-tint: #f6e7d4;

  /* category colours */
  --cat-body:      #1a4a2e;
  --cat-nutrition: #e08a3c;
  --cat-strength:  #b04132;
  --cat-cardio:    #2c5da8;
  --cat-lifestyle: #6b4f8a;

  /* type */
  --f-head: 'Space Grotesk', ui-sans-serif, system-ui;
  --f-body: 'Inter', ui-sans-serif, system-ui;
  --f-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* radii */
  --r-card: 14px;
  --r-pill: 999px;
  --r-input: 12px;
  --r-chip: 10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--f-body); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  letter-spacing: -0.005em;
}
h1, h2, h3, h4 { font-family: var(--f-head); font-weight: 700; letter-spacing: -0.02em; color: var(--ink); margin: 0; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
img, svg { display: block; }
.mono { font-family: var(--f-mono); font-feature-settings: "tnum" 1; }

/* ─── LOGO ─────────────────────────────────────────────────────── */
.tc-logo {
  font-family: var(--f-head); font-weight: 800; font-size: 18px;
  letter-spacing: -0.025em; color: var(--ink);
  display: inline-flex; align-items: baseline; gap: 0;
  text-decoration: none;
}
.tc-logo b { color: var(--green); }
.tc-logo-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 999px;
  background: var(--amber); margin-left: 3px; transform: translateY(-3px);
}

/* ─── MOBILE HEADER ─────────────────────────────────────────────── */
.tc-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--hairline);
}
.tc-header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px 12px;
}
.tc-header-icons { display: flex; gap: 8px; }
.tc-icon-btn {
  width: 36px; height: 36px; border-radius: 10px; background: transparent;
  border: 1px solid var(--hairline); display: grid; place-items: center; color: var(--ink);
}
.tc-cat-strip {
  display: flex; gap: 6px; padding: 0 20px 10px;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tc-cat-strip::-webkit-scrollbar { display: none; }
.tc-cat-pill {
  flex: 0 0 auto;
  font-family: var(--f-mono); font-size: 10px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 7px 11px 6px; border-radius: 999px;
  background: var(--bg-card); color: var(--ink-2); border: 1px solid var(--hairline);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.tc-cat-pill .tc-dot { width: 7px; height: 7px; border-radius: 999px; flex-shrink: 0; }
.tc-cat-pill.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ─── HERO ──────────────────────────────────────────────────────── */
.tc-hero {
  background: var(--green); color: #f4f1e8;
  padding: 28px 20px 32px; position: relative; overflow: hidden;
}
.tc-hero::before {
  content: ""; position: absolute; width: 320px; height: 320px;
  border-radius: 50%; border: 1px solid rgba(244,241,232,0.06);
  right: -80px; top: -80px; pointer-events: none;
}
.tc-eyebrow {
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.18em;
  text-transform: uppercase; opacity: 0.72;
  display: flex; align-items: center; gap: 8px; margin-bottom: 16px;
}
.tc-pulse {
  width: 6px; height: 6px; border-radius: 999px; background: var(--amber);
  box-shadow: 0 0 0 4px rgba(224,138,60,0.2); flex-shrink: 0;
}
.tc-hero h1 {
  font-family: var(--f-head); font-weight: 700;
  font-size: 36px; line-height: 1.02; letter-spacing: -0.03em; color: #f6f3e9;
}
.tc-hero h1 em { font-style: normal; color: var(--amber); }
.tc-hero-sub {
  margin-top: 12px; font-size: 13.5px; line-height: 1.55;
  color: rgba(246,243,233,0.72); max-width: 360px;
}
.tc-hero-stats {
  display: grid; grid-template-columns: repeat(3,1fr);
  margin-top: 24px; padding-top: 18px;
  border-top: 1px solid rgba(244,241,232,0.15);
}
.tc-hero-stat { padding-right: 12px; border-right: 1px solid rgba(244,241,232,0.12); }
.tc-hero-stat:last-child { border-right: none; }
.tc-hero-stat .n {
  font-family: var(--f-mono); font-size: 24px; font-weight: 500;
  color: #f6f3e9; letter-spacing: -0.025em; line-height: 1;
}
.tc-hero-stat .n .u { color: var(--amber); font-size: 13px; margin-left: 1px; }
.tc-hero-stat .k {
  font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.14em;
  text-transform: uppercase; color: rgba(244,241,232,0.5); margin-top: 5px;
}

/* ─── FEATURED CARD ─────────────────────────────────────────────── */
.tc-featured {
  margin: 32px 16px 0; padding: 18px 18px 16px;
  background: var(--bg-card); border-radius: var(--r-card);
  border: 1px solid var(--hairline);
  box-shadow: 0 16px 32px -20px rgba(14,22,16,0.22);
  position: relative; z-index: 2;
}
.tc-featured-row { display: flex; align-items: center; justify-content: space-between; }
.tc-tag {
  font-family: var(--f-mono); font-size: 10px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.1em;
  display: inline-flex; align-items: center; gap: 5px;
}
.tc-featured h2 { font-size: 20px; margin-top: 8px; }
.tc-featured p { font-size: 13px; color: var(--muted); margin-top: 4px; }
.tc-featured-mini {
  margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
}
.tc-mini-cell { background: var(--bg); padding: 9px 10px; border-radius: 10px; }
.tc-mini-cell .k {
  font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted);
}
.tc-mini-cell .v {
  font-family: var(--f-mono); font-size: 14px; font-weight: 500; color: var(--ink); margin-top: 2px;
}
.tc-cta-btn {
  margin-top: 14px; width: 100%; padding: 13px 14px; border-radius: 12px;
  background: var(--ink); color: var(--bg); border: none;
  font-family: var(--f-body); font-weight: 600; font-size: 14px;
  display: flex; align-items: center; justify-content: space-between; transition: opacity 0.15s;
}
.tc-cta-btn:hover { opacity: 0.88; }
.tc-cta-btn .arr { font-family: var(--f-mono); font-size: 14px; }

/* ─── SECTIONS ──────────────────────────────────────────────────── */
.tc-section { padding: 32px 20px 0; }
.tc-section-head {
  display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px;
}
.tc-section-head .left { display: flex; align-items: baseline; gap: 10px; }
.tc-section-head h2 { font-size: 18px; }
.tc-section-head .count { font-family: var(--f-mono); font-size: 11px; color: var(--muted); }
.tc-section-head .tc-dot { width: 9px; height: 9px; border-radius: 999px; align-self: center; transform: translateY(-1px); }
.tc-section-head .more { font-family: var(--f-mono); font-size: 11px; color: var(--ink); }

/* ─── TOOL CARDS ────────────────────────────────────────────────── */
.tc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tc-card {
  background: var(--bg-card); border-radius: var(--r-card);
  border: 1px solid var(--hairline); padding: 13px;
  display: flex; flex-direction: column; min-height: 160px;
  transition: border-color 0.15s, transform 0.15s;
  text-decoration: none; color: inherit;
}
.tc-card:hover { border-color: var(--hairline-s); transform: translateY(-1px); }
.tc-card:active { transform: scale(0.99); }
.tc-card h3 { font-size: 15px; margin-top: 13px; letter-spacing: -0.015em; font-weight: 700; line-height: 1.15; }
.tc-card p { font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.35; }
.tc-viz { margin-top: auto; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; }
.tc-read { font-family: var(--f-mono); font-size: 10.5px; color: var(--ink); }
.tc-read .u { color: var(--muted); }

/* ─── FOOTER ────────────────────────────────────────────────────── */
.tc-footer {
  margin-top: 48px; padding: 24px 20px 32px;
  border-top: 1px solid var(--hairline);
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); text-align: center; line-height: 2;
}
.tc-footer a { color: var(--muted); }
.tc-footer a:hover { color: var(--ink); }

/* ─── HIDE DESKTOP-ONLY ELEMENTS ON MOBILE ─────────────────────── */
.tc-rail { display: none; }
.tc-topbar { display: none; }

/* ─── DESKTOP ───────────────────────────────────────────────────── */
@media (min-width: 900px) {
  .tc-header { display: none; }
  body { display: flex; }

  .tc-rail {
    width: 232px; flex-shrink: 0; position: sticky; top: 0; height: 100vh;
    border-right: 1px solid var(--hairline); background: var(--bg);
    padding: 22px 18px 18px; display: flex; flex-direction: column;
    overflow-y: auto;
  }
  .tc-rail-brand {
    font-family: var(--f-head); font-weight: 800; font-size: 19px;
    letter-spacing: -0.025em; display: flex; align-items: baseline;
    padding: 0 6px 22px; text-decoration: none; color: var(--ink);
  }
  .tc-rail-brand b { color: var(--green); }
  .tc-rail-label {
    font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.14em;
    color: var(--muted); text-transform: uppercase; padding: 12px 8px 6px;
  }
  .tc-rail-nav { display: flex; flex-direction: column; gap: 1px; }
  .tc-rail-nav a {
    display: flex; align-items: center; gap: 10px; padding: 9px 10px;
    border-radius: 10px; font-size: 13.5px; color: var(--ink-2);
    border: 1px solid transparent; transition: background 0.12s;
  }
  .tc-rail-nav a:hover { background: var(--bg-soft); }
  .tc-rail-nav a.active { background: var(--bg-card); border-color: var(--hairline); color: var(--ink); font-weight: 600; }
  .tc-rail-nav .tc-dot { width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0; }
  .tc-rail-nav .ct { margin-left: auto; font-family: var(--f-mono); font-size: 10px; color: var(--muted); }
  .tc-rail-pulse {
    margin-top: auto; background: var(--ink); color: #f4f1e8; border-radius: 12px; padding: 14px;
  }
  .tc-rail-pulse .meta { font-family: var(--f-mono); font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber); }
  .tc-rail-pulse h4 { font-family: var(--f-head); font-size: 13px; color: #f4f1e8; font-weight: 600; margin-top: 6px; }
  .tc-rail-pulse p { font-size: 12px; line-height: 1.45; color: rgba(244,241,232,0.65); margin: 4px 0 10px; }
  .tc-rail-pulse a { color: var(--amber); font-family: var(--f-mono); font-size: 11px; }

  .tc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

  .tc-topbar {
    display: flex; align-items: center; padding: 0 40px; height: 56px;
    border-bottom: 1px solid var(--hairline); background: var(--bg);
    position: sticky; top: 0; z-index: 5; gap: 16px; flex-shrink: 0;
  }
  .tc-topbar-path { font-family: var(--f-mono); font-size: 11px; color: var(--muted); letter-spacing: 0.06em; white-space: nowrap; }
  .tc-topbar-search {
    flex: 1; max-width: 480px; height: 36px; display: flex; align-items: center; gap: 8px;
    background: var(--bg-card); border: 1px solid var(--hairline); border-radius: 10px; padding: 0 12px;
    font-family: var(--f-mono); font-size: 12px; color: var(--muted);
  }
  .tc-topbar-search .kbd { margin-left: auto; padding: 2px 6px; border-radius: 4px; background: var(--bg-soft); font-size: 10px; }
  .tc-topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
  .tc-topbar-right a { font-size: 13px; font-weight: 500; color: var(--ink-2); padding: 7px 12px; border-radius: 8px; transition: background 0.12s; }
  .tc-topbar-right a:hover { background: var(--bg-soft); }

  .tc-hero {
    padding: 52px 56px 48px;
    display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 52px;
  }
  .tc-hero::before { width: 520px; height: 520px; right: -100px; top: -120px; }
  .tc-hero h1 { font-size: 64px; line-height: 0.97; }
  .tc-hero-sub { font-size: 15px; max-width: 440px; }
  .tc-hero-stats { grid-template-columns: repeat(3,auto); display: flex; }
  .tc-hero-stat .n { font-size: 30px; }

  .tc-featured { margin: 0; padding: 22px; border-radius: 18px; align-self: center; box-shadow: 0 28px 60px -28px rgba(0,0,0,0.42); }
  .tc-featured h2 { font-size: 22px; }
  .tc-hero-left { position: relative; z-index: 2; }

  .tc-section { padding: 40px 56px 0; }
  .tc-section-head h2 { font-size: 22px; }
  .tc-section-head .count { font-size: 12px; }
  .tc-section-head .more { font-size: 12px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--hairline); background: var(--bg-card); }

  .tc-grid { grid-template-columns: repeat(4,1fr); gap: 14px; }
  .tc-card { min-height: 188px; padding: 18px; }
  .tc-card h3 { font-size: 17px; }
  .tc-card p { font-size: 12.5px; }

  .tc-footer { padding: 24px 56px; display: flex; justify-content: space-between; align-items: center; text-align: left; }
  .tc-footer-links { display: flex; gap: 20px; }
}

/* ─── CALCULATOR PAGE STYLES ────────────────────────────────────── */
.calc-page-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--hairline);
}
.calc-page-header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 20px; max-width: 1100px; margin: 0 auto;
}
.calc-wrapper { max-width: 680px; margin: 0 auto; padding: 0 20px 80px; }

.breadcrumb { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.04em; color: var(--muted); display: flex; align-items: center; gap: 6px; padding-top: 20px; margin-bottom: 6px; }
.breadcrumb .sep { opacity: 0.4; }
.breadcrumb .cur { color: var(--ink); }

.calc-hero-block { padding: 14px 0 22px; }
.calc-hero-block .tc-tag { margin-bottom: 12px; }
.calc-hero-block h1 { font-size: 32px; letter-spacing: -0.03em; line-height: 1.05; }
.calc-hero-block p { font-size: 14px; color: var(--muted); margin-top: 10px; line-height: 1.55; }

.input-card {
  background: var(--bg-card); border: 1px solid var(--hairline);
  border-radius: var(--r-card); padding: 24px; margin-bottom: 16px;
}
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field-label { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.field-label .k { font-size: 13px; font-weight: 600; color: var(--ink); }
.field-label .hint { font-family: var(--f-mono); font-size: 10px; color: var(--muted); }
.tc-input {
  width: 100%; height: 52px; padding: 0 14px;
  background: var(--bg); border: 1px solid var(--hairline); border-radius: var(--r-input);
  font-family: var(--f-mono); font-size: 18px; font-weight: 500; color: var(--ink);
  -webkit-appearance: none; appearance: none;
}
.tc-input:focus { outline: 2px solid var(--ink); outline-offset: -1px; background: var(--bg-card); }
.tc-input::placeholder { color: rgba(14,22,16,0.25); }
.tc-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' stroke='%235b6660' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

.pill-toggle { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg-soft); border-radius: 999px; padding: 4px; position: relative; width: fit-content; }
.pill-toggle button { background: transparent; border: none; padding: 8px 20px; font-family: var(--f-mono); font-size: 11.5px; font-weight: 500; letter-spacing: 0.04em; color: var(--muted); border-radius: 999px; position: relative; z-index: 2; transition: color 0.18s; }
.pill-toggle button.active { color: var(--bg-card); }
.pill-toggle .thumb { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); background: var(--ink); border-radius: 999px; transition: transform 0.22s cubic-bezier(0.4,0,0.2,1); z-index: 1; }
.pill-toggle.right .thumb { transform: translateX(100%); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { flex: 1 1 calc(50% - 4px); min-height: 48px; background: var(--bg-card); border: 1px solid var(--hairline); border-radius: var(--r-chip); padding: 8px 12px; color: var(--ink); font-family: var(--f-body); font-size: 13px; font-weight: 500; text-align: left; display: flex; flex-direction: column; gap: 2px; justify-content: center; transition: all 0.15s; }
.chip .sub { font-family: var(--f-mono); font-size: 10px; color: var(--muted); letter-spacing: 0.02em; }
.chip.active { background: var(--ink); color: #f4f1e8; border-color: var(--ink); }
.chip.active .sub { color: rgba(244,241,232,0.6); }
.chip.full { flex: 1 1 100%; }

.calc-btn { width: 100%; padding: 16px; background: var(--ink); color: #f4f1e8; border: none; border-radius: 14px; font-family: var(--f-head); font-weight: 600; font-size: 16px; display: flex; align-items: center; justify-content: space-between; transition: opacity 0.15s; box-shadow: 0 10px 24px -12px rgba(14,22,16,0.4); }
.calc-btn:hover { opacity: 0.88; }
.calc-btn .arr { font-family: var(--f-mono); font-size: 17px; }

.results-card { background: var(--bg-card); border: 1px solid var(--hairline); border-radius: var(--r-card); margin-top: 16px; display: none; overflow: hidden; }
.results-card.visible { display: block; }

.result-hero { background: var(--ink); color: #f4f1e8; padding: 26px 24px 22px; position: relative; overflow: hidden; }
.result-hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(60% 80% at 110% 20%, rgba(224,138,60,0.18), transparent 60%), radial-gradient(50% 60% at -10% 80%, rgba(26,74,46,0.4), transparent 60%); pointer-events: none; }
.result-hero .lab { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(244,241,232,0.55); display: flex; align-items: center; gap: 8px; position: relative; }
.result-hero .big { font-family: var(--f-mono); font-weight: 500; font-size: 60px; letter-spacing: -0.04em; line-height: 1; color: var(--amber); margin-top: 14px; position: relative; display: flex; align-items: baseline; gap: 6px; }
.result-hero .big .u { font-family: var(--f-mono); font-size: 14px; color: rgba(244,241,232,0.6); letter-spacing: 0.06em; text-transform: uppercase; }
.result-hero .sub { font-size: 13px; color: rgba(244,241,232,0.7); margin-top: 8px; position: relative; }
.result-body { padding: 20px 24px; }

.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.result-metric { background: var(--bg); border-radius: 10px; padding: 12px 14px; }
.result-metric .k { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.result-metric .v { font-family: var(--f-mono); font-size: 22px; font-weight: 500; color: var(--ink); letter-spacing: -0.02em; line-height: 1; }
.result-metric .lbl { font-size: 11px; color: var(--muted); margin-top: 2px; }

.result-info { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; margin-bottom: 16px; }

.result-insight { padding: 14px 16px 14px 18px; border-left: 3px solid var(--amber); background: var(--amber-tint); border-radius: 0 12px 12px 0; margin-bottom: 16px; }
.result-insight h4 { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber-deep); margin-bottom: 6px; }
.result-insight p { font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.result-insight strong { color: var(--ink); font-weight: 600; }

.result-split { display: grid; grid-template-columns: 1fr 1fr 1fr; border: 1px solid var(--hairline); border-radius: var(--r-card); overflow: hidden; margin-bottom: 16px; }
.result-split .col { padding: 14px 12px; }
.result-split .col + .col { border-left: 1px solid var(--hairline); }
.result-split .k { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.result-split .v { font-family: var(--f-mono); font-size: 20px; font-weight: 500; margin-top: 4px; letter-spacing: -0.02em; color: var(--ink); }
.result-split .d { font-family: var(--f-mono); font-size: 10px; margin-top: 2px; }
.result-split .col.cut .d { color: var(--cat-cardio); }
.result-split .col.bulk .d { color: var(--cat-strength); }
.result-split .col.maint .d { color: var(--green); }

.result-related h3 { font-size: 14px; margin-bottom: 10px; }
.result-related .list { display: flex; flex-direction: column; gap: 8px; }
.result-related .item { display: flex; align-items: center; justify-content: space-between; background: var(--bg); border: 1px solid var(--hairline); border-radius: 12px; padding: 12px 14px; text-decoration: none; color: inherit; transition: border-color 0.12s; }
.result-related .item:hover { border-color: var(--hairline-s); }
.result-related .item .l { display: flex; align-items: center; gap: 10px; }
.result-related .item .tc-dot { width: 8px; height: 8px; border-radius: 999px; }
.result-related .item .name { font-size: 13.5px; font-weight: 500; }
.result-related .item .arr { font-family: var(--f-mono); color: var(--muted); }

.aff-card { background: linear-gradient(135deg, #f0fdf4, #dcfce7); border: 1px solid #86efac; border-radius: 12px; padding: 20px 22px; margin-bottom: 16px; }
.aff-card .aff-eyebrow { font-family: var(--f-mono); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #16a34a; margin-bottom: 10px; }
.aff-card h4 { font-size: 15px; color: #14532d; margin-bottom: 6px; font-family: var(--f-head); }
.aff-card p { font-size: 12.5px; color: #166534; margin-bottom: 14px; line-height: 1.5; }
.aff-card a { display: inline-block; background: #16a34a; color: #fff; font-weight: 700; font-size: 13px; padding: 10px 18px; border-radius: 8px; transition: opacity 0.15s; }
.aff-card a:hover { opacity: 0.88; }
.aff-card .aff-disclaimer { font-size: 10px; color: #6b7280; margin-top: 10px; font-family: var(--f-mono); }

.ad-slot { background: var(--bg-soft); border: 1px dashed var(--hairline-s); border-radius: 10px; padding: 18px; text-align: center; font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 16px 0; }

/* ── BACKWARD COMPAT: old calculator page class names ─────────────── */
/* Allows existing calc pages to adopt new design tokens without full rebuild */

/* hide old ad slots and sidebar */
.ad-banner-top, .ad-bottom, .ad-banner, .ad-sidebar { display: none !important; }
.calc-sidebar { display: none !important; }

/* old wrapper → single col centred */
.calc-page-wrapper { max-width: 680px; margin: 0 auto; padding: 0 20px 80px; }
.calc-main { width: 100%; }

/* old calc hero */
.calc-hero { padding: 14px 0 22px; }
.calc-hero h1 { font-family: var(--f-head); font-size: 32px; letter-spacing: -0.03em; line-height: 1.05; }
.calc-hero p { font-size: 14px; color: var(--muted); margin-top: 10px; line-height: 1.55; }

/* breadcrumb */
.breadcrumb { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.04em; color: var(--muted); display: flex; align-items: center; gap: 6px; padding-top: 20px; margin-bottom: 6px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--ink); }
.breadcrumb span { opacity: 0.4; }

/* old form card */
.calc-form-card { background: var(--bg-card); border: 1px solid var(--hairline); border-radius: var(--r-card); padding: 24px; margin-bottom: 16px; }

/* unit toggle — active button is the dark pill (no JS .right class needed) */
.unit-toggle { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg-soft); border-radius: 999px; padding: 4px; margin-bottom: 20px; }
.unit-toggle button { background: transparent; border: none; padding: 9px; font-family: var(--f-mono); font-size: 11.5px; font-weight: 500; color: var(--muted); border-radius: 999px; cursor: pointer; transition: all 0.18s; }
.unit-toggle button.active { background: var(--ink); color: #f4f1e8; }

/* old form groups */
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }
.form-group > label { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 7px; letter-spacing: -0.005em; }
.form-group input, .form-group select { width: 100%; height: 52px; padding: 0 14px; background: var(--bg); border: 1px solid var(--hairline); border-radius: var(--r-input); font-family: var(--f-mono); font-size: 18px; font-weight: 500; color: var(--ink); -webkit-appearance: none; appearance: none; }
.form-group input:focus, .form-group select:focus { outline: 2px solid var(--ink); outline-offset: -1px; background: var(--bg-card); }
.form-group input::placeholder { color: rgba(14,22,16,0.25); }
.form-group select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' stroke='%235b6660' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; font-size: 15px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* radio buttons */
/* chip-btn and chips-stack — shared with TDEE design */
.chip-btn { flex: 1; min-height: 48px; background: var(--bg-card); border: 1px solid var(--hairline); border-radius: var(--r-chip); padding: 8px 12px; color: var(--ink); font-family: var(--f-body); font-size: 13px; font-weight: 500; cursor: pointer; display: flex; flex-direction: column; gap: 2px; justify-content: center; transition: all 0.15s; }
.chip-btn .sub { font-family: var(--f-mono); font-size: 10px; color: var(--muted); letter-spacing: 0.02em; }
.chip-btn.active { background: var(--ink); color: #f4f1e8; border-color: var(--ink); }
.chip-btn.active .sub { color: rgba(244,241,232,0.6); }
.chips-stack { display: flex; flex-direction: column; gap: 8px; margin-top: 0; }
.chips-stack .chip-btn { flex-direction: row; align-items: center; justify-content: space-between; min-height: 54px; padding: 10px 14px; }
.chips-stack .chip-btn .l { display: flex; flex-direction: column; gap: 2px; text-align: left; }
.chips-stack .chip-btn .mult { font-family: var(--f-mono); font-size: 11px; padding: 3px 8px; border-radius: 999px; background: var(--bg-soft); color: var(--muted); flex-shrink: 0; }
.chips-stack .chip-btn.active .mult { background: rgba(244,241,232,0.16); color: var(--amber); }

/* sex/goal chip buttons — matches TDEE chip-btn style */
.radio-group { display: flex; gap: 8px; }
.radio-option { flex: 1; min-height: 48px; background: var(--bg-card); border: 1px solid var(--hairline); border-radius: var(--r-chip); padding: 8px 12px; font-family: var(--f-body); font-size: 13px; font-weight: 500; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.radio-option input[type="radio"] { display: none; }
.radio-option:has(input:checked) { background: var(--ink); color: #f4f1e8; border-color: var(--ink); }

/* calculate button */
.btn-calculate { width: 100%; padding: 16px; background: var(--ink); color: #f4f1e8; border: none; border-radius: 14px; font-family: var(--f-head); font-weight: 600; font-size: 16px; cursor: pointer; margin-top: 4px; box-shadow: 0 10px 24px -12px rgba(14,22,16,0.4); transition: opacity 0.15s; }
.btn-calculate:hover { opacity: 0.88; }
.view-results { font-family: var(--f-mono); font-size: 11px; color: var(--muted); text-align: center; margin-top: 8px; }

/* old results card structure */
.results-card { background: var(--bg-card); border: 1px solid var(--hairline); border-radius: var(--r-card); margin-top: 16px; display: none; overflow: hidden; }
.results-card.visible { display: block; }
.results-card h2 { display: none; }

.result-primary { background: var(--ink); color: #f4f1e8; padding: 26px 24px 22px; position: relative; overflow: hidden; }
.result-primary::before { content: ""; position: absolute; inset: 0; background: radial-gradient(60% 80% at 110% 20%, rgba(224,138,60,0.18), transparent 60%), radial-gradient(50% 60% at -10% 80%, rgba(26,74,46,0.4), transparent 60%); pointer-events: none; }
.result-label { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(244,241,232,0.55); position: relative; display: flex; align-items: center; gap: 8px; }
.result-label::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: var(--amber); box-shadow: 0 0 0 4px rgba(224,138,60,0.2); flex-shrink: 0; }
.result-value { font-family: var(--f-mono); font-weight: 500; font-size: 60px; letter-spacing: -0.04em; line-height: 1; color: var(--amber); margin-top: 14px; position: relative; }
.result-sub { font-size: 13px; color: rgba(244,241,232,0.7); margin-top: 8px; position: relative; }

.results-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 18px 20px; }
.result-item { background: var(--bg); border-radius: 10px; padding: 12px 14px; }
.result-item .val { font-family: var(--f-mono); font-size: 20px; font-weight: 500; color: var(--ink); letter-spacing: -0.02em; line-height: 1; }
.result-item .lbl { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.3; }

.result-info { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; padding: 0 20px 20px; border-left: 3px solid var(--amber); background: var(--amber-tint); margin: 0 20px 20px; padding: 14px 16px 14px 18px; border-radius: 0 12px 12px 0; }

/* BMI range bar label */
.result-bar-wrapper { padding: 20px 20px 4px; }
.result-bar-label { display: flex; justify-content: space-between; margin-bottom: 6px; }
.result-bar-label span { font-family: var(--f-mono); font-size: 10px; letter-spacing: .04em; color: var(--muted); }
.result-bar-track { height: 8px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; margin-bottom: 18px; }
.result-bar-fill { height: 100%; border-radius: 999px; transition: width .5s cubic-bezier(.4,0,.2,1); }

/* related links in sidebar (now shown below results) */
.sidebar-card { margin: 0 20px 20px; padding: 16px; background: var(--bg); border: 1px solid var(--hairline); border-radius: 12px; }
.sidebar-card h3 { font-size: 14px; margin-bottom: 10px; }
.related-links { display: flex; flex-direction: column; gap: 8px; }
.related-links a { font-size: 13.5px; font-weight: 500; color: var(--ink); padding: 10px 12px; background: var(--bg-card); border: 1px solid var(--hairline); border-radius: 10px; transition: border-color 0.12s; }
.related-links a:hover { border-color: var(--hairline-s); }

/* ── Affiliate cards ────────────────────────────────────────────── */
.affiliate-card {
  margin: 0 20px 20px;
  border: 1.5px solid var(--hairline-s);
  border-radius: var(--r-card);
  background: var(--bg-card);
  overflow: hidden;
}
.affiliate-card-label {
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 14px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--hairline);
}
.affiliate-card-body {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
}
.affiliate-card-icon { font-size: 1.9rem; flex-shrink: 0; line-height: 1; }
.affiliate-card-text { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.affiliate-card-text strong {
  font-family: var(--f-head);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}
.affiliate-card-text span {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}
.affiliate-card-btn {
  flex-shrink: 0;
  background: var(--green);
  color: #f4f1e8;
  font-family: var(--f-body);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--r-pill);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s;
}
.affiliate-card-btn:hover { background: var(--green-deep); color: #f4f1e8; }
@media (max-width: 540px) {
  .affiliate-card-body { flex-wrap: wrap; }
  .affiliate-card-btn { width: 100%; text-align: center; margin-top: 4px; }
}

/* ── Mobile: hide calc-page-header nav to prevent overflow ─────────── */
@media (max-width: 700px) {
  .calc-page-header nav { display: none !important; }
  body { overflow-x: hidden; }
}

/* ── Fix: old calc pages flex layout on desktop ─────────────────── */
@media(min-width:900px) {
  body:has(.calc-page-wrapper) { flex-direction: column; }
  body:has(.calc-page-wrapper) .calc-page-wrapper { padding-left: 40px; padding-right: 40px; }
}

/* ── Calc page sidebar — show at wide breakpoint ─────────────────── */
@media(min-width:1080px) {
  body:has(.calc-page-wrapper) .calc-page-wrapper {
    max-width: 1020px !important;
    display: flex !important;
    flex-direction: row !important;
    gap: 32px;
    align-items: flex-start;
  }
  body:has(.calc-page-wrapper) .calc-main {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0;
  }
  .calc-sidebar {
    display: flex !important;
    flex-direction: column;
    gap: 16px;
    flex: 0 0 260px !important;
    width: 260px;
    position: sticky;
    top: 80px;
  }
  .calc-sidebar .sidebar-card { margin: 0; }
  .related-links { display: flex; flex-direction: column; gap: 6px; }
  .related-links a { font-size: 13px; color: var(--ink-2); text-decoration: none; padding: 6px 8px; border-radius: 8px; transition: background 0.12s; }
  .related-links a:hover { background: var(--bg-soft); }
}
