/* ===================================================================
   Teram — feuille de style principale
   Design system : couleurs, typographie, layout, composants communs
   =================================================================== */

:root {
  --color-bg: #F8F7F4;
  --color-surface: #FFFFFF;
  --color-navy: #172B3A;
  --color-petrol: #0E6E78;
  --color-green: #4C7A5A;
  --color-ocre: #C8852E;
  --color-text: #1E2933;
  --color-text-muted: #4C5A63;
  --color-border: #E3DFD6;

  --font-system: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 3px rgba(23, 43, 58, 0.08);
  --shadow-md: 0 6px 20px rgba(23, 43, 58, 0.10);

  --container-width: 1180px;
}

/* ---------- Reset minimal ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-system);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  font-size: 16px;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--color-petrol); text-decoration-thickness: 1.5px; }
a:hover { color: var(--color-navy); }
h1, h2, h3, h4 { color: var(--color-navy); line-height: 1.25; margin-top: 0; }
p { margin-top: 0; }
ul, ol { padding-left: 1.3em; }
button { font-family: inherit; }

/* Respect des préférences de mouvement réduit */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-navy);
  color: #fff;
  padding: 0.75em 1.25em;
  z-index: 1000;
  border-radius: 0 0 var(--radius-md) 0;
}
.skip-link:focus {
  left: 0;
}

/* ---------- Focus visible ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--color-ocre);
  outline-offset: 2px;
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

main { display: block; }
main:focus { outline: none; }

/* ---------- Header / Navigation ---------- */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
  max-width: var(--container-width);
  margin: 0 auto;
  gap: 1rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--color-navy);
  text-decoration: none;
}
.brand:hover { color: var(--color-petrol); }
.brand svg { width: 32px; height: 32px; flex-shrink: 0; }

.nav-toggle {
  display: none;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  color: var(--color-navy);
  font-weight: 600;
}
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-open { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: inline; }

.main-nav ul {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 1.6rem;
  flex-wrap: wrap;
}
.main-nav a {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 600;
  padding: 0.4rem 0.1rem;
  border-bottom: 2px solid transparent;
}
.main-nav a:hover,
.main-nav a:focus-visible,
.main-nav a[aria-current="page"] {
  color: var(--color-petrol);
  border-bottom-color: var(--color-petrol);
}

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .main-nav {
    display: none;
    width: 100%;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
  }
  .main-nav.is-open { display: block; }
  .main-nav ul {
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 1.5rem 1rem;
  }
  .main-nav li { border-bottom: 1px solid var(--color-border); }
  .main-nav li:last-child { border-bottom: none; }
  .main-nav a { display: block; padding: 0.75rem 0.2rem; }
}

/* ---------- Fil d'Ariane ---------- */
.breadcrumb {
  padding: 0.9rem 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}
.breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
}
.breadcrumb li:not(:last-child)::after {
  content: "›";
  margin-left: 0.4rem;
  color: var(--color-border);
}
.breadcrumb a { color: var(--color-text-muted); text-decoration: underline; }
.breadcrumb [aria-current="page"] { color: var(--color-navy); font-weight: 600; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(180deg, #EFEAE0 0%, var(--color-bg) 100%);
  padding: 3.5rem 0;
  border-bottom: 1px solid var(--color-border);
}
.hero-inner { max-width: 760px; }
.hero .eyebrow {
  display: inline-block;
  color: var(--color-petrol);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
}
.hero h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); margin-bottom: 1rem; }
.hero p.lead { font-size: 1.15rem; color: var(--color-text-muted); margin-bottom: 1.8rem; }
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }

.page-hero {
  background: var(--color-navy);
  color: #fff;
  padding: 2.6rem 0;
}
.page-hero h1 { color: #fff; margin-bottom: 0.6rem; }
.page-hero p { color: #CBD8DE; max-width: 700px; margin: 0; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1.2;
}
.btn-primary { background: var(--color-petrol); color: #fff; }
.btn-primary:hover { background: #0A5A63; color: #fff; }
.btn-secondary { background: transparent; border-color: var(--color-navy); color: var(--color-navy); }
.btn-secondary:hover { background: var(--color-navy); color: #fff; }
.btn-ocre { background: #9E641A; color: #fff; }
.btn-ocre:hover { background: #8A5817; color: #fff; }
.btn-ghost { background: transparent; color: var(--color-petrol); border-color: var(--color-border); }
.btn-ghost:hover { border-color: var(--color-petrol); }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.9rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- Sections ---------- */
section { padding: 3rem 0; }
.section-head { max-width: 680px; margin: 0 auto 2.2rem; text-align: center; }
.section-head h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
.section-head p { color: var(--color-text-muted); }
.bg-surface { background: var(--color-surface); }
.bg-navy { background: var(--color-navy); color: #fff; }
.bg-navy h2, .bg-navy h3 { color: #fff; }

/* ---------- Grilles / Cartes ---------- */
.grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 980px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid-4 { grid-template-columns: 1fr; } }

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.card-link {
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.card-link:hover, .card-link:focus-visible {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: #E7F1F1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-petrol);
}
.card-icon svg { width: 24px; height: 24px; }
.card h3 { font-size: 1.15rem; margin-bottom: 0.2rem; }
.card p { color: var(--color-text-muted); margin: 0; font-size: 0.96rem; }
.card .tag {
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: #EFEAE0;
  color: var(--color-navy);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

/* Univers (accueil) */
.universe-card { border-top: 4px solid var(--color-petrol); }
.universe-card.c-simu { border-top-color: var(--color-petrol); }
.universe-card.c-check { border-top-color: var(--color-green); }
.universe-card.c-docs { border-top-color: var(--color-ocre); }
.universe-card.c-guides { border-top-color: var(--color-navy); }
.universe-card.c-web { border-top-color: #6B5CA5; }
.universe-card.c-atlas { border-top-color: #A5473F; }

/* ---------- Listes "pourquoi" ---------- */
.reasons-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 1.4rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.reasons-list li { display: flex; gap: 0.9rem; align-items: flex-start; }
.reasons-list .r-icon {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--color-navy);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.reasons-list .r-icon svg { width: 20px; height: 20px; }
.reasons-list strong { display: block; color: var(--color-navy); margin-bottom: 0.15rem; }

/* ---------- Bloc confidentialité ---------- */
.privacy-banner {
  background: #EAF3F1;
  border: 1px solid #CFE3DE;
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.8rem;
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
}
.privacy-banner svg { flex-shrink: 0; width: 32px; height: 32px; color: var(--color-green); }
.privacy-banner h3 { margin-bottom: 0.3rem; }
.privacy-banner p { margin: 0; color: var(--color-text-muted); }

/* ---------- Avertissement contenu informatif ---------- */
.notice {
  border-left: 4px solid var(--color-ocre);
  background: #FBF3E7;
  padding: 1rem 1.2rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 0.94rem;
  color: var(--color-text);
}
.notice strong { color: var(--color-navy); }

/* ---------- CTA bandeau ---------- */
.cta-band {
  background: var(--color-navy);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 2.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.cta-band h2 { color: #fff; margin-bottom: 0.4rem; }
.cta-band p { color: #CBD8DE; margin: 0; }

/* ---------- Formulaires ---------- */
.field { margin-bottom: 1.2rem; }
.field label { display: block; font-weight: 600; margin-bottom: 0.35rem; color: var(--color-navy); }
.field .hint { font-size: 0.85rem; color: var(--color-text-muted); margin-top: 0.3rem; }
.field input[type="text"],
.field input[type="email"],
.field input[type="number"],
.field input[type="tel"],
.field select,
.field textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: #fff;
  font-size: 1rem;
  color: var(--color-text);
  font-family: inherit;
}
.field textarea { resize: vertical; min-height: 120px; }
fieldset { border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 1rem 1.2rem; margin: 0 0 1.2rem; }
legend { font-weight: 700; color: var(--color-navy); padding: 0 0.4rem; }

/* ---------- Tableaux ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--color-border); }
th { color: var(--color-navy); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-navy);
  color: #CBD8DE;
  margin-top: 3rem;
  padding: 3rem 0 1.5rem;
}
.footer-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: 2fr 1fr 1fr 1fr;
}
@media (max-width: 780px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer h2, .site-footer h3 { color: #fff; }
.site-footer .footer-brand { font-weight: 700; font-size: 1.2rem; color: #fff; margin-bottom: 0.6rem; display: flex; align-items: center; gap: 0.5rem; }
.site-footer .footer-brand svg { width: 26px; height: 26px; }
.site-footer p { color: #A9BAC3; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 0.5rem; }
.site-footer a { color: #CBD8DE; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.12);
  margin-top: 2.2rem;
  padding-top: 1.2rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: #93A5AF;
}

/* ---------- Retour en haut ---------- */
.back-to-top {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  background: var(--color-navy);
  color: #fff;
  border: none;
  border-radius: 999px;
  width: 46px;
  height: 46px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  z-index: 90;
}
.back-to-top.is-visible { display: flex; }
.back-to-top svg { width: 20px; height: 20px; }

/* ---------- Utilitaires ---------- */
.text-muted { color: var(--color-text-muted); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.center { text-align: center; }
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0; padding: 0; margin: -1px;
}
.stack { display: flex; flex-direction: column; gap: 1rem; }
.badge-soon {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: #F1E4C9;
  color: #8A5A16;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

/* ---------- Page "à venir" ---------- */
.coming-soon {
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  background: var(--color-surface);
  text-align: center;
}
.coming-soon svg { width: 40px; height: 40px; color: var(--color-ocre); margin: 0 auto 0.8rem; }

/* ---------- 404 ---------- */
.error-page { text-align: center; padding: 4rem 0; }
.error-page .error-code { font-size: 5rem; font-weight: 800; color: var(--color-petrol); margin: 0; }

/* ---------- Check-lists (Teram Check) ---------- */
.summary-nav {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.5rem;
  margin-bottom: 1.5rem;
}
.summary-nav-title {
  margin: 0 0 0.5rem;
  font-weight: 700;
  color: var(--color-navy);
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}
.summary-nav ol {
  columns: 2;
  column-gap: 2rem;
  margin: 0;
  padding-left: 1.2rem;
}
@media (max-width: 640px) { .summary-nav ol { columns: 1; } }
.summary-nav li { margin-bottom: 0.35rem; }
.summary-nav a { text-decoration: none; }
.summary-nav a:hover { text-decoration: underline; }

.checklist-toolbar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.6rem;
  margin-bottom: 2rem;
}
.storage-note {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--color-text-muted);
  margin: 0 0 1rem;
}
.storage-note svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--color-green); }

.progress-wrap { margin-bottom: 1.1rem; }
.progress-track {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--color-petrol);
  width: 0%;
  transition: width 0.25s ease;
}
@media (prefers-reduced-motion: reduce) { .progress-fill { transition: none; } }
.progress-text {
  margin: 0.5rem 0 0;
  font-weight: 700;
  color: var(--color-navy);
}

.checklist-actions {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.checklist { display: flex; flex-direction: column; gap: 1.6rem; margin-bottom: 2rem; }
.check-category {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-petrol);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.7rem;
  scroll-margin-top: 5.5rem;
}
.check-category.is-complete { border-left-color: var(--color-green); background: #F3F8F5; }
.check-category h2 {
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.cat-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-green);
  background: #E1EFE5;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
}
.cat-badge:empty { display: none; }

.check-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.4rem 0.3rem;
  border-radius: var(--radius-md);
}
.check-item:hover { background: var(--color-bg); }
.check-item input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.2rem;
  flex-shrink: 0;
  accent-color: var(--color-petrol);
}
.check-item label { cursor: pointer; }
.check-item input:checked + label { color: var(--color-text-muted); text-decoration: line-through; }

.notes-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.8rem;
  margin-bottom: 2rem;
}
.notes-textarea {
  width: 100%;
  min-height: 140px;
  padding: 0.8rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1rem;
  color: var(--color-text);
  resize: vertical;
}
.notes-print-view { display: none; }

/* ---------- Teram Atlas : carte schématique interactive ---------- */
.atlas-map-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
}
.atlas-map-wrap svg {
  width: 100%;
  height: auto;
  display: block;
}
.atlas-map-caption {
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: 0.8rem 0 0;
}

.map-zone { cursor: pointer; }
.map-zone rect,
.map-zone polygon,
.map-zone path.zone-shape {
  stroke-dasharray: 6 4;
  stroke-width: 2;
  transition: fill 0.15s ease, stroke 0.15s ease;
}
@media (prefers-reduced-motion: reduce) {
  .map-zone rect, .map-zone polygon, .map-zone path.zone-shape { transition: none; }
}
.map-zone:hover rect,
.map-zone:hover polygon,
.map-zone:hover path.zone-shape {
  filter: brightness(0.96);
}
.map-zone:focus-visible {
  outline: none;
}
.map-zone:focus-visible rect,
.map-zone:focus-visible polygon,
.map-zone:focus-visible path.zone-shape {
  stroke: var(--color-ocre);
  stroke-width: 3.5;
}
.map-zone.is-active rect,
.map-zone.is-active polygon,
.map-zone.is-active path.zone-shape {
  stroke: var(--color-navy);
  stroke-width: 3;
  stroke-dasharray: none;
}
.map-zone text {
  font-family: var(--font-system);
  font-size: 13px;
  fill: var(--color-navy);
  pointer-events: none;
  user-select: none;
}

.map-info-panel {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.3rem 1.5rem;
  background: var(--color-surface);
  margin-top: 1.2rem;
  min-height: 84px;
}
.map-info-panel .map-info-empty { color: var(--color-text-muted); margin: 0; }
.map-info-panel.has-content .map-info-empty { display: none; }
.map-info-panel #map-info-title { margin-bottom: 0.4rem; font-size: 1.1rem; }
.map-info-panel #map-info-text { margin: 0; }

/* ---------- Teram Atlas : chronologie simplifiée ---------- */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 1.4rem;
  border-left: 3px solid var(--color-border);
}
.timeline li {
  position: relative;
  padding-bottom: 1.4rem;
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -1.86rem;
  top: 0.3rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-petrol);
  border: 2px solid var(--color-surface);
}
.timeline-date {
  display: block;
  font-weight: 700;
  color: var(--color-navy);
  margin-bottom: 0.15rem;
}

/* ---------- Teram Atlas : sources à compléter ---------- */
.source-todo {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  color: #8A5A16;
  background: #FBF3E7;
  border: 1px solid #EBD6AE;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  margin-left: 0.4rem;
  white-space: nowrap;
}
