/* =====================================================================
   Le Monde de Cathy — refonte contemporaine
   Design system: éditorial "nature / Pays basque"
   ===================================================================== */

/* ---------- Design tokens ---------- */
:root {
  /* Palette */
  --paper:        #faf7f1;   /* fond crème */
  --paper-2:      #f1ece1;   /* fond alterné */
  --card:         #ffffff;
  --ink:          #211d17;   /* texte principal */
  --ink-soft:     #574f44;   /* texte secondaire */
  --ink-faint:    #8a8073;
  --line:         #e4ddcf;   /* bordures */
  --forest:       #3f5d46;   /* accent principal (vert) */
  --forest-deep:  #2c4231;
  --forest-soft:  #eef2ec;
  --terra:        #b5562f;   /* accent chaud (liens/CTA) */
  --terra-deep:   #8f3f1f;

  /* Typo */
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans:  "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Mesures */
  --measure: 76ch;
  --container: 1180px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow: 0 1px 2px rgba(33,29,23,.05), 0 12px 30px -12px rgba(33,29,23,.18);
  --shadow-soft: 0 1px 2px rgba(33,29,23,.04), 0 6px 18px -10px rgba(33,29,23,.14);
  --ease: cubic-bezier(.22,.61,.36,1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.65;
  font-size: clamp(1rem, .96rem + .25vw, 1.12rem);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, picture, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--terra); text-decoration: none; }
a:hover { color: var(--terra-deep); }
:focus-visible { outline: 3px solid var(--forest); outline-offset: 3px; border-radius: 4px; }

/* ---------- Layout helpers ---------- */
.container { width: min(100% - 2.5rem, var(--container)); margin-inline: auto; }
.prose { width: min(100% - 2.5rem, var(--measure)); margin-inline: auto; }
.section { padding-block: clamp(3rem, 7vw, 6rem); }
.section--alt { background: var(--paper-2); }
.eyebrow {
  font: 600 .78rem/1 var(--sans);
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--terra); margin-bottom: .9rem;
}
.h-serif { font-family: var(--serif); font-weight: 500; line-height: 1.08; letter-spacing: -.01em; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding-block: .85rem;
}
.brand { display: flex; align-items: baseline; gap: .55rem; }
.brand a { color: var(--ink); }
.brand .mark { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; letter-spacing: -.01em; }
.brand .sub { font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-faint); }
.nav-links { display: flex; align-items: center; gap: .35rem; list-style: none; }
.nav-links a {
  display: inline-block; padding: .5rem .8rem; border-radius: 999px;
  color: var(--ink-soft); font-weight: 500; font-size: .98rem;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.nav-links a:hover { background: var(--forest-soft); color: var(--forest-deep); }
.nav-links a[aria-current="page"] { background: var(--forest); color: #fff; }
.nav-toggle {
  display: none; border: 1px solid var(--line); background: var(--card);
  width: 44px; height: 44px; border-radius: 12px; cursor: pointer; align-items: center; justify-content: center;
}
.nav-toggle svg { width: 22px; height: 22px; stroke: var(--ink); }

@media (max-width: 820px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: fixed; inset: 0 0 0 auto; width: min(78vw, 320px);
    flex-direction: column; align-items: stretch; gap: .25rem;
    background: var(--paper); padding: 5rem 1.1rem 2rem; box-shadow: var(--shadow);
    transform: translateX(100%); transition: transform .32s var(--ease); border-left: 1px solid var(--line);
  }
  .nav-links a { padding: .8rem 1rem; border-radius: 12px; font-size: 1.05rem; }
  body.nav-open .nav-links { transform: translateX(0); }
  body.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
  .nav-scrim {
    position: fixed; inset: 0; background: rgba(20,17,13,.4); z-index: 40;
    opacity: 0; pointer-events: none; transition: opacity .3s var(--ease); border: 0;
  }
}

/* ---------- Hero ---------- */
.hero { position: relative; isolation: isolate; color: #fff; }
.hero-media { position: absolute; inset: 0; z-index: -2; overflow: hidden; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; }
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(20,28,20,.35) 0%, rgba(20,28,20,.55) 60%, rgba(20,28,20,.72) 100%);
}
.hero-inner { padding-block: clamp(5rem, 16vw, 9rem); }
.hero h1 {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(2.6rem, 1.6rem + 4.6vw, 5rem); line-height: 1.02; letter-spacing: -.02em;
  max-width: 16ch; text-shadow: 0 2px 30px rgba(0,0,0,.3);
}
.hero p.lead { margin-top: 1.2rem; max-width: 46ch; font-size: clamp(1.05rem, 1rem + .5vw, 1.3rem); color: rgba(255,255,255,.92); }
.hero .eyebrow { color: #f4c9a8; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .8rem 1.35rem; border-radius: 999px; font-weight: 600; font-size: 1rem;
  background: var(--terra); color: #fff; border: 1px solid transparent;
  transition: transform .15s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease);
  box-shadow: var(--shadow-soft);
}
.btn:hover { background: var(--terra-deep); color: #fff; transform: translateY(-1px); }
.btn--ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.55); box-shadow: none; }
.btn--ghost:hover { background: rgba(255,255,255,.12); color: #fff; }
.btn--ink { background: var(--forest); }
.btn--ink:hover { background: var(--forest-deep); }
.btn-row { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.8rem; }

/* ---------- Section headings ---------- */
.section-head { max-width: 60ch; margin-bottom: clamp(1.8rem, 4vw, 2.8rem); }
.section-head h2 { font-family: var(--serif); font-weight: 500; font-size: clamp(1.9rem, 1.3rem + 2.4vw, 3rem); line-height: 1.06; }
.section-head p { margin-top: .8rem; color: var(--ink-soft); font-size: 1.1rem; }

/* ---------- Card grid (sections, années, récits) ---------- */
.grid { display: grid; gap: clamp(1rem, 2.4vw, 1.6rem); }
.grid--cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); }
.grid--feature { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }

