/* ===========================================
   VAÏKO — Magazine épuré
   Inspiration : Substack, The Marginalian, NYT Mag
   =========================================== */

:root {
  --paper: #faf8f4;       /* fond ivoire chaud */
  --paper-2: #f3eee5;     /* fond alterné très subtil */
  --ink: #1a1816;         /* texte principal, presque noir mais chaud */
  --ink-soft: #6b655c;    /* texte secondaire */
  --rule: #d8d2c6;        /* filets de séparation */
  --accent: #8b3a1e;      /* terracotta foncé, utilisé avec parcimonie */
  --max-width: 680px;     /* largeur de lecture confortable */
  --wide-width: 1100px;   /* pour galerie et cartes */
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  font-family: 'Source Serif 4', 'Source Serif Pro', Georgia, serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 18px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--rule);
  transition: text-decoration-color .15s;
}
a:hover { text-decoration-color: var(--ink); }

/* ====== EN-TÊTE MASTHEAD ====== */
.hero {
  padding: 4rem 1.5rem 3rem;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}

.nav {
  max-width: var(--wide-width);
  margin: 0 auto 4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

.logo {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 600;
  font-style: italic;
  font-size: 1.1rem;
  letter-spacing: 0;
  text-transform: none;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 1.75rem;
}

.nav-links a {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 500;
}
.nav-links a:hover { color: var(--ink); }

.hero-content {
  max-width: var(--max-width);
  margin: 0 auto;
  text-align: center;
}

.kicker {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--ink-soft);
  margin-bottom: 2rem;
  font-weight: 500;
}

.hero h1 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 400;
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}

.hero h1 em {
  font-style: italic;
  color: var(--accent);
}

.lede {
  font-size: 1.15rem;
  color: var(--ink-soft);
  line-height: 1.65;
  max-width: 560px;
  margin: 0 auto 2.5rem;
}

.hero-meta {
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.badge {
  background: none;
  border: none;
  padding: 0;
  box-shadow: none;
  font-weight: 500;
}

/* ====== SECTIONS ====== */
.section {
  padding: 5rem 1.5rem;
}

.section-alt { background: var(--paper); }

.section-header {
  max-width: var(--max-width);
  margin: 0 auto 4rem;
  text-align: center;
}

.section-header h2 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 400;
  font-style: italic;
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  letter-spacing: -0.01em;
  margin-bottom: 0.75rem;
}

.section-header p {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

/* ====== JOURNAL — un post = un article pleine largeur ====== */
.journal-grid {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 5rem;
}

.post {
  display: flex;
  flex-direction: column;
}

.post-image {
  margin: 0 -1.5rem 2rem;       /* extension hors-cadre sur mobile */
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--paper-2);
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 720px) {
  .post-image {
    margin: 0 0 2rem;
    border-radius: 2px;
  }
}

.post-image--clickable {
  cursor: zoom-in;
}

.post-image img,
.post-image video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-emoji {
  font-size: 3rem;
  opacity: 0.5;
  filter: grayscale(0.3);
}

.post-image-placeholder {
  background:
    repeating-linear-gradient(45deg,
      var(--paper-2),
      var(--paper-2) 10px,
      #ebe5d8 10px,
      #ebe5d8 20px);
}

.post-body { padding: 0; }

.post-date {
  display: block;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-soft);
  margin-bottom: 1rem;
}

.post h3 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 400;
  font-size: clamp(1.6rem, 2.5vw, 2.1rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin-bottom: 1.25rem;
}

.post p {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--ink);
  margin-bottom: 1.5rem;
}

.post-tag {
  display: inline-block;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-soft);
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}

.post.placeholder { opacity: 0.5; }

/* ====== GALERIE — grille de carrés, pas de gimmicks ====== */
.gallery {
  max-width: var(--wide-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 4px;
}

.gallery-item {
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
  background: var(--paper-2);
  position: relative;
}

.gallery-item img,
.gallery-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}

.gallery-item:hover img,
.gallery-item:hover video { transform: scale(1.03); }

.gallery-item--video { position: relative; }
.gallery-play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: rgba(0,0,0,.5); color: white; font-size: 1.4rem;
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}

.gallery-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  opacity: 0.4;
}

.note {
  max-width: var(--max-width);
  margin: 3rem auto 0;
  text-align: center;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.8rem;
  color: var(--ink-soft);
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}

.note code {
  background: var(--paper-2);
  padding: 0.1rem 0.4rem;
  border-radius: 2px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
}

/* ====== CARTE ====== */
#map {
  max-width: var(--wide-width);
  margin: 0 auto 3rem;
  height: 480px;
  border: 1px solid var(--rule);
}

