/* Compagnon Valmorel — esthétique du « Livret Montagne » (design system des
   cahiers) : papier chaud, encre douce, 4 couleurs « mondes », titres ronds
   Baloo 2, corps Nunito. Mise en page gardée utilitaire : lisible dehors en
   plein soleil, cibles ≥ 44 px, une seule main. Polices embarquées (hors ligne). */

@font-face { font-family: 'Baloo2'; src: url('fonts/Baloo2.ttf') format('truetype');
  font-weight: 400 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('fonts/Nunito.ttf') format('truetype');
  font-weight: 400 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'LuckiestGuy'; src: url('fonts/LuckiestGuy.ttf') format('truetype');
  font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Chewy'; src: url('fonts/Chewy.ttf') format('truetype');
  font-weight: 400; font-style: normal; font-display: swap; }

:root {
  /* Papier & encre (neutres chauds) */
  --fond:       oklch(0.966 0.008 85);   /* page, papier chaud */
  --carte:      oklch(1 0 0);            /* carte, blanc pur */
  --texte:      oklch(0.31 0.015 150);   /* encre */
  --discret:    oklch(0.46 0.014 150);   /* encre douce */
  --line:       oklch(0.85 0.012 85);    /* traits, séparateurs */
  /* 4 mondes du séjour */
  --vert:       oklch(0.565 0.135 152);  /* nature */
  --vert-clair: oklch(0.935 0.050 152);  /* nature-wash */
  --bleu:       oklch(0.560 0.140 242);  /* eau */
  --bleu-clair: oklch(0.935 0.050 242);  /* eau-wash */
  --terre:      oklch(0.585 0.125 55);   /* animaux */
  --baie:       oklch(0.535 0.150 315);  /* jeux */
  --alerte:     oklch(0.56 0.17 25);
  --alerte-fond:oklch(0.94 0.055 25);
  --ombre: 0 1px 0 oklch(0.93 0.014 80), 0 6px 18px oklch(0.40 0.02 150 / 0.06);
  --font-titre:  'Baloo2', system-ui, -apple-system, sans-serif;
  --font-corps:  'Nunito', system-ui, -apple-system, sans-serif;
  --font-affiche:'LuckiestGuy', 'Baloo2', system-ui, sans-serif;
  --font-hand:   'Chewy', 'Baloo2', system-ui, cursive;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: oklch(0.19 0.012 150); --carte: oklch(0.255 0.013 150);
    --texte: oklch(0.94 0.008 150); --discret: oklch(0.72 0.012 150);
    --line: oklch(0.40 0.010 150);
    --vert: oklch(0.72 0.130 152); --vert-clair: oklch(0.32 0.030 152);
    --bleu: oklch(0.72 0.120 242); --bleu-clair: oklch(0.32 0.030 242);
    --terre: oklch(0.72 0.100 60); --baie: oklch(0.70 0.130 315);
    --alerte: oklch(0.72 0.140 25); --alerte-fond: oklch(0.30 0.060 25);
    --ombre: 0 1px 3px rgba(0,0,0,.5);
  }
  .remontees-table .ferme { color: oklch(0.45 0.01 150); }
  #onglets { border-top-color: rgba(255,255,255,.12); }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; max-width: 100%;
  overscroll-behavior: none; }
body {
  font-family: var(--font-corps);
  font-size: 18px; line-height: 1.45; color: var(--texte);
  background: var(--fond);
  /* Épinglé aux 4 bords : remplit exactement l'écran en standalone iOS,
     sans dépendre de vh/dvh (souvent faux en PWA). #app scrolle à l'intérieur. */
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
}

/* Sous-titres et noms en Baloo 2 (rondes) ; le corps reste en Nunito. */
.carte h2, .trouvailles h3, .points-rem h3,
.sentier-num, .sentier-nom, .res-quoi, .r-nom, .gros {
  font-family: var(--font-titre); }

#app {
  flex: 1; min-width: 0; overflow-y: auto;
  /* marge haute = barre d'état/encoche iOS (safe area) + 14px */
  padding: calc(env(safe-area-inset-top) + 14px) 14px 16px;
  -webkit-overflow-scrolling: touch;
}
.chargement { text-align: center; color: var(--discret); margin-top: 40vh; }

/* Titres de page façon livret : Luckiest Guy capitales, pleins dans la couleur
   du « monde » de l'écran (sans ombre). */
.titre-page, .jour-titre {
  font-family: var(--font-affiche); text-transform: uppercase; font-weight: 400;
  letter-spacing: 0.5px; line-height: 1.05; color: var(--monde, var(--vert));
}
.titre-page { font-size: 32px; margin: 10px 4px 18px; }
.jour-titre { font-size: 27px; margin: 4px 0 2px; }

