/* =========================================================================
   Forest Assist — site vitrine — feuille de style
   Charte forestière sur-mesure (SD-E03) · mobile-first (SD-E05)
   Aucune dépendance, aucune police distante (SD-E01).
   Couleurs = palette « Forêt » de l'app iOS Forest Assist (2026-09-04) :
   clair = « Clairière », sombre = « Pin noir ». Source de vérité :
   forest-assist/ForestAssist/Assets.xcassets/Theme/<token>.colorset (ForestPalette.swift).
   Chaque variable cite le token iOS dont elle reprend la valeur.
   ========================================================================= */

/* ---- Design tokens ---------------------------------------------------- */
:root {
  /* Fonds — page = bgSurface (cartes de l'app), sections alternées = bgPrimary (écran de l'app) */
  --c-bg: #fffdf8;                 /* bgSurface */
  --c-surface: #f6f2e8;            /* bgPrimary */
  --c-surface-2: #eee8da;          /* dérivé : bgPrimary 60 % + bgSurfaceBorder 40 % (pied de page, code) */
  /* Textes */
  --c-text: #5a452c;               /* txtPrimary */
  --c-muted: #7b6244;              /* txtSecondary (txtMuted #a08b6c est sous le seuil AA : non repris) */
  /* Accent bois — liens, titres de cartes, surlignages */
  --c-accent: #8a6b3d;             /* accent */
  --c-accent-strong: #6f5530;      /* accentPressed */
  /* Bouton principal — vert forêt */
  --c-btn: #4a6b4f;                /* btnFill */
  --c-btn-hover: #3c583f;          /* btnFillPressed */
  --c-btn-text: #f5e9d2;           /* btnText */
  --c-accent-contrast: var(--c-btn-text);
  /* Bordures, ombres */
  --c-border: #e2d9c6;             /* bgSurfaceBorder (= separator) */
  --c-shadow: rgba(90, 69, 44, 0.08); /* txtPrimary à 8 % */
  /* États (callouts) */
  --c-success: #3e7a34;            /* stateSuccess */
  --c-warning: #9a6b12;            /* stateWarning */
  --c-danger: #b4462f;             /* stateError */

  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --maxw: 72rem;
  --radius: 12px;
  --radius-sm: 8px;
  --gap: clamp(1rem, 3vw, 2rem);
  --nav-h: 4rem;
  --transition: 180ms ease;
}

/* Thème sombre = palette « Pin noir » (Dark Appearance des mêmes Color Sets) */
@media (prefers-color-scheme: dark) {
  :root {
    --c-bg: #151e17;               /* bgSurface */
    --c-surface: #0c120e;          /* bgPrimary */
    --c-surface-2: #1c2820;        /* bgElevated */
    --c-text: #e6cba8;             /* txtPrimary */
    --c-muted: #c4a57f;            /* txtSecondary */
    --c-accent: #9c7140;           /* accentPressed */
    --c-accent-strong: #b5854c;    /* accent (le plus clair porte le texte sur fond sombre) */
    --c-btn: #26402c;              /* btnFill */
    --c-btn-hover: #1e3323;        /* btnFillPressed */
    --c-btn-text: #ead5b2;         /* btnText */
    --c-border: #243026;           /* bgSurfaceBorder */
    --c-shadow: rgba(0, 0, 0, 0.4);
    --c-success: #9cc28a;          /* stateSuccess */
    --c-warning: #e0b25f;          /* stateWarning */
    --c-danger: #e08a70;           /* stateError */
  }
}

