/* ===========================================
   folalier.com — modern.css
   =========================================== */

/* ── Cross-document view transitions ── */
@view-transition {
  navigation: auto;
}

:root {
  --color-bg:      #ffffff;
  --color-text:    #1a1a1a;
  --color-muted:   #888888;
  --color-accent:  #2a5298;
  --color-border:  #e8e8e8;
  --color-overlay: rgba(0, 0, 0, 0.72);
  --font-body: Georgia, 'Times New Roman', serif;
  --font-ui:   system-ui, -apple-system, 'Segoe UI', sans-serif;
  --max-width: 800px;
  --header-h:  52px;
  --mobile-nav-h: 48px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.65;
}
a { color: var(--color-accent); }
img { max-width: 100%; height: auto; display: block; }

/* ── Language — use html[lang] so the default "en" in markup hides .fr immediately,
   before JS runs. JS already does document.documentElement.lang = lang. ── */
html[lang="en"] .fr { display: none; }
html[lang="fr"] .en { display: none; }

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: var(--header-h);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  view-transition-name: site-header;
}
.site-header .logo img { height: 28px; }

.lang-toggle {
  background: none;
  border: 1px solid #ccc;
  color: var(--color-text);
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.3rem 0.9rem;
  border-radius: 2rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  user-select: none;
}
.lang-toggle:hover { background: var(--color-text); color: var(--color-bg); border-color: var(--color-text); }

/* ── Footer ── */
.site-footer {
  text-align: center;
  padding: 2.5rem 1.5rem;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--color-muted);
  border-top: 1px solid var(--color-border);
  margin-top: 3rem;
}
.site-footer a { color: var(--color-muted); }


/* ===========================================
   INDEX PAGE
   =========================================== */

/* ── Hero — above fold ── */
.hero-screen {
  position: relative;
}

/* Desktop: title top-aligned, archive overlaid on hero bg */
.hero-above {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  position: relative;
  padding: calc(var(--header-h) + 2.5rem) 1.5rem 2.5rem;
}

.scroll-hint { display: none; }

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.18;
  pointer-events: none;
}

.hero-logo {
  height: 40px;
  margin: 0 auto 1.5rem;
  position: relative;
}

.hero-screen h1 {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 700;
  margin-bottom: 0.6rem;
  line-height: 1.25;
  position: relative;
}

.hero-screen .hero-sub {
  font-size: clamp(0.85rem, 2.5vw, 1.05rem);
  color: var(--color-muted);
  font-family: var(--font-ui);
  max-width: 480px;
  line-height: 1.5;
  position: relative;
  margin-bottom: 2rem;
}

.hero-cta {
  display: none;
  position: relative;
  padding: 0.85rem 2.25rem;
  background: var(--color-accent);
  color: #fff;
  text-decoration: none;
  border-radius: 2rem;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 18px rgba(42, 82, 152, 0.3);
}
.hero-cta:hover {
  background: #1e3d72;
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(42, 82, 152, 0.4);
  color: #fff;
}

.scroll-hint {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.25rem;
  color: var(--color-muted);
  animation: bounce-hint 2.2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes bounce-hint {
  0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.5; }
  50% { transform: translateX(-50%) translateY(6px); opacity: 1; }
}

/* ── Archive section (overlaid on hero on desktop, below fold on mobile) ── */
.archive-section {
  position: relative;
  padding-top: 1rem;
}

.index-hero {
  text-align: center;
  padding: 1.5rem 1.5rem 0.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
}
.index-hero img { max-width: 100%; margin: 0 auto; }
.index-hero h2 { font-size: 0.9rem; font-weight: 400; color: var(--color-muted); line-height: 1.5; }
.index-hero h2 a { color: var(--color-muted); }

