/* ==========================================================================
   FitForRiders — FINDER, direção STRAVA ("athlete's logbook")
   Escrito a partir de fitforriders/loop-strava/design-system.md.
   Mesmo HTML e mesmo app.js do finder base; só a pele muda.

   Gramática: papel claro em alternância branco/linho, sem sombras e sem
   gradientes — as superfícies separam-se por fios de 1px em bone. Archivo
   com o eixo de largura (display wdth 125, corpo wdth 100). Cantos de 4px
   em tudo o que é controlo ou cartão: linguagem de impresso, não de app.
   O laranja é o ÚNICO croma: CTA do hero, o traço à mão e o badge FITS YOU.
   Sem verde (§1).

   Desvios ao design-system, deliberados e assinalados:
   · §2 pede hero-display a 72px; a 375px não cabe. Fica a 48 (sub-display),
     que é o mínimo que o §2 permite para display. A 1440 sobe aos 72.
   · §5 pede carrossel/grelha de EXATAMENTE 3 cartões de prova; isso é a
     secção de prova de uma landing. Um finder devolve N resultados — os
     cartões ficam em pilha (375) e em 3 colunas (1440), que é o mesmo
     ritmo de grelha.
   · O marcador da régua é laranja. O §1 lista o laranja para CTA/pills/
     chips/traço e não prevê um marcador — mas num finder o marcador É o
     sinal de UI, e é o papel que o laranja já tem no site em produção.
   · --color-frost / --color-mist / --color-carbon são aliases exigidos
     pelo SVG da corrente que vem no HTML base.
   ========================================================================== */

:root {
  /* cor — §1 */
  --white:     #FFFFFF;
  --linen:     #F9F8F5;
  --bone:      #E0E0DE;
  --pewter:    #64635E;
  --charcoal:  #43423F;
  --graphite:  #21211F;
  --ink:       #000000;
  --orange:    #FC5200;

  /* aliases da corrente (SVG do HTML base) */
  --color-frost:  #FFFFFF;
  --color-mist:   #E0E0DE;
  --color-carbon: #FC5200;          /* o marcador é o sinal — ver desvios */

  /* forma — §3. Só estes raios existem. */
  --r-s: 4px;
  --r-m: 16px;
  --r-l: 24px;

  /* espaço */
  --inset:  20px;
  --slab-y: 96px;
  --gutter: 24px;
}

/* --------------------------------------------------------------------------
   BASE
   -------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  font-stretch: 100%;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: inherit; }

.mono { font-family: inherit; }

/* --------------------------------------------------------------------------
   PAPÉIS DE TIPO — §2
   -------------------------------------------------------------------------- */

