/* TITETI — design system. Source unique des couleurs, de la typographie et des composants de base.
   Partagé par le site public (copié dans api/public/ui), le back-office et les apps.
   Règle : aucune couleur en dur ailleurs, toujours une variable --t-*. */

@font-face { font-family: "Big Shoulders"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/BigShoulders-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Big Shoulders"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/BigShoulders-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Instrument Sans"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("fonts/InstrumentSans-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Instrument Sans"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("fonts/InstrumentSans-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* Pō — la nuit : l'encre de la marque, jamais un noir neutre */
  --t-po: #1A1247;
  --t-po-2: #2A2163;
  --t-po-3: #40368A;
  /* Re'a — le curcuma : l'action, le billet */
  --t-rea: #FFC52E;
  --t-rea-fort: #F2B200;
  --t-rea-doux: #FFF1C7;
  /* Surfaces claires (usage par défaut : téléphone en plein jour) */
  --t-tiare: #FFFFFF;
  --t-nacre: #F6F5FB;
  --t-trait: #E2DFF0;
  --t-trait-fort: #C9C4E0;
  /* Texte */
  --t-texte: #1A1247;
  --t-texte-2: #554F7A;
  --t-texte-3: #6E6890;
  /* États : réservés au sens, jamais décoratifs */
  --t-miti: #087F58;        /* valide, payé */
  --t-miti-vif: #19C98D;
  --t-miti-doux: #DCF5EB;
  --t-ura: #D12A20;         /* refusé, erreur */
  --t-ura-vif: #FF4A3D;
  --t-ura-doux: #FDE8E6;
  --t-ambre: #B25E00;       /* attention, déjà scanné */
  --t-ambre-vif: #FF9F1A;
  --t-ambre-doux: #FFEFD6;

  --t-fond: var(--t-tiare);
  --t-surface: var(--t-tiare);
  --t-surface-2: var(--t-nacre);

  --t-titre: "Big Shoulders", "Arial Narrow", sans-serif;
  --t-corps: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --t-r-1: 8px;
  --t-r-2: 14px;
  --t-r-3: 22px;
  --t-ombre-1: 0 1px 2px rgb(26 18 71 / .06), 0 4px 12px rgb(26 18 71 / .06);
  --t-ombre-2: 0 2px 4px rgb(26 18 71 / .06), 0 14px 32px rgb(26 18 71 / .12);
  --t-sortie: cubic-bezier(.16, 1, .3, 1);
  --t-encoche: 11px;
}

/* Thème nuit : l'app de contrôle (portes, de nuit) et les héros d'événement */
[data-theme="nuit"] {
  --t-fond: #120C36;
  --t-surface: #1E1650;
  --t-surface-2: #281F63;
  --t-trait: #3A317C;
  --t-trait-fort: #5248A0;
  --t-texte: #FFFFFF;
  --t-texte-2: #C9C4EC;
  --t-texte-3: #A29BD3;
  --t-miti: #19C98D;
  --t-ura: #FF5A4E;
  --t-ambre: #FFAA33;
  --t-miti-doux: #0E3F35;
  --t-ura-doux: #4A1B2B;
  --t-ambre-doux: #4A3418;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--t-fond); color: var(--t-texte);
  font-family: var(--t-corps); font-size: 1rem; line-height: 1.5;
  font-synthesis-weight: none; -webkit-font-smoothing: antialiased;
  accent-color: var(--t-po); caret-color: var(--t-po-3);
}
::selection { background: var(--t-rea); color: var(--t-po); }
:focus-visible { outline: 3px solid var(--t-po-3); outline-offset: 2px; border-radius: 4px; }
[data-theme="nuit"] :focus-visible { outline-color: var(--t-rea); }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: .18em; text-decoration-thickness: 1.5px; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- Typographie */
.t-titre { font-family: var(--t-titre); font-weight: 800; line-height: .95; letter-spacing: -.005em; text-wrap: balance; }
.t-titre-1 { font-size: clamp(2.6rem, 9vw, 5.5rem); }
.t-titre-2 { font-size: clamp(2rem, 5.5vw, 3.25rem); }
.t-titre-3 { font-size: clamp(1.5rem, 3.6vw, 2rem); line-height: 1; }
.t-titre-4 { font-size: 1.3rem; line-height: 1.05; font-weight: 700; }
.t-chiffre { font-family: var(--t-titre); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 0; line-height: 1; }
.t-fort { font-weight: 650; }
.t-doux { color: var(--t-texte-2); }
.t-petit { font-size: .875rem; }
.t-mini { font-size: .8125rem; }
.t-num { font-variant-numeric: tabular-nums; }

/* ---------- Boutons */
.t-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: .7rem 1.25rem; border: 0; border-radius: var(--t-r-2);
  font-weight: 650; font-size: 1rem; line-height: 1.1; text-decoration: none; cursor: pointer;
  background: var(--t-surface-2); color: var(--t-texte);
  transition: transform .18s var(--t-sortie), background-color .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.t-btn:active { transform: scale(.975); }
.t-btn[disabled], .t-btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.t-btn-rea { background: var(--t-rea); color: var(--t-po); box-shadow: 0 1px 0 rgb(26 18 71 / .18), 0 6px 16px rgb(242 178 0 / .28); }
.t-btn-rea:hover:not([disabled]) { background: var(--t-rea-fort); }
.t-btn-po { background: var(--t-po); color: #fff; }
.t-btn-po:hover:not([disabled]) { background: var(--t-po-2); }
.t-btn-contour { background: transparent; box-shadow: inset 0 0 0 1.5px var(--t-trait-fort); }
.t-btn-contour:hover:not([disabled]) { background: var(--t-surface-2); }
.t-btn-danger { background: var(--t-ura-doux); color: var(--t-ura); }
.t-btn-grand { min-height: 56px; font-size: 1.0625rem; padding-inline: 1.5rem; }
.t-btn-petit { min-height: 38px; padding: .4rem .85rem; font-size: .9rem; border-radius: 10px; }
.t-btn-bloc { width: 100%; }
.t-lien { background: none; border: 0; padding: 0; color: var(--t-po-3); font-weight: 600; text-decoration: underline; cursor: pointer; }
[data-theme="nuit"] .t-lien { color: var(--t-rea); }

/* ---------- Champs */
.t-champ { display: grid; gap: .35rem; }
.t-champ > label, .t-label { font-weight: 600; font-size: .9rem; }
.t-aide { font-size: .8125rem; color: var(--t-texte-2); }
.t-erreur { font-size: .8125rem; color: var(--t-ura); font-weight: 600; }
.t-input, .t-select, .t-textarea {
  width: 100%; min-height: 50px; padding: .7rem .9rem; background: var(--t-surface);
  border: 1.5px solid var(--t-trait-fort); border-radius: var(--t-r-2); font-size: 1rem; /* 16 px : pas de zoom iOS */
  transition: border-color .15s, box-shadow .15s;
}
.t-textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.t-input::placeholder, .t-textarea::placeholder { color: var(--t-texte-3); }
.t-input:hover, .t-select:hover, .t-textarea:hover { border-color: var(--t-po-3); }
.t-input:focus, .t-select:focus, .t-textarea:focus { outline: 0; border-color: var(--t-po); box-shadow: 0 0 0 4px rgb(64 54 138 / .18); }
[data-theme="nuit"] .t-input:focus { border-color: var(--t-rea); box-shadow: 0 0 0 4px rgb(255 197 46 / .2); }
.t-input[aria-invalid="true"] { border-color: var(--t-ura); }

/* ---------- Pastilles et états */
.t-puce { display: inline-flex; align-items: center; gap: .35rem; padding: .28rem .65rem; border-radius: 999px; font-size: .8125rem; font-weight: 650; background: var(--t-surface-2); color: var(--t-texte-2); white-space: nowrap; }
.t-puce-rea { background: var(--t-rea); color: var(--t-po); }
.t-puce-miti { background: var(--t-miti-doux); color: var(--t-miti); }
.t-puce-ura { background: var(--t-ura-doux); color: var(--t-ura); }
.t-puce-ambre { background: var(--t-ambre-doux); color: var(--t-ambre); }
.t-puce-po { background: var(--t-po); color: #fff; }

.t-note { padding: .85rem 1rem; border-radius: var(--t-r-2); background: var(--t-surface-2); color: var(--t-texte-2); font-size: .9375rem; }
.t-note-ura { background: var(--t-ura-doux); color: var(--t-ura); font-weight: 600; }
.t-note-miti { background: var(--t-miti-doux); color: var(--t-miti); font-weight: 600; }
.t-note-ambre { background: var(--t-ambre-doux); color: var(--t-ambre); font-weight: 600; }

/* ---------- Compteur de quantité */
.t-pas { display: inline-flex; align-items: center; gap: .25rem; }
.t-pas button { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--t-trait-fort); background: var(--t-surface); font-size: 1.35rem; line-height: 1; cursor: pointer; display: grid; place-items: center; touch-action: manipulation; }
.t-pas button:hover:not([disabled]) { border-color: var(--t-po); }
.t-pas button[disabled] { opacity: .35; cursor: not-allowed; }
.t-pas output { min-width: 2ch; text-align: center; font-family: var(--t-titre); font-weight: 800; font-size: 1.6rem; font-variant-numeric: tabular-nums; }

/* ---------- Le billet : la seule forme signature. Encoches + perforation, nulle part ailleurs. */
.t-billet {
  --coupe: 64%;
  position: relative; background: var(--t-surface); color: var(--t-texte); border-radius: var(--t-r-3);
  -webkit-mask: radial-gradient(circle var(--t-encoche) at 0 var(--coupe), #0000 97%, #000) left / 51% 100% no-repeat, radial-gradient(circle var(--t-encoche) at 100% var(--coupe), #0000 97%, #000) right / 51% 100% no-repeat;
  mask: radial-gradient(circle var(--t-encoche) at 0 var(--coupe), #0000 97%, #000) left / 51% 100% no-repeat, radial-gradient(circle var(--t-encoche) at 100% var(--coupe), #0000 97%, #000) right / 51% 100% no-repeat;
}
.t-billet-perfo { position: absolute; left: calc(var(--t-encoche) + 8px); right: calc(var(--t-encoche) + 8px); top: var(--coupe); border-top: 2px dashed var(--t-trait-fort); }
.t-billet-rea { background: var(--t-rea); color: var(--t-po); }
.t-billet-rea .t-billet-perfo { border-color: rgb(26 18 71 / .35); }
.t-billet-ombre { filter: drop-shadow(0 2px 3px rgb(26 18 71 / .08)) drop-shadow(0 16px 28px rgb(26 18 71 / .16)); }

/* ---------- Divers */
.t-carte { background: var(--t-surface); border: 1px solid var(--t-trait); border-radius: var(--t-r-3); }
.t-sep { border: 0; border-top: 1px solid var(--t-trait); margin: 0; }
.t-pile { display: grid; gap: var(--pile, 1rem); }
.t-rang { display: flex; align-items: center; gap: var(--rang, .75rem); }
.t-entre { justify-content: space-between; }
.t-cache-visuel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

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