/* Threshold — lactate threshold testing & sensor landscape */
:root {
  --bg: #0a0e17;
  --bg-elevated: #111827;
  --bg-card: #151d2e;
  --border: #1e2a3f;
  --text: #e8edf5;
  --text-muted: #8b9bb4;
  --accent: #3ddc97;
  --accent-dim: rgba(61, 220, 151, 0.12);
  --accent-hover: #5ae8a8;
  --danger: #ff6b6b;
  --warning: #f5a623;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'SF Mono', 'Fira Code', ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
}

/* ── Nav ─────────────────────────────────────────────── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  padding: 1rem 2.5rem;
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: color 0.2s;
}

nav a[aria-current="page"] { color: var(--text); }

nav a:first-child {
  color: var(--accent);
  font-weight: 700;
  font-size: 1.1rem;
  margin-right: auto;
}

nav a:hover { color: var(--text); }

/* ── Header ──────────────────────────────────────────── */
header {
  max-width: 1100px;
  margin: 0 auto;
  padding: 4rem 2.5rem 2.5rem;
}

header h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  background: linear-gradient(135deg, var(--text) 40%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

header p {
  margin-top: 1rem;
  color: var(--text-muted);
  font-size: 1.15rem;
  max-width: 640px;
}

/* ── Sections ────────────────────────────────────────── */
section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 2.5rem 4rem;
}

section h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--accent-dim);
  display: inline-block;
}

/* ── Cards ───────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.card h3 {
  color: var(--accent);
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
}

.card p { color: var(--text-muted); font-size: 0.95rem; }

.card-links,
.text-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

.card-links { margin-top: 1rem; }

.card-links a,
.text-links a {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
}

.card-links a:hover,
.text-links a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ── Device review cards ─────────────────────────────── */
.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.75rem;
}

.device-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  transition: border-color 0.25s, box-shadow 0.25s;
  cursor: pointer;
}

.device-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.device-card.expanded { border-color: var(--accent); }

.device-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.device-header h2 {
  font-size: 1.35rem;
  border: none;
  padding: 0;
  margin: 0;
}

.badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.3rem 0.7rem;
  border-radius: 100px;
  background: var(--accent-dim);
  color: var(--accent);
}

.badge:nth-of-type(2) { background: rgba(245, 166, 35, 0.15); color: var(--warning); }

.tagline {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
}

.specs {
  list-style: none;
  margin-bottom: 1.5rem;
}

.specs li {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.specs .pending { color: var(--text-muted); font-style: italic; }

.affiliate { text-align: center; }

.btn {
  display: inline-block;
  padding: 0.7rem 1.8rem;
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  line-height: inherit;
  transition: background 0.2s, transform 0.2s;
}

.btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
}