.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-soft);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--forest) 30%, var(--line)); }
.card-media { aspect-ratio: 16/10; overflow: hidden; background: var(--paper-2); }
.card-media--empty {
  background:
    radial-gradient(120% 120% at 80% 0%, #5a7d5a 0%, transparent 55%),
    linear-gradient(135deg, var(--forest) 0%, var(--forest-deep) 100%);
  position: relative;
}
.card-media--empty::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.18) 1px, transparent 1.4px);
  background-size: 14px 14px; opacity: .5;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.card:hover .card-media img { transform: scale(1.05); }
.card-body { padding: 1.1rem 1.2rem 1.3rem; display: flex; flex-direction: column; gap: .4rem; flex: 1; }
.card-kicker { font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; color: var(--terra); font-weight: 600; }
.card h3 { font-family: var(--serif); font-weight: 500; font-size: 1.3rem; line-height: 1.15; color: var(--ink); }
.card p { color: var(--ink-soft); font-size: .98rem; }
.card .stretched { position: absolute; inset: 0; }
.card .meta { margin-top: auto; padding-top: .5rem; color: var(--ink-faint); font-size: .85rem; }

/* Simple link list (poèmes, divers) */
.linklist { list-style: none; display: grid; gap: .2rem; }
.linklist a {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .9rem 1.1rem; border-radius: 12px; background: var(--card);
  border: 1px solid var(--line); color: var(--ink); font-weight: 500;
  transition: background .2s var(--ease), border-color .2s var(--ease), transform .15s var(--ease);
}
.linklist a:hover { background: var(--forest-soft); border-color: color-mix(in srgb,var(--forest) 30%, var(--line)); transform: translateX(2px); }
.linklist a span.arrow { color: var(--terra); }

/* Chips (filtres années) */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 2rem; }
.chip {
  padding: .45rem .9rem; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink-soft); font-size: .9rem; font-weight: 600; cursor: pointer;
}
.chip:hover { border-color: var(--forest); color: var(--forest-deep); }

/* ---------- Article / récit ---------- */
.article-header { padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(1.5rem, 3vw, 2.5rem); }
.article-header .eyebrow { justify-content: center; }
.article-title { font-family: var(--serif); font-weight: 500; font-size: clamp(2rem, 1.4rem + 3vw, 3.4rem); line-height: 1.07; letter-spacing: -.015em; }
.article-meta { margin-top: 1rem; color: var(--ink-faint); font-size: .95rem; }
.lede { font-size: 1.2rem; color: var(--ink-soft); font-style: italic; }

