/* FearCraft. Lire DESIGN.md avant de modifier : tokens uniquement. */

:root {
  color-scheme: dark;

  /* Niveaux de lumière : chaque section est un cran plus sombre que la précédente */
  --light-4: oklch(0.2 0.012 245);
  --light-3: oklch(0.18 0.012 245);
  --light-2: oklch(0.165 0.011 245);
  --light-1: oklch(0.15 0.011 245);
  --light-0: oklch(0.135 0.01 245);

  --line: oklch(0.3 0.012 245);
  --line-strong: oklch(0.45 0.012 245);

  --ink: oklch(0.93 0.008 245);
  --ink-2: oklch(0.77 0.01 245);
  --ink-3: oklch(0.64 0.012 245);

  /* La seule lumière chaude de la page, réservée au téléchargement */
  --torch: oklch(0.82 0.135 75);
  --torch-hi: oklch(0.87 0.12 80);
  --torch-edge: oklch(0.6 0.12 58);
  --on-torch: oklch(0.2 0.03 65);

  --font-logo: "Jacquard 12", "Archivo", sans-serif;
  --font-text: "Archivo", "Helvetica Neue", Arial, sans-serif;

  --step--1: clamp(0.875rem, 0.85rem + 0.12vw, 0.95rem);
  --step-0: clamp(1.0625rem, 1rem + 0.28vw, 1.25rem);
  --step-1: clamp(1.25rem, 1.12rem + 0.55vw, 1.6rem);
  --step-2: clamp(1.6rem, 1.3rem + 1.3vw, 2.5rem);
  --step-3: clamp(2.1rem, 1.5rem + 2.7vw, 4.25rem);
  --step-4: clamp(2.75rem, 1.4rem + 6vw, 8rem);

  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4rem;
  --s-9: 6rem;
  --s-10: 8rem;

  --gutter: clamp(1.25rem, 0.6rem + 3.2vw, 4rem);
  --measure: 36rem;

  --ease-ui: cubic-bezier(0.25, 0.8, 0.25, 1);
  --ease-dread: cubic-bezier(0.45, 0, 0.3, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

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

body {
  margin: 0;
  background: var(--light-4);
  color: var(--ink-2);
  font-family: var(--font-text);
  font-size: var(--step-0);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
  font-stretch: 80%;
  line-height: 1.02;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: var(--line-strong);
  transition: color 150ms var(--ease-ui), text-decoration-color 150ms var(--ease-ui);
}

a:hover {
  color: var(--ink);
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

::selection {
  background: var(--torch);
  color: var(--on-torch);
}

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

.skip {
  position: absolute;
  top: var(--s-3);
  left: var(--gutter);
  z-index: 10;
  padding: var(--s-2) var(--s-4);
  background: var(--ink);
  color: var(--light-0);
  text-decoration: none;
  transform: translateY(-200%);
}

.skip:focus-visible {
  transform: none;
}

/* Logo */

.wordmark {
  color: var(--ink);
  font-family: var(--font-logo);
  font-weight: 400;
  line-height: 1;
  text-decoration: none;
}

/* Fond du premier écran : le tunnel et sa torche.
   Le noir de l'image est presque pur ; en fusion « screen » sur --light-4,
   il remonte exactement à la couleur de la page, donc aucun bord ne se voit. */

.backdrop {
  position: absolute;
  inset: 0 0 auto;
  height: 100svh;
  min-height: 36rem;
  overflow: hidden;
  background: var(--light-4);
  isolation: isolate;
  pointer-events: none;
}

.backdrop img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 32% 35%;
  mix-blend-mode: screen;
}

/* En-tête */

.site-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-6);
  padding: var(--s-5) var(--gutter);
}

.site-header .wordmark {
  font-size: 2rem;
}

.site-header .btn {
  margin-left: auto;
}

.site-nav {
  display: none;
  gap: var(--s-6);
  margin-left: auto;
  font-size: var(--step--1);
}

.site-nav a {
  padding-block: var(--s-3);
  color: var(--ink-3);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--ink);
}

@media (min-width: 760px) {
  .site-nav {
    display: flex;
  }

  .site-header .btn {
    margin-left: 0;
  }
}

/* Bouton de téléchargement : un bloc qui s'enfonce */

