/* ═══════════════════════════════════════════════════════════
   CHRISTOPHE VERMARE — style.css
   Direction B: Space Mono + Cormorant Garamond
   All values derive from --unit. Never hardcode spatial values.
═══════════════════════════════════════════════════════════ */

/* ── TOKENS ──────────────────────────────────────────────── */
:root {
  --unit:          10px;

  --c-bg:          #ffffff;
  --c-ink:         #0a0a0a;
  --c-mid:         #666666;
  --c-faint:       #cccccc;

  --font-serif:    'Cormorant Garamond', Georgia, serif;
  --font-mono:     'Space Mono', 'Courier New', monospace;

  --type-display:  clamp(48px, 5.5vw, 80px);
  --type-title:    11px;
  --type-caption:  10px;
  --type-ui:       13px;
  --type-small:    9px;

  --lh-display:    0.92;
  --lh-body:       1.8;
  --lh-caption:    1.7;

  --ls-title:      0.12em;
  --ls-ui:         0.10em;
  --ls-small:      0.16em;

  --nav-h:         calc(var(--unit) * 4);   /* 40px  */
  --caption-h:     calc(var(--unit) * 6);   /* 60px  */
  --filmstrip-h:   calc(var(--unit) * 6);   /* 60px  */

  --photo-inset-x: 4%;
  --photo-inset-top: 10%;
  --photo-inset-bottom: 16%;
  --film-inset:    12%;

  --thumb-h:       calc(var(--unit) * 5);   /* 50px  */
  --thumb-gap:     calc(var(--unit) * 1);   /* 10px  */

  --overlay-w:     calc(var(--unit) * 72);  /* 720px */
  --overlay-nav-w: calc(var(--unit) * 24);  /* 240px */

  --margin:        calc(var(--unit) * 4);   /* 40px  */

  --ease-out:      cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:       cubic-bezier(0.7, 0, 0.84, 0);
  --ease-snap:     cubic-bezier(0.4, 0, 0.2, 1);

  --t-film-in:     400ms;
  --t-film-out:    800ms;
  --t-overlay:     320ms;
  --t-snap:        160ms;
  --t-lang:        180ms;
}

@media (min-width: 1280px) { :root { --margin: calc(var(--unit) * 5); } }
@media (min-width: 1440px) { :root { --margin: calc(var(--unit) * 6); } }

/* ── RESET ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--font-mono);
  font-size: var(--type-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; cursor: pointer; }
button { font-family: inherit; background: none; border: none; cursor: pointer; padding: 0; }

/* ── LANGUAGE ────────────────────────────────────────────── */
html[data-lang="fr"] [data-en] { display: none; }
html[data-lang="en"] [data-fr] { display: none; }

/* ── VIEWER ──────────────────────────────────────────────── */
.cv-viewer {
  position: fixed;
  inset: 0;
  background: var(--c-bg);
  z-index: 1;
  overflow: hidden;
}

.cv-photo-frame {
  position: absolute;
  inset: var(--photo-inset-top) var(--photo-inset-x) var(--photo-inset-bottom);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: inset 700ms var(--ease-in);
}
.is-ui-hidden .cv-photo-frame {
  inset: calc(var(--photo-inset-top) - 5%) calc(var(--photo-inset-x) - 3%) calc(var(--photo-inset-bottom) - 5%);
}
.cv-photo-frame img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

/* ── NAVIGATION ──────────────────────────────────────────── */
.cv-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--margin);
  background: transparent;
  transition:
    opacity var(--t-film-out) var(--ease-in),
    transform var(--t-film-out) var(--ease-in);
}
.cv-nav.is-hidden {
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
}

.cv-nav__name {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 13px;
  line-height: 1;
  color: var(--c-ink);
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: opacity var(--t-snap) var(--ease-snap);
}
.cv-nav__name:hover { opacity: 0.55; }

.cv-nav__links {
  display: flex;
  align-items: center;
  gap: calc(var(--unit) * 3);
}
.cv-nav__links:hover .cv-nav__item { color: var(--c-faint); }
.cv-nav__links .cv-nav__item:hover { color: var(--c-mid) !important; }

.cv-nav__item {
  font-size: var(--type-ui);
  letter-spacing: var(--ls-ui);
  text-transform: uppercase;
  color: var(--c-mid);
  cursor: pointer;
  transition: color var(--t-snap) var(--ease-snap);
  user-select: none;
}

