/* Fortin Studio — une seule vue, sans défilement.
   Polices : Atkinson Hyperlegible Next (texte) et Mono (étiquettes), hébergées ici.
   Mouvement : courbes ease-out (expo, quart), entrées en fondu + translation + flou, 200 à 800 ms. */

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/AtkinsonHyperlegibleNext-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/AtkinsonHyperlegibleNext-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Hyperlegible Mono";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/AtkinsonHyperlegibleMono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Atkinson Hyperlegible Mono";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/AtkinsonHyperlegibleMono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Jetons ---------- */
:root {
  color-scheme: light;
  --paper: #f6f7f4;
  --ink: #12161c;
  --ink-2: #5a6270;
  --rule: #dfe2db;
  --todo: #fff3b0;

  --sans: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Atkinson Hyperlegible Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --gutter: clamp(1.25rem, 4vw, 3rem);

  /* Courbes, dans l'esprit d'animations.dev */
  --out-expo: cubic-bezier(0.19, 1, 0.22, 1);
  --out-quart: cubic-bezier(0.165, 0.84, 0.44, 1);
  --sheet: cubic-bezier(0.32, 0.72, 0, 1);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 0 var(--gutter) env(safe-area-inset-bottom);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}
h1, h2, p { margin: 0; }
svg { display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 3px; }

html[data-lang="fr"] .en, html[data-lang="en"] .fr { display: none !important; }

.todo { background: var(--todo); color: var(--ink); padding: 0 0.2em; border-radius: 3px; }

/* ---------- Haut ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding-block: clamp(1rem, 2.5vh, 1.5rem);
}
.brand { display: inline-flex; align-items: center; gap: 0.7rem; text-decoration: none; }
.brand__mark { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 12; stroke-linejoin: round; }
.brand__name {
  font-family: var(--mono); font-size: 0.8125rem; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
}

/* Sélecteur de langue : pastille qui glisse */
.seg {
  position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 3px; border: 1px solid var(--rule); border-radius: 999px; background: transparent;
}
.seg__pill {
  position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px);
  border-radius: 999px; background: var(--ink);
  transition: transform 380ms var(--sheet);
}
html[data-lang="en"] .seg__pill { transform: translateX(100%); }
.seg__btn {
  position: relative; z-index: 1; padding: 0.3rem 0.8rem;
  font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.12em; color: var(--ink-2);
  border-radius: 999px; transition: color 220ms ease;
}
.seg__btn[aria-pressed="true"] { color: var(--paper); }
.seg__btn:hover { color: var(--ink); }
.seg__btn[aria-pressed="true"]:hover { color: var(--paper); }
.seg__btn:focus-visible { outline-offset: 5px; }

/* ---------- Centre ---------- */
.hero {
  display: grid; gap: clamp(1.25rem, 3vh, 2rem) 3rem; align-content: center; align-items: center;
  padding-block: clamp(0.5rem, 2vh, 1.5rem);
}
.hero__title {
  font-size: clamp(2.125rem, 1.1rem + 4.6vw, 4.5rem);
  font-weight: 800; line-height: 1.04; letter-spacing: -0.028em;
  max-width: 16ch; text-wrap: balance;
}
/* Mots révélés par un masque : chaque mot glisse depuis le bas de sa ligne. */
.w { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: 0.12em; margin-bottom: -0.12em; }
.w > span { display: inline-block; }
.hero__lead {
  margin-top: clamp(1rem, 2.4vh, 1.5rem);
  font-size: clamp(1.0625rem, 0.95rem + 0.5vw, 1.25rem); line-height: 1.55;
  max-width: 36em;
}
.hero__cta { margin-top: clamp(0.9rem, 2vh, 1.25rem); }

.arrow-link {
  display: inline-flex; align-items: center; gap: 0.5em;
  font-weight: 600; text-decoration: none;
}
.arrow-link__icon { width: 22px; height: 22px; border-radius: 6px; margin-right: 0.1em; }
.arrow-link__label {
  background: linear-gradient(currentColor, currentColor) no-repeat left 100% / 0 1.5px;
  padding-bottom: 2px;
  transition: background-size 320ms var(--out-quart);
}
.arrow-link:hover .arrow-link__label, .arrow-link:focus-visible .arrow-link__label { background-size: 100% 1.5px; }
.arrow-link__arrow { display: inline-block; transition: transform 380ms var(--out-expo); }
.arrow-link:hover .arrow-link__arrow { transform: translateX(4px); }
.arrow-link:active { transform: translateY(1px); }

.hero__mark {
  width: clamp(88px, 20vw, 300px); height: auto;
  fill: none; stroke: var(--ink); stroke-linejoin: round;
  order: -1;
  transform: rotate(var(--rot, 0deg));
  transition: transform 1100ms var(--out-expo);
}
.hero__outer { stroke-width: 2.6; }
.hero__inner { stroke-width: 1.6; opacity: 0.7; }

