/* Merlin : sobre façon iOS, touches celtiques discrètes (triskèle, ogham, bronze).
   Sombre par défaut, thème clair disponible. Onglets en bas sur iPhone, barre latérale sur ordinateur. */
:root {
  --sol: #0B1110; --carte: #141C1A; --carte-2: #1B2522; --trait: #26322E;
  --texte: #E7EEEB; --doux: #8EA39B; --lueur: #86CFDC; --bronze: #CFA968;
  --bien: #6FC596; --veille: #E2B65C; --alerte: #EC8B7C; --voile: rgba(11,17,16,.82);
  --f-titre: "Marcellus", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --f-texte: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-ogham: "Noto Sans Ogham", "Segoe UI Historic", sans-serif;
  --r: 18px;
  color-scheme: dark;
  padding-top: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) {
  --sol: #F1F4F3; --carte: #FFFFFF; --carte-2: #E8EEEC; --trait: #D5DEDB;
  --texte: #13201C; --doux: #5B6E67; --lueur: #1F7A8C; --bronze: #8A672C;
  --bien: #2F8A57; --veille: #A86F0E; --alerte: #B4473A; --voile: rgba(241,244,243,.82);
  color-scheme: light;
}}
:root[data-theme="light"] {
  --sol: #F1F4F3; --carte: #FFFFFF; --carte-2: #E8EEEC; --trait: #D5DEDB;
  --texte: #13201C; --doux: #5B6E67; --lueur: #1F7A8C; --bronze: #8A672C;
  --bien: #2F8A57; --veille: #A86F0E; --alerte: #B4473A; --voile: rgba(241,244,243,.82);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0; background: var(--sol); color: var(--texte);
  font-family: var(--f-texte); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--lueur); outline-offset: 2px; border-radius: 8px; }

.ogham {
  font-family: var(--f-ogham); color: var(--bronze); font-size: 18px;
  display: flex; align-items: center; gap: 10px; opacity: .9;
}
.ogham::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--bronze), transparent); opacity: .5; }
.ogham-centre { justify-content: center; }
.ogham-centre::after { display: none; }

/* ---------- Connexion ---------- */
.connexion {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 32px max(24px, env(safe-area-inset-bottom, 0px));
}
.porte { width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.porte .nemeton { width: 132px; height: 132px; margin-bottom: 8px; }
.nom { font-family: var(--f-titre); font-weight: 400; font-size: 40px; line-height: 1.1; margin: 0 0 4px; letter-spacing: .01em; }
.accueil { font-family: var(--f-titre); font-size: 18px; line-height: 1.5; color: var(--doux); margin: 14px 0 24px; text-wrap: balance; }

form { width: 100%; display: flex; flex-direction: column; gap: 6px; text-align: left; }
label { font-size: 13px; color: var(--doux); margin-top: 8px; }
input {
  width: 100%; font: inherit; font-size: 17px; color: var(--texte);
  background: var(--carte); border: 1px solid var(--trait); border-radius: 12px; padding: 12px 14px;
}
input:focus { outline: none; border-color: var(--lueur); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lueur) 25%, transparent); }
.entrer {
  margin-top: 18px; border: 0; border-radius: 12px; padding: 14px; font-size: 17px; font-weight: 600;
  background: var(--lueur); color: var(--sol);
}
.entrer:disabled { opacity: .6; cursor: progress; }
.erreur { margin: 10px 0 0; font-size: 14px; color: var(--alerte); }
.avis {
  width: 100%; text-align: left; font-size: 14px; line-height: 1.5; color: var(--texte);
  border: 1px dashed var(--veille); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px;
}
.avis b { color: var(--veille); display: block; margin-bottom: 2px; }
.avis code { font-size: 13px; color: var(--bronze); }
.pied-porte { font-size: 12px; color: var(--doux); margin: 0; letter-spacing: .04em; }

/* ---------- Tableau de bord ---------- */
.app { display: grid; grid-template-columns: 1fr; min-height: 100vh; }
.cote { display: none; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border: 0; background: none; border-radius: 10px;
  color: var(--doux); text-align: left; font-size: 15px;
}
.nav-item svg { width: 20px; height: 20px; flex: none; }
.nav-item[aria-current="page"] { background: var(--carte-2); color: var(--texte); }
.nav-item:hover { color: var(--texte); }