.index-fini { margin-bottom: 2rem; }
.index-fini h2 { font-size: 1.1rem; font-weight: 700; color: var(--color-text); margin-bottom: 1rem; }
.index-fini img { max-width: 100%; margin: 0 auto 1rem; }
.index-fini h3 { font-size: 0.88rem; font-weight: 400; color: var(--color-muted); line-height: 1.6; }
.index-fini h3 a { color: var(--color-muted); }
.index-browse-label { font-size: 0.9rem; font-weight: 400; color: var(--color-muted); line-height: 1.5; }
.index-browse-label a { color: var(--color-muted); }

@media (max-width: 768px) {
  .index-fini { display: none; }
}

.index-nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}
.index-nav hr { border: none; border-top: 1px solid var(--color-border); margin: 1.25rem 0; }

/* ── Video grid ── */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}
.video-item {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.video-item video {
  width: 100%;
  border-radius: 6px;
  background: #111;
  display: block;
}
.video-item figcaption {
  font-size: 0.82rem;
  color: var(--color-muted);
  text-align: center;
}

.month-row {
  display: flex;
  justify-content: center;
  gap: 0.4rem 0.75rem;
  margin-bottom: 0.6rem;
  align-items: baseline;
  flex-wrap: wrap;
}
.month-label {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-muted);
  text-align: right;
  padding-right: 0.5rem;
  white-space: nowrap;
  width: 11rem;
  flex-shrink: 0;
}
.day-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 0;
  font-family: var(--font-ui);
  font-size: 0.82rem;
}
.day-links a {
  color: var(--color-accent);
  text-decoration: none;
  padding: 0.15rem 0.28rem;
  border-radius: 3px;
  transition: background 0.1s;
  min-width: 1.5rem;
  text-align: center;
}
.day-links a:hover { background: #e8eef8; }
.prose-links a { margin-right: 0.5rem; font-family: var(--font-ui); font-size: 0.85rem; }

/* ── Mobile: restore original full-viewport hero, archive below fold ── */
@media (max-width: 768px) {
  .hero-above {
    min-height: 100dvh;
    justify-content: center;
    padding: 2rem 1.5rem 5rem;
    overflow: hidden;
  }
  .hero-bg {
    height: 100dvh; /* only cover the hero-above area, not the archive */
  }
  .hero-cta { display: inline-block; }
  .scroll-hint { display: block; }
  .archive-section {
    background: var(--color-bg); /* cover the hero-bg behind this section */
  }
}


/* ===========================================
   DAILY PAGE — DESKTOP
   =========================================== */

.day-page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.75rem 1.5rem 0;
}
.day-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1.25rem;
}
.day-title { font-family: var(--font-ui); font-size: 1rem; font-weight: 600; }
.day-images { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.day-images img { border: 1px solid var(--color-border); }

.day-caption { margin-top: 0.9rem; font-size: 0.88rem; color: #444; text-align: center; max-width: 520px; margin-left: auto; margin-right: auto; }
.day-caption a { color: var(--color-accent); }

.day-position { font-family: var(--font-ui); color: var(--color-muted); font-style: italic; }
.day-position a {  text-decoration: none; }
.day-position a:hover { text-decoration: underline; }
.day-date { font-family: var(--font-ui); font-size: 0.72rem; color: #bbb; text-align: right; margin-top: 0.35rem; max-width: 520px; margin-left: auto; margin-right: auto; }

.day-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 2rem;
  padding: 1rem 0;
  border-top: 1px solid var(--color-border);
  font-family: var(--font-ui);
  font-size: 0.82rem;
}
.day-nav a { color: var(--color-accent); text-decoration: none; padding: 0.35rem 0.5rem; }
.day-nav a:hover { text-decoration: underline; }
.day-nav .nav-home { color: var(--color-muted); font-size: 0.75rem; }


/* ===========================================
   MOBILE — native scroll-snap carousel
   =========================================== */

/* Hidden on desktop; shown inside @media below */
.slides-track { display: none; }
.mobile-nav   { display: none; }

@media (max-width: 768px) {

  .day-page { display: none; }

  /* ── Slides track: horizontal scroll container ── */
  .slides-track {
    display: flex;
    overflow-x: scroll;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;          /* Firefox */
    height: calc(100dvh - var(--header-h));
    background: #111;
    -webkit-overflow-scrolling: touch;
  }
  .slides-track::-webkit-scrollbar { display: none; }

  /* Before JS scrolls into position: hide adj slides to avoid flash of wrong image.
     JS adds .snap-ready once scrollLeft is set, revealing them. */
  .slides-track .slide-adj { visibility: hidden; }
  .slides-track.snap-ready .slide-adj { visibility: visible; }

  /* ── Each slide: full-width snap cell ── */
  .slide {
    width: 100vw;
    flex-shrink: 0;
    scroll-snap-align: center;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #111;
  }

  .slide > img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
  }

  /* Disable view-transition on mobile — swipe is already the animation */
  .slide-current:not(.slide-extra) > img {
    view-transition-name: none;
  }

  /* ── Caption strip — always visible at bottom of current slide ── */
  .caption-peek {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 3rem 1rem calc(0.9rem + env(safe-area-inset-bottom));
    background: linear-gradient(transparent, rgba(0,0,0,0.72) 40%);
    color: #fff;
    pointer-events: none;
  }

  .peek-date {
    font-family: var(--font-ui);
    font-size: 0.68rem;
    color: rgba(255,255,255,0.55);
    letter-spacing: 0.04em;
    margin-bottom: 0.25rem;
  }

  .peek-text {
    font-size: 0.88rem;
    line-height: 1.4;
  }

  /* Full caption panel — hidden (peek strip is used instead) */
  .slide-caption { display: none; }

  /* Bottom nav hidden — swipe handles navigation */
  .mobile-nav { display: none; }

  .day-nav { display: none; }

  /* ── Index page on mobile ── */
  .month-row { grid-template-columns: 1fr; margin-bottom: 1rem; }
  .month-label { text-align: left; padding-right: 0; margin-bottom: 0.2rem; }
}

/* ===========================================
   VIEW TRANSITION ANIMATIONS
   (Chromium 116+; gracefully ignored elsewhere)
   =========================================== */

/* Direction set on <html data-nav-dir="next|prev|down|up"> by JS */
@media (prefers-reduced-motion: no-preference) {
  html[data-nav-dir="next"]::view-transition-old(day-photo) {
    animation: vt-exit-left 0.32s ease both;
  }
  html[data-nav-dir="next"]::view-transition-new(day-photo) {
    animation: vt-enter-right 0.32s ease both;
  }
  html[data-nav-dir="prev"]::view-transition-old(day-photo) {
    animation: vt-exit-right 0.32s ease both;
  }
  html[data-nav-dir="prev"]::view-transition-new(day-photo) {
    animation: vt-enter-left 0.32s ease both;
  }
  html[data-nav-dir="down"]::view-transition-old(day-photo) {
    animation: vt-exit-up 0.32s ease both;
  }
  html[data-nav-dir="down"]::view-transition-new(day-photo) {
    animation: vt-enter-down 0.32s ease both;
  }
  html[data-nav-dir="up"]::view-transition-old(day-photo) {
    animation: vt-exit-down 0.32s ease both;
  }
  html[data-nav-dir="up"]::view-transition-new(day-photo) {
    animation: vt-enter-up 0.32s ease both;
  }

  @keyframes vt-exit-left   { to   { transform: translateX(-30vw); opacity: 0; } }
  @keyframes vt-enter-right { from { transform: translateX(30vw);  opacity: 0; } }
  @keyframes vt-exit-right  { to   { transform: translateX(30vw);  opacity: 0; } }
  @keyframes vt-enter-left  { from { transform: translateX(-30vw); opacity: 0; } }
  @keyframes vt-exit-up     { to   { transform: translateY(-20vh); opacity: 0; } }
  @keyframes vt-enter-down  { from { transform: translateY(20vh);  opacity: 0; } }
  @keyframes vt-exit-down   { to   { transform: translateY(20vh);  opacity: 0; } }
  @keyframes vt-enter-up    { from { transform: translateY(-20vh); opacity: 0; } }
}