.cv-nav__lang {
  font-size: var(--type-ui);
  letter-spacing: var(--ls-ui);
  color: var(--c-faint);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color var(--t-snap) var(--ease-snap);
}
.cv-nav__lang-active { color: var(--c-mid); transition: color var(--t-lang) var(--ease-snap); }
.cv-nav__lang:hover .cv-nav__lang-active { color: var(--c-ink); }
.cv-nav__lang-sep { color: var(--c-faint); }

/* ── CAPTION ─────────────────────────────────────────────── */
.cv-caption {
  display: none;
}
.cv-caption.is-hidden {
  display: none;
}
/* caption hidden */

/* ── FILMSTRIP ───────────────────────────────────────────── */
.cv-filmstrip-vignette {
  display: none;
}
.cv-filmstrip-vignette.is-hidden { display: none; }

.cv-filmstrip {
  position: fixed;
  bottom: 4%;
  left: var(--film-inset);
  right: var(--film-inset);
  height: var(--filmstrip-h);
  z-index: 10;
  overflow: visible;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: var(--thumb-gap);
  padding: 0 var(--unit);
  padding-bottom: calc(var(--filmstrip-h) * 0.15);
  transition:
    opacity var(--t-film-out) var(--ease-in),
    transform var(--t-film-out) var(--ease-in);
}
.cv-filmstrip.is-hidden {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

/* Rule + lemniscate */
.cv-filmstrip__rule {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  display: flex;
  align-items: center;
  pointer-events: none;
  overflow: visible;
}
.cv-filmstrip__rule::before,
.cv-filmstrip__rule::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--c-ink);
  opacity: 0.4;
}
.cv-filmstrip__rule-mark {
  flex-shrink: 0;
  padding: 0 8px;
  position: relative;
  top: 0;
  display: flex;
  align-items: center;
}

/* Numbered filmstrip */
.cv-thumb {
  flex-shrink: 0;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: var(--type-small);
  letter-spacing: 0.08em;
  color: var(--c-faint);
  padding: 0 calc(var(--unit) * 0.6);
  line-height: var(--thumb-h);
  height: var(--thumb-h);
  display: flex;
  align-items: center;
  transition: color var(--t-snap) var(--ease-snap);
  user-select: none;
}
.cv-thumb:hover { color: var(--c-mid); }
.cv-thumb.is-active {
  color: var(--c-ink);
  font-style: italic;
}

/* ── PORTFOLIO OVERLAY ───────────────────────────────────── */
.cv-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--t-overlay) var(--ease-out);
}
.cv-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}
.cv-overlay__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* Centred 720px panel */
.cv-overlay__panel {
  position: relative;
  z-index: 1;
  width: var(--overlay-w);
  max-height: 80vh;
  background: var(--c-bg);
  display: flex;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--c-faint);
}

.cv-overlay__nav {
  width: var(--overlay-nav-w);
  flex-shrink: 0;
  padding: calc(var(--unit) * 4) calc(var(--unit) * 3);
  border-right: 1px solid var(--c-faint);
  overflow-y: auto;
}

.cv-overlay__portfolio-name {
  font-size: var(--type-ui);
  letter-spacing: var(--ls-ui);
  text-transform: uppercase;
  color: var(--c-mid);
  padding: calc(var(--unit) * 0.7) 0;
  cursor: pointer;
  transition: color var(--t-snap);
  user-select: none;
  display: block;
}
.cv-overlay__portfolio-name:hover { color: var(--c-ink); }
.cv-overlay__portfolio-name.is-open { color: var(--c-ink); }

.cv-overlay__series-list {
  overflow: hidden;
  max-height: 0;
  transition: max-height 260ms var(--ease-out);
}
.cv-overlay__series-list.is-open { max-height: 300px; }

.cv-overlay__series-name {
  font-size: calc(var(--type-ui) - 0.5px);
  letter-spacing: 0.08em;
  color: var(--c-faint);
  padding: calc(var(--unit) * 0.5) 0 calc(var(--unit) * 0.5) calc(var(--unit) * 1.4);
  cursor: pointer;
  transition: color var(--t-snap);
  user-select: none;
  display: block;
}
.cv-overlay__series-name:hover { color: var(--c-mid); }
.cv-overlay__series-name.is-active { color: var(--c-mid); }