/* ---- Base ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.125rem);
  line-height: 1.6;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 { line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 1.4rem + 3vw, 3.4rem); margin: 0 0 1rem; }
h2 { font-size: clamp(1.5rem, 1.1rem + 1.8vw, 2.3rem); margin: 0 0 0.75rem; }
h3 { font-size: 1.2rem; margin: 0 0 0.5rem; }
p { margin: 0 0 1rem; }
a { color: var(--c-accent-strong); }

em { font-style: normal; color: var(--c-accent-strong); }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2.5rem); }

/* Ancres compensées par la nav fixe */
:target { scroll-margin-top: calc(var(--nav-h) + 1rem); }
section[id], footer [id] { scroll-margin-top: calc(var(--nav-h) + 1rem); }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 1000;
  background: var(--c-btn); color: var(--c-btn-text); padding: 0.6rem 1rem; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; border-radius: 4px; }

/* ---- Boutons ---------------------------------------------------------- */
.btn {
  display: inline-block; text-decoration: none; font-weight: 600;
  padding: 0.7rem 1.3rem; border-radius: var(--radius-sm);
  border: 1.5px solid transparent; cursor: pointer;
  transition: transform var(--transition), background var(--transition), border-color var(--transition);
}
.btn:hover { transform: translateY(-1px); }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.95rem; }
.btn-primary { background: var(--c-btn); color: var(--c-btn-text); }
.btn-primary:hover { background: var(--c-btn-hover); }
.btn-ghost { background: transparent; color: var(--c-text); border-color: var(--c-border); }
.btn-ghost:hover { border-color: var(--c-accent); color: var(--c-accent-strong); }

/* ---- Badge App Store (auto-hébergé — SD-E10) -------------------------- */
.app-store-link { display: inline-flex; align-items: center; text-decoration: none; }
.app-store-badge { display: block; height: 47px; width: auto; border-radius: 8px; }
.app-store-disabled { flex-direction: column; align-items: flex-start; gap: 0.35rem; opacity: 0.75; cursor: not-allowed; }
.app-store-disabled .app-store-badge { filter: grayscale(0.3); }
.app-store-soon { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--c-muted); }

/* ---- En-tête / navigation --------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--c-bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--c-border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: var(--nav-h); }

.brand { display: inline-flex; align-items: center; gap: 0.5rem; text-decoration: none; color: var(--c-text); font-weight: 800; letter-spacing: 0.02em; }

/* Marque = l'icône de l'application iOS (theme/assets/logo-forest-assist.png, 192 px).
   ⚠️ Les attributs `width`/`height` du HTML portent la taille d'AFFICHAGE, jamais la taille
   du fichier : si la feuille de style manque ou arrive d'un cache périmé, le logo reste à sa
   taille au lieu de s'afficher à 192 px et de faire exploser l'en-tête (constaté le
   2026-09-11). La règle CSS et les attributs disent donc la même chose.
   En-tête : 4 rem (64 px), soit le tiers des 192 px. `.header-inner` ayant `min-height: 4rem`,
   le logo tient pile dans la barre : elle ne grandit pas, et le panneau de navigation mobile
   — positionné à `inset: var(--nav-h) …` — reste aligné sur son bord bas.
   Pied de page : 1,75 rem (28 px), la marque y accompagne une simple ligne de texte.
   L'image est servie à 192 px dans les deux cas : nette sur Retina, un seul fichier. */
.brand-mark { border-radius: 22%; display: block; flex: none; }
.brand .brand-mark { width: 4rem; height: 4rem; }
.footer-brand .brand-mark { width: 1.75rem; height: 1.75rem; display: inline-block; vertical-align: -0.45rem; }
.brand-name { font-size: 1.15rem; }