.btn {
  display: inline-block;
  padding: 0.9rem 1.75rem 0.8rem;
  border-bottom: 0.25rem solid var(--torch-edge);
  background: var(--torch);
  color: var(--on-torch);
  font-size: var(--step-0);
  font-weight: 650;
  font-stretch: 88%;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: background-color 150ms var(--ease-ui);
}

.btn:hover {
  background: var(--torch-hi);
  color: var(--on-torch);
}

.btn:active {
  transform: translateY(2px);
}

.btn--small {
  padding: 0.8rem 1.125rem 0.7rem;
  border-bottom-width: 0.1875rem;
  font-size: var(--step--1);
}

.download {
  display: grid;
  gap: var(--s-4);
  justify-items: start;
}

.download .btn {
  width: 100%;
}

.download-note {
  color: var(--ink-3);
  font-size: var(--step--1);
  line-height: 1.6;
}

.download-note a {
  color: var(--ink-2);
}

@media (min-width: 560px) {
  .download .btn {
    width: auto;
  }
}

/* Les yeux */

.eyes {
  --u: clamp(5px, 0.6vw, 10px);
  position: absolute;
  display: flex;
  gap: calc(var(--u) * 2);
  pointer-events: none;
  transition: opacity 1.8s var(--ease-dread) 0.4s;
}

.eyes span {
  display: block;
  width: calc(var(--u) * 2);
  height: var(--u);
  background: var(--ink);
  transition: transform 70ms ease-in;
}

.js .eyes:not(.is-here),
.js .eyes.is-gone {
  opacity: 0;
}

.eyes.is-gone {
  transition-duration: 0.25s;
  transition-delay: 0s;
}

.eyes.is-blinking span {
  transform: scaleY(0.12);
}

.eyes--far {
  top: 24%;
  right: 17%;
}

.eyes--far span {
  background: var(--ink-2);
}

.eyes--near {
  --u: clamp(8px, 1vw, 15px);
  top: 30%;
  right: 12%;
}

/* Premier écran */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: end;
  min-height: calc(100svh - 5.5rem);
  padding: var(--s-9) var(--gutter) var(--s-8);
  container-type: inline-size;
}

.hero-title {
  margin-left: -0.03em;
  font-family: var(--font-logo);
  font-size: min(26cqi, 20rem);
  font-weight: 400;
  font-stretch: normal;
  line-height: 0.82;
  letter-spacing: 0;
}

.hero-grid {
  display: grid;
  gap: var(--s-7);
  margin-top: var(--s-7);
}

.hero-lead {
  margin-bottom: var(--s-4);
  color: var(--ink);
  font-size: var(--step-2);
  font-weight: 650;
  font-stretch: 80%;
  line-height: 1.08;
}

.hero-text {
  max-width: var(--measure);
}

@media (min-width: 1000px) {
  .hero-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: end;
  }

  .hero-copy {
    grid-column: 1 / span 6;
  }

  .hero .download {
    grid-column: 9 / -1;
  }
}

/* Voice chat : l'échelle de voix */

.voice {
  display: grid;
  gap: var(--s-8);
  padding: var(--s-10) var(--gutter);
  background: var(--light-3);
}

.voice h2,
.setup h2,
.faq h2 {
  font-size: var(--step-3);
}

.voice h2 {
  margin-bottom: var(--s-5);
}

.voice-intro p {
  max-width: 30rem;
}

.falloff {
  margin: 0;
  padding: 0;
  list-style: none;
}

.falloff li {
  display: grid;
  grid-template-columns: 5.75rem minmax(0, 1fr);
  align-items: baseline;
  gap: var(--s-4);
  padding-block: var(--s-4);
}

.falloff-dist {
  color: var(--ink-3);
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
}

.falloff-line {
  --volume: 1;
  color: var(--ink);
  font-size: var(--step-2);
  font-weight: 600;
  font-stretch: 82%;
  line-height: 1.12;
  quotes: "«\202F" "\202F»";
  opacity: var(--volume);
  transition: opacity 1.6s var(--ease-dread) var(--delay, 0s);
}

.falloff li:nth-child(2) .falloff-line {
  --volume: 0.5;
  --delay: 0.3s;
  font-size: calc(var(--step-2) * 0.8);
}

