/*
 * PaceMetric — pm-base.css — Design System v3
 * Dark chaud · DM Sans · Accent lime unique · Minimaliste
 * ────────────────────────────────────────────────────────
 */

:root {
  /* Fonds */
  --ink-0: #0E0C0A;  /* fond global */
  --ink-1: #161310;  /* surface primaire */
  --ink-2: #1E1B18;  /* surface hover / active */

  /* Bordures */
  --rim-1: #2C2824;
  --rim-2: #3A342E;

  /* Textes */
  --txt:   #F2EDE8;
  --dim:   #7A6E66;
  --faint: #3D3730;

  /* Accent unique */
  --lime:    #C8F05A;
  --lime-lo: rgba(200,240,90,.07);
  --lime-md: rgba(200,240,90,.14);
  --lime-hi: rgba(200,240,90,.25);

  /* Erreur */
  --err:     #FF6B6B;
  --err-lo:  rgba(255,107,107,.08);

  /* Typo */
  --font: 'DM Sans',  system-ui, sans-serif;
  --mono: 'DM Mono', 'Courier New', monospace;

  /* Rayons */
  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 999px;

  /* Transitions */
  --t-fast: 100ms ease;
  --t-base: 180ms ease;

  /* Layout */
  --max-w: 520px;
  --hd-h:  58px;
}

/* ── RESET ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--ink-0);
  color: var(--txt);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; border-radius: var(--r-sm); }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* ── HEADER ───────────────────────────────────── */
.pm-nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--hd-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.25rem;
  background: rgba(14,12,10,.93);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--rim-1);
}
.pm-brand { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.pm-brand-mark {
  width: 28px; height: 28px;
  background: var(--lime); border-radius: 7px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.pm-brand-mark svg { width: 16px; height: 16px; fill: var(--ink-0); }
.pm-brand-name { font-size: 1rem; font-weight: 800; letter-spacing: -.025em; color: var(--txt); }
.pm-nav-right { display: flex; align-items: center; gap: .5rem; }
.pm-nav-links { display: flex; align-items: center; gap: 2px; }
.pm-nav-link {
  font-family: var(--mono); font-size: .65rem; font-weight: 500;
  color: var(--dim); text-decoration: none;
  padding: 3px 8px; border-radius: var(--r-pill);
  transition: color var(--t-base), background var(--t-base);
  white-space: nowrap;
}
.pm-nav-link:hover { color: var(--txt); background: var(--ink-2); }
.pm-nav-link.active { color: var(--lime); background: var(--lime-lo); }

/* ── LAYOUT ───────────────────────────────────── */
.pm-wrap {
  max-width: var(--max-w); margin: 0 auto;
  padding: 2rem 1.25rem 5rem;
}

/* ── TOOL HEADER ──────────────────────────────── */
.pm-tool-header { padding-bottom: 2rem; margin-bottom: 2rem; border-bottom: 1px solid var(--rim-1); }
.pm-tool-eyebrow {
  font-family: var(--mono); font-size: .65rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--lime);
  margin-bottom: .875rem;
}
.pm-tool-title {
  font-size: clamp(1.6rem, 6vw, 2.2rem); font-weight: 800;
  letter-spacing: -.035em; line-height: 1.1; color: var(--txt);
  margin-bottom: .625rem;
}
.pm-tool-desc {
  font-size: .875rem; font-weight: 300; color: var(--dim); line-height: 1.7; max-width: 40ch;
}

/* ── FORM ─────────────────────────────────────── */
.pm-form { display: flex; flex-direction: column; gap: 1.75rem; }
.pm-field { display: flex; flex-direction: column; gap: .625rem; }
.pm-label {
  font-family: var(--mono); font-size: .62rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--dim);
  display: flex; align-items: center; gap: .5rem;
}
.pm-optional {
  font-size: .58rem; color: var(--faint); background: var(--ink-1);
  border: 1px solid var(--rim-1); border-radius: var(--r-pill);
  padding: 1px 7px; text-transform: none; letter-spacing: 0;
}
.pm-hint { font-size: .72rem; color: var(--faint); line-height: 1.6; }
.pm-error { font-size: .8rem; color: var(--err); }

/* Inputs numériques */
.pm-input {
  height: 60px; padding: 0 1rem;
  background: var(--ink-1); border: 1px solid var(--rim-1);
  border-radius: var(--r-md); color: var(--txt);
  font-family: var(--mono); font-size: 2rem; font-weight: 500;
  text-align: center; letter-spacing: -.02em; width: 100%;
  transition: border-color var(--t-base), background var(--t-base), box-shadow var(--t-base);
}
.pm-input::placeholder { color: var(--faint); }
.pm-input:focus {
  outline: none; border-color: var(--lime);
  background: var(--lime-lo); box-shadow: 0 0 0 3px var(--lime-hi);
}
.pm-input--sm { height: 50px; font-size: 1.5rem; }

