/*
 * Bike Fit Europe — Aero brand components.
 * Consumes brand-tokens.css. Rules mirror DESIGN.md (repo root).
 * All classes are bfe- prefixed so they never collide with admin.css / c-*.
 */

/* ---- Base (scoped to pages that opt in via .bfe-page on <body>) ---- */
.bfe-page {
  margin: 0;
  background: var(--bfe-surface);
  color: var(--bfe-on-surface);
  font-family: var(--bfe-font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.bfe-page * { box-sizing: border-box; }
.bfe-page a { color: inherit; }

.bfe-container {
  max-width: var(--bfe-content-max);
  margin: 0 auto;
  padding: 0 16px;
}
@media (min-width: 768px) {
  .bfe-container { padding: 0 24px; }
}

/* ---- Typography ---- */
.bfe-display,
.bfe-h1, .bfe-h2, .bfe-h3 {
  font-family: var(--bfe-font-display);
  text-transform: uppercase;
  letter-spacing: 0.01em;
  margin: 0;
}
.bfe-display { font-size: clamp(44px, 8vw, 72px); font-weight: 700; line-height: 0.95; }
.bfe-h1 { font-size: clamp(36px, 5vw, 48px); font-weight: 700; line-height: 1.05; }
.bfe-h2 { font-size: clamp(28px, 4vw, 36px); font-weight: 700; line-height: 1.1; }
.bfe-h3 { font-size: 22px; font-weight: 600; line-height: 1.15; }
.bfe-accent { color: var(--bfe-red-500); }

.bfe-lead { font-size: 18px; line-height: 1.6; color: var(--bfe-charcoal-600); max-width: 44em; }
.bfe-muted { color: var(--bfe-muted); }

.bfe-eyebrow {
  font-family: var(--bfe-font-label);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--bfe-red-500);
}
.bfe-eyebrow--quiet { color: var(--bfe-muted); }

.bfe-label {
  font-family: var(--bfe-font-label);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bfe-charcoal-500);
}

/* ---- Buttons ---- */
.bfe-btn {
  display: inline-block;
  font-family: var(--bfe-font-body);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  padding: 12px 24px;
  border-radius: var(--bfe-radius-md);
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.bfe-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bfe-surface), 0 0 0 4px var(--bfe-red-500);
}
.bfe-btn-primary {
  background: var(--bfe-red-500);
  color: #fff;
}
.bfe-btn-primary:hover { background: var(--bfe-red-600); }
.bfe-btn-secondary {
  background: var(--bfe-surface);
  color: var(--bfe-charcoal-800);
  border-color: var(--bfe-charcoal-200);
}
.bfe-btn-secondary:hover { border-color: var(--bfe-charcoal-400); }
.bfe-section--dark .bfe-btn-secondary {
  background: transparent;
  color: #fff;
  border-color: var(--bfe-charcoal-500);
}

/* ---- Header / footer ---- */
.bfe-header {
  background: var(--bfe-charcoal-800);
  color: var(--bfe-on-dark);
  border-bottom: 4px solid var(--bfe-red-500);
}
.bfe-header .bfe-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}
.bfe-header a { text-decoration: none; }
.bfe-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  font-family: var(--bfe-font-label);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.bfe-nav a { color: var(--bfe-charcoal-200); }
.bfe-nav a:hover { color: #fff; }

.bfe-footer {
  background: var(--bfe-charcoal-900);
  color: var(--bfe-charcoal-300);
  font-size: 14px;
  padding: 32px 0;
}
.bfe-footer a { color: var(--bfe-charcoal-200); }

/* ---- Sections ---- */
.bfe-section { padding: 64px 0; background: var(--bfe-surface); }
.bfe-section--alt { background: var(--bfe-surface-alt); }
.bfe-section--dark {
  background: var(--bfe-charcoal-800);
  color: var(--bfe-on-dark);
  border-top: 4px solid var(--bfe-red-500);
}
.bfe-section--dark .bfe-lead { color: var(--bfe-charcoal-200); }
@media (min-width: 768px) {
  .bfe-section { padding: 96px 0; }
}

/* ---- Cards ---- */
.bfe-card {
  background: var(--bfe-surface);
  border: 1px solid var(--bfe-border);
  border-radius: var(--bfe-radius-lg);
  padding: var(--bfe-card-pad);
  box-shadow: var(--bfe-shadow-card);
}
.bfe-card-title {
  font-family: var(--bfe-font-display);
  font-size: 20px;
  font-weight: 600;
  text-transform: uppercase;
  margin: 0 0 8px;
}
.bfe-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .bfe-grid-2 { grid-template-columns: repeat(2, 1fr); }
  .bfe-grid-3 { grid-template-columns: repeat(3, 1fr); }
  .bfe-grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ---- Stat tiles ---- */
.bfe-stat-value {
  font-family: var(--bfe-font-display);
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
}
.bfe-stat-label {
  font-family: var(--bfe-font-label);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bfe-muted);
  margin-top: 6px;
}

