/* ==========================================================================
   TIMOTHÉUS — BASE : reset, fond, scène, contour de survol, curseur
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  background: #000;
}

body {
  margin: 0;
  min-height: 100svh;
  background: #000;
  color: var(--white);
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  line-height: 1.35;
  text-transform: uppercase;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
  text-transform: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

img,
video {
  display: block;
  max-width: 100%;
}

.mono {
  font-family: var(--font-mono);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

::selection {
  background: var(--white);
  color: var(--black);
}

/* --------------------------------------------------------------------------
   Arrière-plans : fixes, plein écran, fondu enchaîné entre pages
   -------------------------------------------------------------------------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #000;
}

.bg__layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 900ms var(--ease);
}

.bg__layer.is-active {
  opacity: 1;
}

.bg__layer[data-page="home"] { background: var(--fallback-home); }
.bg__layer[data-page="work"] { background: var(--fallback-work); }
.bg__layer[data-page="about"] { background: var(--fallback-about); }
.bg__layer[data-page="contact"] { background: var(--fallback-contact); }

/* Parallaxe : on déplace ce conteneur, légèrement agrandi pour ne pas voir les bords */
.bg__parallax {
  position: absolute;
  inset: -3%;
  will-change: transform;
}

.bg__media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 600ms ease;
}

.bg__media.is-loaded {
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Scène : centre la carte ; la page défile si la carte dépasse l'écran
   -------------------------------------------------------------------------- */
.stage {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding: 48px 16px;
}

.stage > .card {
  margin: auto; /* centrage sûr, même quand la carte est plus haute que l'écran */
}

/* --------------------------------------------------------------------------
   CONTOUR DE SURVOL — rectangle blanc 1px autour des éléments cliquables
   Utilisé aussi pour le focus clavier et l'état actif de la navigation.
   -------------------------------------------------------------------------- */
.hit {
  position: relative;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.hit::after {
  content: "";
  position: absolute;
  inset: calc(var(--hit-y) * -1) calc(var(--hit-x) * -1);
  border: 1px solid var(--white);
  opacity: 0;
  transform: scale(1.06, 1.25);
  transition:
    opacity var(--t-fast) ease,
    transform var(--t-fast) var(--ease);
  pointer-events: none;
}

@media (hover: hover) {
  .hit:hover::after {
    opacity: 1;
    transform: none;
  }
}

/* Tactile : le contour apparaît à l'appui */
.hit:active::after,
.hit:focus-visible::after,
.hit.is-active::after {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------------------
   Curseur personnalisé (ordinateur uniquement, activé par JS)
   -------------------------------------------------------------------------- */
.cursor {
  display: none;
}

.has-cursor,
.has-cursor a,
.has-cursor button {
  cursor: none;
}

.has-cursor .cursor {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: var(--white);
  pointer-events: none;
  mix-blend-mode: difference;
  transition:
    width 200ms var(--ease),
    height 200ms var(--ease),
    margin 200ms var(--ease),
    opacity 200ms ease;
  will-change: transform;
}

.has-cursor .cursor.is-hover {
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
}

.has-cursor .cursor.is-hidden {
  opacity: 0;
}

/* --------------------------------------------------------------------------
   Aperçu projet (survol d'une ligne du tableau) : passe au-dessus du fond
   -------------------------------------------------------------------------- */
.bg__preview {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  transition: opacity 500ms var(--ease);
}

.bg__preview.is-active {
  opacity: 1;
}

/* flou comme les autres fonds (agrandi pour masquer les bords flous) */
.bg__pimg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  filter: blur(18px) saturate(1.1);
  transform: scale(1.14);
  transition:
    opacity 450ms ease,
    transform 1400ms var(--ease);
}

.bg__pimg.is-on {
  opacity: 1;
  transform: scale(1.1);
}

/* Fenêtres ouvertes (fiche projet, visionneuse) : le point blanc y est
   déplacé par js/app.js pour rester au premier plan ; pas de souris système. */
.has-cursor dialog[open],
.has-cursor dialog[open] * {
  cursor: none;
}

/* --------------------------------------------------------------------------
   ÉCRAN D'ENTRÉE (js/intro.js) : fond noir et blanc + carte TIMOTHÉUS
   -------------------------------------------------------------------------- */
.has-intro body {
  overflow: hidden;
}

.splash {
  position: fixed;
  inset: 0;
  z-index: 95; /* sous le curseur personnalisé */
  display: grid;
  place-items: center;
  background: #000;
  transition: opacity 1000ms var(--ease);
}

.splash[hidden] {
  display: none;
}

.splash.is-leaving {
  opacity: 0;
  pointer-events: none;
}

.splash__bg {
  position: absolute;
  inset: -3%;
}

.splash__card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 30px 52px 26px;
  border-radius: var(--card-radius);
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.04) 100%);
  -webkit-backdrop-filter: blur(26px) saturate(120%);
  backdrop-filter: blur(26px) saturate(120%);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  color: var(--white);
  outline: none;
  animation: splash-in 1300ms var(--ease) both;
  transition: transform 900ms var(--ease), filter 900ms var(--ease);
}

@media (hover: hover) {
  .splash__card:hover {
    transform: scale(1.02);
  }
}

.splash__card:focus-visible {
  box-shadow: 0 0 0 1px var(--white), 0 30px 80px -30px rgba(0, 0, 0, 0.6);
}

.splash.is-leaving .splash__card {
  transform: scale(1.08);
  filter: blur(8px);
}

.splash__logo {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: clamp(44px, 8vw, 96px);
  line-height: 0.9;
  letter-spacing: -0.045em;
}

.splash__hint {
  font-size: 11px;
  letter-spacing: 0.14em;
  opacity: 0.75;
  animation: splash-pulse 2400ms ease-in-out infinite;
}

@keyframes splash-in {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
    filter: blur(10px);
  }
}

@keyframes splash-pulse {
  50% { opacity: 0.3; }
}

@media (max-width: 640px) {
  .splash__card {
    padding: 24px 30px 20px;
    gap: 12px;
  }

  .splash__hint {
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .splash__card,
  .splash__hint {
    animation: none;
  }
}

/* --------------------------------------------------------------------------
   BOUTON DE LANGUE FR / EN (en haut à droite de l'écran, js/i18n.js)
   -------------------------------------------------------------------------- */
.lang {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 96; /* au-dessus de l'écran d'entrée, sous le curseur */
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.08em;
  color: #fff;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.lang:hover {
  border-color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.14);
}
.lang__btn {
  appearance: none;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  padding: 4px 6px;
  border-radius: 999px;
  opacity: 0.5;
  cursor: pointer;
  transition: opacity 0.25s var(--ease), background 0.25s var(--ease);
}
.lang__btn:hover,
.lang__btn:focus-visible {
  opacity: 1;
}
.lang__btn:focus-visible {
  outline: 1px solid #fff;
  outline-offset: 1px;
}
.lang__btn.is-on {
  opacity: 1;
  background: rgba(255, 255, 255, 0.18);
}
.lang__sep {
  opacity: 0.35;
}
@media (max-width: 640px) {
  .lang {
    top: max(10px, env(safe-area-inset-top));
    right: max(10px, env(safe-area-inset-right));
  }
}