.pm-row { display: flex; align-items: center; gap: .75rem; }
.pm-unit { font-family: var(--mono); font-size: 1rem; font-weight: 500; color: var(--dim); }

/* Radio cards */
.pm-radio-grid { display: grid; gap: 1px; }
.pm-radio-grid--2 { grid-template-columns: 1fr 1fr; }
.pm-radio-grid--4 { grid-template-columns: 1fr 1fr; }
@media (min-width: 420px) { .pm-radio-grid--4 { grid-template-columns: repeat(4,1fr); } }

.pm-radio { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.pm-radio-card {
  display: flex; flex-direction: column; gap: .2rem;
  padding: .75rem .875rem;
  background: var(--ink-1); border: none;
  cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none;
  transition: background var(--t-fast);
  position: relative;
}
.pm-radio-group { display: contents; }
.pm-radio-group:first-child .pm-radio-card { border-radius: var(--r-md) 0 0 var(--r-md); }
.pm-radio-group:last-child  .pm-radio-card { border-radius: 0 var(--r-md) var(--r-md) 0; }
.pm-radio-card:hover { background: var(--ink-2); }

/* Conteneur avec bordure externe */
.pm-radio-wrap {
  display: flex;
  border: 1px solid var(--rim-1); border-radius: var(--r-md); overflow: hidden;
  gap: 1px; background: var(--rim-1);
}
.pm-radio-card { border-radius: 0; }
.pm-radio-card:first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
.pm-radio-card:last-child  { border-radius: 0 var(--r-md) var(--r-md) 0; }

.pm-radio:checked ~ .pm-radio-card,
.pm-radio-card:has(.pm-radio:checked) {
  background: var(--lime-lo);
}
.pm-radio-card-name {
  font-size: .8rem; font-weight: 600; color: var(--txt);
  transition: color var(--t-fast);
}
.pm-radio:checked ~ .pm-radio-card .pm-radio-card-name,
.pm-radio-card:has(.pm-radio:checked) .pm-radio-card-name { color: var(--lime); }
.pm-radio-card-desc { font-size: .67rem; color: var(--dim); font-weight: 300; line-height: 1.4; }

/* ── RÉSULTATS ────────────────────────────────── */
.pm-results { display: flex; flex-direction: column; gap: 1px; margin-top: 1.75rem; }

/* Carte héro résultat */
.pm-result-hero {
  background: var(--ink-1); border-radius: var(--r-xl);
  padding: 1.5rem 1.25rem 1.25rem;
  margin-bottom: 1px;
}
.pm-result-label {
  font-family: var(--mono); font-size: .62rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--dim); margin-bottom: .5rem;
}
.pm-result-value {
  font-family: var(--mono); font-size: 3rem; font-weight: 500;
  letter-spacing: -.03em; color: var(--lime); line-height: 1;
  margin-bottom: .875rem;
}
.pm-result-sub { font-size: .78rem; color: var(--dim); font-weight: 300; }

/* Grille stats secondaires */
.pm-stats {
  display: grid; gap: 1px;
  background: var(--rim-1); border-radius: var(--r-xl); overflow: hidden;
  margin-bottom: 1px;
}
.pm-stats--2 { grid-template-columns: 1fr 1fr; }
.pm-stats--3 { grid-template-columns: repeat(3,1fr); }
.pm-stats--4 { grid-template-columns: repeat(2,1fr); }
@media (min-width: 420px) {
  .pm-stats--4 { grid-template-columns: repeat(4,1fr); }
}
.pm-stat {
  background: var(--ink-1); padding: .875rem 1rem;
  display: flex; flex-direction: column; gap: .25rem;
}
.pm-stat-value {
  font-family: var(--mono); font-size: 1.25rem; font-weight: 500;
  color: var(--txt); letter-spacing: -.02em;
}
.pm-stat-label { font-size: .68rem; color: var(--dim); font-weight: 300; }

/* Blocs secondaires */
.pm-block {
  background: var(--ink-1); border-radius: var(--r-xl);
  padding: 1.25rem;
}
.pm-block-title {
  font-family: var(--mono); font-size: .62rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--dim);
  margin-bottom: 1rem;
}

/* Barre de progression */
.pm-bar-track {
  height: 5px; background: var(--rim-1); border-radius: var(--r-pill); overflow: hidden;
}
.pm-bar-fill {
  height: 100%; background: var(--lime); border-radius: var(--r-pill);
  width: 0%; transition: width 500ms cubic-bezier(.34,1.4,.64,1);
}