/* ---- Chips ---- */
.bfe-chip {
  display: inline-block;
  font-family: var(--bfe-font-label);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: var(--bfe-radius-full);
  background: var(--bfe-charcoal-50);
  color: var(--bfe-charcoal-600);
}
.bfe-chip--good { background: var(--bfe-status-good-tint); color: var(--bfe-status-good-text); }
.bfe-chip--warn { background: var(--bfe-status-warn-tint); color: var(--bfe-status-warn-text); }
.bfe-chip--bad  { background: var(--bfe-status-bad-tint);  color: var(--bfe-status-bad-text); }

/* ---- Technical details disclosure ---- */
.bfe-details {
  border: 1px solid var(--bfe-border);
  border-radius: var(--bfe-radius-lg);
  background: var(--bfe-surface-alt);
}
.bfe-details > summary {
  font-family: var(--bfe-font-label);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bfe-charcoal-500);
  padding: 14px 20px;
  cursor: pointer;
  list-style: none;
}
.bfe-details > summary::-webkit-details-marker { display: none; }
.bfe-details > summary::before { content: "+"; margin-right: 10px; color: var(--bfe-red-500); }
.bfe-details[open] > summary::before { content: "\2212"; }
.bfe-details-body { padding: 0 20px 20px; font-size: 14px; }
.bfe-details-body table { width: 100%; border-collapse: collapse; }
.bfe-details-body th {
  font-family: var(--bfe-font-label);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  color: var(--bfe-muted);
  padding: 6px 8px;
  border-bottom: 1px solid var(--bfe-border);
}
.bfe-details-body td { padding: 6px 8px; border-bottom: 1px solid var(--bfe-border); }

/* ---- Tables ---- */
.bfe-table-wrap { overflow-x: auto; }
.bfe-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.bfe-table th {
  font-family: var(--bfe-font-label);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  color: var(--bfe-muted);
  padding: 10px 12px;
  border-bottom: 2px solid var(--bfe-charcoal-800);
  white-space: nowrap;
}
.bfe-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--bfe-border);
  vertical-align: top;
}
.bfe-table tbody tr:hover { background: var(--bfe-surface-alt); }
.bfe-table .num { font-variant-numeric: tabular-nums; }

/* ---- Toolbar (report actions) ---- */
.bfe-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.bfe-btn--sm { padding: 8px 16px; font-size: 14px; }

/* ---- Chart frame ---- */
.bfe-chart {
  background: var(--bfe-surface);
  border: 1px solid var(--bfe-border);
  border-radius: var(--bfe-radius-lg);
  padding: 16px;
}
.bfe-chart-canvas { width: 100%; height: 320px; }

/* ---- Hero wash (retained for compatibility) ---- */
.bfe-hero-wash {
  background: linear-gradient(135deg, var(--bfe-red-50) 0%, var(--bfe-surface) 40%, var(--bfe-charcoal-50) 100%);
}

/* ============================================================
   Elevation layer — "measured on the line".
   Velodrome measurement-line motif, dark track hero, instrument
   readouts. Additive only: the components above are unchanged, so
   the athlete report that shares them stays intact.
   ============================================================ */