.walks-list {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.walk-card {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 1.5rem;
  align-items: baseline;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule);
}
.walk-card:last-child { border-bottom: none; }

.walk-num {
  font-family: 'Source Serif 4', Georgia, serif;
  font-style: italic;
  font-size: 1.5rem;
  color: var(--ink-soft);
  background: none;
  width: auto;
  height: auto;
  border-radius: 0;
  display: block;
  text-align: right;
}

.walk-card h4 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 400;
  font-size: 1.2rem;
  margin-bottom: 0.25rem;
}

.walk-card p {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.85rem;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

/* ====== CONTACT ====== */
.contact { text-align: center; }

.cta {
  display: inline-block;
  border: 1px solid var(--ink);
  background: none;
  color: var(--ink);
  padding: 1rem 2.5rem;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  text-decoration: none;
  font-weight: 500;
  transition: background .2s, color .2s;
  margin-top: 1rem;
}

.cta:hover {
  background: var(--ink);
  color: var(--paper);
}

/* ====== FOOTER ====== */
footer {
  background: var(--paper);
  color: var(--ink-soft);
  text-align: center;
  padding: 4rem 1.5rem;
  border-top: 1px solid var(--rule);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.8rem;
}

footer p { margin-bottom: 0.4rem; }
.footer-small { font-size: 0.75rem; opacity: 0.7; }

/* ====== LIGHTBOX ====== */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 24, 22, 0.96);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 2rem;
}

.lightbox.active { display: flex; }

