/* ============================================================================
   theme.css — Design system du briefing décollage CEPS09
   "EFB day-mode, chrome cockpit" — contenu CLAIR lisible au soleil, encadré
   par des bandes de chrome sombres (en-tête, stepper, nav basse) comme un
   EFB en mode jour. Sobre et plat : hiérarchie par filets 1 px, pas d'ombres.
   Discipline couleur = signification : cyan = interactif / sélection ·
   vert = conforme · ambre = caution uniquement · rouge = stop.
   Les infos décisionnelles sont MISES EN ÉVIDENCE : verdicts en bandeaux
   pleins (GO/NO-GO), readouts clés en gros mono avec liseré de statut.

   Type : IBM Plex superfamily — Sans (texte), Sans Condensed (étiquettes
   d'instrument, capitales espacées), Mono (chaque valeur, chiffres tabulaires).

   Le chrome sombre utilise des littéraux (--chrome-*) ; le contenu utilise
   les tokens clairs ci-dessous.
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans+Condensed:wght@500;600;700&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

/* ---- Tokens ------------------------------------------------------------- */
:root {
  /* type */
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-cond: "IBM Plex Sans Condensed", "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* chrome cockpit (bandes sombres : en-tête, stepper, nav basse) */
  --chrome:      #1a2027;
  --chrome-2:    #232b34;
  --chrome-line: #333d48;
  --chrome-ink:  #e9eef4;
  --chrome-mut:  #8d9aa9;

  /* surfaces — jour, neutres et mates */
  --paper:     #edf0f4;   /* fond app */
  --paper-2:   #e6eaef;
  --surface:   #ffffff;   /* panneau / carte */
  --surface-2: #f3f5f8;   /* face de readout / inset */
  --surface-3: #e8ecf1;   /* hover / inset profond */

  /* encre */
  --ink:    #14212e;
  --ink-2:  #3e5165;
  --muted:  #71818f;

  /* filets */
  --line:   #dbe1e8;   /* hairline */
  --line-2: #c3ccd6;   /* bord de contrôle */

  /* encre de titre + accents */
  --navy:   #173a5e;   /* encre de titre / valeur forte */
  --navy-2: #1f4f7d;
  --amber:  #e8a020;   /* CAUTION uniquement (statuts, tags d'attention) */
  --amber-d:#c5820e;
  --amber-ink:#3a2706;
  --cyan:   #0c7f96;   /* interactif / sélection — aplats et bords */
  --cyan-d: #096274;   /* interactif — texte */

  /* statuts avionique (teintes claires + aplats pleins pour les verdicts) */
  --ok:      #1f9d57;  --ok-bg:#e2f4ea;  --ok-ink:#10623a;  --ok-line:#aaddc0;
  --warn:    #d98a0b;  --warn-bg:#fcf1da; --warn-ink:#8a5806; --warn-line:#efd49a;
  --danger:  #c0392b;  --danger-bg:#fbe4e0; --danger-ink:#8f261b; --danger-line:#eeb2aa;
  --info-bg: #e3f1f5;  --info-line:#b4dbe5;

  /* rayons / profondeur — plat : pas d'ombres portées */
  --radius-sm: 6px;
  --radius:    8px;
  --radius-lg: 10px;
  --shadow-sm: none;
  --shadow:    none;
  --shadow-lg: 0 18px 50px rgba(10,20,30,.35);

  /* espacements */
  --sp-1:4px; --sp-2:8px; --sp-3:12px; --sp-4:16px; --sp-5:22px; --sp-6:32px;

  --focus: 0 0 0 3px rgba(12,127,150,.28);
}

