/* =========================
   Variables
   ========================= */

:root {
  --bg: #fff;
  --fg: #000;
  --muted: #000;
  --dot: #000;
  --dot-active: rgba(245, 247, 255, 0.95);
  --header-h: 64px;
}

/* =========================
   Reset / base
   ========================= */

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
}

/* =========================
   Scroll snap container
   ========================= */

.snap {
  height: 100vh;
  box-sizing: border-box;

  overflow-y: auto;
  scroll-snap-type: y mandatory;
}

/* =========================
   Sections full viewport
   ========================= */

.panel {
  height: 100vh;
  scroll-snap-align: start;
  scroll-snap-stop: always;

  overflow: hidden;
  padding-top: var(--header-h);
  box-sizing: border-box;
}


/* ======================
   Sections image seule
   ====================== */

.panel--image {
  display: grid;
  place-items: center; /* centre l’image */
  min-height: 0;
}

.panel--image .media {
  width: 100%;
  height: 100%;
  margin: 0;

  display: flex;
  align-items: center;
  justify-content: center;
  
  min-height: 0;
}

.panel--image .media img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain; /* ✅ image entière visible */
  display: block;
}


/* =========================
   Sections texte
   ========================= */

.panel--text {
  display: flex;
  align-items: center;
  justify-content: center;
}

.content {
  width: min(1500px, 100%);
  padding: 6vh 6vw;
}

.content p {
  font-size: clamp(1rem, 1.5vw, 1.4rem);
  line-height: 1.6;
  margin-bottom: 1.2em;
}

/* ======================
   Sections image + texte
   ====================== */

.panel--split {
  display: grid;
  grid-template-rows: 4fr 1fr; /* 80% / 20% */
  min-height: 0;              /* ✅ LIGNE CRITIQUE */
}

.panel--split .media {
  min-height: 0;              /* ✅ LIGNE CRITIQUE */
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.panel--split .media img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;        /* ✅ pas de crop */
  display: block;
}

.panel--split .caption {
  min-height: 0;              /* ✅ LIGNE CRITIQUE */
  padding: 2rem 6vw;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
}

/* ======================
   Section 2 colonnes
   ====================== */

.panel--two-cols {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "media content";
  min-height: 0;
}

.panel--two-cols .media {
  grid-area: media;

  margin: 0;
  height: 100%;
  min-height: 0;
  min-width: 0;

  display: flex;
  align-items: center;
  justify-content: center;

}

.panel--two-cols .media img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.panel--two-cols .content {
  grid-area: content;
  padding: 6vh 6vw;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.panel--two-cols.text-bottom .content {
  justify-content: flex-end;
}

.panel--two-cols.reverse {
  grid-template-areas: "content media";
}

@media (max-width: 900px) {
  .panel--two-cols {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
}

/* =========================
   Typo
   ========================= */

h1, h2 {
  margin: 0 0 0.75rem 0;
  letter-spacing: -0.02em;
}

p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

/* =========================
   Header fixe
   ========================= */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;

  height: var(--header-h);
  padding: 0 6vw;

  display: flex;
  align-items: center;

  z-index: 20;
  transition: opacity 0.4s ease;
}

.site-header.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.site-title {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0;
}

/* =========================
   Navigation dots
   ========================= */

.dots {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  gap: 12px;
  z-index: 10;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--dot);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.dot.is-active {
  background: var(--dot-active);
  transform: scale(1.4);
}

.dot-thumb {
  position: fixed;
  right: 48px;
  width: 120px;
  height: 80px;
  transform: translateY(-50%);
  background-size: cover;
  background-position: center;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 9;
}

.dot-thumb.is-visible {
  opacity: 1;
}

/* =========================
   Section intro (s1)
   ========================= */

.panel--intro {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.scroll-cta {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: none;
  border: none;
  padding: 0 16px;
  cursor: pointer;
  width: 1px;
  height: 64px;
}

.scroll-cta::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 100%;
  background: currentColor;
  opacity: 0.2;
}

.scroll-cta::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: dotScroll 2s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

@keyframes dotScroll {
  0%   { top: 0;              opacity: 0; }
  10%  { opacity: 1; }
  85%  { opacity: 0.8; }
  100% { top: calc(100% - 6px); opacity: 0; }
}

.content .intro-title {
  font-size: clamp(2rem, 5.5vw, 5rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.05;
  white-space: nowrap;
  margin: 0 0 3vh 0;
}

/* =========================
   RESPONSIVE DESIGN
   ========================= */

/* ======================================
   TABLET (768px - 1024px)
   ====================================== */

@media (max-width: 1024px) {
  :root {
    --header-h: 56px;
  }

  .site-title {
    font-size: 1rem;
  }

  .content {
    padding: 4vh 5vw;
    width: min(90vw, 900px);
  }

  .panel--two-cols .content {
    padding: 4vh 5vw;
  }

  h1, h2 {
    font-size: 1.5rem;
  }

  p {
    font-size: 0.95rem;
  }
}

/* --- Tablet Portrait (768px - 1024px, portrait) --- */
@media (max-width: 1024px) and (orientation: portrait) {
  .dots {
    right: 12px;
    gap: 8px;
  }

  .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
  }

  .panel--two-cols {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .panel--two-cols .media {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 0;
  }

  .panel--two-cols .media img {
    width: 100%;
    height: auto;
    object-fit: contain;
  }

  .panel--two-cols .content {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 4vh 5vw;
  }
}

/* --- Tablet Landscape (768px - 1024px, landscape) --- */
@media (max-width: 1180px) and (orientation: landscape) {
  :root {
    --header-h: 48px;
  }

  .panel {
    height: 100vh;
  }

  .panel--two-cols {
    grid-template-columns: 1fr 2fr;
    grid-template-areas: "media content";
  }

  .panel--two-cols.reverse {
    grid-template-areas: "content media";
  }

  .content {
    padding: 3vh 4vw;
  }

  .panel--two-cols .media {
    align-self: flex-end;
  }

  h2 {
    font-size: 1.3rem;
  }

  p {
    font-size: 0.9rem;
    line-height: 1.5;
  }

  .dots {
    right: 10px;
    gap: 6px;
  }

  .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
  }
}

/* ======================================
   MOBILE (< 768px)
   ====================================== */

@media (max-width: 768px) {
  :root {
    --header-h: 48px;
  }

  .site-title {
    font-size: 0.9rem;
    letter-spacing: 0.05em;
  }

  .content {
    padding: 3vh 5vw;
    width: min(90vw, 100%);
  }

  .panel--two-cols .content {
    padding: 3vh 5vw;
  }

  .panel--split .caption {
    padding: 1.5rem 5vw;
  }

  h1 {
    font-size: 1.3rem;
    margin: 0 0 0.5rem 0;
  }

  h2 {
    font-size: 1.2rem;
    margin: 0 0 0.5rem 0;
  }

  p {
    font-size: 0.9rem;
    line-height: 1.5;
  }

  /* Navigation dots: smaller and repositioned */
  .dots {
    right: 8px;
    gap: 6px;
  }

  .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
  }

  .dot.is-active {
    transform: scale(1.3);
  }

  /* Two-column layout becomes single column */
  .panel--two-cols {
    grid-template-columns: 1fr;
    grid-template-areas: "media" "content";
  }

  .panel--two-cols.reverse {
    grid-template-areas: "content" "media";
  }

  .panel--two-cols .media {
    min-height: 40vh;
  }

  .panel--two-cols .content {
    min-height: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}

/* --- Mobile Portrait (< 768px, portrait) --- */
@media (max-width: 768px) and (orientation: portrait) {
  .panel {
    height: 100vh;
  }

  .panel--text {
    padding-top: var(--header-h);
  }

  .content {
    padding: 3vh 5vw;
  }

  .panel--two-cols {
    display: flex;
    flex-direction: column;
  }

  .panel--two-cols .media {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
  }

  .panel--two-cols .media img {
    width: 100%;
    height: auto;
    object-fit: contain;
  }

  .panel--two-cols .content {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 3vh 5vw;
  }

  h1, h2 {
    font-size: 1.2rem;
  }

  p {
    font-size: 0.88rem;
    line-height: 1.5;
  }
}

/* --- Mobile Landscape (< 768px, landscape) --- */
@media (max-width: 768px) and (orientation: landscape) {
  :root {
    --header-h: 44px;
  }

  .snap {
    height: 100vh;
  }

  .panel {
    height: 100vh;
  }

  .content {
    padding: 2vh 5vw;
  }

  .panel--text {
    padding-top: var(--header-h);
  }

  h1, h2 {
    font-size: 1.1rem;
    margin: 0 0 0.3rem 0;
  }

  p {
    font-size: 0.85rem;
    line-height: 1.4;
  }

  .dots {
    right: 6px;
    gap: 4px;
  }

  .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
  }

  /* Optimize layout for limited height */
  .panel--two-cols {
    grid-template-columns: 2fr 1fr;
    grid-template-areas: "media content";
  }

  .panel--two-cols.reverse {
    grid-template-areas: "content media";
  }

  .panel--two-cols .media {
    min-height: auto;
    align-self: flex-end;
  }

  .panel--two-cols .content {
    padding: 2vh 3vw;
    justify-content: center;
  }
}

/* ======================================
   EXTRA SMALL (< 480px)
   ====================================== */

@media (max-width: 480px) {
  :root {
    --header-h: 44px;
  }

  .site-title {
    font-size: 0.85rem;
  }

  h1, h2 {
    font-size: 1.1rem;
    margin: 0 0 0.4rem 0;
  }

  p {
    font-size: 0.85rem;
    line-height: 1.45;
  }

  .content {
    padding: 2.5vh 4vw;
  }

  .dots {
    right: 6px;
    gap: 4px;
  }

  .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
  }
}