/* The measurement-line tick before every eyebrow — the velodrome datum,
   in miniature, repeated site-wide. Uses currentColor so it inherits the
   eyebrow's red (or muted, for --quiet). */
.bfe-eyebrow { display: inline-flex; align-items: center; }
.bfe-eyebrow::before {
  content: ""; flex: none; width: 24px; height: 2px;
  margin-right: 12px; background: currentColor; opacity: .85;
}

/* Instrument readout — measured numbers speak in Space Grotesk, tabular. */
.bfe-readout {
  font-family: var(--bfe-font-label);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: .9;
  letter-spacing: -0.015em;
}
.bfe-readout-lg { font-size: clamp(52px, 7vw, 88px); }
.bfe-readout-unit {
  font-family: var(--bfe-font-display); font-weight: 600;
  font-size: .34em; letter-spacing: .02em; margin-left: .1em;
  color: var(--bfe-muted); vertical-align: baseline;
}

/* Card hover lift (subtle; only where a pointer can hover). */
.bfe-card { transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease; }
@media (hover: hover) {
  .bfe-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 44px rgba(34, 34, 33, .13);
    border-color: var(--bfe-charcoal-200);
  }
}

/* ---- Track hero (dark, velodrome line-drawing) ---- */
.bfe-hero--track {
  position: relative;
  overflow: hidden;
  background: var(--bfe-charcoal-900);
  color: #fff;
  border-top: 4px solid var(--bfe-red-500);
}
.bfe-hero--track .bfe-eyebrow { color: var(--bfe-red-400); }
.bfe-hero--track .bfe-lead { color: var(--bfe-charcoal-200); max-width: 34em; }
/* On the dark hero the secondary button is an outline, not a white block.
   Specificity (0,2,0) intentionally beats `.bfe-page a { color: inherit }`. */
.bfe-hero--track .bfe-btn-secondary {
  background: transparent; color: #fff; border-color: var(--bfe-charcoal-500);
}
.bfe-hero--track .bfe-btn-secondary:hover { border-color: #fff; }

.bfe-hero-grid { display: grid; grid-template-columns: 1fr; gap: 44px; align-items: center; }
@media (min-width: 900px) {
  .bfe-hero-grid { grid-template-columns: 1.05fr 0.95fr; gap: 56px; }
}
.bfe-hero-headline {
  font-family: var(--bfe-font-display); text-transform: uppercase; font-weight: 700;
  font-size: clamp(46px, 7.6vw, 86px); line-height: .92; letter-spacing: .005em;
  margin: 16px 0 0; text-wrap: balance;
}
.bfe-hero-metrics {
  display: flex; flex-wrap: wrap; gap: 20px 48px; margin-top: 44px;
  padding-top: 30px; border-top: 1px solid rgba(255, 255, 255, .12);
}
.bfe-hero-metric .bfe-readout { color: #fff; }
.bfe-hero-metric .bfe-stat-label { color: var(--bfe-charcoal-300); margin-top: 12px; max-width: 20ch; }

/* Velodrome figure — the black line is the datum; here it's brand red. */
.bfe-velo { width: 100%; height: auto; display: block; }
.bfe-velo .track-faint { stroke: rgba(255, 255, 255, .16); }
.bfe-velo .track-line { stroke: var(--bfe-red-500); }
.bfe-velo .track-dot  { fill: var(--bfe-red-500); }
.bfe-velo-cap {
  text-align: center; margin-top: 14px;
  color: var(--bfe-charcoal-300);
}
@media (prefers-reduced-motion: no-preference) {
  .bfe-velo .track-line { stroke-dasharray: 1500; stroke-dashoffset: 1500; animation: bfe-draw 2.4s cubic-bezier(.4, 0, .1, 1) forwards .25s; }
  .bfe-velo .track-dot  { opacity: 0; animation: bfe-dot 600ms ease forwards 2.5s; }
}
@keyframes bfe-draw { to { stroke-dashoffset: 0; } }
@keyframes bfe-dot  { to { opacity: 1; } }