/* ---- Reset / base ------------------------------------------------------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
:root { color-scheme: light; accent-color: var(--cyan); }
body {
  font-family: var(--font-sans);
  color: var(--ink);
  background-color: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
}
a { color: var(--cyan-d); text-decoration: none; }
a:hover { color: var(--cyan); }
h1, h2, h3 { line-height: 1.15; }

/* tabular mono numbers wherever wanted */
.mono, .tnum { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* instrument label / eyebrow */
.eyebrow, .label-instr {
  font-family: var(--font-cond);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .74rem;
  font-weight: 600;
  color: var(--cyan-d);
}

/* ---- App header (bande de chrome cockpit, plate) ------------------------ */
.app-header {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 22px;
  color: var(--chrome-ink);
  background: var(--chrome);
  border-bottom: 1px solid var(--chrome-line);
}
.app-header .logo { flex: none; display: inline-flex; }
.app-header h1 {
  font-family: var(--font-cond); font-weight: 600; font-size: 1.16rem;
  letter-spacing: .015em; margin: 0; color: var(--chrome-ink);
}
.app-header .badge {
  font-family: var(--font-cond); text-transform: uppercase; letter-spacing: .08em;
  font-weight: 600; font-size: .7rem;
  background: transparent; color: #7fcbdd;
  border: 1px solid var(--chrome-line);
  padding: 3px 10px; border-radius: 999px;
}
.app-header .spacer { flex: 1; }
.app-header a.home {
  color: var(--chrome-mut); font-family: var(--font-cond); text-transform: uppercase;
  letter-spacing: .07em; font-size: .8rem; white-space: nowrap;
}
.app-header a.home:hover { color: var(--chrome-ink); }
.app-header .btn.ghost { background: transparent; color: var(--chrome-ink); border-color: var(--chrome-line); }
.app-header .btn.ghost:hover { background: rgba(255,255,255,.08); border-color: #4a5765; color: #fff; }

/* ---- Layout helpers ----------------------------------------------------- */
.wrap { max-width: 1500px; margin: 0 auto; padding: 18px 22px; }
.row  { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: center; }
.stack{ display: flex; flex-direction: column; gap: var(--sp-3); }
.spacer { flex: 1; }

/* ---- Card --------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

/* section header as instrument label: accent tick + hairline rule */
.card > h2, .section-title {
  font-family: var(--font-cond);
  text-transform: uppercase;
  letter-spacing: .09em;
  font-weight: 600;
  font-size: .84rem;
  color: var(--navy);
  display: flex; align-items: center; gap: 9px;
  margin: 0 0 14px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}
.card > h2::before, .section-title::before {
  content: ""; flex: none; width: 9px; height: 9px; border-radius: 2px;
  background: var(--cyan); box-shadow: 0 0 0 3px rgba(12,127,150,.14);
}
.card > h2 .sub, .section-title .sub {
  margin-left: auto; font-family: var(--font-sans); text-transform: none;
  letter-spacing: 0; font-weight: 500; font-size: .72rem; color: var(--muted);
}

/* ---- Buttons — touches de façade (softkeys), plates -------------------- */
.btn {
  font-family: var(--font-cond); text-transform: uppercase; letter-spacing: .05em;
  font-weight: 600; font-size: .82rem;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--navy); cursor: pointer;
  transition: background .14s ease, border-color .14s ease, transform .08s ease, box-shadow .14s ease;
}
.btn:hover { background: var(--surface-2); border-color: #aab6c2; }
.btn:active { transform: translateY(1px); }
.btn.accent { background: var(--cyan); border-color: var(--cyan); color: #fff; }
.btn.accent:hover { background: var(--cyan-d); border-color: var(--cyan-d); }
.btn.ghost { background: transparent; color: var(--ink-2); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--cyan); color: var(--cyan-d); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---- Form controls ------------------------------------------------------ */
input[type=number], input[type=text], input[type=date], input[type=time],
input[type=password], select, textarea {
  font-family: var(--font-sans); font-size: .92rem; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); padding: 8px 10px; width: 100%;
  transition: border-color .14s ease, box-shadow .14s ease;
}
/* numbers entered read like instrument entries */
input[type=number], input[type=date], input[type=time] {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--cyan); box-shadow: var(--focus);
}
input[readonly] { background: var(--surface-3); color: var(--ink-2); cursor: not-allowed; }
label { font-family: var(--font-cond); text-transform: uppercase; letter-spacing: .05em;
  font-size: .72rem; font-weight: 600; color: var(--ink-2); }

/* ---- Form layout helpers (shared by perf + briefing) -------------------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group.full { grid-column: 1 / -1; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.status { font-size: .82rem; color: var(--muted); min-height: 1.1em; }

/* ---- Instrument readout (the signature panel) --------------------------- */
.readout {
  position: relative; overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 13px 11px;
  display: flex; flex-direction: column; gap: 2px;
}
.readout::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--line-2);
}
.readout .lbl {
  font-family: var(--font-cond); text-transform: uppercase; letter-spacing: .07em;
  font-size: .68rem; font-weight: 600; color: var(--muted);
}
.readout .val {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
  font-size: 1.6rem; font-weight: 600; color: var(--navy); line-height: 1.05;
}
.readout .unit { font-size: .66rem; color: var(--muted); }
.readout.hl  { background: var(--info-bg); border-color: var(--info-line); }
.readout.hl::before  { background: var(--cyan); }
.readout.hl2 { background: var(--warn-bg); border-color: var(--warn-line); }
.readout.hl2::before { background: var(--amber); }
.readout.ok::before     { background: var(--ok); }
.readout.warn::before   { background: var(--warn); }
.readout.danger::before { background: var(--danger); }

/* ---- Status bar + pills (avionics semantics) ----------------------------
   Le bandeau de verdict est l'info décisionnelle : aplat PLEIN, façon
   GO / NO-GO d'un calculateur de perfo — rien d'autre ne crie sur la page. */