/* ── FAQ ──────────────────────────────────────── */
.pm-faq { display: flex; flex-direction: column; gap: 1px; background: var(--rim-1); border-radius: var(--r-xl); overflow: hidden; }
.pm-faq details { background: var(--ink-1); padding: .9rem 1rem; }
.pm-faq details[open] { background: var(--ink-2); }
.pm-faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  font-size: .875rem; font-weight: 500; color: var(--txt);
  cursor: pointer; list-style: none; user-select: none;
}
.pm-faq summary::-webkit-details-marker { display: none; }
.pm-faq-icon { width: 14px; height: 14px; fill: var(--dim); flex-shrink: 0; transition: transform 160ms, fill 160ms; }
.pm-faq details[open] summary { color: var(--lime); }
.pm-faq details[open] .pm-faq-icon { transform: rotate(45deg); fill: var(--lime); }
.pm-faq details p {
  font-size: .82rem; font-weight: 300; color: var(--dim); line-height: 1.75;
  margin-top: .625rem; padding-right: .5rem;
}

/* Liens internes */
.pm-see-also { margin-top: 1.75rem; }
.pm-see-also-label {
  font-family: var(--mono); font-size: .62rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--dim); margin-bottom: .625rem;
}
.pm-see-also-links { display: flex; flex-wrap: wrap; gap: .4rem; }
.pm-see-also-link {
  font-size: .75rem; font-weight: 500; color: var(--dim);
  background: var(--ink-1); border: 1px solid var(--rim-1);
  border-radius: var(--r-pill); padding: 4px 12px;
  text-decoration: none; transition: color var(--t-base), border-color var(--t-base), background var(--t-base);
}
.pm-see-also-link:hover { color: var(--lime); border-color: rgba(200,240,90,.3); background: var(--lime-lo); }

/* ── FOOTER ───────────────────────────────────── */
.pm-footer {
  text-align: center; padding: 2rem 1.25rem;
  font-family: var(--mono); font-size: .62rem; color: var(--faint);
  border-top: 1px solid var(--rim-1);
  max-width: var(--max-w); margin: 0 auto;
}

/* ── ANIMATIONS ───────────────────────────────── */
@keyframes pm-up { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
.pm-reveal { animation: pm-up 240ms ease both; }
.pm-reveal-2 { animation: pm-up 240ms 80ms ease both; }
.pm-reveal-3 { animation: pm-up 240ms 160ms ease both; }

/* ── DESKTOP LAYOUT ───────────────────────────────── */
@media (min-width: 900px) {

  /* Layout racine plus large */
  :root { --max-w: 960px; }

  /* Header */
  .pm-nav { padding: 0 2rem; }
  .pm-nav-link { font-size: .72rem; padding: 4px 11px; }

  /* Wrap principal */
  .pm-wrap { padding: 2.5rem 2rem 5rem; }

  /* Tool header plus grand */
  .pm-tool-header { padding-bottom: 2.5rem; margin-bottom: 2.5rem; }
  .pm-tool-title  { font-size: 2.75rem; }
  .pm-tool-desc   { font-size: 1rem; max-width: 52ch; }

  /* Layout 2 colonnes : formulaire à gauche, résultats à droite */
  .pm-layout-2col {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 2rem;
    align-items: start;
  }
  .pm-layout-2col .pm-form {
    position: sticky; top: calc(var(--hd-h) + 1.5rem);
  }

  /* Formulaire plus aéré */
  .pm-form { gap: 2rem; }
  .pm-input { height: 64px; font-size: 2.25rem; }
  .pm-input--sm { height: 54px; font-size: 1.625rem; }

  /* Résultats */
  .pm-result-value { font-size: 3.5rem; }
  .pm-result-hero  { padding: 2rem; }
  .pm-stat-value   { font-size: 1.375rem; }

  /* FAQ et see-also */
  .pm-faq { margin-top: 0; }
  .pm-see-also { margin-top: 2rem; }
  .pm-faq details { padding: 1rem 1.25rem; }
  .pm-faq summary { font-size: .95rem; }

  /* Bloc */
  .pm-block { padding: 1.5rem; }
  .pm-block-title { font-size: .68rem; }

  /* Hub desktop */
  .pm-hub-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 2rem;
  }
  .pm-hub-section { margin-bottom: 0; }
  .pm-hub-section:first-child { grid-column: 1; }
  .pm-hub-section:nth-child(2) { grid-column: 2; grid-row: 1 / span 2; }
}

@media (min-width: 1200px) {
  :root { --max-w: 1100px; }
  .pm-layout-2col { grid-template-columns: 420px 1fr; gap: 2.5rem; }
}

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