:root {
  /* Ligne 12 RATP : #00643C. */
  --green: #00643c;
  --green-light: #267253;
  --enamel: #f2ebcf;
  --red: #a52b27;
  --light: #f3c64f;
  --ink: #1d2521;
  --muted: #59635e;
  --background: #f5f6f6;
  --line: #cbd2cf;
  --zh: "Noto Serif TC", Georgia, serif;
  --ui: "Source Sans 3", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--background);
  font-family: var(--zh);
  line-height: 1.55;
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 4px;
}

img {
  display: block;
  max-width: 100%;
}

.page {
  width: min(100% - 3rem, 82rem);
  margin-inline: auto;
}

/* Emblème compact : aucun montant ou sous-panneau. */
.brand-stage {
  width: min(100%, 43rem);
  margin: 1rem auto 2.5rem;
  text-align: center;
}

.brand-stage > img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0.2rem 0.15rem rgb(15 31 24 / 10%));
}

.brand-zh {
  margin: 0.8rem 0 0;
  color: var(--green);
  font-family: var(--zh);
  font-size: 1.35rem;
  font-weight: 700;
}

.brand-dek {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 500;
}

.brand-dek span {
  font-family: var(--ui);
  font-size: 0.9rem;
  font-weight: 400;
}

.intro {
  max-width: 38rem;
  margin: 0 auto 2.7rem;
  text-align: center;
}

.intro-zh {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 500;
}

.intro-fr {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-family: var(--ui);
  font-size: 0.88rem;
}

/* Les portes sont des départs de lignes, sans cadres de cartes. */
.doors {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3.4rem 1.8rem;
  margin-bottom: 3.5rem;
}

.door {
  display: block;
  min-width: 0;
}

.door-image {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  margin-bottom: 0;
  background: #e3e6e5;
}

.door-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 300ms ease;
}

.door:hover .door-image img {
  transform: scale(1.025);
}

.door h2 {
  margin: 0.65rem 0 0;
  text-align: center;
  font-size: 1.08rem;
  line-height: 1.3;
}

.door p {
  margin: 0.2rem 0 0;
  color: var(--green-light);
  font-family: var(--ui);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0 2.4rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--ui);
  font-size: 0.78rem;
}

.footer a {
  color: var(--green);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

/* En-tête intérieur : l'enseigne reste lisible et centrée. */
.site-head {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  padding: 1.5rem 0 0.5rem;
}

.mini-sign {
  display: block;
  width: clamp(19rem, 34vw, 25rem);
}

.mini-sign img {
  display: block;
  width: 100%;
  height: auto;
}

.section-page .site-head {
  padding-bottom: 1.5rem;
}

.section-page .mini-sign {
  width: min(100%, 23rem);
}

.section-intro {
  max-width: 76rem;
  margin-inline: auto;
}

.back-link {
  display: inline-block;
  margin-top: 0.5rem;
  color: var(--green);
  font-family: var(--ui);
  font-size: 0.76rem;
  font-weight: 600;
}

.route {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  color: var(--muted);
  font-family: var(--ui);
  font-size: 0.78rem;
}

.route a {
  color: var(--green);
  font-weight: 600;
}

.route > * {
  white-space: nowrap;
}

.route > * + *::before {
  content: "";
  display: inline-block;
  width: clamp(1rem, 4vw, 3rem);
  height: 6px;
  margin: 0 0.45rem;
  vertical-align: middle;
  background: var(--green);
}

.route .current::after {
  content: "";
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  margin-left: 0.45rem;
  border: 4px solid var(--green);
  border-radius: 50%;
  background: var(--background);
  vertical-align: middle;
}

.page-head {
  max-width: 44rem;
  margin: 1rem auto 3rem;
  text-align: center;
}

.section-intro .page-head {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.5rem;
  align-items: center;
  max-width: none;
  width: 100%;
  margin: 1rem 0 0;
  text-align: left;
}

.page-title {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  justify-content: center;
}

.page-title-wrap {
  grid-column: 1 / 3;
}

.section-intro .page-title {
  justify-content: flex-start;
}

.section-intro .dek {
  grid-column: 3;
  margin: 0;
}

.article-head {
  margin-bottom: 1.5rem;
}

.page-head h1,
.article h1 {
  margin: 0;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  line-height: 1.25;
}

.page-head .fr,
.article .fr {
  margin: 0.4rem 0 0;
  color: var(--green);
  font-family: var(--ui);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.page-head .dek {
  margin: 0.85rem 0 0;
  color: var(--muted);
}

/* Index de section : deux colonnes équilibrées, une ligne par famille. */
.family-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3rem 2.5rem;
  max-width: 76rem;
  margin: 3rem auto 4rem;
}

.family:nth-child(5) {
  grid-column: 3;
}

/* Mono-liste (itinéraire jours, fallback) : pas de tracks vides */
.family-grid:has(> .family:only-child),
.family-grid--days {
  grid-template-columns: minmax(0, 28rem);
  justify-content: start;
}

.family > header {
  margin-bottom: 1.1rem;
}

.family h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1.25;
}