/* display: wdth 125, w600, sentence case, SEMPRE com ponto final */
.hero-headline,
.result-count {
  margin: 0;
  font-stretch: 125%;
  font-size: 48px;
  line-height: 1.08;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* lede */
.hero-sub { font-size: 22px; line-height: 1.3; font-weight: 400; max-width: 40ch; }

/* label — 13 w700 caps +0.06em */
.field-label,
.slab-eyebrow,
.result-label,
.knob-label,
.brand,
.price .label,
.plaque dt,
.sel-meta,
.beta {
  font-size: 13px;
  line-height: 1.2;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* micro */
.hero-specimen,
.ticks span,
.fit-note { font-size: 12px; line-height: 1.4; font-weight: 400; color: var(--pewter); }

/* --------------------------------------------------------------------------
   NAV — §4. Branca, fio bone em baixo.
   -------------------------------------------------------------------------- */

.nav {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 20px var(--inset);
  background: var(--white);
  border-bottom: 1px solid var(--bone);
}

.wordmark {
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.beta { color: var(--pewter); }

/* --------------------------------------------------------------------------
   HERO — branco
   -------------------------------------------------------------------------- */

.hero-band { background: var(--white); }

.hero { padding: 56px var(--inset) var(--slab-y); }

/* o traço à mão — UM por ecrã (§4) */
.marked {
  position: relative;
  display: inline-block;
  white-space: nowrap;
}

.stroke {
  position: absolute;
  left: -2%;
  bottom: -6px;
  width: 104%;
  height: 18px;
  color: var(--orange);
  overflow: visible;
}

.hero-support { margin-top: 28px; }

.hero-sub { margin: 0 0 28px; color: var(--charcoal); }

/* CTA primário — §4: laranja, branco 16 w600, radius 4, padding 14x28 */
.hero-support .cta {
  display: inline-block;
  padding: 14px 28px;
  border-radius: var(--r-s);
  background: var(--orange);
  color: var(--white);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
}

/* §6: still hi-res como matéria escura full-bleed */
.hero-photo-wrap {
  margin: 48px calc(var(--inset) * -1) 0;
  background: var(--graphite);
}

.hero-photo { width: 100%; height: auto; }

.hero-specimen {
  margin: 0;
  padding: 14px var(--inset) 20px;
  color: var(--bone);               /* §1: bone é o secundário sobre escuro */
}

/* seletor de categorias — linhas de logbook separadas por fios */
.hero-selector { margin-top: 48px; }

.sel {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--bone);
  text-decoration: none;
  color: var(--pewter);
}

.sel:first-child { border-top: 1px solid var(--bone); }

.sel-name { font-size: 16px; font-weight: 400; }

.sel-active { color: var(--ink); }

.sel-active .sel-name { font-weight: 600; }

.sel-meta { color: var(--pewter); }

/* --------------------------------------------------------------------------
   FINDER — linho
   -------------------------------------------------------------------------- */

.finder {
  background: var(--linen);
  padding: var(--slab-y) var(--inset);
}

.slab-eyebrow { margin: 0 0 16px; color: var(--pewter); }

/* §3: zero sombra em superfícies claras — o cartão define-se pelo fio */
.panel {
  background: var(--white);
  border: 1px solid var(--bone);
  border-radius: var(--r-s);
  padding: 24px 20px;
}

.fields { display: flex; flex-direction: column; gap: 24px; }

.field-label { display: block; margin-bottom: 8px; color: var(--pewter); }

.control--measure {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  border: 1px solid var(--bone);
  border-radius: var(--r-s);
}

/* a medida é o número da caderneta — display, wdth 125 */
.measure-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: 0;
  background: none;
  padding: 0;
  color: var(--ink);
  font-family: inherit;
  font-stretch: 125%;
  font-size: 48px;
  line-height: 1.08;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.measure-input:focus { outline: none; }

.unit-toggle { display: flex; gap: 4px; flex: none; }

.unit-toggle span {
  padding: 6px 10px;
  border-radius: var(--r-s);
  color: var(--pewter);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.unit-toggle .is-active { background: var(--ink); color: var(--white); }

.control--select {
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid var(--bone);
  border-radius: var(--r-s);
}

.control--select select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  border: 0;
  background: none;
  padding: 13px 44px 13px 16px;
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.5;
  cursor: pointer;
}

.control--select select:focus { outline: none; }

.chevron {
  position: absolute;
  right: 16px;
  width: 12px;
  height: 12px;
  fill: none;
  stroke: var(--pewter);
  stroke-width: 1.5;
  pointer-events: none;
}

.help-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 15px;
  color: var(--charcoal);
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   RÉGUA
   -------------------------------------------------------------------------- */

.slider-zone { margin-top: 40px; }

.histogram {
  display: grid;
  grid-template-columns: repeat(17, 1fr);
  align-items: end;
  gap: 2px;
  height: 140px;
  margin-bottom: 32px;              /* a corrente sobe 12px do carril — sem
                                       esta folga desenhava por cima das barras */
}

.histogram .bar {
  width: 100%;
  background: var(--bone);          /* barras iguais — o marcador é a corrente */
  transition: height 120ms ease;
}

.slider-track {
  position: relative;
  height: 1px;
  background: var(--bone);
  touch-action: none;
}

.slider-track::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: -26px; bottom: -30px;
}

.chain {
  position: absolute;
  left: 0; right: 0;
  top: -12px;
  width: 100%;
  height: 24px;
}

.knob {
  position: absolute;
  left: calc(100% * 13.5 / 17);
  top: 50%;
  transform: translate(-50%, -50%);
  width: 38px;
  height: 22px;
  cursor: grab;
  touch-action: none;
}

.knob svg { display: block; width: 100%; height: 100%; }

.slider-track.is-dragging .knob { cursor: grabbing; }

.knob-label {
  position: absolute;
  left: calc(100% * 13.5 / 17);
  top: calc(50% + 19px);
  transform: translateX(-50%);
  color: var(--ink);
  white-space: nowrap;
}

.ticks {
  display: grid;
  grid-template-columns: repeat(17, 1fr);
  justify-items: center;
  margin-top: 44px;
}

/* @375 as 17 marcas não cabem (17 x 2 dígitos a 12px = 290px em 278px
   úteis dentro do painel); ficam os extremos e o valor lê-se na etiqueta */
.ticks span { visibility: hidden; }

.ticks span:first-child { visibility: visible; justify-self: start; }
.ticks span:last-child  { visibility: visible; justify-self: end; }

.ticks .is-active { color: var(--ink); font-weight: 700; }

.slider-caption {
  margin: 20px 0 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--charcoal);
}

/* --------------------------------------------------------------------------
   RESULTADOS — branco
   -------------------------------------------------------------------------- */

.paper { background: var(--white); }

.result-band { padding: var(--slab-y) var(--inset) 0; }

.result-label { display: block; margin-bottom: 12px; color: var(--pewter); }

