/* ─────────────────────────────────────────────────────────────
   DVSN Photography — styles globaux
   Principes : noir profond, la photo est la seule source de couleur,
   typographie discrète, animations liées au scroll (réversibles),
   aucune animation si prefers-reduced-motion.
   ───────────────────────────────────────────────────────────── */

@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/fonts/cormorant-garamond-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/fonts/cormorant-garamond-latin-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/fonts/cormorant-garamond-latin-400-italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --black: #000;
  --ink: #ece8e2;          /* blanc chaud, jamais pur */
  --ink-2: #a8a39c;        /* texte secondaire — contraste AA sur noir */
  --ink-3: #8a857e;        /* méta, discret — contraste AA sur noir */
  --line: rgba(236, 232, 226, 0.18);
  --serif: 'Cormorant Garamond', 'Garamond', 'Iowan Old Style', 'Times New Roman', serif;
  --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --gutter: max(16px, env(safe-area-inset-left), env(safe-area-inset-right));
  --gap: 3cqw;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --nav-h: 56px;
  color-scheme: dark;
}
@media (min-width: 900px) {
  :root { --gutter: max(4vw, env(safe-area-inset-left), env(safe-area-inset-right)); --nav-h: 64px; }
}

*, *::before, *::after { box-sizing: border-box; }
html {
  background: var(--black);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--black);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
/* clip (et non hidden) : ne crée pas de conteneur de défilement → position: sticky reste fonctionnel */
main { overflow-x: clip; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; font-weight: 400; }
ul { margin: 0; padding: 0; list-style: none; }
::selection { background: var(--ink); color: var(--black); }

:focus { outline: none; }
:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 6px;
  border-radius: 1px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px; left: var(--gutter);
  padding: 10px 14px;
  background: var(--ink); color: var(--black);
  font: 500 12px/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase;
  transform: translateY(-200%);
}
.skip-link:focus-visible { transform: none; outline-offset: 2px; }

/* ── Navigation ─────────────────────────────────────────────── */
.nav {
  position: fixed;
  z-index: 50;
  inset: 0 0 auto 0;
  height: calc(var(--nav-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) var(--gutter) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}
.nav > * { pointer-events: auto; }
.nav-brand, .nav-links {
  --fg: var(--ink);
  color: var(--fg);
  transition: color 0.5s var(--ease), text-shadow 0.5s var(--ease);
  text-shadow: 0 0 18px rgba(0, 0, 0, 0.35);
}
.nav-brand[data-tone='dark'], .nav-links[data-tone='dark'] {
  --fg: #0d0d0d;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.35);
}
.nav-brand {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 24px;
  letter-spacing: 0.08em;
  line-height: 1;
  padding: 8px 0;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(12px, 3.4vw, 36px);
  font-size: 11px;
  font-weight: 450;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.nav-links a {
  position: relative;
  display: inline-block;
  padding: 12px 0;         /* zone tactile ≥ 40px */
  opacity: 0.86;
  transition: opacity 0.3s var(--ease);
}
.nav-links a:hover { opacity: 1; }
.nav-links a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 8px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s var(--ease);
}
.nav-links a:hover::after, .nav-links a[aria-current='true']::after { transform: scaleX(1); }
.nav-lang { opacity: 0.6 !important; letter-spacing: 0.12em; }
@media (max-width: 360px) {
  .nav-links { gap: 10px; font-size: 10px; letter-spacing: 0.12em; }
  .nav-brand { font-size: 19px; }
}

/* ── Intro ──────────────────────────────────────────────────── */
.intro { position: relative; }
.work-anchor { position: absolute; top: 100vh; top: 100svh; }
.intro-stage { position: relative; }
.intro-title {
  height: 100vh;
  height: 100svh;
  display: grid;
  place-items: center;
  padding-inline: var(--gutter);
  font-family: var(--serif);
  font-size: clamp(19px, 2.9vw, 34px);
  font-weight: 500;
  letter-spacing: 0.34em;
  text-indent: 0.34em;           /* compense le tracking pour un centrage optique */
  line-height: 1;
  white-space: nowrap;
  text-align: center;
}
@media (max-width: 380px) {
  .intro-title { font-size: 17px; letter-spacing: 0.26em; text-indent: 0.26em; }
}
.intro .opening { padding-block: 10svh; }
.intro .series-head { display: none; }

/* ── Séries ─────────────────────────────────────────────────── */
.series { position: relative; }
.series + .series { margin-top: 34svh; }           /* respiration noire entre séries */
.series-head { padding-inline: var(--gutter); }
.series-head h2, .series-head .h2-like { line-height: 1; }
.t-large h2, .t-large .h2-like {
  font-family: var(--serif);
  font-size: clamp(50px, 10vw, 150px);
  letter-spacing: 0.01em;
}
.t-small { text-align: center; }
.t-small h2, .t-small .h2-like {
  font-size: 11px;
  font-weight: 450;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  color: var(--ink-2);
}
.t-quiet h2, .t-quiet .h2-like {
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  letter-spacing: 0.08em;
  color: var(--ink-2);
}
.series > .series-head { margin-bottom: 18svh; }

/* ── Blocs photo ────────────────────────────────────────────── */
.block {
  container-type: inline-size;
  display: flex;
  padding-inline: var(--gutter);
  margin-block: 14svh;
}
.block.is-featured { margin-block: 24svh; }
.ph { margin: 0; flex: none; }
.media {
  position: relative;
  width: 100%;
  background: var(--black);
}
.media img {
  width: 100%;
  height: auto;
  /* Pas d'enregistrement « en deux clics » : le clic droit, le glisser-déposer et
     l'appui long (iOS/Android) visent le cadre, jamais le fichier image. */
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}
.media { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.ph.is-broken .media img { visibility: hidden; }  /* espace conservé, aucun pictogramme d'erreur */
.ph figcaption {
  margin-top: 14px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}

/* Taille universelle : largeur = min(largeur max, hauteur max × ratio).
   Le ratio d'origine est toujours conservé. */
.single .ph { width: min(var(--mw), calc(var(--mh) * var(--ar))); margin-inline: auto; }

/* Mobile (par défaut) */
.single { --mw: 100cqw; --mh: 86svh; }
.single.m-full { padding-inline: 0; }
.single.m-inset { --mw: 100cqw; }
.single.m-tall { --mw: 100cqw; --mh: 86svh; }
.single.m-small-left { --mw: 72cqw; --mh: 60svh; }
.single.m-small-left .ph { margin-left: 0; }
.single.m-small-right { --mw: 72cqw; --mh: 60svh; }
.single.m-small-right .ph { margin-right: 0; }

/* Desktop */
@media (min-width: 900px) {
  .block { margin-block: 18svh; }
  .block.is-featured { margin-block: 30svh; }
  .single.m-full { padding-inline: var(--gutter); }
  .single.m-small-left .ph, .single.m-small-right .ph { margin-inline: auto; }

  .single.l-full { padding-inline: 0; --mw: 100cqw; --mh: 100svh; }
  .single.l-wide { --mw: 92cqw; --mh: 88svh; }
  .single.l-framed { --mw: 60cqw; --mh: 72svh; }
  .single.l-left { --mw: 60cqw; --mh: 80svh; }
  .single.l-left .ph { margin-left: 2cqw; }
  .single.l-right { --mw: 60cqw; --mh: 80svh; }
  .single.l-right .ph { margin-right: 2cqw; }
  .single.l-small-left { --mw: 34cqw; --mh: 56svh; }
  .single.l-small-left .ph { margin-left: 12cqw; }
  .single.l-small-right { --mw: 34cqw; --mh: 56svh; }
  .single.l-small-right .ph { margin-right: 12cqw; }
  .single.l-tall { --mw: 96cqw; --mh: 92svh; }
  .single.l-tall-left { --mw: 72cqw; --mh: 84svh; }
  .single.l-tall-left .ph { margin-left: 8cqw; }
  .single.l-tall-right { --mw: 72cqw; --mh: 84svh; }
  .single.l-tall-right .ph { margin-right: 8cqw; }
}

/* Groupes (paire / triptyque) :
   hauteur commune H = min(hauteur max, largeur dispo / Σ(ratio × k)) ; largeur = ratio × k × H */
.group {
  --hcap: 70svh;
  justify-content: center;
  align-items: flex-start;
  gap: var(--gap);
}
.group .ph {
  width: calc(var(--ar) * var(--k) * min(var(--hcap), (100cqw - (var(--n) - 1) * var(--gap)) / var(--sum)));
}
.group.g-side { align-items: center; }
.group.g-asym { align-items: flex-end; }
.group.g-mstack { display: block; }
.group.g-mstack .ph { width: min(86cqw, calc(66svh * var(--ar))); }
.group.g-mstack .ph + .ph { margin-top: 9svh; margin-left: auto; }

@media (min-width: 900px) {
  .group, .group.g-mstack { display: flex; }
  .group.g-mstack .ph { width: calc(var(--ar) * var(--k) * min(var(--hcap), (100cqw - (var(--n) - 1) * var(--gap)) / var(--sum))); }
  .group.g-mstack .ph + .ph { margin-top: 0; margin-left: 0; }
  .group.g-side { --hcap: 82svh; --gap: 2.4cqw; }
  .group.g-stagger { --hcap: 64svh; --gap: 6cqw; }
  .group.g-stagger .ph:nth-child(2), .group.g-stagger.g-mstack .ph:nth-child(2) { margin-top: 20svh; }
  .group.g-asym { --hcap: 82svh; --gap: 4cqw; }
}

/* ── Transition Work → About (dernier plan) ─────────────────── */
.finale { margin-bottom: 0; }

/* ── About ──────────────────────────────────────────────────── */
.about {
  padding: 40svh var(--gutter) 22svh;
}
.about-inner { max-width: 34rem; }
@media (min-width: 900px) {
  .about-inner { margin-left: 34%; }
}
.section-label {
  font-size: 11px;
  font-weight: 450;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 9svh;
}
.about p {
  font-family: var(--serif);
  font-size: clamp(25px, 2.5vw, 34px);
  font-weight: 500;
  line-height: 1.28;
  color: var(--ink);
}
.about p + p { margin-top: 1.4em; color: var(--ink-2); }
.placeholder { color: var(--ink-3) !important; font-style: italic; }

/* ── Contact ────────────────────────────────────────────────── */
.contact { padding: 18svh var(--gutter) 30svh; }
.contact-inner { max-width: 60rem; }
@media (min-width: 900px) {
  .contact-inner { margin-left: 34%; }
}
.contact-list li + li { margin-top: 5svh; }
.contact-list .k {
  display: block;
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.contact-list a {
  font-family: var(--serif);
  font-size: clamp(29px, 4.4vw, 58px);
  font-weight: 500;
  line-height: 1.1;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 0.6s var(--ease);
  overflow-wrap: anywhere;
}
.contact-list a:hover { background-size: 100% 1px; }

/* ── Écran final ────────────────────────────────────────────── */
.final {
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  padding: 16svh var(--gutter) calc(28px + env(safe-area-inset-bottom));
  margin-top: 14svh;
}
.final-mark {
  font-family: var(--serif);
  font-size: clamp(80px, 21vw, 300px);
  line-height: 0.9;
  letter-spacing: 0.06em;
  text-indent: 0.06em;
}
.final-foot { display: grid; gap: 14px; justify-items: center; text-align: center; }
.final-foot small { font-size: 11px; letter-spacing: 0.06em; color: var(--ink-3); }
.final-links { display: flex; gap: 22px; font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-2); }
.final-links a { padding: 10px 0; transition: color 0.3s var(--ease); }
.final-links a:hover { color: var(--ink); }

/* ── Curseur (desktop, pointeur fin uniquement) ─────────────
   Un point qui suit la souris sans retard + un anneau qui le rejoint en douceur. */
.cursor { display: none; }
@media (hover: hover) and (pointer: fine) {
  html.has-cursor, html.has-cursor a, html.has-cursor button { cursor: none; }
  .cursor {
    display: block;
    position: fixed;
    z-index: 200;
    top: 0; left: 0;
    pointer-events: none;
    mix-blend-mode: difference;
    opacity: 0;
    transition: opacity 0.4s var(--ease);
  }
  .cursor.is-on { opacity: 1; }
  .cursor-dot, .cursor-ring {
    position: absolute;
    top: 0; left: 0;
    border-radius: 50%;
    will-change: transform;
  }
  .cursor-dot {
    width: 6px; height: 6px;
    margin: -3px 0 0 -3px;
  }
  .cursor-dot > span, .cursor-ring > span {
    display: block;
    width: 100%; height: 100%;
    border-radius: inherit;
    transition: scale 0.5s var(--ease), opacity 0.5s var(--ease);
  }
  .cursor-dot > span { background: #fff; }
  .cursor-ring {
    width: 34px; height: 34px;
    margin: -17px 0 0 -17px;
  }
  .cursor-ring > span {
    border: 1px solid rgba(255, 255, 255, 0.55);
    scale: 0.5;
    opacity: 0;
  }
  .cursor[data-state='link'] .cursor-ring > span { scale: 1.25; opacity: 1; }
  .cursor[data-state='link'] .cursor-dot > span { scale: 0; }
  .cursor[data-state='photo'] .cursor-ring > span { scale: 1; opacity: 0.6; }
  .cursor.is-down .cursor-ring > span { scale: 0.8; }
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: reduce) {
  .cursor-ring { display: none; }
}

/* ─────────────────────────────────────────────────────────────
   Animations liées au scroll (CSS scroll-driven animations).
   - jouent sur le thread du compositeur (opacity / translate / scale)
   - naturellement réversibles : remonter rejoue l'animation à l'envers
   - navigateurs sans support → mise en page statique complète
   ───────────────────────────────────────────────────────────── */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {

    /* Navigation : apparaît une fois l'exposition commencée */
    .nav {
      animation: nav-in linear both;
      animation-timeline: scroll(root);
      animation-range: 12vh 42vh;
    }
    .nav:focus-within { animation: none; opacity: 1; }
    @keyframes nav-in { from { opacity: 0; } to { opacity: 1; } }

    /* Intro : DVSN PHOTOGRAPHY tient, se retire dans le noir (même transition que
       le dernier plan avant About), puis la première photographie remonte. */
    .intro { height: 260vh; height: 260svh; view-timeline: --intro block; }
    .intro-stage {
      position: sticky;
      top: 0;
      height: 100vh;
      height: 100svh;
      overflow: clip;
    }
    .intro-title {
      position: absolute;
      inset: 0;
      animation: finale-out linear both;
      animation-timeline: --intro;
      animation-range: contain 6% contain 38%;
    }
    .intro .opening {
      position: absolute;
      inset: 0;
      margin: 0;
      padding-block: 0;
      align-items: center;
      animation: intro-rise linear both;
      animation-timeline: --intro;
      animation-range: contain 42% contain 78%;
    }
    @keyframes intro-rise {
      from { translate: 0 100svh; }
      to { translate: 0 0; }
    }
    .intro .opening .ph { width: min(100cqw, calc(100svh * var(--ar))); }
    .intro .series-head {
      display: block;
      position: absolute;
      left: 0; right: 0; bottom: max(6svh, calc(18px + env(safe-area-inset-bottom)));
      animation: title-card linear both;
      animation-timeline: --intro;
      animation-range: contain 80% contain 92%;
    }
    @keyframes title-card {
      from { opacity: 0; translate: 0 2svh; }
      to { opacity: 1; translate: 0 0; }
    }
    .intro .work-anchor { position: absolute; top: 150svh; }
    .series.is-first > .series-head {
      position: absolute; width: 1px; height: 1px; overflow: hidden;
      clip-path: inset(50%); white-space: nowrap; margin: 0;
    }

    /* Effets photo */
    .fx-rise {
      animation: fx-rise linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 36%;
    }
    @keyframes fx-rise {
      from { opacity: 0; translate: 0 9vh; }
      to { opacity: 1; translate: 0 0; }
    }
    .fx-fade {
      animation: fx-fade linear both;
      animation-timeline: view();
      animation-range: entry 10% cover 40%;
    }
    @keyframes fx-fade { from { opacity: 0; } to { opacity: 1; } }
    .fx-zoom {
      animation: fx-fade linear both, fx-zoom linear both;
      animation-timeline: view(), view();
      animation-range: entry 0% cover 30%, entry 0% cover 50%;
    }
    @keyframes fx-zoom { from { scale: 1.06; } to { scale: 1; } }
    .fx-parallax {
      animation: fx-fade linear both, fx-drift linear both;
      animation-timeline: view(), view();
      animation-range: entry 0% cover 35%, cover 0% cover 100%;
    }
    @keyframes fx-drift { from { translate: 0 14vh; } to { translate: 0 -14vh; } }

    /* Titres de série : entrée lente */
    .series > .series-head h2 {
      animation: fx-fade linear both;
      animation-timeline: view();
      animation-range: entry 20% cover 45%;
    }

    /* Work → About : le dernier plan tient, puis se retire dans le noir */
    .finale-wrap { height: 210svh; view-timeline: --finale block; }
    .finale-wrap > .block {
      position: sticky;
      top: 0;
      height: 100svh;
      margin: 0;
      align-items: center;
    }
    .finale-wrap .ph {
      animation: finale-out linear both;
      animation-timeline: --finale;
      animation-range: contain 30% contain 100%;
    }
    @keyframes finale-out {
      0% { opacity: 1; scale: 1; }
      100% { opacity: 0; scale: 0.9; }
    }

    /* Contact → DVSN final : même transition, le contact tient puis se retire */
    .contact-wrap { height: 210svh; view-timeline: --contact block; }
    .contact-wrap > .contact {
      position: sticky;
      top: 0;
      min-height: 100svh;
      display: flex;
      align-items: center;
      padding-block: 10svh;
    }
    .contact-wrap .contact-inner {
      width: 100%;
      animation: finale-out linear both;
      animation-timeline: --contact;
      animation-range: contain 30% contain 100%;
    }
    .contact-wrap + .final { margin-top: 0; }

    /* About / Contact : apparitions douces, presque invisibles */
    .reveal {
      animation: fx-reveal linear both;
      animation-timeline: view();
      animation-range: entry 10% cover 34%;
    }
    @keyframes fx-reveal {
      from { opacity: 0; translate: 0 3vh; }
      to { opacity: 1; translate: 0 0; }
    }

    /* Écran final : DVSN se révèle comme le dernier plan d'un film */
    .final-mark {
      animation: final-mark linear both;
      animation-timeline: view();
      animation-range: entry 30% cover 55%;
    }
    @keyframes final-mark {
      from { opacity: 0; scale: 0.96; }
      to { opacity: 1; scale: 1; }
    }
  }

  /* Mobile : effets simplifiés (pas de dérive parallaxe, pas de zoom) */
  @media (prefers-reduced-motion: no-preference) and (max-width: 899px) {
    .fx-parallax, .fx-zoom {
      animation: fx-rise linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 36%;
    }
    .finale-wrap, .contact-wrap { height: 170svh; }
  }
}

@media (prefers-reduced-motion: no-preference) {
  html:not(.js) { scroll-behavior: smooth; }
}