.family h2 small {
  display: block;
  margin-top: 0.2rem;
  color: var(--green);
  font-family: var(--ui);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.family-stations {
  --rail-x: 0.55rem;
  display: grid;
  grid-template-columns: 1fr;
}

.family-stations a {
  position: relative;
  min-width: 0;
  padding: 0.65rem 0 0.65rem 2rem;
  text-align: left;
}

/* Rail per-station with 1px overlap — avoids hairline gap at item boundaries */
.family-stations a::after {
  content: "";
  position: absolute;
  z-index: 0;
  top: -1px;
  bottom: -1px;
  left: var(--rail-x);
  width: 7px;
  background: var(--green);
  transform: translateX(-50%);
}

.family-stations a::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 50%;
  left: var(--rail-x);
  width: 0.95rem;
  height: 0.95rem;
  border: 4px solid var(--green);
  border-radius: 50%;
  background: var(--background);
  transform: translate(-50%, -50%);
  transition: background 140ms ease, transform 140ms ease;
}

.family-stations a:first-child::after {
  top: 50%;
}

.family-stations a:last-child::after {
  bottom: 50%;
}

.family-stations a:only-child::after {
  /* single stop: just a stub under the circle, no rail segment */
  top: 50%;
  bottom: auto;
  height: 0;
}

.family-stations a:hover::before,
.family-stations a:focus-visible::before {
  background: var(--green);
  transform: translate(-50%, -50%) scale(1.1);
}

.family-stations h3 {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.3;
}

.family-stations p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-family: var(--ui);
  font-size: 0.78rem;
  line-height: 1.3;
}

/* Article : texte continu, plan de marche en ligne. */
.article-page .mini-sign {
  width: min(100%, 23rem);
}

.article-layout {
  max-width: 76rem;
  margin: 0 auto 3rem;
  padding-top: 0.5rem;
}

.article-back {
  display: inline-flex;
  gap: 0.4rem;
  align-items: baseline;
  margin-bottom: 1.25rem;
  color: var(--green);
  font-family: var(--ui);
  font-size: 0.76rem;
  font-weight: 600;
}

.article-back strong {
  font-family: var(--zh);
  font-size: 1rem;
}

.article-back span::before {
  content: "· ";
}

.article {
  max-width: 48rem;
  min-width: 0;
  margin-inline: auto;
  padding: 0 0 3rem;
}

.article > p:not(.fr, .meta),
.article > h1,
.article > .fr,
.article > .meta,
.article > .stops {
  max-width: 42rem;
}

.article .meta {
  margin: 0.45rem 0 1.5rem;
  color: var(--muted);
  font-family: var(--ui);
  font-size: 0.78rem;
}

.article .meta span {
  display: block;
}