.article-body { font-size: clamp(1.05rem, 1rem + .35vw, 1.2rem); }
.article-body > * + * { margin-top: 1.3em; }
.article-body p { line-height: 1.8; text-align: justify; text-justify: inter-word; hyphens: auto; }
.article-body ul { list-style: disc; padding-left: 1.5em; }
.article-body ol { list-style: decimal; padding-left: 1.6em; }
.article-body li { text-align: justify; hyphens: auto; line-height: 1.8; }
.article-body li + li { margin-top: .35em; }
.article-body li > ul, .article-body li > ol { margin-top: .35em; }
.article-body h2 { font-family: var(--serif); font-weight: 600; font-size: 1.7rem; margin-top: 2.2em; }
.article-body h3 { font-family: var(--serif); font-weight: 600; font-size: 1.35rem; margin-top: 1.8em; }
.article-body img { border-radius: var(--radius); box-shadow: var(--shadow-soft); margin-inline: auto; }
.article-body figure { margin-block: 2rem; }
.article-body figure img { width: 100%; }
.article-body figcaption { margin-top: .6rem; text-align: center; color: var(--ink-faint); font-size: .9rem; font-style: italic; }
.article-body blockquote {
  border-left: 3px solid var(--forest); padding-left: 1.2rem; color: var(--ink-soft); font-style: italic;
}
.article-body a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--terra) 40%, transparent); }

/* Image gallery within a récit */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: .8rem; margin-block: 2rem; }
.gallery a { display: block; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-soft); }
.gallery img { aspect-ratio: 4/3; object-fit: cover; width: 100%; transition: transform .4s var(--ease); }
.gallery a:hover img { transform: scale(1.06); }

/* Floated images for récit text flow */
.article-body img.float-r { float: right; max-width: min(46%, 360px); margin: .3rem 0 1rem 1.5rem; }
.article-body img.float-l { float: left;  max-width: min(46%, 360px); margin: .3rem 1.5rem 1rem 0; }
@media (max-width: 620px) { .article-body img.float-r, .article-body img.float-l { float: none; max-width: 100%; margin-inline: auto; } }