.lightbox-content {
  max-width: 90vw;
  max-height: 78vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content img,
.lightbox-content video {
  max-width: 90vw;
  max-height: 78vh;
  width: auto;
  height: auto;
  display: block;
}

.lightbox-content > div:not(img):not(video) {
  font-size: 6rem;
  color: var(--paper);
  opacity: 0.4;
}

.lightbox-caption {
  color: var(--paper);
  margin-top: 1.5rem;
  font-family: 'Source Serif 4', Georgia, serif;
  font-style: italic;
  font-size: 1rem;
  opacity: 0.85;
  text-align: center;
  max-width: 600px;
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  color: var(--paper);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  cursor: pointer;
  opacity: 0.7;
  background: none;
  border: none;
  padding: 0.5rem 1rem;
}
.lightbox-close:hover { opacity: 1; }

/* ====== SÉPARATEURS ENTRE SECTIONS ====== */
.section + .section { border-top: 1px solid var(--rule); }

/* ====== RESPONSIVE ====== */
@media (max-width: 640px) {
  body { font-size: 16px; }

  /* Nav compacte */
  .hero { padding: 1.5rem 1.25rem 2.5rem; }
  .nav { margin-bottom: 2rem; }
  .nav-links { gap: .75rem; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .nav-links a { font-size: 0.7rem; white-space: nowrap; }
  .logo { font-size: 1rem; }

  /* Sections */
  .section { padding: 3rem 1.25rem; }
  .section-header { margin-bottom: 2.5rem; }

  /* Journal */
  .journal-grid { gap: 3.5rem; }
  .post-image { margin: 0 -1.25rem 1.75rem; } /* aligne avec padding section */
  .post h3 { font-size: 1.5rem; }

  /* Galerie */
  .gallery { gap: 2px; grid-template-columns: repeat(3, 1fr); }

  /* Carte */
  #map { height: 260px; }

  /* Hero */
  .hero-meta { flex-direction: column; gap: 0.4rem; align-items: center; }
  .lede { font-size: 1rem; }

  /* Interactions */
  .post-interactions { padding: 1rem 0 1.5rem; }
  .reactions { gap: .35rem; }
  .reaction-btn { padding: .5rem .7rem; font-size: .9rem; }
  .comment-name, .comment-text {
    font-size: 16px; /* évite le zoom auto iOS */
  }
  .comment-text { min-height: 80px; }
  .comment-submit { width: 100%; justify-content: center; }

  /* Lightbox */
  .lightbox { padding: 1rem; }
  .lightbox-content { max-height: 65vh; }
}

/* Safe area iPhone X+ */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  footer {
    padding-bottom: calc(4rem + env(safe-area-inset-bottom));
  }
  .hero {
    padding-top: calc(1.5rem + env(safe-area-inset-top));
  }
}

/* ====== IMPRESSION ====== */
@media print {
  .nav, footer, #map, .lightbox { display: none; }
  body { background: white; }
}

/* ====== RÉACTIONS & COMMENTAIRES ====== */
.post-interactions {
  border-top: 1px solid var(--rule);
  padding: 1rem 1.5rem 1.5rem;
}
.reactions {
  display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.2rem;
}
.reaction-btn {
  background: var(--paper); border: 1px solid var(--rule);
  border-radius: 2rem; padding: .45rem .85rem;
  font-size: .95rem; cursor: pointer; transition: all .15s;
  display: flex; align-items: center; gap: .3rem;
  min-height: 44px; touch-action: manipulation;
}
.reaction-btn:hover { background: #f0ebe3; border-color: #c4876a; }
.reaction-btn.has-reactions { background: #fdf3ee; border-color: #c4876a; }
.reaction-btn.reacted { transform: scale(1.15); }
.reaction-count { font-size: .8rem; color: var(--ink-soft); font-family: var(--sans); }
.comments-list { margin-bottom: 1rem; }
.comment { padding: .75rem 0; border-bottom: 1px solid var(--rule); }
.comment:last-child { border-bottom: none; }
.comment-author { font-weight: 600; font-size: .85rem; }
.comment-date { font-size: .75rem; color: var(--ink-soft); margin-left: .5rem; }
.comment-text { margin-top: .25rem; font-size: .9rem; line-height: 1.5; }
.comment-form { display: flex; flex-direction: column; gap: .6rem; }
.comment-name, .comment-text {
  border: 1px solid var(--rule); border-radius: 8px;
  padding: .6rem .85rem; font-size: .9rem; font-family: inherit;
  background: var(--paper); color: var(--ink); resize: none;
  transition: border-color .15s;
}
.comment-name:focus, .comment-text:focus { outline: none; border-color: #c4876a; }
.comment-submit {
  align-self: flex-end; background: #c4876a; color: white;
  border: none; border-radius: 8px; padding: .65rem 1.4rem;
  font-size: .9rem; cursor: pointer; transition: background .15s;
  min-height: 44px; touch-action: manipulation;
}
.comment-submit:hover { background: #a8694e; }
.comment-submit:disabled { opacity: .5; cursor: default; }


/* ====== SKELETON LOADING ====== */
@keyframes shimmer {
  0% { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--paper-2) 25%, #ede8df 50%, var(--paper-2) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
}
.skeleton-post { gap: 0; }
.skeleton-img  { height: 260px; margin: 0 0 1.5rem; border-radius: 2px; }
.skeleton-date { height: 12px; width: 120px; margin-bottom: 1rem; }
.skeleton-title { height: 32px; width: 85%; margin-bottom: 1rem; }
.skeleton-line  { height: 16px; margin-bottom: .6rem; }
.skeleton-line.short { width: 60%; }

/* ====== BANNER NOUVEAU POST ====== */
#new-posts-banner {
  display: none; position: fixed; top: 0; left: 0; right: 0; z-index: 500;
  background: #c4876a; color: white; padding: .75rem 1.5rem;
  align-items: center; justify-content: center; gap: 1rem;
  font-family: 'Inter', system-ui, sans-serif; font-size: .9rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
#new-posts-banner button {
  background: white; color: #c4876a; border: none; border-radius: 6px;
  padding: .35rem .85rem; font-size: .85rem; font-weight: 600; cursor: pointer;
}

/* ====== DERNIÈRE MÀJ ====== */
#last-updated {
  display: none; font-family: 'Inter', system-ui, sans-serif;
  font-size: .72rem; color: var(--ink-soft); text-transform: uppercase;
  letter-spacing: .12em; margin-left: .75rem;
}

/* ====== BOUTON NOTIFICATION ====== */
.notif-btn {
  background: none; border: 1px solid var(--rule); border-radius: 50%;
  width: 34px; height: 34px; font-size: 1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s; flex-shrink: 0;
}
.notif-btn:hover { border-color: var(--ink); background: var(--paper-2); }
.notif-btn.active { border-color: #c4876a; background: #fdf3ee; }

/* ====== TOAST GLOBAL ====== */
.toast-global {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  background: #2c2c2c; color: white; padding: .75rem 1.5rem;
  border-radius: 2rem; font-family: 'Inter', system-ui, sans-serif;
  font-size: .9rem; opacity: 0; transition: opacity .3s;
  pointer-events: none; z-index: 600; white-space: nowrap;
}
.toast-global.show { opacity: 1; }

/* Pastille nouveaux posts sur le bouton notif */
.notif-btn.has-badge::after {
  content: '';
  position: absolute; top: 2px; right: 2px;
  width: 9px; height: 9px;
  background: #c4876a; border-radius: 50%;
  border: 2px solid var(--paper);
}
.notif-btn { position: relative; }