.nav-toggle {
  display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
  width: 44px; height: 44px; padding: 10px; background: none; border: 1px solid var(--c-border);
  border-radius: var(--radius-sm); cursor: pointer;
}
.nav-toggle-bar { display: block; height: 2px; width: 100%; background: var(--c-text); transition: transform var(--transition), opacity var(--transition); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.primary-nav { position: absolute; inset: var(--nav-h) 0 auto 0; background: var(--c-bg); border-bottom: 1px solid var(--c-border); max-height: 0; overflow: hidden; transition: max-height var(--transition); }
.primary-nav.open { max-height: 26rem; }
.primary-nav ul { list-style: none; margin: 0; padding: 0.5rem clamp(1rem, 4vw, 2.5rem) 1rem; display: flex; flex-direction: column; gap: 0.25rem; }
.primary-nav a { display: block; padding: 0.7rem 0.25rem; text-decoration: none; color: var(--c-text); font-weight: 600; border-radius: var(--radius-sm); }
.primary-nav a:hover { color: var(--c-accent-strong); }
.nav-cta { margin-top: 0.5rem; text-align: center; }

/* Sélecteur de langue (SD-E13) — liste déroulante (drapeau + autonyme) */
.lang-switch { display: flex; align-items: center; padding: 0.5rem 0.25rem; }
.lang-select { font: inherit; font-size: 0.9rem; font-weight: 600; color: var(--c-text); background: var(--c-bg); border: 1px solid var(--c-border); border-radius: var(--radius-sm); padding: 0.35rem 0.5rem; cursor: pointer; }
.lang-select:hover { border-color: var(--c-accent-strong); }
.lang-select:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }

/* Nav horizontale sur tablette / desktop */
@media (min-width: 48rem) {
  .nav-toggle { display: none; }
  .primary-nav { position: static; max-height: none; overflow: visible; background: none; border: 0; }
  .primary-nav ul { flex-direction: row; align-items: center; gap: 0.25rem 1.5rem; padding: 0; }
  .primary-nav a { padding: 0.4rem 0.25rem; }
  .nav-cta { margin-top: 0; }
  .lang-switch { padding: 0.4rem 0; border-left: 1px solid var(--c-border); padding-left: 1.25rem; }
}

/* ---- Hero ------------------------------------------------------------- */
.hero {
  padding: clamp(3rem, 8vw, 6.5rem) 0 clamp(2.5rem, 6vw, 5rem);
  background:
    radial-gradient(120% 90% at 80% -10%, color-mix(in srgb, var(--c-accent) 22%, transparent), transparent 60%),
    linear-gradient(180deg, var(--c-surface), var(--c-bg));
  border-bottom: 1px solid var(--c-border);
}
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.8rem; font-weight: 700; color: var(--c-accent-strong); margin: 0 0 0.75rem; }
.hero .lead { font-size: clamp(1.05rem, 1rem + 0.6vw, 1.35rem); color: var(--c-muted); max-width: 42rem; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; margin-top: 1.75rem; }

/* ---- Sections --------------------------------------------------------- */
.section { padding: clamp(3rem, 7vw, 5.5rem) 0; }
.section-alt { background: var(--c-surface); border-block: 1px solid var(--c-border); }
.section-head { max-width: 46rem; margin-bottom: clamp(1.5rem, 4vw, 2.5rem); }
.section-intro { color: var(--c-muted); font-size: 1.05rem; margin: 0; }

/* ---- Cartes ----------------------------------------------------------- */
.cards { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 40rem) { .cards-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 64rem) { .cards-3 { grid-template-columns: repeat(3, 1fr); } }

.card {
  background: var(--c-bg); border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: 0 1px 2px var(--c-shadow);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px var(--c-shadow); border-color: color-mix(in srgb, var(--c-accent) 40%, var(--c-border)); }
.card-icon { font-size: 1.8rem; margin-bottom: 0.6rem; }
.card p { margin: 0; color: var(--c-muted); }
.card p strong { color: var(--c-text); }

.card-guide h3 { color: var(--c-accent-strong); }

/* Carte de guide entièrement cliquable (« stretched link ») : le lien vit dans le
   titre — nom accessible court et exact — et son ::after recouvre la carte. Toute
   la surface est donc cliquable, sans imbriquer de lien ni noyer le lecteur d'écran
   sous le texte complet de la carte. Spécification : specs/SD-E02-Arborescence-sections.md. */
