/* ============================================================
   Asian Roadtrip — feuille de style « Carnet de voyage »
   Tons terre & terracotta · sérif éditorial · mode clair.
   Compatible avec le balisage produit par build.js.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Spectral:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Playfair+Display:wght@600;700;800;900&family=Caveat:wght@400;500;600&display=swap');

:root {
  --paper:   #f2e8d6;
  --card:    #fffdf8;
  --ink:     #2c2419;
  --soft:    #6f6149;
  --faint:   #a99876;
  --terra:   #b14f2a;
  --terra-d: #97431f;
  --ochre:   #bd8a2e;
  --dash:    #c6b491;
  --line:    #e4d8bd;

  --serif: 'Spectral', Georgia, 'Times New Roman', serif;
  --display: 'Playfair Display', Georgia, serif;
  --hand: 'Caveat', 'Segoe Script', cursive;

  --wrap: 1140px;
  --read: 720px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--serif);
  color: var(--ink);
  line-height: 1.72;
  font-size: 1.075rem;
  background:
    radial-gradient(circle at 18% 8%, rgba(189,138,46,.07), transparent 42%),
    radial-gradient(circle at 88% 96%, rgba(177,79,42,.06), transparent 46%),
    var(--paper);
  position: relative;
  min-height: 100vh;
}

/* Grain papier discret */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

a { color: var(--terra); }

/* ---------- Bandeau / masthead ---------- */
.site-header {
  position: relative;
  z-index: 1;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 54px 32px 26px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  border-bottom: 2px dashed var(--dash);
}

.site-header-brand { min-width: 0; }

.site-kicker {
  font-family: var(--hand);
  font-size: 26px;
  color: var(--terra);
  transform: rotate(-2deg);
  display: inline-block;
  margin-bottom: 2px;
}

.site-title {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(40px, 6vw, 64px);
  line-height: .95;
  letter-spacing: -1px;
  color: var(--ink);
  text-decoration: none;
  display: inline-block;
}
.site-title:hover { color: var(--terra); }

.site-tagline {
  font-family: var(--hand);
  font-size: 24px;
  color: var(--soft);
  margin: 8px 0 0;
  font-style: normal;
}

/* Tampon de passeport */
.site-stamp {
  flex: 0 0 auto;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  border: 2.5px solid var(--terra);
  color: var(--terra);
  display: grid;
  place-content: center;
  text-align: center;
  transform: rotate(9deg);
  opacity: .82;
  position: relative;
}
.site-stamp::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1.5px dashed var(--terra);
  border-radius: 50%;
}
.site-stamp b {
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: 3px;
  text-transform: uppercase;
  display: block;
}
.site-stamp span {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  display: block;
  margin-top: 3px;
}

/* ---------- Conteneurs ---------- */
main {
  position: relative;
  z-index: 1;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 8px 32px 40px;
}

.section-title {
  font-family: var(--hand);
  font-size: 34px;
  color: var(--terra);
  margin: 40px 0 6px;
  transform: rotate(-1deg);
}

/* ---------- Itinéraire ---------- */
.itinerary-wrap { overflow-x: auto; overflow-y: hidden; padding-bottom: 4px; }

.itinerary {
  position: relative;
  height: 236px;
  min-width: 820px;
  margin: 14px 8px 0;
}

.itinerary-line {
  position: absolute;
  top: 50%; left: 70px; right: 70px;
  height: 0;
  border-top: 2.5px dashed var(--ochre);
  opacity: .8;
}