#app[data-ecran="aujourdhui"] { --monde: var(--terre); }
#app[data-ecran="sentiers"]   { --monde: var(--vert); }
#app[data-ecran="remontees"]  { --monde: var(--bleu); }
#app[data-ecran="reserver"]   { --monde: var(--baie); }

.carte {
  background: var(--carte); border-radius: 14px; padding: 14px 16px;
  margin-bottom: 14px; box-shadow: var(--ombre);
}
.carte h2 { font-family: var(--font-hand); font-size: 20px; letter-spacing: .3px;
  color: var(--monde, var(--vert)); margin: 2px 0 10px; }
.carte.alerte { background: var(--alerte-fond); }
.carte.alerte .gros { color: var(--alerte); }

.gros { font-size: 20px; font-weight: 600; margin: 4px 0; }
.discret { color: var(--discret); font-size: 15px; }

/* Carte météo (Aujourd'hui). */
.meteo-jour { display: flex; align-items: center; gap: 12px; margin: 2px 0 8px; }
.meteo-emoji { font-size: 40px; line-height: 1; }
.meteo-jour-txt { display: flex; flex-direction: column; }
.meteo-temp { font-family: var(--font-titre); font-size: 23px; font-weight: 700; line-height: 1.15; }
.meteo-desc { color: var(--discret); font-size: 15px; }
.meteo-detail { margin: 10px 0 4px; }
.meteo-courbe { display: block; max-width: 100%; height: auto; overflow: visible; }
.mc-line { fill: none; stroke: var(--terre); stroke-width: 0.7; stroke-linejoin: round; stroke-linecap: round; }
.mc-pt { fill: var(--terre); }
.mc-lbl { fill: var(--texte); font-size: 4.7px; font-weight: 600; font-family: var(--font-corps); }
.meteo-heures { display: flex; }
.mh-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.mh-h { font-size: 13px; color: var(--discret); font-weight: 600; }
.mh-e { font-size: 23px; line-height: 1; }
.mh-p { font-size: 12px; color: var(--bleu); font-weight: 600; }

.meteo-pluie { font-size: 16px; font-weight: 600; margin: 16px 0 8px; }
.meteo-demain { color: var(--discret); font-size: 15px; margin: 4px 0; }
.meteo-releve { font-size: 13px; margin-top: 8px; }

.remontee-ligne { display: flex; justify-content: space-between; align-items: baseline;
  padding: 6px 0; border-bottom: 1px solid var(--vert-clair); }
.remontee-ligne:last-of-type { border-bottom: none; }
.r-nom { font-weight: 700; font-size: 19px; }
.r-horaire { color: var(--discret); font-size: 15px; text-align: right; }

.kv { display: flex; gap: 10px; padding: 3px 0; }
.kv .k { color: var(--discret); min-width: 92px; font-size: 15px; }
.kv .v { flex: 1; }

/* Sentiers repliables : en-tête cliquable + corps masqué par défaut. */
.sentier-pliable { padding: 0; overflow: hidden; }
.sentier-tete { width: 100%; display: flex; align-items: center; gap: 10px;
  background: none; border: none; text-align: left; font: inherit; color: var(--texte);
  padding: 14px 16px; min-height: 60px; cursor: pointer; }