.article .meta span + span {
  margin-top: 0.15rem;
}

.stops {
  margin: 0 0 1.8rem;
  padding: 0.9rem 0;
  border-block: 1px solid var(--line);
}

.stops p {
  margin: 0 0 0.6rem;
  color: var(--green);
  font-family: var(--ui);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.stops ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-family: var(--ui);
  font-size: 0.82rem;
}

.stops li + li::before {
  content: "";
  display: inline-block;
  width: 2rem;
  height: 6px;
  margin: 0 0.5rem;
  background: var(--green);
  vertical-align: middle;
}

.stops a:hover {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.article figure {
  margin: 2rem 0;
  scroll-margin-top: 2rem;
}

.article figure img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.article figcaption {
  margin-top: 0.55rem;
  padding-left: 0.75rem;
  border-left: 3px solid var(--green);
  color: var(--muted);
  font-size: 0.9rem;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 22.5rem));
  gap: 2rem 1.25rem;
  margin-top: 2rem;
}

.article .photo-grid figure {
  margin: 0;
}

.article .photo-grid figure:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  width: min(100%, 22.5rem);
  justify-self: center;
}

.photo-grid img {
  width: 100%;
  height: auto;
}

/* Navigation de fin : contexte visible plutôt qu'un simple précédent/suivant. */
.journey {
  margin-top: 2.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}

.journey > p {
  margin: 0 0 1rem;
  color: var(--muted);
  font-family: var(--ui);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.journey > p strong {
  color: var(--ink);
  font-family: var(--zh);
  font-size: 1rem;
}

.journey > p span::before {
  content: " · ";
}

.journey-window {
  overflow: hidden;
  padding: 0.5rem 0.25rem;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.journey-line {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(7rem, 1fr));
  align-items: start;
  min-width: 42rem;
}

.journey-line::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 0.55rem;
  left: 0;
  right: 0;
  height: 7px;
  background: var(--green);
  transform: translateY(-50%);
}

.journey-stop {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-family: var(--ui);
  font-size: 0.78rem;
  text-align: center;
}

.journey-stop i {
  display: block;
  width: 1.1rem;
  height: 1.1rem;
  border: 4px solid var(--green);
  border-radius: 50%;
  background: var(--background);
  transition: background 140ms ease, transform 140ms ease;
}

.journey-stop:hover i,
.journey-stop:focus-visible i {
  background: var(--green);
  transform: scale(1.1);
}

.journey-stop.active {
  color: var(--ink);
  font-weight: 700;
}

.journey-stop.active i {
  background: var(--green);
}

.journey-stop strong,
.journey-stop small {
  display: block;
}

.journey-stop strong {
  font-family: var(--zh);
  font-size: 0.92rem;
  line-height: 1.2;
}

.journey-stop small {
  margin-top: 0.18rem;
  font-size: 0.66rem;
  font-weight: 400;
  line-height: 1.25;
}