.result-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 16px;
  font-size: 15px;
  color: var(--charcoal);
}

.band { padding: 32px var(--inset) var(--slab-y); }

.grid { display: flex; flex-direction: column; gap: var(--gutter); }

.empty { margin: 0; font-size: 16px; color: var(--charcoal); }

/* --------------------------------------------------------------------------
   CARTÃO DE CATÁLOGO — §4. Branco, fio bone, radius 4, SEM sombra.
   -------------------------------------------------------------------------- */

.card {
  background: var(--white);
  border: 1px solid var(--bone);
  border-radius: var(--r-s);
  padding: 0 0 20px;
}

.photo {
  margin: 0 0 20px;
  padding: 20px;
  border-bottom: 1px solid var(--bone);
}

.photo img { width: 100%; height: 170px; object-fit: contain; }

.brand, .name, .fit, .plaque, .points, .buy, .foot {
  margin-left: 20px;
  margin-right: 20px;
}

.brand { margin-top: 0; margin-bottom: 4px; color: var(--pewter); }

.name {
  margin-top: 0;
  margin-bottom: 14px;
  font-size: 22px;
  line-height: 1.2;
  font-weight: 600;
}

.fit { margin-bottom: 18px; }

/* §4: FITS YOU = chip laranja, branco 14 w700 (nunca abaixo de 14 sobre
   laranja, §7). RUNS TIGHT = outline charcoal. Sem verde. */
.fit-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: var(--r-s);
  font-size: 14px;
  line-height: 1.2;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fit-badge svg { stroke: currentColor; }

.fit-badge--you {
  background: var(--orange);
  color: var(--white);
}

.fit-badge--tight {
  border-color: var(--charcoal);
  color: var(--charcoal);
}

.fit-note { margin: 8px 0 0; }

.plaque { margin-top: 0; margin-bottom: 18px; }

.plaque .row {
  display: flex;
  gap: 14px;
  padding: 6px 0;
  border-bottom: 1px solid var(--bone);
}

.plaque .row:last-child { border-bottom: 0; }

.plaque dt { flex: none; width: 76px; padding-top: 2px; color: var(--pewter); }

.plaque dd { margin: 0; font-size: 14px; color: var(--charcoal); }

.stars { display: inline-flex; gap: 2px; vertical-align: -1px; }

.muted { color: var(--pewter); }

.points {
  margin-top: 0;
  margin-bottom: 20px;
  padding-left: 18px;
  font-size: 15px;
  color: var(--charcoal);
}

.points li { margin-bottom: 3px; }

.buy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--bone);
  margin-bottom: 14px;
}

.price { display: flex; flex-direction: column; gap: 2px; }

.price .label { color: var(--pewter); }

.price .value { font-size: 16px; font-weight: 600; }

/* CTA secundário ghost — o laranja primário é UM por secção (§4) */
.buy .cta {
  flex: none;
  padding: 12px 22px;
  border: 1px solid var(--ink);
  border-radius: var(--r-s);
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
}

.foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0;
  font-size: 13px;
  color: var(--pewter);
}

/* --------------------------------------------------------------------------
   ACESSIBILIDADE
   -------------------------------------------------------------------------- */

a:focus-visible,
select:focus-visible,
input:focus-visible,
.knob:focus-visible,
.unit-toggle span:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* --------------------------------------------------------------------------
   1440 — segundo alvo
   -------------------------------------------------------------------------- */

@media (min-width: 900px) {
  :root {
    --inset:  120px;
    --slab-y: 120px;
  }

  /* 900px = ~22 caracteres por linha a 72px wdth125: parte em DUAS linhas.
     A 14ch partia em quatro e deixava dois terços do ecrã vazios. */
  .hero-headline { font-size: 72px; line-height: 1.02; max-width: 900px; }

  .result-count { font-size: 60px; line-height: 1.2; }

  .measure-input { font-size: 60px; line-height: 1.2; }

  .hero-sub { font-size: 24px; }

  .hero { padding: 72px var(--inset) var(--slab-y); }

  .stroke { height: 24px; bottom: -10px; }

  /* a 1440 há largura para as 17 marcas da régua */
  .ticks span { visibility: visible; }
  .ticks span:first-child, .ticks span:last-child { justify-self: center; }

  .panel { padding: 40px; max-width: 1200px; }

  .fields { flex-direction: row; gap: 32px; }

  .field { flex: 1; }

  .field:first-child { flex: 1.6; }

  .hero-selector { display: flex; gap: 0; }

  .sel { flex: 1; border-top: 1px solid var(--bone); }

  .grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gutter);
    max-width: 1200px;
  }

  .result-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 48px;
    max-width: 1200px;
  }

  .result-meta { margin-top: 0; text-align: right; }
}
