/* GRAVITISM LOCK — STABLE BUILD
 * DO NOT modify, refactor, replace, or improve existing styles unless the user
 * explicitly requests that exact part. Preserve all approved layout, sizing,
 * positioning, typography, transitions, animations, and responsive behavior.
 */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #fbfaf8;
}

body {
  font-family: 'Avant Garde', 'AvantGarde', 'Century Gothic', 'Avenir Next', Avenir, Arial, Helvetica, sans-serif;
}

.page {
  width: 100vw;
  height: 100svh;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #fbfaf8;
}

.artboard {
  position: relative;
  width: min(100vw, calc(100svh * 1.777897));
  aspect-ratio: 1672 / 941;
  overflow: hidden;
  background: #fbfaf8;
}

/* Exact header placement from the 1672 × 941 reference. */
.site-header {
  position: absolute;
  z-index: 20;
  top: calc(4.15% + 5px);
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
}


/* V159 — GRAVITISM wordmark on internal pages, vertically aligned with header navigation. */
.internal-wordmark {
  position:fixed;
  z-index:30;
  top:calc(4.15% + 5px);
  left:32px;
  transform:translateY(-50%);
  color:#f0eeea;
  text-decoration:none;
  font-family:'Avant Garde','AvantGarde','Century Gothic','Avenir Next',Avenir,Arial,Helvetica,sans-serif;
  font-size:16px;
  font-weight:400;
  letter-spacing:.34em;
  line-height:1;
  white-space:nowrap;
  opacity:.92;
  transition:opacity .25s ease, letter-spacing 900ms cubic-bezier(.2,.75,.25,1);
}
.internal-wordmark:hover,.internal-wordmark:focus-visible {
  opacity:.58;
  letter-spacing:.39em;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 34px;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: .22em;
}

.site-header a {
  color: #171717;
  text-decoration: none;
  transition: opacity .25s ease, transform 1200ms cubic-bezier(.2,.75,.25,1);
}

.site-header a:hover,
.site-header a:focus-visible {
  opacity: .48;
  transform: scaleX(1.055); transform-origin: center;
}

.site-header span {
  color: #171717;
  opacity: .58;
  font-size: 16px;
  letter-spacing: 0;
}

/*
  Exact logo placement derived from the supplied 1672 × 941 reference.
  SVG viewBox = 750 × 530.4
*/
.logo-layer {
  position: absolute;
  z-index: 4;
  left: 17.205%;
  top: 8.50%;
  width: 70.30%;
  height: auto;
  line-height: 0;
  transform-origin: top left;
  perspective: 700px;
}

.logo-layer .gravitisim-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

/* The artwork itself never animates automatically. */
.word-letter {
  transform-style: preserve-3d;
  backface-visibility: visible;
  transform-box: fill-box;
  transform-origin: 50% 100%;
  cursor: pointer;
  pointer-events: auto;
}

/* Keep the rest of the SVG exactly as supplied. */
.logo-layer path,
.logo-layer polygon,
.logo-layer rect,
.logo-layer line,
.logo-layer circle {
  vector-effect: non-scaling-stroke;
}

#particles,
#impact {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#particles {
  z-index: 6;
}

#impact {
  z-index: 7;
}

/*
  While a letter is animating, its exact SVG path stays in place underneath.
  A tiny visual "ghost" is avoided by briefly making only that path transparent.
*/
.word-letter.is-dropping {
  opacity: 0;
}


/* Tiny copyright notice on the home page. */
.copyright-notice {
  position: absolute;
  z-index: 25;
  left: 0;
  bottom: 7px;
  width: 100%;
  text-align: center;
  font-size: 9.8px;
  line-height: 1;
  letter-spacing: .08em;
  font-weight: 400;
  color: #777;
  pointer-events: none;
}

@media (max-width: 600px) {
  .copyright-notice {
    bottom: 6px;
    font-size: 8.4px;
  }
}

/* Tablet / portrait devices: use the full viewport rather than a fixed 16:9 artboard. */
@media (max-width: 1000px) {
  .page {
    display: block;
  }

  .artboard {
    width: 100vw;
    height: 100svh;
    aspect-ratio: auto;
  }

  .site-header {
    top: 33px;
  }

  .site-header nav {
    gap: 24px;
    font-size: 12px;
    letter-spacing: .19em;
  }

  .site-header a:hover,
  .site-header a:focus-visible { transform: scaleX(1.045); transform-origin: center; }

  .logo-layer {
    left: 7%;
    top: 22%;
    width: 86%;
  }
}