.card-link { position: relative; cursor: pointer; }
.card-link h3 a { color: inherit; text-decoration: none; }
.card-link h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.card-link:hover h3 a, .card-link:focus-within h3 a { text-decoration: underline; }
.card-link:focus-within { outline: 2px solid var(--c-accent); outline-offset: 3px; }
.card-link h3 a:focus-visible { outline: none; }
.card-go { margin: 0; font-weight: 600; color: var(--c-accent-strong); }
.card-go::after { content: " \2192"; }
.card-guide p { margin-bottom: 1rem; }
.card-guide p:last-child { margin-bottom: 0; }

/* ---- Confidentialité -------------------------------------------------- */
.trust-grid { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 40rem) { .trust-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 64rem) { .trust-grid { grid-template-columns: repeat(3, 1fr); } }
.trust-item { padding-left: 1rem; border-left: 3px solid var(--c-accent); }
.trust-item h3 { color: var(--c-text); }
.trust-item p { margin: 0; color: var(--c-muted); }

/* ---- Télécharger ------------------------------------------------------ */
.download { text-align: center; max-width: 44rem; }
.download-text { color: var(--c-muted); font-size: 1.05rem; }
.download-actions { display: flex; justify-content: center; margin-top: 1.5rem; }

/* ---- À propos & contact ----------------------------------------------- */
.about-contact { display: grid; gap: var(--gap); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 56rem) { .about-contact { grid-template-columns: 1.4fr 1fr; } }
.about p { color: var(--c-muted); }
.about p strong { color: var(--c-text); }
.contact-card {
  background: var(--c-bg); border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: 1.75rem; box-shadow: 0 8px 30px var(--c-shadow); position: sticky; top: calc(var(--nav-h) + 1rem);
}
.contact-card h3 { color: var(--c-accent-strong); }
.contact-card .btn { margin-top: 0.5rem; }

/* ---- Pied de page ----------------------------------------------------- */
.site-footer { background: var(--c-surface-2); border-top: 1px solid var(--c-border); padding: clamp(2rem, 5vw, 3rem) 0 2rem; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; align-items: start; }
.footer-brand { font-weight: 800; }
.footer-tagline { font-weight: 400; color: var(--c-muted); margin: 0.35rem 0 0; font-size: 0.95rem; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.footer-nav a { text-decoration: none; color: var(--c-muted); font-weight: 600; }
.footer-nav a:hover { color: var(--c-accent-strong); }
.footer-lang { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; font-size: 0.9rem; }
.footer-lang a { text-decoration: none; color: var(--c-muted); }
.footer-lang a:hover { color: var(--c-accent-strong); }
.footer-lang [aria-current] { color: var(--c-text); font-weight: 600; }

.legal { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--c-border); color: var(--c-muted); font-size: 0.9rem; }
.legal-title { font-size: 1rem; color: var(--c-text); margin-bottom: 0.5rem; }
.legal p { margin: 0 0 0.5rem; }
.copyright { margin-top: 0.5rem; }

