/* Carte des États de Savoie — Cœur de Savoie. Dans la palette du site. */

/* ---- Hero ---- */
.carte-hero {
  position: relative;
  padding: 0;
  min-height: min(78vh, 700px);
  background: #15110f;
  color: var(--paper);
  overflow: hidden;
}
.carte-hero__bg {
  position: absolute;
  inset: 0;
  background: url("../img/carte/blaeu-sabaudia-1635.jpg") center 42% / cover no-repeat;
  filter: saturate(.85) contrast(1.05);
  transform: scale(1.04);
}
.carte-hero__scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(14, 10, 12, .92) 0%, rgba(14, 10, 12, .74) 40%, rgba(14, 10, 12, .22) 78%),
    linear-gradient(180deg, rgba(14, 10, 12, .2), rgba(14, 10, 12, .6));
}
.carte-hero .container {
  position: relative;
  z-index: 2;
  padding-top: clamp(48px, 8vh, 96px);
  padding-bottom: 64px;
  min-height: min(78vh, 700px);
  display: flex;
  align-items: center;
}
.carte-hero__copy { max-width: 40rem; }
.carte-hero .kicker { color: var(--gold-light); }
.carte-hero .kicker::before { background: var(--gold-light); }
.carte-hero h1 {
  color: var(--white);
  font-size: clamp(2.4rem, 5vw, 4.4rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  margin: 10px 0 16px;
}
.carte-hero .lead { color: rgba(250, 248, 246, .88); font-size: 1.08rem; max-width: 38rem; }
.carte-hero__credit {
  position: absolute;
  right: 16px;
  bottom: 10px;
  z-index: 2;
  margin: 0;
  max-width: 34rem;
  font-size: 11.5px;
  color: rgba(250, 248, 246, .62);
  text-align: right;
}

/* ---- Pastilles de légende (dans le texte) ---- */
.swatch {
  display: inline-block;
  width: 14px;
  height: 10px;
  margin: 0 5px 0 2px;
  border-radius: 2px;
  vertical-align: baseline;
  border: 1.5px solid;
}
.swatch--in { background: rgba(195, 20, 50, .45); border-color: #a3132b; }
.swatch--fr { background: rgba(45, 91, 184, .4); border-color: #1f3f8a; }
.swatch--occ { background: repeating-linear-gradient(45deg, #6b6b73 0 2px, transparent 2px 5px); border-color: #55555c; }
.swatch--unk { background: transparent; border: 1.5px dashed #7a6f60; }
.step a { color: var(--red-800); text-decoration: underline; text-underline-offset: 2px; }

/* ---- Application carte ---- */
.carte-app { display: grid; gap: 16px; }

.epoques-bar {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}
.epoques-nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  padding: 2px 2px 8px;
  flex: 1;
  min-width: 0;
}
.epoques-nav button {
  flex: 1 0 auto;
  min-width: 92px;
  display: grid;
  gap: 2px;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 12px;
  padding: 8px 12px 9px;
  scroll-snap-align: start;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.epoques-nav button b {
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.epoques-nav button span {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-mute);
  white-space: nowrap;
}
.epoques-nav button:hover { border-color: var(--red); }
.epoques-nav button[aria-selected="true"] {
  background: var(--red);
  border-color: var(--red);
  box-shadow: var(--shadow-md);
}
.epoques-nav button[aria-selected="true"] b,
.epoques-nav button[aria-selected="true"] span { color: var(--white); }
.epoques-nav button:focus-visible,
.epoques-step:focus-visible,
.carte-terr__list button:focus-visible,
.prov__focus:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.epoques-step {
  flex: 0 0 auto;
  width: 42px;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 12px;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
}
.epoques-step svg { width: 20px; height: 20px; }
.epoques-step:hover:not(:disabled) { border-color: var(--red); color: var(--red-700); }
.epoques-step:disabled { opacity: .35; cursor: default; }

.carte-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr);
  gap: 18px;
  align-items: start;
}
.carte-map-wrap { min-width: 0; }
.carte-map {
  height: clamp(440px, 70vh, 660px);
  border-radius: 16px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #e9e4da;
  box-shadow: var(--shadow-sm);
}
.carte-map:focus { outline: none; }
.carte-map:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.carte-map-note { margin: 8px 2px 0; font-size: 12.5px; color: var(--ink-mute); }
.carte-noscript { padding: 24px; font-size: 15px; }

/* Leaflet dans le style du site */
.carte-map .leaflet-tile-pane { filter: grayscale(.9) sepia(.22) contrast(.92) brightness(1.04); }
.carte-map .leaflet-container,
.carte-map.leaflet-container { font-family: var(--font-body); }
.carte-map .leaflet-control-attribution { font-size: 11px; background: rgba(255, 255, 255, .82); }
.carte-map .leaflet-control-attribution a { color: var(--red-800); }
.carte-map .leaflet-bar a { color: var(--ink); }

.carte-label {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .02em;
  color: #2a2226;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 2px #fff;
  white-space: nowrap;
}
.carte-label::before { display: none; }
.carte-map.is-far .carte-label--minor { display: none; }
.carte-map.is-very-far .carte-label { display: none; }
.carte-map.is-far .carte-place:not(.carte-place--cap) { display: none; }
@media (max-width: 760px) {
  .carte-map:not(.is-near) .carte-label--minor,
  .carte-map:not(.is-near) .carte-place:not(.carte-place--cap) { display: none; }
}
#lire, #carte, #provinces, #blaeu, #sources, .epoque, .carte-fiche { scroll-margin-top: 76px; }
.carte-fiche { scroll-margin-top: 100px; }

.carte-place {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 2px #fff;
}
.carte-place::before { display: none; }
.leaflet-tooltip-left.carte-place { padding: 0 4px 0 0; }
.carte-place--cap { font-weight: 800; color: var(--red-900); font-size: 12.5px; }
.carte-cap-icon {
  display: grid;
  place-items: center;
  color: var(--red);
  font-size: 20px;
  line-height: 1;
  text-shadow: 0 0 2px #fff, 0 0 4px #fff;
}

.carte-legend {
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  max-width: 250px;
}
.carte-legend p { margin: 0; color: var(--ink); display: flex; gap: 6px; align-items: flex-start; }
.carte-legend p + p { margin-top: 4px; }
.carte-legend .swatch { flex: 0 0 auto; margin: 2px 0 0; }
.carte-legend .carte-legend__cap { color: var(--red); font-size: 14px; line-height: 1; width: 14px; text-align: center; }

/* ---- Panneau ---- */
.carte-panel {
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 20px 18px;
  box-shadow: var(--shadow-sm);
}
.epoque + .epoque { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.js .epoque { display: none; }
.js .epoque.is-active { display: block; margin: 0; padding: 0; border: 0; }
.no-carte .epoque { display: block !important; }
.no-carte .epoque + .epoque { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.epoque__year {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 1.6rem;
  letter-spacing: -0.03em;
  color: var(--red);
  font-variant-numeric: tabular-nums;
}
.epoque__year span {
  display: inline-block;
  margin-left: 6px;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink-mute);
}
.epoque h3 { margin: 4px 0 10px; font-size: 1.4rem; }
.epoque p { font-size: 15px; margin: 0 0 10px; }
.epoque__note {
  font-size: 13.5px !important;
  color: var(--ink-mute);
  border-left: 3px solid var(--gold-light);
  padding-left: 10px;
}
.goto { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.goto a {
  display: inline-block;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
}
.goto a small {
  display: inline-block;
  margin-right: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--red);
}
.goto a:hover { border-color: var(--red); color: var(--red-800); }

.carte-fiche {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 2px solid var(--red);
  position: relative;
}
.carte-fiche__close {
  position: absolute;
  top: 12px;
  right: 0;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
}
.carte-fiche__close svg { width: 16px; height: 16px; }
.carte-fiche__close:hover { border-color: var(--red); color: var(--red-700); }
.carte-fiche__kicker {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 40px 4px 0;
}
.carte-fiche__state { font-size: 13px !important; font-weight: 600; margin: 0 0 10px !important; }
.carte-fiche__state.is-in { color: var(--red-700); }
.carte-fiche__state.is-fr { color: #1f3f8a; }
.carte-fiche__state.is-occ,
.carte-fiche__state.is-unk,
.carte-fiche__state.is-none { color: var(--ink-mute); }
.carte-fiche__head { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.carte-fiche__head img { width: 64px; height: auto; flex: 0 0 auto; filter: drop-shadow(0 2px 4px rgba(0,0,0,.18)); }
.carte-fiche h3 { margin: 0; font-size: 1.3rem; padding-right: 40px; }
.carte-fiche p { font-size: 14.5px; margin: 0 0 8px; }
.carte-fiche .prov__blazon { font-size: 1rem; padding: 10px 12px; }
.carte-fiche .prov__src { font-size: 12.5px; }
.carte-fiche a { color: var(--red-800); text-decoration: underline; text-underline-offset: 2px; }
.carte-fiche__more { font-size: 13.5px !important; font-weight: 650; }

.carte-terr {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}
.carte-terr__label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.carte-terr__list { display: flex; flex-wrap: wrap; gap: 6px; }
.carte-terr__list button,
.prov__focus {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.carte-terr__list button:hover,
.prov__focus:hover { border-color: var(--red); color: var(--red-800); }
.carte-terr__list button[aria-pressed="true"] { background: var(--ink); color: var(--white); border-color: var(--ink); }
html:not(.js) .carte-terr,
html:not(.js) .prov__focus,
html:not(.js) .epoques-bar,
.no-carte .carte-terr,
.no-carte .prov__focus,
.no-carte .epoques-bar { display: none; }

.carte-pop { display: grid; gap: 4px; font-family: var(--font-body); }
.carte-pop strong { font-family: var(--font-display); font-size: 15px; }
.carte-pop__state { font-size: 12.5px; color: var(--ink-mute); }
.carte-pop__go {
  justify-self: start;
  margin-top: 4px;
  border: 0;
  background: var(--red);
  color: var(--white);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 700;
}
.carte-hover { font-weight: 600; }

/* ---- Provinces ---- */
.prov-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.prov {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 18px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
  scroll-margin-top: 90px;
}
.prov.is-flash { animation: prov-flash 1.6s ease-out; }
@keyframes prov-flash { 0% { box-shadow: 0 0 0 4px var(--red); } 100% { box-shadow: var(--shadow-sm); } }
.prov__arms { margin: 0; }
.prov__arms img { width: 112px; height: auto; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .16)); }
.prov__kicker {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 2px;
}
.prov h3 { margin: 0 0 10px; font-size: 1.45rem; }
.prov p { font-size: 14.5px; margin: 0 0 10px; }
.prov__blazon {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem !important;
  color: var(--ink) !important;
  background: var(--paper-alt);
  border-left: 3px solid var(--red);
  border-radius: 0 8px 8px 0;
  padding: 10px 14px;
}
.prov__blazon span {
  display: block;
  font-family: var(--font-body);
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--red-700);
  margin-bottom: 2px;
}
.prov__approx { font-size: 13.5px !important; }
.prov__approx b {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-right: 4px;
}
.prov__src {
  font-size: 12.5px !important;
  color: var(--ink-mute) !important;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.prov__src a, .prov-hint a, .voisins a { color: var(--red-800); text-decoration: underline; text-underline-offset: 2px; }
.prov__links { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 0 !important; }
.prov__links a { font-size: 13.5px; font-weight: 650; color: var(--red-800); border-bottom: 1px solid var(--red-100); }
.prov__links a:hover { border-color: var(--red); }
.prov-hint { margin: 18px 0 0; font-size: 14px; }

.voisins {
  margin-top: 36px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: clamp(18px, 3vw, 28px);
}
.voisins__title { font-size: 1.35rem; margin: 0 0 6px; }
.voisins__lead { margin: 0 0 16px; font-size: 15px; }
.voisins__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 28px; margin: 0; }
.voisins__list > div { border-top: 1px solid var(--line); padding-top: 12px; scroll-margin-top: 90px; }
.voisins__list dt { font-family: var(--font-display); font-weight: 600; font-size: 1.08rem; color: var(--ink); margin-bottom: 4px; }
.voisins__list dd { margin: 0; font-size: 14px; color: var(--ink-soft); }
.voisins__approx { display: block; margin-top: 4px; font-size: 12.5px; color: var(--ink-mute); }

/* ---- Blaeu ---- */
.blaeu { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); gap: 32px; align-items: center; }
.blaeu__fig { margin: 0; }
.blaeu__fig img { width: 100%; height: auto; border-radius: 14px; box-shadow: var(--shadow-md); }
.blaeu__fig figcaption { margin-top: 10px; font-size: 13px; color: var(--ink-mute); line-height: 1.45; }
.blaeu__fig figcaption a { color: var(--red-800); text-decoration: underline; text-underline-offset: 2px; }
.blaeu__body h2 { margin: 8px 0 12px; }
.blaeu__body p { font-size: 15.5px; margin: 0 0 12px; }

/* ---- Responsive ---- */
@media (max-width: 1020px) {
  .carte-stage { grid-template-columns: minmax(0, 1fr); }
  .carte-map { height: clamp(380px, 62vh, 560px); }
  .prov-grid { grid-template-columns: minmax(0, 1fr); }
  .blaeu { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .carte-hero, .carte-hero .container { min-height: auto; }
  .carte-hero .container { padding-top: 56px; padding-bottom: 72px; }
  .carte-hero__scrim { background: linear-gradient(180deg, rgba(14, 10, 12, .78), rgba(14, 10, 12, .88)); }
  .carte-hero__credit { left: 16px; text-align: left; }
  .epoques-step { display: none; }
  .epoques-nav button { min-width: 84px; padding: 7px 10px 8px; }
  .carte-map { height: 64vh; min-height: 360px; max-height: 520px; border-radius: 12px; }
  .carte-panel { padding: 16px; }
  .voisins__list { grid-template-columns: minmax(0, 1fr); }
  .carte-legend { max-width: 190px; font-size: 11px; padding: 6px 8px; }
  .has-popup .carte-legend { opacity: 0; visibility: hidden; }
}
@media (max-width: 520px) {
  .prov { grid-template-columns: minmax(0, 1fr); }
  .prov__arms img { width: 84px; }
}
@media (prefers-reduced-motion: reduce) {
  .prov.is-flash { animation: none; }
}