/* Phones: keep the whole identity visible and preserve comfortable touch targets. */
@media (max-width: 600px) {
  .site-header {
    top: 27px;
  }

  .site-header nav {
    gap: 13px;
    font-size: 9px;
    letter-spacing: .13em;
  }

  .site-header a:hover,
  .site-header a:focus-visible { transform: scaleX(1.035); transform-origin: center; }

  .logo-layer {
    left: -9.8%;
    top: 27%;
    width: 119.6%;
  }
}

/* Very short phones / landscape phones. */
@media (max-width: 900px) and (max-height: 500px) {
  .site-header {
    top: 21px;
  }

  .logo-layer {
    left: 13%;
    top: 15%;
    width: 74%;
  }
}
/* The central logo is clickable, but the pointer affordance only appears on painted logo artwork. */
#logoLayer {
  cursor: default;
}

.logo-layer .gravitisim-svg {
  pointer-events: visiblePainted;
}

.logo-cursor {
  position: fixed;
  left: 0;
  top: 0;
  width: 18px;
  height: 40px;
  pointer-events: none;
  z-index: 1000;
  opacity: 0;
  transform-origin: 10% 12%;
  will-change: transform, opacity;
  background: url("assets/Mouse-pointer.svg") center / contain no-repeat;
  filter: drop-shadow(0 0 1px rgba(255,255,255,.14));
  transition: opacity .12s ease;
}

.logo-cursor.is-visible {
  opacity: .96;
}

.logo-cursor-trail {
  position: fixed;
  left: 0;
  top: 0;
  width: 18px;
  height: 40px;
  pointer-events: none;
  z-index: 999;
  opacity: 0;
  transform-origin: 10% 12%;
  background: url("assets/Mouse-pointer.svg") center / contain no-repeat;
  filter: blur(.35px);
  will-change: transform, opacity;
}

@media (hover: none), (pointer: coarse) {
  .logo-cursor,
  .logo-cursor-trail {
    display: none;
  }
}

/* ---------------------------
   Tagline magnetic compression
   --------------------------- */
.logo-layer .tagline-letter {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  transition: transform 720ms cubic-bezier(.18,.82,.22,1);
  will-change: transform;
}

.logo-layer .gravitisim-svg.tagline-compress .tagline-letter {
  transform: translateX(calc(var(--tag-shift, 0) * 1px)) scaleX(1.045);
}

/* ---------------------------
   Page transition — colour dissolve
   Home -> WHO AM I: black
   WHO AM I -> Home: white
   --------------------------- */
.page-transition {
  position: fixed;
  inset: 0;
  z-index: 5000;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  background: #000;
}

.page-transition span,
.page-transition i,
.page-transition b { display: none; }