.falloff li:nth-child(3) .falloff-line {
  --volume: 0.26;
  --delay: 1s;
  font-size: calc(var(--step-2) * 0.64);
}

.falloff-flat {
  display: block;
  align-self: center;
  height: 1px;
  background: var(--line-strong);
  transform-origin: left;
  transition: transform 1.1s var(--ease-dread) 1.5s;
}

.falloff.is-loud .falloff-line {
  opacity: 1;
  transition: none;
}

.falloff.is-loud .falloff-flat {
  transform: scaleX(0);
  transition: none;
}

@media (min-width: 760px) {
  .falloff li {
    grid-template-columns: 7.5rem minmax(0, 1fr);
  }
}

@media (min-width: 1000px) {
  .voice {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: end;
  }

  .voice-intro {
    grid-column: 1 / span 5;
  }

  .falloff {
    grid-column: 7 / -1;
  }
}

/* Hors de portée : un plan large, sans texte, entre la voix et l'installation */

.band {
  margin: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--light-3);
  isolation: isolate;
}

.band img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 68% 50%;
  transform-origin: 69% 48%;
  mix-blend-mode: screen;
  /* Le plafond et le sol se perdent dans le noir : aucun bord haut ni bas */
  -webkit-mask-image: linear-gradient(transparent, #000 22%, #000 78%, transparent);
  mask-image: linear-gradient(transparent, #000 22%, #000 78%, transparent);
}

@media (min-width: 760px) {
  .band {
    aspect-ratio: 21 / 9;
  }

  .band img {
    object-position: 50% 48%;
  }
}

/* Installation */

.setup {
  display: grid;
  gap: var(--s-8);
  padding: var(--s-10) var(--gutter);
  background: var(--light-2);
}

.setup-head {
  display: grid;
  gap: var(--s-5);
}

.setup-head p {
  max-width: 30rem;
}

.steps {
  display: grid;
  gap: var(--s-6);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  padding-top: var(--s-4);
  border-top: 1px solid var(--line-strong);
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  display: block;
  margin-bottom: var(--s-3);
  color: var(--ink-3);
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
}

.steps h3 {
  margin-bottom: var(--s-3);
  font-size: var(--step-1);
  font-stretch: 85%;
  line-height: 1.15;
}

.steps p {
  font-size: 1rem;
}

@media (min-width: 760px) {
  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .setup-head {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: end;
    gap: var(--s-6);
  }

  .setup-head h2 {
    grid-column: 1 / span 6;
  }

  .setup-head p {
    grid-column: 8 / -1;
  }

  /* Une seule ligne de temps continue plutôt que quatre blocs séparés */
  .steps {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding-top: var(--s-4);
    border-top: 1px solid var(--line-strong);
  }

  .steps li {
    padding-top: 0;
    border-top: 0;
  }

  .steps li::before {
    margin-bottom: var(--s-6);
  }
}

/* Questions */

.faq {
  display: grid;
  gap: var(--s-6);
  padding: var(--s-9) var(--gutter) var(--s-10);
  background: var(--light-1);
}

.faq-side {
  display: grid;
  align-content: start;
  gap: var(--s-7);
}

/* Le puits : seulement quand la colonne de gauche existe */
.shaft {
  display: none;
}

.faq-list {
  margin: 0;
}

.faq-item {
  display: grid;
  gap: var(--s-2) var(--s-6);
  padding-block: var(--s-5);
  border-top: 1px solid var(--line);
}

.faq-item dt {
  color: var(--ink);
  font-weight: 600;
  font-stretch: 90%;
}

.faq-item dd {
  max-width: var(--measure);
  margin: 0;
}

@media (min-width: 760px) {
  .faq-item {
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  }
}

@media (min-width: 1100px) {
  .faq {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .faq-side {
    grid-column: 1 / span 3;
  }

  .shaft {
    display: block;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    background: var(--light-1);
    isolation: isolate;
  }

  .shaft img {
    display: block;
    width: 100%;
    height: 120%;
    object-fit: cover;
    mix-blend-mode: screen;
  }

  .faq-list {
    grid-column: 5 / -1;
  }
}

/* Dernier écran : la torche au plus profond */

/* Sur mobile, le texte occupe toute la largeur : le feu passe dessous */
.last-light {
  position: relative;
  display: grid;
  align-content: start;
  gap: var(--s-6);
  min-height: 85svh;
  padding: var(--s-9) var(--gutter) 20rem;
  background: var(--light-0);
  isolation: isolate;
}

/* Le feu de camp, derrière le texte : même fusion que le tunnel, sur --light-0 */
.deep {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: var(--light-0);
  pointer-events: none;
}

.deep img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 66% 64%;
  mix-blend-mode: screen;
}

@media (max-width: 759px) {
  .deep {
    top: 35%;
  }
}

@media (min-width: 760px) {
  .last-light {
    align-content: center;
    padding: var(--s-10) var(--gutter);
  }
}

.last-light h2 {
  max-width: 10ch;
  font-size: var(--step-4);
  font-stretch: 75%;
  line-height: 0.95;
}

.last-light-text {
  margin-bottom: var(--s-4);
  font-size: var(--step-1);
}

/* Pied de page */

.site-footer {
  display: grid;
  gap: var(--s-4);
  padding: var(--s-6) var(--gutter) var(--s-7);
  border-top: 1px solid var(--line);
  background: var(--light-0);
  color: var(--ink-3);
  font-size: var(--step--1);
}

.site-footer a {
  justify-self: start;
  padding-block: var(--s-2);
  color: var(--ink-2);
}

.site-footer-name {
  color: var(--ink-2);
}

@media (min-width: 900px) {
  .site-footer {
    grid-template-columns: auto 1fr auto;
    align-items: baseline;
    gap: var(--s-7);
  }
}

/* 404 */

.lost {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: var(--s-5);
  min-height: calc(100svh - 5.5rem);
  padding: var(--s-9) var(--gutter);
}

.lost h1 {
  font-size: var(--step-4);
  font-stretch: 75%;
  line-height: 0.95;
}

.lost p {
  max-width: 30rem;
  margin-bottom: var(--s-4);
}

/* Mouvement. Chaque animation raconte la descente :
   les yeux s'habituent au noir, les torches vacillent, le pote s'éloigne,
   le puits défile. Opacité et transform uniquement. */

@media (prefers-reduced-motion: no-preference) {
  .backdrop {
    animation: adjust 2.6s var(--ease-dread) both;
  }

  .backdrop img {
    animation: flicker 6.5s linear 2.6s infinite;
  }

  .deep img {
    animation: flicker 4.8s linear infinite;
  }

  .hero-title {
    animation: adjust 1.6s var(--ease-dread) 0.2s both;
  }

  .hero-lead,
  .hero-text,
  .hero .download {
    animation: emerge 0.9s var(--ease-ui) both;
  }

  .hero-lead {
    animation-delay: 0.7s;
  }

  .hero-text {
    animation-delay: 0.82s;
  }

  .hero .download {
    animation-delay: 0.95s;
  }

  @supports (animation-timeline: view()) {
    .band img {
      animation: recede linear both;
      animation-timeline: view();
      animation-range: entry 0% exit 50%;
    }

    .shaft img {
      animation: descend linear both;
      animation-timeline: view();
    }

    .deep {
      animation: adjust linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 45%;
    }
  }
}

@keyframes adjust {
  from {
    opacity: 0;
  }
}

@keyframes emerge {
  from {
    opacity: 0;
    transform: translateY(0.75rem);
  }
}

/* Une flamme : des baisses courtes et irrégulières, jamais de pulsation régulière */
@keyframes flicker {
  0%, 100% { opacity: 1; }
  7% { opacity: 0.88; }
  10% { opacity: 0.97; }
  24% { opacity: 0.92; }
  29% { opacity: 1; }
  51% { opacity: 0.94; }
  54% { opacity: 0.8; }
  58% { opacity: 0.96; }
  76% { opacity: 0.9; }
  81% { opacity: 1; }
}

@keyframes recede {
  from {
    opacity: 0;
    transform: scale(1.2);
  }

  35% {
    opacity: 1;
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes descend {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(-16.6667%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .eyes,
  .eyes span,
  .falloff-line,
  .falloff-flat {
    transition: none;
  }
}