.status-bar {
  font-family: var(--font-sans); font-weight: 700; font-size: .95rem;
  padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
}
.status-ok     { background: var(--ok);     color: #fff; }
.status-warn   { background: var(--amber);  color: var(--amber-ink); }
.status-danger { background: var(--danger); color: #fff; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-cond); text-transform: uppercase; letter-spacing: .06em;
  font-weight: 600; font-size: .73rem; padding: 4px 11px; border-radius: 999px;
  border: 1px solid transparent;
}
.pill.ok     { background: var(--ok-bg);     color: var(--ok-ink);     border-color: var(--ok-line); }
.pill.warn   { background: var(--warn-bg);   color: var(--warn-ink);   border-color: var(--warn-line); }
.pill.danger { background: var(--danger-bg); color: var(--danger-ink); border-color: var(--danger-line); }
.pill.info   { background: var(--info-bg);   color: var(--cyan-d);     border-color: var(--info-line); }

/* ---- Segmented toggle --------------------------------------------------- */
.toggle { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  overflow: hidden; background: var(--surface); }
.toggle button {
  font-family: var(--font-cond); text-transform: uppercase; letter-spacing: .04em;
  font-weight: 600; font-size: .82rem; color: var(--ink-2);
  padding: 7px 14px; border: none; background: transparent; cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.toggle button + button { border-left: 1px solid var(--line); }
.toggle button:hover { background: var(--surface-2); }
.toggle button.active { background: var(--cyan); color: #fff; }

/* ---- Hairline table ----------------------------------------------------- */
.t-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.t-table th, .t-table td { padding: 6px 9px; border-bottom: 1px solid var(--line); text-align: right; }
.t-table th { font-family: var(--font-cond); text-transform: uppercase; letter-spacing: .05em;
  font-size: .7rem; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.t-table td { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.t-table td:first-child, .t-table th:first-child { text-align: left; }

/* ---- Footer ------------------------------------------------------------- */
.app-footer, footer.app-footer {
  text-align: center; padding: 18px; font-size: .76rem; color: var(--muted);
  line-height: 1.6;
}
.app-footer code, footer code {
  font-family: var(--font-mono); color: var(--ink-2);
  background: rgba(23,58,94,.07); padding: .1rem .4rem; border-radius: 5px;
}

/* ---- Lightbox ----------------------------------------------------------- */
.lightbox { position: fixed; inset: 0; background: rgba(8,18,30,.88);
  display: none; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 95%; max-height: 95%; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); }

/* ---- Motion: staggered load reveal (opt-in via .reveal) ----------------- */
@keyframes instr-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; animation: instr-rise .5s cubic-bezier(.22,.61,.36,1) forwards; }
  .reveal:nth-child(1){animation-delay:.04s}.reveal:nth-child(2){animation-delay:.10s}
  .reveal:nth-child(3){animation-delay:.16s}.reveal:nth-child(4){animation-delay:.22s}
  .reveal:nth-child(5){animation-delay:.28s}.reveal:nth-child(6){animation-delay:.34s}
}

::selection { background: rgba(12,127,150,.22); }

/* ════════════════════════════════════════════════════════════════════════
   Tablette & smartphone — couche responsive ajoutée pour briefing-deco.
   Le thème de base est fluide (flex/grid + clamp) ; on ajoute ici des
   points de rupture qui passent les grilles en une colonne et agrandissent
   les cibles tactiles (≥ 44 px) pour l'usage sur le terrain (gants, soleil).
   ════════════════════════════════════════════════════════════════════════ */

/* Cibles tactiles confortables dès qu'on est sur un écran tactile. */
@media (pointer: coarse) {
  .btn { padding: 12px 18px; font-size: .9rem; min-height: 44px; }
  .toggle button { padding: 11px 16px; min-height: 44px; }
  input[type=number], input[type=text], input[type=date], input[type=time],
  input[type=password], select, textarea { padding: 11px 12px; font-size: 16px; /* ≥16px ⇒ pas de zoom auto iOS */ min-height: 44px; }
  .pill { padding: 6px 13px; }
  .step { min-height: 44px; }
}

/* Tablette portrait & petits écrans. */
@media (max-width: 820px) {
  .wrap { padding: 12px 14px; }
  .app-header { padding: 10px 14px; gap: 10px; }
  .app-header h1 { font-size: 1.02rem; }
  .card { padding: 14px; }
  .form-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .tiles { gap: 9px; }
}

/* Smartphone. */
@media (max-width: 560px) {
  .wrap { padding: 10px 11px; }
  .app-header { gap: 8px 10px; }
  .app-header h1 { font-size: .96rem; }
  .app-header .badge { font-size: .62rem; padding: 2px 8px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full { grid-column: 1 / -1; }
  .readout .val { font-size: 1.3rem; }
  .btn-row { gap: 7px; }
  .btn-row .btn { flex: 1 1 auto; justify-content: center; }
  /* Tables larges : scroll horizontal plutôt que débordement. */
  .t-table, .pf-table { font-size: .8rem; }
  h1 { font-size: 1.4rem; }
}