.page {
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 20px calc(96px + env(safe-area-inset-bottom, 0px));
  max-width: 1180px; width: 100%; margin: 0 auto; min-width: 0;
}
.bandeau { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--doux); margin-bottom: 18px; }
.bandeau .qui { overflow-wrap: anywhere; min-width: 0; }
.petit-btn { border: 1px solid var(--trait); background: var(--carte); border-radius: 999px; padding: 4px 10px; font-size: 12px; color: var(--doux); }
#theme { margin-left: auto; }

.tete { display: grid; grid-template-columns: 1fr; gap: 20px; align-items: center; margin-bottom: 26px; }
.date { font-size: 13px; color: var(--doux); text-transform: uppercase; letter-spacing: .08em; }
.tete h1 { font-family: var(--f-titre); font-weight: 400; font-size: clamp(30px, 6vw, 46px); line-height: 1.08; margin: 6px 0 10px; text-wrap: balance; }
.parole { font-family: var(--f-titre); font-size: 19px; line-height: 1.5; max-width: 34em; margin: 14px 0 0; text-wrap: pretty; }

.orbe {
  background: var(--carte); border: 1px solid var(--trait); border-radius: 24px;
  padding: 16px; display: grid; grid-template-columns: 112px 1fr; gap: 16px; align-items: center;
}
.orbe .nemeton { width: 112px; height: 112px; display: block; }
.orbe h2 { margin: 0; font-size: 17px; font-weight: 600; }
.orbe .meta { font-size: 13px; color: var(--doux); margin: 2px 0 8px; }

.grille { display: grid; grid-template-columns: 1fr; gap: 16px; }
.carte { background: var(--carte); border-radius: var(--r); padding: 16px; min-width: 0; }
.carte-tete { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.carte-tete h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--doux); font-weight: 600; }
.carte-tete .compte { margin-left: auto; font-size: 13px; color: var(--doux); }
.vide { margin: 0; font-size: 14px; color: var(--doux); line-height: 1.5; }

.conseil { border-radius: var(--r); padding: 16px; display: flex; gap: 14px; align-items: flex-start; border: 1px dashed var(--trait); }
.conseil svg { width: 28px; height: 28px; color: var(--bronze); flex: none; margin-top: 2px; }
.conseil p { margin: 0; font-family: var(--f-titre); font-size: 17px; line-height: 1.5; }
.conseil .qui-parle { font-size: 12px; color: var(--doux); margin-top: 4px; }

.onglets {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--voile); backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-top: 1px solid var(--trait);
  padding-top: 6px;
  padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
  padding-left: max(8px, env(safe-area-inset-left, 0px));
  padding-right: max(8px, env(safe-area-inset-right, 0px));
}
.onglets button { border: 0; background: none; display: grid; justify-items: center; gap: 2px; font-size: 10px; color: var(--doux); padding: 4px 0; }
.onglets button svg { width: 24px; height: 24px; }
.onglets button[aria-current="page"] { color: var(--lueur); }

.toast {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 12px);
  background: var(--texte); color: var(--sol); padding: 10px 16px; border-radius: 12px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); z-index: 6;
}
.toast.vu { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 700px) {
  .tete { grid-template-columns: 1.15fr 1fr; gap: 28px; }
  .grille { grid-template-columns: 1fr 1fr; grid-auto-flow: dense; }
  .large, .conseil { grid-column: span 2; }
}
@media (min-width: 1100px) {
  .app { grid-template-columns: 236px 1fr; }
  .cote {
    display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh;
    padding: 24px 14px; border-right: 1px solid var(--trait);
    padding-left: max(14px, env(safe-area-inset-left, 0px));
  }
  .marque { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; }
  .marque svg { width: 28px; height: 28px; color: var(--lueur); }
  .marque b { font-family: var(--f-titre); font-weight: 400; font-size: 22px; }
  .cote .pied { margin-top: auto; }
  .onglets, .sortir-mobile { display: none; }
  .page { padding-block: 32px 48px; padding-left: 40px; padding-right: max(40px, env(safe-area-inset-right, 0px)); }
  .grille { grid-template-columns: repeat(3, 1fr); }
  .large { grid-column: span 2; }
  .conseil { grid-column: span 1; }
  .toast { bottom: 32px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
