/* ==========================================================================
   HouseTradery — base : reset, tokens, typographie, primitives
   ========================================================================== */

/* ----- Reset léger ------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body, h1, h2, h3, h4, p, figure, blockquote, dl, dd, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }

/* ----- Tokens ------------------------------------------------------------ */
:root {
  /* Noir NEUTRE — pas d'ardoise bleutée. Les surfaces se distinguent
     uniquement par leur clarté : aucune bordure, aucune ombre. C'est ce qui
     fait l'épure. */
  --bg:            #0f0f10;
  --bg-deep:       #232325;   /* pastilles, champs, survols */
  --surface:       #191919;   /* cartes, panneaux */
  --surface-2:     #1f1f21;
  --border:        #262628;   /* filets de séparation uniquement */
  --border-strong: #35353a;
  /* Aplat des états « actif » (onglet, tag, page courante) : un gris moyen,
     comme les tags sélectionnés de la maquette. */
  --fill-active:   #34343a;

  --text:        #f4f4f5;
  --text-dim:    #a1a1a6;
  --text-faint:  #6e6e73;

  /* Un seul accent, vif sur fond sombre, avec du texte SOMBRE dessus —
     c'est le contraste le plus lisible en interface nocturne. */
  --brand:        #34d399;
  --brand-strong: #6ee7b7;
  --brand-soft:   #12271f;
  --on-brand:     #08130e;

  --brand-fill:   #34d399;
  --brand-fill-h: #6ee7b7;
  --sky-fill:     #38bdf8;
  --sky-fill-h:   #7dd3fc;
  --honey-fill:   #fbbf24;
  --honey-fill-h: #fcd34d;

  /* Accents secondaires — teintes vives, fonds sourds. */
  --sky:          #38bdf8;
  --sky-soft:     #10222c;
  --honey:        #fbbf24;
  --honey-soft:   #2a2113;
  --clay:         #fb7185;
  --clay-soft:    #2b1519;
  --plum:         #c084fc;
  --plum-soft:    #211a2c;
  --danger:       #f87171;
  --danger-soft:  #2b1618;

  /* Alias conservés : le reste de la feuille et les vues les utilisent encore. */
  --mint:         var(--brand);
  --mint-soft:    var(--brand-soft);
  --peach:        var(--honey);
  --peach-soft:   var(--honey-soft);
  --lilac:        var(--plum);
  --lilac-soft:   var(--plum-soft);
  --pink:         var(--clay);
  --pink-soft:    var(--clay-soft);

  /* Raretés — des POINTS, jamais des fonds teintés. Le texte reste blanc,
     donc toujours parfaitement lisible ; seule la puce porte la couleur. */
  --r-common:     #8e8e94;
  --r-uncommon:   #4ade80;
  --r-rare:       #60a5fa;
  --r-ultra:      #c084fc;
  --r-legendary:  #fbbf24;

  /* Formes : angles quasi carrés comme la maquette, boutons en gélule. */
  --radius-sm:   4px;
  --radius:      5px;
  --radius-lg:   6px;
  --radius-pill: 999px;

  /* Les ombres ne se voient pas sur du noir : on ne s'en sert plus. */
  --shadow-sm: none;
  --shadow:    none;
  --shadow-lg: 0 18px 50px rgba(0,0,0,.55);

  /* Rythme */
  --container: 1120px;
  --gap: 18px;

  /* Valley Sans pour les titres, les boutons et la marque ; Inter pour le
     texte. La chasse fixe porte les chiffres (rep, quantités, compteurs) et les
     pseudos : c'est un marqueur discret mais très reconnaissable des
     plateformes d'échange, et le seul dessin où I majuscule et l minuscule ne
     se confondent pas. */
  --font-display: 'Valley Sans', 'Segoe UI', system-ui, sans-serif;
  --font-body:    'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;
  --font-ui:      var(--font-display);
}

/* ----- Page -------------------------------------------------------------- */
body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  /* Blanc franc, sans dégradé : le fond ne doit rien raconter, ce sont les
     photos de maisons qui portent la couleur. */
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ----- Voile d'arrivée --------------------------------------------------- */
/* Masqué par défaut : seul le script inline du layout l'allume, et seulement à
   la première page de la visite. Sans JavaScript, il n'existe pas. */
.splash { display: none; }
.splash.is-running {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: var(--bg);
  /* Le voile s'efface tout seul. Même si le script mourait avant son
     setTimeout, le site redeviendrait utilisable. */
  animation: splash-out .4s ease 1.5s forwards;
}
.splash-inner { display: grid; justify-items: center; gap: 18px; }
.splash-name {
  font-family: var(--font-display);
  font-size: clamp(28px, 7vw, 46px);
  letter-spacing: -0.03em;
  color: var(--text);
  animation: splash-in .5s cubic-bezier(.2, .7, .3, 1) both;
}
.splash-name span { color: var(--brand-strong); }
/* Une jauge plutôt qu'un spinner : elle a une fin, donc elle annonce combien
   de temps on attend au lieu de tourner indéfiniment. */
.splash-bar {
  position: relative;
  width: 132px;
  height: 2px;
  border-radius: var(--radius-pill);
  background: var(--border);
  overflow: hidden;
}
.splash-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--brand);
  transform-origin: left;
  animation: splash-load 1.5s cubic-bezier(.4, 0, .2, 1) both;
}
@keyframes splash-in   { from { opacity: 0; transform: translateY(9px); } }
@keyframes splash-load { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes splash-out  { to { opacity: 0; visibility: hidden; } }

/* Mouvement réduit : on garde l'écran, on retire l'animation. */
@media (prefers-reduced-motion: reduce) {
  .splash.is-running,
  .splash-name,
  .splash-bar::after { animation-duration: .01ms; animation-delay: 0s; }
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.18;
  /* Valley Sans est large : elle respire trop sans un léger resserrement. */
  letter-spacing: -0.02em;
  color: var(--text);
}
h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }

/* Chiffres en chasse fixe partout où ils comptent : rep, quantités, compteurs. */
.num, .qty-value, .want-qty, .hero-stat b, .profile-stats b {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

p { margin: 0 0 10px; }
p:last-child { margin-bottom: 0; }
strong { font-weight: 800; }
small { font-size: 12.5px; }

::selection { background: var(--brand-soft); }

:focus-visible {
  outline: 3px solid var(--sky);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ----- Conteneur centré : le site n'occupe jamais toute la largeur -------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}
.site-main { flex: 1 0 auto; padding: 28px 0 56px; }

/* ----- Boutons ----------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 15px;
  padding: 11px 21px;
  /* Boutons en gélule, partout. */
  border-radius: var(--radius-pill);
  border: 1.5px solid transparent;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
/* Un bouton désactivé doit rester un bouton : fond, bordure, texte lisible. */
.btn[disabled], .btn.is-disabled {
  pointer-events: none;
  transform: none;
  background: var(--surface-2);
  color: var(--text-faint);
  border-color: transparent;
  box-shadow: none;
}

/* Une seule action pleine par écran. Texte SOMBRE sur accent vif : c'est le
   contraste le plus élevé possible en interface nocturne. */
.btn-primary { background: var(--brand-fill); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-fill-h); }

.btn-sky { background: var(--sky-fill); color: var(--on-brand); }
.btn-sky:hover { background: var(--sky-fill-h); }

.btn-mint { background: var(--brand-fill); color: var(--on-brand); }
.btn-mint:hover { background: var(--brand-fill-h); }

.btn-ghost { background: var(--bg-deep); color: var(--text); border-color: transparent; }
.btn-ghost:hover { background: #2d2d30; color: #fff; }

.btn-quiet { background: transparent; color: var(--text-dim); }
.btn-quiet:hover { background: rgba(255,255,255,.06); color: var(--text); }

.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: var(--danger); color: var(--on-brand); }

.btn-sm { font-size: 14px; padding: 8px 15px; }
.btn-lg { font-size: 17px; padding: 14px 28px; }
.btn-block { width: 100%; }

/* ----- Formulaires ------------------------------------------------------- */
.field { margin-bottom: 18px; }
.field > label,
.label {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 7px;
  color: var(--text);
}
.hint { font-size: 13px; color: var(--text-dim); margin-top: 6px; }

.input, .select, .textarea {
  width: 100%;
  background: var(--bg-deep);
  border: 1px solid transparent;
  color: var(--text);
  border-radius: var(--radius);
  padding: 11px 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(52,211,153,.25);
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23a1a1a6' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.input-code {
  font-family: var(--font-display);
  font-size: 30px;
  letter-spacing: 12px;
  text-align: center;
  padding: 14px 10px 14px 22px;
}

/* ----- Cartes ------------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 0;
  border-radius: var(--radius-lg);
}
.card-pad { padding: 22px; }

/* ----- Puces / badges ---------------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  background: var(--bg-deep);
  color: var(--text-dim);
  white-space: nowrap;
}
/* Fond neutre pour TOUTES les pastilles ; seule la couleur du texte varie.
   C'est plus sobre que des aplats teintés, et le contraste est garanti quelle
   que soit la teinte. */
.chip-sky   { color: var(--sky); }
.chip-mint  { color: var(--brand); }
.chip-coral { color: var(--brand); }
.chip-peach { color: var(--honey); }
.chip-lilac { color: var(--plum); }
.chip-danger{ color: var(--danger); }

.pill {
  display: inline-block;
  min-width: 19px;
  padding: 0 6px;
  margin-left: 6px;
  font-size: 11.5px;
  font-weight: 800;
  line-height: 19px;
  text-align: center;
  color: #fff;
  background: var(--brand);
  border-radius: var(--radius-pill);
}

/* ----- Messages ---------------------------------------------------------- */
.flash {
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-weight: 600;
  font-size: 14.5px;
  border: 1px solid transparent;
}
.flash-ok    { background: var(--surface); color: var(--brand);  border-color: transparent; }
.flash-err   { background: var(--surface); color: var(--danger); border-color: transparent; }
.flash-info  { background: var(--surface); color: var(--text-dim); border-color: transparent; }
.flash-warn  { background: var(--surface); color: var(--honey-fill); border-color: transparent; }
/* Le corps d'un message reste lisible même quand la couleur porte le niveau. */
.flash strong { color: var(--text); }
.flash a      { color: inherit; text-decoration: underline; }

/* ----- États vides ------------------------------------------------------- */
.empty {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-dim);
}
.empty-emoji { font-size: 46px; margin-bottom: 10px; }
.empty h2 { margin-bottom: 6px; }

/* ----- Utilitaires ------------------------------------------------------- */
.stack > * + * { margin-top: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.center { text-align: center; }
.mt-2 { margin-top: 20px; }
.mb-2 { margin-bottom: 20px; }
.grow { flex: 1; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* Libellé réservé aux lecteurs d'écran : invisible, mais lu et focusable. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head p { color: var(--text-dim); margin-top: 4px; }

@media (max-width: 720px) {
  h1 { font-size: 25px; }
  .container { padding: 0 14px; }
  .site-main { padding: 20px 0 40px; }
}