@media (min-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr) auto; }
  .hero__mark { order: 0; justify-self: end; }
  .hero__outer { stroke-width: 1.6; }
  .hero__inner { stroke-width: 1; }
}
@media (max-width: 859px) and (max-height: 620px) {
  .hero__mark { display: none; }
}

/* ---------- Bas ---------- */
.bottom {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 1.5rem;
  padding-block: clamp(1rem, 2.5vh, 1.5rem);
  font-family: var(--mono); font-size: 0.8125rem; color: var(--ink-2);
}
.bottom__mail {
  color: var(--ink); text-decoration: none;
  background: linear-gradient(var(--rule), var(--rule)) no-repeat left 100% / 100% 1.5px;
  padding-bottom: 2px;
  transition: background-image 200ms ease, transform 200ms var(--out-quart);
}
.bottom__mail:hover { background-image: linear-gradient(var(--ink), var(--ink)); }
.bottom__mail:active { transform: translateY(1px); }
.bottom__meta { display: inline-flex; align-items: baseline; gap: 0.6rem; }
.bottom__dot { color: var(--rule); }
.bottom__legal { color: var(--ink-2); text-decoration: underline; text-underline-offset: 0.2em; text-decoration-color: var(--rule); transition: color 200ms ease, text-decoration-color 200ms ease; }
.bottom__legal:hover { color: var(--ink); text-decoration-color: var(--ink); }

/* ---------- Mentions légales (panneau) ---------- */
.legal {
  margin: auto; border: 0; padding: clamp(1.25rem, 3vw, 1.75rem);
  width: min(100% - 2rem, 34rem); max-height: min(80vh, 80dvh); overflow: auto;
  border-radius: 18px; background: var(--paper); color: var(--ink);
  box-shadow: 0 24px 64px rgba(18, 22, 28, 0.22), 0 0 0 1px rgba(18, 22, 28, 0.06);
  font-size: 0.9375rem; line-height: 1.55;
}
.legal::backdrop { background: rgba(18, 22, 28, 0.32); }
.legal__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.legal__title { font-size: 1.125rem; font-weight: 700; letter-spacing: -0.01em; }
.legal__close {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: 999px;
  color: var(--ink-2); transition: background-color 200ms ease, color 200ms ease, transform 200ms var(--out-quart);
}
.legal__close svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.legal__close:hover { background: rgba(18, 22, 28, 0.06); color: var(--ink); }
.legal__close:active { transform: scale(0.94); }
.legal__body { color: var(--ink-2); }
.legal__body p + p { margin-top: 0.7rem; }
.legal__body strong { color: var(--ink); font-weight: 600; }

/* ---------- Mouvement ---------- */
@media (prefers-reduced-motion: no-preference) {
  /* Séquence de chargement */
  .top, .bottom { opacity: 0; animation: fade-up 700ms var(--out-quart) forwards; }
  .top { animation-delay: 60ms; }
  .bottom { animation-delay: 620ms; }

  .w > span { transform: translateY(115%); animation: reveal 900ms var(--out-expo) forwards; animation-delay: calc(120ms + var(--i, 0) * 45ms); }

  .hero__lead, .hero__cta { opacity: 0; animation: blur-in 800ms var(--out-quart) forwards; }
  .hero__lead { animation-delay: 420ms; }
  .hero__cta { animation-delay: 520ms; }

  .hero__outer, .hero__inner { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1600ms var(--out-quart) forwards; }
  .hero__outer { animation-delay: 200ms; }
  .hero__inner { animation-delay: 480ms; animation-duration: 1400ms; }

  /* Changement de langue : le nouveau texte arrive net depuis un léger flou */
  .swap .fr, .swap .en { animation: blur-in 360ms var(--out-quart) both; }
  /* Le titre, lui, rejoue la révélation mot à mot : pas de flou par-dessus. */
  .swap .hero__title .fr, .swap .hero__title .en { animation: none; }

  /* Panneau : ouverture et fermeture animées en CSS seul, y compris avec Échap. */
  .legal {
    opacity: 0; transform: translateY(6px) scale(0.97);
    transition: opacity 180ms ease-in, transform 180ms ease-in,
                overlay 180ms allow-discrete, display 180ms allow-discrete;
  }
  .legal[open] {
    opacity: 1; transform: none;
    transition: opacity 420ms var(--sheet), transform 420ms var(--sheet),
                overlay 420ms allow-discrete, display 420ms allow-discrete;
  }
  @starting-style { .legal[open] { opacity: 0; transform: translateY(10px) scale(0.96); } }
  .legal::backdrop {
    background: rgba(18, 22, 28, 0);
    transition: background-color 180ms ease-in, overlay 180ms allow-discrete, display 180ms allow-discrete;
  }
  .legal[open]::backdrop {
    background: rgba(18, 22, 28, 0.32);
    transition: background-color 300ms ease-out, overlay 300ms allow-discrete, display 300ms allow-discrete;
  }
  @starting-style { .legal[open]::backdrop { background: rgba(18, 22, 28, 0); } }
}

@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes reveal { to { transform: none; } }
@keyframes blur-in { from { opacity: 0; transform: translateY(6px); filter: blur(5px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