.cv-overlay__grid-wrap {
  flex: 1;
  padding: calc(var(--unit) * 4) calc(var(--unit) * 3);
  overflow-y: auto;
}
.cv-overlay__grid-label {
  font-size: var(--type-small);
  letter-spacing: var(--ls-small);
  text-transform: uppercase;
  color: var(--c-faint);
  margin-bottom: calc(var(--unit) * 2);
  display: block;
}
.cv-overlay__grid {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--unit) * 0.8);
  align-content: flex-start;
}
.cv-overlay__thumb {
  height: 80px;
  overflow: hidden;
  opacity: 0.55;
  cursor: pointer;
  transition: opacity var(--t-snap);
  flex-shrink: 0;
}
.cv-overlay__thumb:hover { opacity: 1; }
.cv-overlay__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.cv-overlay__close {
  position: absolute;
  top: calc(var(--unit) * 1.8);
  right: calc(var(--unit) * 2);
  font-size: var(--type-small);
  letter-spacing: var(--ls-small);
  text-transform: uppercase;
  color: var(--c-mid);
  cursor: pointer;
  z-index: 2;
  transition: color var(--t-snap);
}
.cv-overlay__close:hover { color: var(--c-ink); }

/* ── CONTACT OVERLAY ─────────────────────────────────────── */
.cv-contact {
  position: fixed;
  inset: 0;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--t-overlay) var(--ease-out);
}
.cv-contact.is-open { opacity: 1; pointer-events: all; }
.cv-contact__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.cv-contact__panel {
  position: relative;
  z-index: 1;
  width: 400px;
  padding: calc(var(--unit) * 5) calc(var(--unit) * 4);
}
.cv-contact__close {
  position: absolute;
  top: calc(var(--unit) * 1.5); right: 0;
  font-size: var(--type-small);
  letter-spacing: var(--ls-small);
  text-transform: uppercase;
  color: var(--c-mid);
  cursor: pointer;
  transition: color var(--t-snap);
}
.cv-contact__close:hover { color: var(--c-ink); }
.cv-contact__title {
  font-size: var(--type-small);
  letter-spacing: var(--ls-small);
  text-transform: uppercase;
  color: var(--c-mid);
  margin-bottom: calc(var(--unit) * 3);
  display: block;
}
.cv-contact__field { margin-bottom: calc(var(--unit) * 1.8); }
.cv-contact__label {
  display: block;
  font-size: calc(var(--type-small) - 0.5px);
  letter-spacing: var(--ls-small);
  text-transform: uppercase;
  color: var(--c-faint);
  margin-bottom: calc(var(--unit) * 0.7);
}
.cv-contact__input,
.cv-contact__textarea {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--c-faint);
  padding: calc(var(--unit) * 0.7) 0;
  font-size: var(--type-ui);
  color: var(--c-ink);
  background: transparent;
  outline: none;
  transition: border-color var(--t-snap);
  border-radius: 0;
  -webkit-appearance: none;
}
.cv-contact__input:focus,
.cv-contact__textarea:focus { border-color: var(--c-mid); }
.cv-contact__textarea { resize: none; height: calc(var(--unit) * 7); line-height: var(--lh-body); }
.cv-contact__submit {
  margin-top: calc(var(--unit) * 2.5);
  font-size: var(--type-small);
  letter-spacing: var(--ls-small);
  text-transform: uppercase;
  color: var(--c-mid);
  display: inline-block;
  transition: color var(--t-snap);
}
.cv-contact__submit:hover { color: var(--c-ink); }
.cv-contact__submit.is-sent { color: var(--c-faint); pointer-events: none; }

/* ── ABOUT PAGE ──────────────────────────────────────────── */
.cv-about {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: var(--c-bg);
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-overlay) var(--ease-out);
}
.cv-about.is-open { opacity: 1; pointer-events: all; }
.cv-about__inner {
  padding: calc(var(--nav-h) + var(--unit) * 6) var(--margin) calc(var(--unit) * 12);
  max-width: 780px;
}
.cv-about__name {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: var(--type-display);
  line-height: var(--lh-display);
  letter-spacing: 0.01em;
  margin-bottom: calc(var(--unit) * 5);
}
.cv-about__section-label {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: 26px;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--c-ink);
  margin-bottom: calc(var(--unit) * 2);
  margin-top: calc(var(--unit) * 6);
  display: block;
}
.cv-about__body {
  font-size: 13px;
  line-height: 1.9;
  color: var(--c-mid);
  max-width: 560px;
}
.cv-about__body p + p { margin-top: calc(var(--unit) * 2); }
.cv-about__list { list-style: none; margin-top: calc(var(--unit) * 2); }
.cv-about__list-item {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: calc(var(--unit) * 2);
  padding: calc(var(--unit) * 0.8) 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 11px;
  color: var(--c-mid);
  line-height: 1.5;
}
.cv-about__list-year { color: var(--c-faint); }

/* ── HAMBURGER BUTTON ────────────────────────────────────────── */
.cv-nav__hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  color: var(--c-mid);
  transition: color var(--t-snap) var(--ease-snap);
}
.cv-nav__hamburger:hover { color: var(--c-ink); }
.cv-nav__hamburger svg { width: 16px; height: 12px; display: block; }

/* ── RESPONSIVE — TABLETTE (≤ 1024px) ───────────────────────── */
@media (max-width: 1024px) {
  :root {
    --overlay-w: min(calc(var(--unit) * 72), calc(100vw - 32px));
  }
}

/* ── RESPONSIVE — MOBILE (≤ 767px) ──────────────────────────── */
@media (max-width: 767px) {
  :root {
    --margin:               calc(var(--unit) * 2);   /* 20px */
    --photo-inset-top:      8%;
    --photo-inset-bottom:   22%;
    --film-inset:           3%;
    --overlay-w:            calc(100vw - 16px);
    --overlay-nav-w:        100%;
  }

  /* ── Nav ──────────────────────────────────────────────── */
  .cv-nav__hamburger { display: flex; }

  .cv-nav__links {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: var(--c-bg);
    padding: calc(var(--unit) * 2) var(--margin) calc(var(--unit) * 3);
    gap: calc(var(--unit) * 2);
    z-index: 9999;
    border-top: 1px solid var(--c-faint);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  }
  .cv-nav__links.is-mobile-open { display: flex; }

  /* ── Flèches de navigation ────────────────────────────── */
  .cv-viewer .cv-nav-arrow {
    opacity: 0.35;
    padding: 24px 10px;
  }

  /* ── Filmstrip : défilement horizontal ───────────────── */
  .cv-filmstrip {
    overflow-x: auto;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .cv-filmstrip::-webkit-scrollbar { display: none; }

  /* ── Overlay portfolio : colonne ─────────────────────── */
  .cv-overlay__panel { flex-direction: column; }

  .cv-overlay__nav {
    width: 100%;
    flex-shrink: 0;
    border-right: none;
    border-bottom: 1px solid var(--c-faint);
    padding: calc(var(--unit) * 1.5) var(--margin);
    max-height: 38vh;
    overflow-y: auto;
  }

  .cv-overlay__grid-wrap {
    padding: calc(var(--unit) * 2) var(--margin);
  }

  .cv-overlay__close {
    top: calc(var(--unit) * 1);
    right: var(--margin);
  }

  .cv-overlay__thumb { height: 64px; }

  /* ── Panneau contact : fluide ─────────────────────────── */
  .cv-contact__panel {
    width: calc(100vw - calc(var(--unit) * 4));
    max-width: 400px;
    padding: calc(var(--unit) * 4) calc(var(--unit) * 3);
  }

  /* ── Nav dans les pages de contenu : masqué sur mobile ── */
  .cv-about .cv-nav { display: none; }

  /* ── Bouton retour sur les pages de contenu ───────────── */
  .cv-about__back {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-h);
    display: flex;
    align-items: center;
    padding: 0 var(--margin);
    z-index: 10;
    background: var(--c-bg);
    border-bottom: 1px solid var(--c-faint);
    font-size: var(--type-small);
    letter-spacing: var(--ls-small);
    text-transform: uppercase;
    color: var(--c-mid);
    cursor: pointer;
    transition: color var(--t-snap);
  }
  .cv-about__back:hover { color: var(--c-ink); }

  /* ── Pages de contenu (Biographie, Livres…) ──────────── */
  .cv-about__inner {
    padding-top: calc(var(--nav-h) + calc(var(--unit) * 3));
    padding-bottom: calc(var(--unit) * 8);
  }

  .cv-about__section-label { font-size: 22px; }

  .cv-about__list-item { grid-template-columns: 46px 1fr; }

  /* Annuler les flottants des images inline */
  .cv-about__body img {
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: calc(var(--unit) * 1.5) 0 !important;
    display: block !important;
  }

  /* Vidéo pleine largeur */
  .cv-about video {
    width: 100% !important;
    height: auto !important;
    max-width: 100%;
  }
}