.sentier-tete-titre { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.sentier-num { font-size: 13px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--vert); font-weight: 700; }
.sentier-nom { font-size: 19px; font-weight: 700; line-height: 1.2; }
.sentier-tete-duree { font-size: 13px; font-weight: 600; color: var(--vert);
  background: var(--vert-clair); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.sentier-chevron { color: var(--discret); font-size: 18px; transition: transform .15s ease; }
.sentier-pliable.ouvert .sentier-chevron { transform: rotate(90deg); }
.sentier-corps { padding: 0 16px 14px; }

.sentier-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.pastille { background: var(--vert-clair); color: var(--vert); border-radius: 999px;
  padding: 3px 12px; font-size: 14px; font-weight: 600; }
.trace { margin: 10px 0; }
.trace svg { max-width: 100%; height: auto; display: block; }
.trace .t-ligne { fill: none; stroke: var(--vert); stroke-width: 0.9; stroke-opacity: .55;
  stroke-linejoin: round; stroke-linecap: round; }
.trace .t-pt { fill: var(--bleu); }
.trace .t-pt.t-star { fill: var(--vert); }
.trace .t-lbl { fill: var(--texte); font-size: 3.6px; }
.trace .t-lbl.t-star { font-weight: 700; }
.trace .t-sens { fill: var(--discret); font-size: 3.2px; }
.trace .t-lbl, .trace .t-sens { paint-order: stroke; stroke: var(--carte);
  stroke-width: 1.2px; stroke-linejoin: round; }

.sentier-itineraire { margin: 8px 0; }
.points-rem h3 { font-size: 15px; color: var(--vert); margin: 12px 0 6px; }
.points-rem .pr-item { padding: 5px 0; margin: 0; font-size: 16px;
  border-bottom: 1px solid var(--vert-clair); }
.points-rem .pr-item:last-child { border-bottom: none; }
.funfact { background: var(--vert-clair); border-radius: 10px; padding: 10px 12px;
  margin: 10px 0; font-size: 16px; }
.trouvailles h3 { font-size: 15px; color: var(--vert); margin: 12px 0 6px; }
.trouvaille { display: flex; gap: 12px; align-items: flex-start;
  padding: 8px 0; border-bottom: 1px solid var(--vert-clair); }
.trouvaille:last-child { border-bottom: none; }
.tr-photo { width: 76px; height: 100px; object-fit: cover; border-radius: 8px;
  flex-shrink: 0; background: var(--vert-clair); cursor: zoom-in; }
.tr-txt { flex: 1; min-width: 0; }
.tr-nom { font-weight: 700; display: block; }
.tr-signe { color: var(--discret); font-size: 15px; }

/* Lightbox photo nature (agrandissement). */
#lightbox { position: fixed; inset: 0; z-index: 100; display: none;
  align-items: center; justify-content: center; padding: 16px; background: rgba(0,0,0,.9); }
#lightbox.visible { display: flex; }
.lb-fig { margin: 0; display: flex; flex-direction: column; align-items: center;
  gap: 12px; max-width: 100%; max-height: 100%; }
.lb-img { max-width: 92vw; max-height: 78vh; object-fit: contain; border-radius: 10px;
  box-shadow: 0 6px 30px rgba(0,0,0,.5); }
.lb-cap { color: #fff; font-size: 16px; text-align: center; max-width: 92vw; line-height: 1.35; }

.remontees-table { width: 100%; border-collapse: collapse; font-size: 16px; }
.remontees-table th { font-size: 13px; color: var(--discret); padding: 4px 2px; }
.remontees-table td { text-align: center; padding: 8px 2px; }
.remontees-table td.r-nom { text-align: left; font-weight: 700; font-size: 17px; }
.remontees-table .ouvert { color: var(--monde, var(--vert)); font-size: 20px; }
.remontees-table .ferme { color: oklch(0.87 0.006 85); font-size: 18px; }

.reserve-item { padding: 10px 0; border-bottom: 1px solid var(--vert-clair); }
.reserve-item:last-child { border-bottom: none; }
.res-quoi { font-weight: 700; font-size: 18px; display: block; }
.res-ferme { display: inline-block; background: var(--alerte-fond); color: var(--alerte);
  border-radius: 6px; padding: 1px 8px; font-size: 13px; margin: 3px 0; }
.res-info { display: block; color: var(--discret); font-size: 15px; margin: 2px 0; }
.res-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.res-tel { display: inline-block; padding: 10px 18px; min-height: 44px;
  background: var(--vert); color: #fff; border-radius: 10px; text-decoration: none;
  font-weight: 700; font-size: 17px; }
.lien-maps { display: inline-block; padding: 10px 18px; min-height: 44px;
  background: var(--bleu); color: #fff; border-radius: 10px; text-decoration: none;
  font-weight: 700; font-size: 17px; }
.sentier-corps > .lien-maps { margin: 8px 0; }

#onglets {
  flex-shrink: 0;
  display: flex; background: var(--carte);
  border-top: 1px solid rgba(0,0,0,.1);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -1px 6px rgba(0,0,0,.08);
}
#onglets button {
  flex: 1; border: none; background: none; color: var(--discret);
  padding: 8px 2px 6px; font-size: 11px; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: 56px;
}
#onglets button .ico { font-size: 22px; }
#onglets button.actif { color: var(--vert); font-weight: 700; }

/* Garde-fou anti-débordement : rien ne dépasse la largeur de l'écran. */
#app > div { max-width: 100%; }
.carte { max-width: 100%; overflow: hidden; }
.funfact, .tr-signe, .res-info, .kv .v, .carte p, .r-horaire { overflow-wrap: anywhere; }
.r-horaire { white-space: normal; }