@media (max-width: 760px) {
  .doors {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mini-sign {
    width: min(100%, 21rem);
  }

  .page-title {
    flex-direction: column;
    gap: 0.15rem;
    align-items: center;
  }

  .section-intro .page-title {
    align-items: flex-start;
  }

  .page-title-wrap {
    grid-column: auto;
  }

  .section-intro .page-head {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .section-intro .dek {
    grid-column: auto;
  }

  .family-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .photo-grid {
    grid-template-columns: minmax(0, 22.5rem);
  }

  .article .photo-grid figure:last-child:nth-child(odd) {
    grid-column: auto;
    justify-self: start;
  }

  .journey-window {
    overflow: visible;
    padding: 0.25rem 0;
    mask-image: none;
  }

  .journey-line {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .journey-line::before {
    top: 1.1rem;
    right: auto;
    bottom: 1.1rem;
    left: 0.55rem;
    width: 7px;
    height: auto;
    transform: translateX(-50%);
  }

  .journey-stop {
    grid-template-columns: 1.1rem 1fr;
    gap: 0.8rem;
    align-items: center;
    justify-items: start;
    padding: 0.55rem 0;
    text-align: left;
  }

  .family:nth-child(5) {
    grid-column: auto;
  }

}

@media (min-width: 761px) and (max-width: 900px) {
  .family-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .family:nth-child(5) {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .door-image img {
    transition: none;
  }
}

/* Ghost content / imported promenades */
body.pmc {
  margin: 0;
}

.post-body {
  max-width: 48rem;
}

.post-body > p {
  margin: 0 0 1.1rem;
  max-width: 42rem;
}

/*
 * Ghost import turns <div class="photo-grid"> into stacked .kg-image-card.
 * Re-create the 2-col photo grid; non-image blocks span full width.
 */
.post-body.gh-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 22.5rem));
  column-gap: 1.25rem;
  row-gap: 2rem;
  justify-content: start;
}

.post-body.gh-content > :not(.kg-image-card) {
  grid-column: 1 / -1;
}

.post-body .photo-grid,
.article .photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 22.5rem));
  gap: 2rem 1.25rem;
  margin: 2rem 0;
}

.post-body figure,
.article figure,
.post-body .kg-image-card {
  margin: 0;
  max-width: 22.5rem;
}

.post-body figure img,
.article figure img,
.post-body .kg-image-card img,
.post-body img.kg-image {
  width: 100%;
  height: auto !important;
  object-fit: contain;
}

.post-body figcaption,
.article figcaption,
.post-body .kg-image-card figcaption {
  margin-top: 0.55rem;
  padding-left: 0.75rem;
  border-left: 3px solid var(--green);
  color: var(--muted);
  font-size: 0.9rem;
}

.post-body .photo-grid figure:last-child:nth-child(odd),
.article .photo-grid figure:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  width: min(100%, 22.5rem);
  justify-self: center;
}

@media (max-width: 760px) {
  .post-body.gh-content,
  .post-body .photo-grid,
  .article .photo-grid {
    grid-template-columns: minmax(0, 22.5rem);
  }

  .post-body .photo-grid figure:last-child:nth-child(odd),
  .article .photo-grid figure:last-child:nth-child(odd) {
    grid-column: auto;
    justify-self: start;
  }
}

/* Koenig / Ghost card requirements (gscan) */
.kg-width-wide {
  position: relative;
  width: min(100vw - 3rem, 58rem);
  max-width: none;
  margin-left: calc(50% - min(50vw - 1.5rem, 29rem));
}
.kg-width-full {
  width: 100vw;
  max-width: none;
  margin-left: calc(50% - 50vw);
}
.kg-gallery-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.kg-gallery-row {
  display: flex;
  gap: 0.5rem;
}
.kg-gallery-image { flex: 1; }
.kg-gallery-image img {
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: cover;
}
.kg-bookmark-card { margin: 1.5rem 0; }
.kg-bookmark-container {
  display: flex;
  min-height: 9rem;
  overflow: hidden;
  color: inherit;
  text-decoration: none !important;
  border: 1px solid var(--line);
}
.kg-bookmark-content {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  padding: 1rem;
}
.kg-bookmark-title {
  font-family: var(--zh);
  font-weight: 600;
}
.kg-bookmark-description {
  display: -webkit-box;
  margin-top: 0.35rem;
  overflow: hidden;
  color: var(--muted);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.kg-bookmark-metadata {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.75rem;
  font-family: var(--ui);
  font-size: 0.75rem;
}
.kg-bookmark-icon {
  width: 1rem;
  height: 1rem;
}
.kg-bookmark-author,
.kg-bookmark-publisher {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kg-bookmark-thumbnail {
  position: relative;
  flex: 0 0 33%;
}
.kg-bookmark-thumbnail img {
  position: absolute;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: cover;
}
.journey-stop.active {
  color: var(--ink);
  font-weight: 700;
  pointer-events: none;
}