.stop {
  position: absolute;
  top: 50%;
  left: calc(70px + var(--i) * ((100% - 140px) / (var(--n) - 1)));
  width: 0;
}
.stop-dot {
  position: absolute;
  left: 0; top: 0;
  width: 13px; height: 13px;
  margin: -6.5px 0 0 -6.5px;
  border-radius: 50%;
  background: var(--terra);
  box-shadow: 0 0 0 4px var(--paper), 0 0 0 5.5px var(--ochre);
  transition: transform .2s;
}
.stop-stamp {
  position: absolute;
  left: -66px;
  width: 132px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 4px 14px rgba(80,60,30,.13);
  padding: 10px 8px 9px;
  text-align: center;
  transform: rotate(-2deg);
  transition: transform .22s, box-shadow .22s;
}
.stop:nth-child(even) .stop-stamp { transform: rotate(2deg); }
.stop--up .stop-stamp { bottom: 24px; }
.stop--down .stop-stamp { top: 24px; }
.stop--up::after, .stop--down::after {
  content: "";
  position: absolute;
  left: 0;
  width: 1px; height: 24px;
  border-left: 1.5px dotted var(--ochre);
}
.stop--up::after { bottom: 0; }
.stop--down::after { top: 0; }
.stop-country { display: block; font-family: var(--display); font-weight: 700; font-size: 16px; }
.stop-meta    { display: block; font-size: 11.5px; color: var(--soft); margin-top: 1px; }
.stop-when    { display: block; font-family: var(--hand); font-size: 16px; color: var(--terra); margin-top: 1px; }
.stop:hover .stop-stamp { transform: rotate(0) scale(1.08); box-shadow: 0 10px 26px rgba(80,60,30,.22); z-index: 3; }
.stop:hover .stop-dot   { transform: scale(1.35); }

/* Frise cliquable : filtre par pays */
.itinerary .stop-stamp { cursor: pointer; }
.stop--active .stop-stamp {
  transform: rotate(0) scale(1.08);
  box-shadow: 0 10px 26px rgba(80,60,30,.22);
  border-color: var(--terra);
  background: #fff8ef;
  z-index: 3;
}
.stop--active .stop-dot { transform: scale(1.35); background: var(--terra-d); }

.feed-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.feed-reset {
  font-family: var(--hand);
  font-size: 21px;
  color: var(--terra);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
}
.feed-reset:hover { color: var(--terra-d); text-decoration: underline; }

/* ---------- Compteur ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-top: 28px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 3px 12px rgba(80,60,30,.1);
  padding: 18px 14px;
  text-align: center;
  position: relative;
}
.stat::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px dashed var(--line);
  pointer-events: none;
}
.stat-value {
  display: block;
  font-family: var(--display);
  font-weight: 800;
  font-size: 38px;
  color: var(--terra);
  line-height: 1;
}
.stat-label {
  display: block;
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--soft);
  margin-top: 8px;
}

/* ---------- Grille des articles ---------- */
.feed {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 36px 30px;
  margin-top: 18px;
}

.post-card {
  position: relative;
  --rot: -0.8deg;
}
.post-card:nth-child(3n+1) { --rot: -1.3deg; }
.post-card:nth-child(3n+2) { --rot:  0.9deg; }
.post-card:nth-child(3n)   { --rot: -0.5deg; }

.post-card-link {
  display: block;
  background: var(--card);
  padding: 13px 13px 0;
  box-shadow: 0 5px 18px rgba(80,60,30,.16);
  transform: rotate(var(--rot));
  transition: transform .25s, box-shadow .25s;
  text-decoration: none;
  color: inherit;
}
.post-card-link:hover {
  transform: rotate(0) translateY(-5px);
  box-shadow: 0 16px 34px rgba(80,60,30,.24);
  z-index: 2;
  position: relative;
}

/* Scotch */
.post-card-link::before {
  content: "";
  position: absolute;
  top: -12px; left: 50%;
  width: 96px; height: 26px;
  transform: translateX(-50%) rotate(-3deg);
  background: linear-gradient(180deg, rgba(189,138,46,.5), rgba(189,138,46,.32));
  border-left: 1px dashed rgba(255,255,255,.5);
  border-right: 1px dashed rgba(255,255,255,.5);
}

.post-card-photo { overflow: hidden; line-height: 0; }
.post-card-photo img {
  width: 100%;
  height: 196px;
  object-fit: cover;
  filter: saturate(1.02) contrast(1.02);
}

/* Vignette sans photo : placeholder papier */
.post-card-noimg {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    repeating-linear-gradient(135deg, rgba(189,138,46,.10) 0 12px, transparent 12px 24px),
    var(--paper);
  border: 1px solid var(--line);
  font-family: var(--hand);
  font-size: 22px;
  color: var(--faint);
}

.post-card-body { padding: 14px 6px 18px; }
.post-card-kicker { font-family: var(--hand); font-size: 20px; color: var(--terra); }
.post-card h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 21px;
  line-height: 1.18;
  margin: 2px 0 7px;
}
.post-card h2 a { color: inherit; text-decoration: none; }
.post-card-excerpt { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--soft); text-wrap: pretty; }