/* ---- Pages annexes (gabarit « page », générées du vault) --------------- */
.page { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.breadcrumb { color: var(--c-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }
.breadcrumb a { color: var(--c-accent-strong); text-decoration: none; }
.breadcrumb.retour { margin-top: 2.5rem; margin-bottom: 0; }
.prose { max-width: 46rem; }
.prose h2 { margin-top: 2rem; }
.prose ul, .prose ol { padding-left: 1.2rem; color: var(--c-muted); }
.prose li { margin-bottom: 0.4rem; }
.prose li > ul, .prose li > ol { margin-top: 0.4rem; }
.prose img { max-width: 100%; height: auto; border-radius: var(--radius); }

/* ---- Éléments Markdown Obsidian (générés par tools/build_site.py) ------ */
mark { background: color-mix(in srgb, var(--c-accent) 25%, transparent); color: inherit; padding: 0 0.15em; border-radius: 3px; }
del { color: var(--c-muted); }
.task { color: var(--c-accent-strong); }

code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; background: var(--c-surface-2); padding: 0.1em 0.35em; border-radius: 4px; }
pre { background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: var(--radius-sm); padding: 1rem; overflow-x: auto; margin: 0 0 1rem; }
pre code { background: none; padding: 0; font-size: 0.85rem; }

blockquote { margin: 0 0 1rem; padding: 0.25rem 1rem; border-left: 3px solid var(--c-border); color: var(--c-muted); }
blockquote p:last-child { margin-bottom: 0; }

.callout { margin: 0 0 1rem; padding: 0.9rem 1.1rem; border-left: 3px solid var(--c-accent); border-radius: var(--radius-sm); background: var(--c-surface); }
.callout p:last-child, .callout ul:last-child, .callout ol:last-child { margin-bottom: 0; }
.callout-title { font-weight: 700; margin-bottom: 0.35rem; color: var(--c-accent-strong); }
/* Titres des callouts d'état : couleur d'état rabattue de 15 % vers le texte — stateWarning seul
   (4,2:1 sur section claire) passe sous le seuil AA ; le mélange ramène les trois au-dessus. */
.callout-warning { border-left-color: var(--c-warning); }
.callout-warning .callout-title { color: color-mix(in srgb, var(--c-warning) 85%, var(--c-text)); }
.callout-danger { border-left-color: var(--c-danger); }
.callout-danger .callout-title { color: color-mix(in srgb, var(--c-danger) 85%, var(--c-text)); }
.callout-success { border-left-color: var(--c-success); }
.callout-success .callout-title { color: color-mix(in srgb, var(--c-success) 85%, var(--c-text)); }

.table-wrap { overflow-x: auto; margin: 0 0 1rem; }
.table-wrap table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
.table-wrap th, .table-wrap td { border: 1px solid var(--c-border); padding: 0.5rem 0.75rem; text-align: left; }
.table-wrap th { background: var(--c-surface); }
.table-wrap tbody tr:nth-child(even) { background: color-mix(in srgb, var(--c-surface) 55%, transparent); }

/* ---- Écrans de l'application (callout `> [!ecran]`) --------------------
   Un bloc « écran » présente une ou plusieurs captures de l'app sous une
   légende commune. Sans image, un cadre d'attente réserve l'emplacement :
   la page reste complète et l'on voit ce qu'il reste à photographier.
   Le cadre reproduit la proportion d'un iPhone (9/19,5) pour que le texte
   ne se réagence pas quand la capture réelle arrive.
   Spécification : specs/SD-E11-Guides-videos.md. */
.screens { margin: 1.75rem 0; }
.screens-row { display: flex; flex-wrap: wrap; gap: var(--gap); justify-content: center; align-items: flex-start; }
.screen { display: block; flex: 0 1 15rem; max-width: 15rem; }
.screen img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--c-border); border-radius: 20px;
  box-shadow: 0 6px 24px var(--c-shadow); background: var(--c-surface);
}
.screens-caption {
  margin: 0.85rem auto 0; max-width: 34rem;
  font-size: 0.9rem; line-height: 1.5; color: var(--c-muted); text-align: center;
}
.screens-caption strong { color: var(--c-text); }
.screens > p { margin-top: 0.6rem; font-size: 0.95rem; }

/* Cadre d'attente : dimensions d'un écran d'iPhone, sans image */
.screen-todo {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 9 / 19.5; width: 15rem;
  border: 2px dashed var(--c-border); border-radius: 20px;
  background: repeating-linear-gradient(
    45deg, var(--c-surface), var(--c-surface) 10px,
    color-mix(in srgb, var(--c-surface-2) 60%, transparent) 10px,
    color-mix(in srgb, var(--c-surface-2) 60%, transparent) 20px);
}
.screen-todo-label {
  font-size: 0.85rem; font-weight: 600; color: var(--c-muted);
  text-align: center; padding: 0 1rem;
}

@media (max-width: 30rem) {
  .screen, .screen-todo { flex-basis: 100%; max-width: 13rem; width: 13rem; }
}

/* ---- Préférences de mouvement ----------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .btn:hover, .card:hover { transform: none; }
}