/* ---------- Série de voyage (navigation inter-épisodes) ---------- */
.series {
  background: var(--forest-soft); border: 1px solid color-mix(in srgb, var(--forest) 18%, var(--line));
  border-radius: var(--radius); padding: 1rem 1.2rem; margin: 0 0 2rem;
  text-align: left;
}
.series-title { font: 600 .78rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--forest-deep); margin-bottom: .6rem; }
.series-list { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; counter-reset: step; padding: 0; }
.series-list li { margin: 0; }
.series-list a, .series-list span {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .35rem .75rem; border-radius: 999px; font-size: .9rem; font-weight: 500;
  background: var(--card); border: 1px solid var(--line); color: var(--ink-soft); text-decoration: none;
}
.series-list a:hover { border-color: var(--forest); color: var(--forest-deep); }
.series-list span[aria-current] { background: var(--forest); color: #fff; border-color: var(--forest); }

/* ---------- Pager / back ---------- */
.subnav { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-block: 2.5rem 0; }
.back-link { display: inline-flex; align-items: center; gap: .4rem; color: var(--forest-deep); font-weight: 600; }
.back-link:hover { color: var(--terra-deep); }

/* ---------- Fil d'Ariane (breadcrumb) ---------- */
.breadcrumb {
  display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .55rem;
  margin-block: 1.25rem .5rem;
  font-size: .84rem; color: var(--ink-faint);
}
.breadcrumb a { color: var(--ink-soft); font-weight: 600; }
.breadcrumb a:hover { color: var(--terra-deep); }
.breadcrumb > :not(:first-child)::before {
  content: "›"; margin-right: .55rem; color: var(--ink-faint); font-weight: 400;
}
.breadcrumb [aria-current="page"] { color: var(--ink-faint); font-weight: 600; }

/* ---------- Footer ---------- */
.site-footer { background: var(--forest-deep); color: #e8efe6; padding-block: clamp(2.5rem, 6vw, 4rem); margin-top: clamp(3rem, 8vw, 6rem); }
.site-footer a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.footer-grid { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.site-footer h4 { font-family: var(--serif); font-weight: 500; font-size: 1.2rem; margin-bottom: .6rem; }
.site-footer ul { list-style: none; display: grid; gap: .35rem; }
.site-footer .muted { color: #b9c8b6; font-size: .9rem; }
.footer-bottom { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,.14); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; color: #b9c8b6; font-size: .88rem; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: none; place-items: center;
  background: rgba(15,13,10,.92); padding: 2rem; cursor: zoom-out;
}
.lightbox.open { display: grid; }
.lightbox img { max-width: 95vw; max-height: 90vh; width: auto; height: auto; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lightbox .lb-close { position: fixed; top: 1.2rem; right: 1.4rem; color: #fff; font-size: 2rem; background: none; border: 0; cursor: pointer; line-height: 1; }

/* ---------- Animation Flash (lecteur Ruffle) ---------- */
.flash-embed {
  position: relative;
  width: 100%;
  max-width: var(--sw, 900px);
  aspect-ratio: var(--ar, 4 / 3);
  margin: 2rem auto 1rem;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.flash-embed ruffle-player,
.flash-embed > * { width: 100%; height: 100%; }
/* Repli si Ruffle ne charge pas (pas de JS, WASM bloqué, réseau) */
.flash-embed .flash-fallback {
  position: absolute; inset: 0; display: none;
  place-items: center; text-align: center; padding: 1.5rem;
  color: #e8e4dc; background: var(--forest-deep); font-size: .95rem;
}
.flash-embed.flash-failed { aspect-ratio: auto; min-height: 8rem; }
.flash-embed.flash-failed ruffle-player { display: none; }
.flash-embed.flash-failed .flash-fallback { display: grid; position: static; }

/* ---------- Recherche (rubriques) ----------
   Barre de recherche des pages-rubriques (Récits, Voyages, Articles, Accueil).
   Les résultats s'affichent dans le flux, juste sous le champ : pas de menu
   flottant à positionner, rien qui puisse être rogné sur petit écran. */
.site-search { margin-bottom: clamp(1.6rem, 4vw, 2.4rem); }
.ss-label {
  display: block; margin-bottom: .5rem;
  font: 600 .78rem/1 var(--sans); letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-faint);
}
.ss-field {
  display: flex; align-items: center; gap: .6rem;
  max-width: 34rem; padding: .2rem .6rem .2rem .9rem;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; box-shadow: var(--shadow-soft);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.ss-field:focus-within { border-color: var(--forest); box-shadow: var(--shadow); }
.ss-icon { width: 20px; height: 20px; flex: none; stroke: var(--ink-faint); fill: none; }
.ss-input {
  flex: 1; min-width: 0; border: 0; background: none; outline: none;
  padding: .75rem 0; font: inherit; font-size: 1rem; color: var(--ink);
}
.ss-input::placeholder { color: var(--ink-faint); }
.ss-input::-webkit-search-cancel-button { display: none; }   /* on a notre bouton ✕ */
.ss-clear {
  flex: none; width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: none; color: var(--ink-faint); font-size: 1.35rem; line-height: 1;
  cursor: pointer;
}
.ss-clear:hover { background: var(--paper-2); color: var(--ink); }
.ss-status { margin-top: .6rem; color: var(--ink-faint); font-size: .9rem; }

.ss-results { display: grid; gap: .3rem; margin-top: 1rem; max-width: 46rem; }
.ss-group {
  margin-top: 1.2rem; font: 600 .78rem/1 var(--sans); letter-spacing: .14em;
  text-transform: uppercase; color: var(--terra);
}
.ss-group:first-child { margin-top: 0; }
.ss-hit {
  display: block; padding: .75rem 1rem; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line); color: var(--ink);
  transition: background .2s var(--ease), border-color .2s var(--ease), transform .15s var(--ease);
}
.ss-hit:hover, .ss-hit.is-active {
  background: var(--forest-soft); color: var(--ink);
  border-color: color-mix(in srgb, var(--forest) 32%, var(--line));
  transform: translateX(2px);
}
.ss-hit-t { display: block; font-family: var(--serif); font-size: 1.12rem; font-weight: 500; line-height: 1.25; }
.ss-hit-p { display: block; margin-top: .15rem; color: var(--ink-faint); font-size: .82rem; }
.ss-hit-x { display: block; margin-top: .3rem; color: var(--ink-soft); font-size: .9rem; }
.ss-hit mark { background: color-mix(in srgb, var(--terra) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 .1em; }

/* Pendant une recherche, les vignettes de la rubrique s'effacent : seuls les
   résultats restent à l'écran. Jamais en mode édition, où il faut pouvoir
   continuer à modifier la page. */
body.ss-searching:not(.cms-editing) main .grid,
body.ss-searching:not(.cms-editing) main .section-head ~ .section-head { display: none; }

/* ---------- Utilities ---------- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.divider { height: 1px; background: var(--line); border: 0; margin-block: clamp(2rem,5vw,3.5rem); }
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--ink); color: #fff; padding: .7rem 1rem; z-index: 200; border-radius: 0 0 8px 0; }
.skip-link:focus { left: 0; color: #fff; }