/* État vide */
.empty {
  grid-column: 1 / -1;
  color: var(--soft);
  font-style: italic;
  text-align: center;
  padding: 40px 0;
}

/* ============================================================
   Page article
   ============================================================ */
.post {
  max-width: var(--read);
  margin: 14px auto 0;
}
.post > h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(30px, 4.4vw, 44px);
  line-height: 1.12;
  letter-spacing: -.5px;
  margin: 28px 0 8px;
  text-wrap: balance;
}
.post > time,
.post-card time {
  color: var(--faint);
  font-size: .82rem;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.post-body { margin-top: 1.8rem; }
.post-body p { margin: 0 0 1.25rem; text-wrap: pretty; }
.post-body h2, .post-body h3 { font-family: var(--display); font-weight: 700; line-height: 1.2; margin: 2rem 0 .6rem; }

.post-body a { color: var(--terra); text-decoration-color: rgba(177,79,42,.35); text-underline-offset: 2px; }
.post-body a:hover { text-decoration-color: var(--terra); }

/* Images dans le corps : tirage encadré, légèrement incliné */
.post-body p > img,
.post-body > img,
.post-body figure img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.6rem auto;
  background: var(--card);
  padding: 10px;
  box-shadow: 0 6px 22px rgba(80,60,30,.18);
  border: 1px solid var(--line);
}

.post-body figure { margin: 1.8rem 0; text-align: center; }
.post-body figcaption,
.post-body .wp-caption-text {
  font-family: var(--hand);
  font-size: 19px;
  color: var(--soft);
  margin-top: .4rem;
}

/* Galeries */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 1.8rem 0;
}
.gallery a { display: block; line-height: 0; background: var(--card); padding: 8px; box-shadow: 0 4px 14px rgba(80,60,30,.16); transition: transform .2s; }
.gallery a:nth-child(2n) { transform: rotate(1deg); }
.gallery a:nth-child(2n+1) { transform: rotate(-1deg); }
.gallery a:hover { transform: rotate(0) scale(1.03); z-index: 2; position: relative; }
.gallery img { width: 100%; height: 220px; object-fit: cover; }

.post-body blockquote {
  margin: 1.6rem 0;
  padding: .4rem 1.4rem;
  border-left: 3px solid var(--terra);
  font-style: italic;
  color: var(--soft);
}

.video { position: relative; aspect-ratio: 16/9; margin: 1.8rem 0; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; box-shadow: 0 6px 22px rgba(80,60,30,.18); }

pre {
  background: #2c2419;
  color: #f2e8d6;
  border-radius: 4px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-size: .9rem;
  line-height: 1.5;
}
code {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  background: rgba(177,79,42,.1);
  padding: .1em .35em;
  border-radius: 3px;
  font-size: .9em;
}
pre code { background: none; padding: 0; color: inherit; }

.back { margin-top: 2.6rem; }
.back a {
  font-family: var(--hand);
  font-size: 21px;
  color: var(--terra);
  text-decoration: none;
}
.back a:hover { color: var(--terra-d); }

/* ---------- Pied de page ---------- */
.site-footer {
  position: relative;
  z-index: 1;
  max-width: var(--wrap);
  margin: 46px auto 0;
  padding: 22px 32px 48px;
  border-top: 2px dashed var(--dash);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--soft);
}
.site-footer a { color: var(--soft); }
.site-footer .footer-note { font-family: var(--hand); font-size: 20px; color: var(--terra); }

/* ============================================================
   Adaptations écrans étroits
   ============================================================ */
@media (max-width: 900px) {
  .feed { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
  .site-header { padding: 38px 20px 22px; flex-direction: column; align-items: flex-start; }
  .site-stamp { width: 92px; height: 92px; transform: rotate(6deg); }
  main { padding: 8px 20px 32px; }
  .feed { grid-template-columns: 1fr; gap: 30px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat-value { font-size: 32px; }
  .site-footer { padding: 22px 20px 40px; }
}

@media (prefers-reduced-motion: no-preference) {
  .post-card-link, .stop-stamp, .stop-dot, .gallery a { will-change: transform; }
}