.affiliate small {
  display: block;
  margin-top: 0.6rem;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.device-card.placeholder {
  border-style: dashed;
  opacity: 0.5;
  cursor: default;
}

.device-card.placeholder:hover {
  transform: none;
  border-color: var(--border);
  box-shadow: none;
}

/* ── Blog ────────────────────────────────────────────── */
.blog-list { display: flex; flex-direction: column; gap: 1.5rem; }

.blog-post {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  transition: border-color 0.25s;
}

.blog-post:hover { border-color: var(--accent); }

.blog-post a { text-decoration: none; color: inherit; }

.blog-post h2 {
  font-size: 1.4rem;
  border: none;
  padding: 0;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.blog-post time {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
}

.blog-post p {
  color: var(--text-muted);
  margin-top: 0.75rem;
}

.blog-post.placeholder { opacity: 0.45; }

/* ── Blog post template ──────────────────────────────── */
.post-header {
  max-width: 760px;
  margin: 0 auto;
  padding: 4rem 2.5rem 2rem;
}

.post-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.post-header time {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
}

.post-body {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 2.5rem 4rem;
}

.post-body h2 {
  font-size: 1.35rem;
  margin: 2.5rem 0 1rem;
  border: none;
  padding: 0;
  color: var(--accent);
}

.post-body p { margin-bottom: 1.25rem; color: var(--text-muted); }

.post-body a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.post-body a:hover { text-decoration: underline; }

.post-body a.btn,
.post-body a.btn:hover {
  color: var(--bg);
  text-decoration: none;
}

.post-body .lede {
  font-size: 1.2rem;
  color: var(--text);
  font-weight: 500;
  line-height: 1.6;
}

.callout {
  background: var(--accent-dim);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  color: var(--text);
}

.callout ul,
.callout ol { margin: 0.5rem 0 0 1.1rem; }

.callout li { margin: 0.3rem 0; }

.post-body footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.post-body footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.post-body footer a:hover { text-decoration: underline; }

/* ── Chart container ─────────────────────────────────── */
.chart-container {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 1.5rem 0;
}

/* ── Field protocols ─────────────────────────────────── */
header.protocol-header,
main.protocol { max-width: 900px; }

.protocol-header .eyebrow {
  margin: 0 0 0.75rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.protocol-header .dek { max-width: 68ch; }

.protocol-header .text-links { margin-top: 1.25rem; }

.protocol ul,
.protocol ol {
  margin: 0 0 1.25rem 1.2rem;
  color: var(--text-muted);
}

.protocol li { margin: 0.4rem 0; }

.protocol li strong,
.protocol td strong { color: var(--text); font-weight: 600; }

.protocol h3 {
  color: var(--text);
  font-size: 1.05rem;
  margin: 1.75rem 0 0.55rem;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 0 1.25rem;
}

.protocol table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.25rem;
  font-size: 0.92rem;
}

.table-scroll table { margin: 0; }

.protocol th,
.protocol td {
  border: 1px solid var(--border);
  padding: 0.55rem 0.7rem;
  text-align: left;
  vertical-align: top;
}

.protocol th {
  background: var(--bg-elevated);
  color: var(--text);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.protocol td { color: var(--text-muted); }

.stage-table th:first-child,
.stage-table td:first-child {
  width: 10.5rem;
  white-space: nowrap;
}

.wide-table { min-width: 40rem; }

.data-sheet td { height: 2.15rem; }

.data-sheet td:first-child,
.meta-table th {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

.meta-table th { width: 34%; }

.notes-table td { height: 4.5rem; }

.rpe-key {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: -0.35rem 0 1.25rem;
}

.sheet .btn { margin: 0.25rem 0 1.25rem; }

.sheet-kicker {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.scroll-hint {
  display: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 0 0 0.4rem;
}

.disclaimer {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
  nav { padding: 0.85rem 1.1rem; gap: 0.45rem 0.85rem; }
  nav a { font-size: 0.84rem; }
  nav a:first-child {
    flex-basis: 100%;
    margin-right: 0;
    font-size: 1.05rem;
  }
  header, section { padding-left: 1.25rem; padding-right: 1.25rem; }
  .post-header, .post-body { padding-left: 1.25rem; padding-right: 1.25rem; }
  .scroll-hint { display: block; }
  html { scroll-padding-top: 8rem; }
}

/* ── Print ───────────────────────────────────────────── */
@media print {
  @page { margin: 1.4cm; }

  nav,
  .no-print,
  .scroll-hint,
  .chart-container { display: none !important; }

  html, body {
    background: #fff !important;
    color: #111 !important;
  }

  body, p, li, td, th, h1, h2, h3, a, strong, time, label, .callout, .disclaimer, .lede, .rpe-key, .sheet-kicker {
    color: #111 !important;
    -webkit-text-fill-color: #111 !important;
  }

  h1, h2, h3 {
    background: none !important;
    -webkit-background-clip: border-box !important;
    background-clip: border-box !important;
  }

  header, .post-header, .post-body, main.protocol, section {
    max-width: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .post-header, header.protocol-header { padding-top: 0 !important; }

  .callout {
    background: #f3f3f3 !important;
    border-left-color: #222 !important;
  }

  .protocol th,
  .protocol td {
    border-color: #222 !important;
    background: #fff !important;
    color: #111 !important;
  }

  .protocol th { background: #eee !important; }

  .sheet {
    break-before: page;
    page-break-before: always;
  }

  .table-scroll { overflow: visible !important; }
  .wide-table { min-width: 0 !important; }

  tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  thead { display: table-header-group; }

  .data-sheet td { height: 1.65rem; }
  .meta-table td { height: 1.45rem; }
  .notes-table td { height: 4.5rem; }

  a { text-decoration: none !important; }
}

/* ── Scrollbar ───────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }