/* ═══════════════════════════════════════════════════════════════════════════
   VAIN Studio — DA « Monolog » : noir grainé + crème, hairlines, typo oversize.
   Zéro dépendance. Fonts self-hosted. Scroll-driven animations avec fallback IO.
   ═══════════════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-italic-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

/* ── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  --noir: #0c0c0d;
  --noir-2: #131315;
  --blanc: #f4f2ee;
  --mute-d: rgba(244, 242, 238, 0.56);
  --hair-d: rgba(244, 242, 238, 0.16);
  --turquoise: #17b9bd;
  --display: "Archivo", system-ui, sans-serif;
  --body: "Archivo", system-ui, sans-serif;
  --mono: "Archivo", system-ui, sans-serif;
  --pad: clamp(20px, 5vw, 72px);
  --ease-out: cubic-bezier(0.19, 1, 0.22, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --t-press: 150ms;   /* feedback au press */
  --t-state: 250ms;   /* hover, changements d'état */
  --t-reveal: 450ms;  /* reveals décoratifs */
  --header-h: 64px;
  /* Échelle typographique — 4 crans display, tracking/graisse unifiés */
  --fs-title: clamp(16px, 1.4vw, 20px);        /* noms de cartes */
  --fs-h3: clamp(22px, 2.6vw, 34px);           /* titres de dialog */
  --fs-display-m: clamp(30px, 4.6vw, 64px);    /* manifesto, pages projets */
  --fs-display-l: clamp(36px, 6vw, 88px);      /* statement contact */
  --tracking-display: -0.028em;
  --w-display: 640;
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-x: hidden; overflow-x: clip; scroll-behavior: smooth; scrollbar-gutter: stable; }
html:has(dialog[open]) { overflow: hidden; }
body {
  overflow-x: hidden; overflow-x: clip;
  background: var(--noir);
  color: var(--blanc);
  font-family: var(--body);
  font-weight: 420;
  font-size: clamp(15px, 1.05vw, 17px);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
[hidden] { display: none !important; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
em { font-style: italic; }
:focus-visible { outline: 2px solid var(--turquoise); outline-offset: 3px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

/* Scrollbar — fine, sombre, dans la DA */
html { scrollbar-width: thin; scrollbar-color: rgba(244, 242, 238, 0.25) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(244, 242, 238, 0.2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(244, 242, 238, 0.35); }
::-webkit-scrollbar-corner { background: transparent; }

/* Grain global — visible sur le noir, discret sur crème. Zéro requête. */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 3;
  opacity: 0.055;
  background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="180" height="180"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.72" numOctaves="2" stitchTiles="stitch"/><feColorMatrix type="saturate" values="0"/></filter><rect width="100%25" height="100%25" filter="url(%23n)"/></svg>');
  background-size: 180px 180px;
}


/* ── Micro-labels techniques ────────────────────────────────────────────── */
.k {
  font-family: var(--body);
  font-size: 10.5px;
  font-weight: 620;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--mute-d);
}
.k-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
  margin-right: 10px;
  vertical-align: 1px;
}

/* Statements typographiques */
.statement {
  font-family: var(--display);
  font-weight: var(--w-display);
  font-size: var(--fs-display-l);
  line-height: 1.04;
  letter-spacing: var(--tracking-display);
  text-wrap: balance;
}
.statement em { font-style: italic; font-weight: 560; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--pad);
  color: var(--blanc);
  pointer-events: none;
}
.header-wordmark {
  pointer-events: auto;
  font-family: var(--display);
  font-weight: 620;
  font-size: 16px;
  letter-spacing: -0.015em;
  color: var(--blanc);
  transition: opacity var(--t-state) ease;
}
.header-wordmark:hover { opacity: 0.7; }
.header-wordmark:active { opacity: 0.5; }
.site-header .header-link {
  pointer-events: auto;
  padding-bottom: 3px;
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-state) ease, color var(--t-state) ease;
}
.site-header .header-link:hover { border-bottom-color: currentColor; }
.site-header .header-link:active { opacity: 0.6; }

.header-cta {
  font-size: 13px;
  font-weight: 560;
  padding: 9px 16px;
  border: 1px solid currentColor;
  border-radius: 999px;
  white-space: nowrap;
  transition: background-color var(--t-state) ease, color var(--t-state) ease;
}
.site-header .header-cta:hover { background: var(--blanc); color: var(--noir); border-color: var(--blanc); }


/* ── Hero — le mark XXL déborde, la ligne géante se coupe aux bords ─────── */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--header-h) + clamp(4px, 2vh, 24px)) 0 clamp(28px, 5vh, 60px);
  overflow: hidden;
}

#bg-liquid {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
}
main, .site-footer { position: relative; z-index: 1; }
.logo-stage {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  display: block;
}
.logo-fallback { width: clamp(120px, 22vw, 200px); height: auto; opacity: 0.95; }
.logo-stage.gl-on .logo-fallback { display: none; }

.hero-line {
  position: absolute;
  z-index: 3;
  left: 0; right: 0;
  bottom: clamp(30px, 7vh, 72px);
  pointer-events: none;
  text-align: center;
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(13px, 1.35vw, 21px);
  line-height: 1.5;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  text-indent: 0.34em;   /* compense le tracking du dernier caractère pour un vrai centrage */
  color: var(--blanc);
}

/* ── Sections communes ──────────────────────────────────────────────────── */
main section { position: relative; scroll-margin-top: var(--header-h); }
.section-head {
  padding: clamp(56px, 9vh, 110px) var(--pad) clamp(30px, 5vh, 60px);
}
.section-head .statement { margin-top: 22px; max-width: 18ch; }

/* ── Projets — grille filtrable crème ───────────────────────────────────── */
.projects { padding-bottom: clamp(60px, 9vh, 120px); }
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px clamp(18px, 2.5vw, 34px);
  margin-top: clamp(22px, 4vh, 40px);
}
.filter {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 2px 0;
  color: var(--mute-d);
  border-bottom: 1px solid transparent;
  transition: color var(--t-state) ease, border-color var(--t-state) ease;
}
.filter:hover { color: var(--blanc); }
.filter:active { opacity: 0.6; }
.filter.is-active { color: var(--blanc); border-bottom-color: var(--blanc); }

.pj-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(18px, 2.6vw, 40px) clamp(14px, 2vw, 28px);
  padding: 0 var(--pad);
}
.pj {
  min-width: 0;
  transition: opacity var(--t-state) var(--ease-out), transform var(--t-state) var(--ease-out);
}
.pj.is-leaving { opacity: 0; transform: scale(0.98); transition-duration: var(--t-press); }
.pj.is-out { display: none; }
.pj.is-pre { opacity: 0; transform: translateY(8px); transition: none; }
.pj-open {
  display: block; width: 100%; text-align: left;
  transition: transform var(--t-press) var(--ease-out);
}
.pj-open:active { transform: scale(0.985); }
.pj-media {
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: var(--noir-2);
}
.pj-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--t-reveal) var(--ease-out), opacity 300ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .pj-open:hover .pj-media img { transform: scale(1.04); }
}
.card-typo {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 12px;
  text-align: center;
  font-family: var(--display); font-weight: 640;
  font-size: clamp(16px, 1.6vw, 24px);
  color: var(--mute-d);
}
.pj-meta { padding: 12px 2px 0; }
.pj-name {
  color: var(--blanc);
  font-family: var(--display);
  font-weight: 620;
  font-size: var(--fs-title);
  line-height: 1.15;
  letter-spacing: -0.012em;
}
.pj-facts {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 5px;
}
.pj-tag { font-size: 12px; color: var(--mute-d); }
.pj-index { font-size: 10px; }


/* ── Services — manifesto + liste oversize ──────────────────────────────── */
.services { border-top: 1px solid var(--hair-d); }
.manifesto-wrap { padding: clamp(70px, 12vh, 130px) var(--pad); }
.manifesto {
  font-family: var(--display);
  font-weight: var(--w-display);
  font-size: var(--fs-display-m);
  line-height: 1.12;
  letter-spacing: var(--tracking-display);
  max-width: 22ch;
}
.manifesto .w { color: var(--mute-d); transition: color var(--t-reveal) ease; }
.manifesto .w.lit { color: var(--blanc); }



/* ── Contact — CTA final plein écran ────────────────────────────────────── */
.contact {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(22px, 4vh, 40px);
  text-align: center;
  padding: clamp(70px, 12vh, 140px) var(--pad);
  border-top: 1px solid var(--hair-d);
}
.contact .statement em { color: var(--turquoise); font-style: italic; }
.contact-mail {
  transition: border-color var(--t-state) ease, color var(--t-state) ease, transform var(--t-press) var(--ease-out);
  font-family: var(--display);
  font-weight: 620;
  font-size: clamp(20px, 3.2vw, 44px);
  letter-spacing: -0.02em;
  padding-bottom: 6px;
  border-bottom: 1.5px solid var(--hair-d);
  transition: border-color var(--t-state) ease, color var(--t-state) ease;
}
.contact-mail:hover { border-color: var(--blanc); }
.contact-mail:active { transform: scale(0.985); }
.contact-socials { display: flex; align-items: center; gap: 14px; color: var(--mute-d); }
.contact-socials a { transition: color var(--t-state) ease; }
.contact-socials a:hover { color: var(--blanc); }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  align-items: center;
  justify-content: space-between;
  padding: 22px var(--pad) calc(22px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--hair-d);
  font-size: 12.5px;
  color: var(--mute-d);
}
.site-footer nav { display: flex; gap: 18px; }
.site-footer a { border-bottom: 1px solid var(--hair-d); transition: color var(--t-state) ease; }
.site-footer a:hover { color: var(--blanc); }

/* ── Dialogs projets ────────────────────────────────────────────────────── */
dialog {
  width: min(860px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  margin: auto;
  border: 0;
  background: var(--noir-2);
  color: var(--blanc);
  overflow: hidden auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;                                  /* Firefox + Chrome 121+ */
  scrollbar-color: rgba(244, 242, 238, 0.25) transparent;
}
dialog::-webkit-scrollbar { width: 10px; }                /* Safari */
dialog::-webkit-scrollbar-track { background: transparent; }
dialog::-webkit-scrollbar-thumb {
  background: rgba(244, 242, 238, 0.22);
  border-radius: 99px;
  border: 3px solid var(--noir-2);
}
dialog::-webkit-scrollbar-thumb:hover { background: rgba(244, 242, 238, 0.38); }
dialog::backdrop { background: rgba(8, 8, 9, 0.82); }

/* Entrée/sortie du dialog — enhancement moderne, apparition instantanée sinon */
@supports (transition-behavior: allow-discrete) {
  dialog {
    opacity: 0;
    transform: scale(0.98) translateY(8px);
    transition:
      opacity 160ms var(--ease-out),
      transform 160ms var(--ease-out),
      overlay 160ms allow-discrete,
      display 160ms allow-discrete;
  }
  dialog[open] {
    opacity: 1;
    transform: none;
    transition-duration: 220ms;
  }
  @starting-style {
    dialog[open] { opacity: 0; transform: scale(0.97) translateY(10px); }
  }
  dialog::backdrop {
    opacity: 0;
    transition: opacity 220ms ease, overlay 220ms allow-discrete, display 220ms allow-discrete;
  }
  dialog[open]::backdrop { opacity: 1; }
  @starting-style {
    dialog[open]::backdrop { opacity: 0; }
  }
}
.dlg-close {
  position: sticky;
  top: 12px;
  margin-left: calc(100% - 48px);
  z-index: 2;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(244, 242, 238, 0.1);
  transition: background-color var(--t-state) ease;
}
.dlg-close:hover { background: rgba(244, 242, 238, 0.22); }
.dlg-close { transition: background-color var(--t-state) ease, transform var(--t-press) var(--ease-out); }
.dlg-close:active { transform: scale(0.9); }
.dlg-embed { aspect-ratio: 16 / 9; background: #000; margin-top: -48px; }
.dlg-embed iframe { width: 100%; height: 100%; border: 0; display: block; }
dialog > img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; margin-top: -48px; }
.dlg-body { padding: 26px clamp(20px, 4vw, 40px) 36px; }
.dlg-kicker {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mute-d);
  margin-bottom: 12px;
}
.dlg-body h3 {
  font-family: var(--display);
  font-weight: var(--w-display);
  font-size: var(--fs-h3);
  letter-spacing: var(--tracking-display);
  margin-bottom: 10px;
}
.dlg-role { color: var(--mute-d); font-size: 13.5px; margin-bottom: 14px; }
.dlg-desc { max-width: 62ch; }
.dlg-specs { color: var(--mute-d); font-size: 13.5px; margin-top: 12px; }
.dlg-link {
  display: inline-block;
  margin-top: 18px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--hair-d);
  transition: border-color var(--t-state) ease;
}
.dlg-link:hover { border-color: var(--blanc); }

/* Galerie case study (planches) */
.dlg-gallery {
  display: grid;
  gap: clamp(28px, 4vh, 44px);
  padding: 0 clamp(20px, 4vw, 40px) 40px;
}
.dlg-g { margin: 0; }
.dlg-g figcaption { display: block; margin-bottom: 10px; }
.dlg-g img { width: 100%; height: auto; transition: opacity 300ms ease; }
img.img-pending { opacity: 0; }
.dlg-g video { display: block; max-width: 100%; max-height: 72vh; margin-inline: auto; background: #000; }
.dlg-gif { display: block; width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--hair-d); }
.charte-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  width: 100%;
  padding: 20px 26px;
  border: 1px solid var(--hair-d);
  border-radius: 6px;
  font-weight: 620; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--blanc);
  transition: background-color var(--t-state) ease, color var(--t-state) ease, border-color var(--t-state) ease;
}
.charte-btn:hover { background: var(--blanc); color: var(--noir); border-color: var(--blanc); }
.charte-btn:active { transform: scale(0.99); }
.charte-btn-icon { transition: transform 0.35s var(--ease-out); font-size: 14px; }
.charte-block.is-open .charte-btn-icon { transform: rotate(180deg); }
.charte-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.5s var(--ease-out);
}
.charte-block.is-open .charte-panel { grid-template-rows: 1fr; }
.charte-panel-in { min-height: 0; overflow: hidden; }
.charte-panel-in > * { margin-top: 14px; }
.dlg-iframe { display: block; width: 100%; height: min(74vh, 720px); border: 1px solid var(--hair-d); border-radius: 6px; background: var(--noir-2); }
.dlg-iframe-open { display: inline-block; }

/* ── Motion — socle IO (universel) ──────────────────────────────────────── */
.line { display: block; overflow: hidden; }
.line-in {
  display: block;
  transform: translateY(110%);
  transition: transform 0.7s var(--ease-out);
  transition-delay: var(--d, 0ms);
}
.line.in .line-in { transform: translateY(0); }

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.55s var(--ease-out);
  transition-delay: var(--d, 0ms);
}
.reveal.in { opacity: 1; transform: none; }

/* Entrée du hero */
.logo-stage {
  opacity: 0;
  transition: opacity 0.7s ease 0.15s;
}
html.is-ready .logo-stage { opacity: 1; }

/* ── Motion — scroll-driven (progressive enhancement) ───────────────────── */
@supports (animation-timeline: view()) {
  /* Manifesto : les mots s'illuminent séquentiellement au fil du scroll */
  .manifesto-wrap { view-timeline: --manif block; }
  .manifesto .w {
    animation: w-lit linear both;
    animation-timeline: --manif;
    animation-range: entry calc(18% + var(--wi, 0) * 3.2%) entry calc(34% + var(--wi, 0) * 3.2%);
  }
  @keyframes w-lit { to { color: var(--blanc); } }
}

/* ── Reduced motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .line-in { transform: none; }
  .reveal { opacity: 1; transform: none; }
  .logo-stage { opacity: 1; }
  .manifesto .w { color: var(--blanc); animation: none; }
}

/* ── Sans JS : tout visible ─────────────────────────────────────────────── */
html:not(.js) .line-in { transform: none; }
html:not(.js) .reveal { opacity: 1; transform: none; }
html:not(.js) .logo-stage { opacity: 1; }
html:not(.js) .manifesto .w { color: var(--blanc); }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
}
@media (max-width: 760px) {
  .pj-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { min-height: 100svh; }
  .hero-line { font-size: 12px; letter-spacing: 0.3em; padding-inline: 18px; }
  .dlg-close { top: 8px; margin-left: calc(100% - 44px); }
}

/* ── Pages projets (versions indexables des case studies) ───────────────── */
@media (prefers-reduced-motion: no-preference) {
  .pp-main > * {
    animation: pp-in 0.4s var(--ease-out) both;
  }
  .pp-main > *:nth-child(2) { animation-delay: 90ms; }
  .pp-main > *:nth-child(n+3) { animation-delay: 180ms; }
  @keyframes pp-in {
    from { opacity: 0; transform: translateY(10px); filter: blur(3px); }
    to   { opacity: 1; transform: none; filter: none; }
  }
}
.pp-main {
  max-width: 900px;
  margin-inline: auto;
  padding: calc(var(--header-h) + clamp(24px, 5vh, 56px)) var(--pad) clamp(48px, 8vh, 90px);
}
.pp-title {
  font-family: var(--display);
  font-weight: var(--w-display);
  font-size: var(--fs-display-m);
  line-height: 1.04;
  letter-spacing: var(--tracking-display);
  margin-bottom: 12px;
}
.pp-main .dlg-desc { margin-top: 6px; }
.pp-hero { width: 100%; height: auto; margin-top: 28px; }
.pp-main .dlg-embed { margin-top: 28px; aspect-ratio: 16 / 9; background: #000; }
.pp-main .dlg-embed iframe { width: 100%; height: 100%; border: 0; display: block; }
.pp-gallery { padding: 28px 0 0; }
.pp-back { margin-top: 36px; }