.page-transition.transition-black { background: #000; }
.page-transition.transition-white { background: #fff; }

.page-transition.is-leaving,
.page-transition.is-entering {
  visibility: visible;
  opacity: 1;
}

.page-transition.is-leaving {
  animation: gravTransitionCover 1s cubic-bezier(.76,0,.24,1) forwards;
}

.page-transition.is-entering {
  animation: gravTransitionReveal 1s cubic-bezier(.76,0,.24,1) forwards;
}

@keyframes gravTransitionCover {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes gravTransitionReveal {
  from { opacity: 1; }
  to   { opacity: 0; visibility: hidden; }
}

/* The SVG root itself is not a hit target; the JS checks the actual painted
   wordmark paths so the custom pointer can never appear over empty space. */
.logo-layer .gravitisim-svg { pointer-events: none; }
.logo-layer .word-letter { pointer-events: auto; }
.logo-layer .tagline-letter { pointer-events: auto; }


/* ---------------------------
   Language switcher
   Desktop: hover to open. Mobile/touch: tap the globe.
   The selected language is kept as the first row, aligned with the globe.
   --------------------------- */
.language-switcher {
  position: fixed;
  z-index: 60;
  top: calc(4.15% - 7px);
  right: 28px;
  height: 30px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  pointer-events: auto;
}

.language-globe {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  width: 58px;
  height: 30px;
  padding: 0 3px 0 4px;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  border: 0;
  background: transparent;
  color: #171717;
  cursor: pointer;
  pointer-events: auto;
  opacity: .78;
  transition: opacity .25s ease, transform .25s ease;
}
.language-globe:hover,
.language-globe:focus-visible { opacity: 1; }
.language-globe:focus-visible { outline: none; }
.language-globe svg { width: 22px; height: 22px; flex: 0 0 22px; display: block; }
.language-code {
  display: inline-block;
  font-family: inherit;
  font-size: 11px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: .12em;
  white-space: nowrap;
  color: currentColor;
}
.language-globe circle,
.language-globe path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.15;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.language-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 30px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 16px;
  background: rgba(251,250,248,.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition:
    width 320ms cubic-bezier(.18,.82,.22,1),
    opacity 180ms ease,
    height 360ms cubic-bezier(.18,.82,.22,1),
    border-color 220ms ease;
}

.language-list {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 0 31px 0 5px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 180ms ease, transform 280ms cubic-bezier(.18,.82,.22,1);
}

.language-option {
  flex: 1 1 0;
  min-height: 0;
  border: 0;
  background: transparent;
  color: #171717;
  font-family: inherit;
  font-size: 13px;
  line-height: 1;
  font-weight: 400;
  letter-spacing: .14em;
  text-align: left;
  padding: 0 6px;
  cursor: pointer;
  opacity: .52;
  white-space: nowrap;
  transition: opacity 180ms ease, transform 180ms ease;
}
.language-option:hover,
.language-option:focus-visible,
.language-option.active { opacity: 1; }
.language-option:hover { transform: translateX(2px); }
.language-option:focus-visible { outline: none; }

.language-switcher.is-open {
  height: 184px;
}

.language-switcher.is-open .language-panel {
  width: 125px;
  height: 184px;
  opacity: 1;
  pointer-events: auto;
  border-color: rgba(23,23,23,.12);
}
.language-switcher.is-open .language-list {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 270ms;
}
.language-switcher.is-open .language-globe { opacity: 1; }

/* Dark-page version */
.who-page .language-switcher { top: calc(4.15% - 7px); }
.who-page .language-globe { color: #f0eeea; }
.who-page .language-panel {
  background: rgba(17,16,15,.94);
  border-color: transparent;
}
.who-page .language-option { color: #f0eeea; }
.who-page .language-option.active,
.who-page .language-option:hover,
.who-page .language-option:focus-visible { color: #fff; }
.who-page .language-switcher.is-open .language-panel { border-color: rgba(240,238,234,.16); }

@media (max-width: 1000px) {
  .language-switcher { top: 25px; right: 20px; }
  .who-page .language-switcher { top: 25px; }
}

@media (max-width: 600px) {
  .language-switcher { top: 20px; right: 12px; }
  .who-page .language-switcher { top: 20px; }
  .language-globe { width: 54px; height: 26px; }
  .language-globe svg { width: 21px; height: 21px; flex-basis: 21px; }
  .language-code { font-size: 10px; }
  .language-panel { height: 26px; }
  .language-switcher.is-open .language-panel { width: 125px; height: 184px; }
  .language-list { padding-right: 31px; }
  .language-option { font-size: 14px; }
}

/* WORKS language switcher: visible on the dark page in its normal state. */
.works-page .language-globe { color: #f0eeea; opacity: .82; }
.works-page .language-globe:hover,
.works-page .language-globe:focus-visible { opacity: 1; }
.works-page .language-panel {
  background: rgba(17,16,15,.94);
  border-color: transparent;
}
.works-page .language-option { color: #f0eeea; }
.works-page .language-option.active,
.works-page .language-option:hover,
.works-page .language-option:focus-visible { color: #fff; }
.works-page .language-switcher.is-open .language-panel { border-color: rgba(240,238,234,.16); }

/* Generic incoming cover for all-page navigation. The approved visual styles remain unchanged. */
html.grav-incoming-home body > .page {
  opacity: 0;
  animation: gravGenericDestinationReveal 1000ms cubic-bezier(.22,.72,.22,1) forwards;
}

@keyframes gravGenericDestinationReveal {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* GRAVITISM dark-to-dark page transition: keep the shared atmosphere and
   particle canvas alive visually; dissolve only the page UI/content. */
html.grav-dark-dissolve-out body.theme-dark > *:not(canvas):not(.page-transition) {
  animation: gravDarkContentOut 1000ms cubic-bezier(.22,.72,.22,1) forwards;
}

html.grav-dark-dissolve-in body.theme-dark > *:not(canvas):not(.page-transition) {
  animation: gravDarkContentIn 1000ms cubic-bezier(.22,.72,.22,1) forwards;
}

html.grav-dark-dissolve-out body.theme-dark .page-transition,
html.grav-dark-dissolve-in body.theme-dark .page-transition {
  opacity: 0 !important;
  visibility: hidden !important;
  background: transparent !important;
}

@keyframes gravDarkContentOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes gravDarkContentIn {
  from { opacity: 0; }
  to { opacity: 1; }
}


@media (max-width: 900px) {
  .internal-wordmark { left:24px; font-size:13px; letter-spacing:.29em; }
}
@media (max-width: 600px) {
  .internal-wordmark { left:18px; top:27px; font-size:9px; letter-spacing:.20em; }
}

/* V160 — Use the supplied GRAVITISM logotype on all internal pages.
   Left edge aligns with internal page titles; vertical center aligns with header navigation. */
.internal-wordmark {
  left:5.2vw;
  top:calc(4.15% + 5px);
  transform:translateY(-50%);
  width:130px;
  height:auto;
  line-height:0;
  letter-spacing:0;
}
.internal-wordmark img {
  display:block;
  width:100%;
  height:auto;
  filter:none;
  opacity:.92;
}
.internal-wordmark:hover,.internal-wordmark:focus-visible { letter-spacing:0; }
@media (max-width:900px){
  .internal-wordmark{left:5vw;width:112px;}
}
@media (max-width:700px){
  .internal-wordmark{left:50%;top:27px;width:100px;transform:translate(-50%,-50%);}
}

/* V191 — phones: the GRAVITISM wordmark sits above the menu instead of on it. */
@media (max-width:700px){
  .internal-wordmark{top:19px !important;}
  body:has(.internal-wordmark) .site-header:not(.reader-header){top:36px !important;}
}

/* V195 — phones: the language switch is a small rounded "EN" box on the
   GRAVITISM row (top right), clear of the menu; the globe icon is hidden. */
@media (max-width:700px){
  html body .language-switcher{top:8px !important;right:12px !important;height:22px;transform:none}
  html body .language-switcher .language-globe{width:auto !important;height:22px !important;min-width:36px;padding:0 7px !important;gap:0 !important;justify-content:center !important;flex-direction:row !important;border:1px solid currentColor;border-radius:6px;opacity:.75}
  html body .language-switcher .language-globe svg{display:none !important}
  html body .language-switcher .language-code{font-size:10px !important;letter-spacing:.12em;line-height:1;margin:0 !important}
  html body .language-switcher .language-globe::after{content:"";position:absolute;inset:-10px -8px}
  html body .language-switcher.is-open{height:190px}
  html body .language-switcher.is-open .language-panel{width:150px;height:190px;top:-4px;right:-4px}
  html body .language-switcher .language-list{padding:30px 10px 6px 6px}
}

/* V201 — home page on very narrow and landscape phones.
   Narrow: the menu drops below the EN box so they never touch.
   Landscape: the logo is sized by the screen height so the wordmark and
   tagline stay clear of the copyright line. */
@media (max-width:360px){
  body:not(:has(.internal-wordmark)) .site-header:not(.reader-header){top:38px !important;}
}
@media (max-width:900px) and (max-height:500px) and (orientation:landscape){
  .logo-layer{
    --lw:min(74vw, calc((100svh - 104px) * 1.35));
    width:var(--lw);
    left:calc(50% - var(--lw) / 2);
    top:max(52px, calc((100svh - var(--lw) / 1.414) / 2 + 8px));
  }
}
/* Small portrait phones (e.g. 240×480) keep the normal phone logo, not the
   landscape one. */
@media (max-width:600px) and (max-height:500px) and (orientation:portrait){
  .logo-layer{left:-9.8%;top:25%;width:119.6%;}
}
/* Very narrow phones: the menu tightens so long translations
   (QUI SUIS-JE | ← ŒUVRES | CONTACT) stay on screen. */
@media (max-width:300px){
  html body .site-header nav{gap:7px !important;letter-spacing:.07em !important;}
}
