/* ══════════════════════════════════════════
   LOGO « AI » — Armand Ito
   Une géométrie, deux habillages :
   .ai-logo--brand  logo d'origine (Fredoka, aplats arrondis), couleurs du site
   .ai-logo--site   version adaptée à la DA : angles droits, filets 1 px, Roboto fin
   Unité u : 1/216 de la hauteur du cadre. La marque dépliée tient dans
   l'écran moins --ai-gutter, sans JS ni transform: scale.
══════════════════════════════════════════ */

/* Fin de l'entrée : le sous-titre, l'indice de défilement et la nav s'y calent. */
:root { --intro-end: 3s; }
:root:has(.ai-logo--site) { --intro-end: 2.3s; }

.ai-logo {
  --ai-max: 1px;
  --ai-gutter: 88px;
  --u: min(var(--ai-max), (100vw - var(--ai-gutter)) / var(--ai-span));
  --skew: 12.7deg;
  position: relative; flex: none; direction: ltr;
  display: flex; align-items: flex-end;
  box-sizing: border-box;
  height: calc(216 * var(--u));
  padding: 0 calc(var(--pr) * var(--u)) calc(33 * var(--u)) calc(var(--pl) * var(--u));
  letter-spacing: 0; text-transform: none;
  -webkit-user-select: none; user-select: none;
}

/* Cadre : deux équerres fixes et un segment central qui s'étire avec le nom. */
.ai-frame { position: absolute; inset: 0; display: flex; pointer-events: none; }
.ai-frame svg { display: block; flex: none; width: calc(70 * var(--u)); height: 100%; overflow: visible; }
.ai-frame .ai-frame-m { flex: 1 1 auto; width: auto; margin: 0 -1px; }
.ai-frame .ai-frame-r { transform: scaleX(-1); }
.ai-frame path { fill: none; stroke: currentColor; }

.ai-a { position: relative; z-index: 1; display: block; flex: none;
  width: calc(118 * var(--u)); height: calc(150 * var(--u)); fill: currentColor;
  transform: skewX(var(--skew)); overflow: visible; }
/* Le A est incliné comme les bandes puis son tracé est redressé : forme inchangée, mais le A passe
   par le même rendu que la bande « rmand » (sous-pixel identique). Sans ça, le SVG est arrondi au
   pixel et la bande non : marche d'environ 1 px à leur jonction selon l'écran et l'échelle. */
.ai-a path { transform: skewX(calc(-1 * var(--skew))); transform-box: view-box; transform-origin: 59px 75px; }

.ai-i { position: relative; z-index: 1; display: block; flex: none;
  width: calc(var(--iw) * var(--u)); height: calc(150 * var(--u));
  margin-left: calc(14 * var(--u)); background: currentColor; transform: skewX(var(--skew)); }

/* Bandes : repliées sous leur initiale (largeur 0, marges nettes nulles), elles en sortent
   en glissant jusqu'à leur place, un interstice de 7 u après la lettre. Partir de dessous
   l'initiale évite qu'un filet de bande apparaisse seul au début du dépliage. */
.ai-band { position: relative; display: block; flex: none; overflow: hidden;
  width: 0; height: calc(150 * var(--u));
  margin-left: calc(var(--ml0) * var(--u)); margin-right: calc(-1 * var(--ml0) * var(--u));
  transform: skewX(var(--skew));
  animation: aiBand var(--open-dur) var(--open-delay) var(--open-ease) both; }
.ai-band > span { display: block; height: 100%; width: calc(var(--w) * var(--u));
  text-align: center; white-space: nowrap; transform: skewX(calc(-1 * var(--skew))); }
.ai-txt-i { font-weight: inherit; }
.ai-band-1 { --w: var(--b1); --ml0: var(--s1, -40); --ml1: var(--g1); --mr1: 14; }
.ai-band-2 { --w: var(--b2); --ml0: var(--s2, calc(var(--iw) / -2)); --ml1: var(--g2); --mr1: 0; }
@keyframes aiBand { to { width: calc(var(--w) * var(--u));
  margin-left: calc(var(--ml1) * var(--u)); margin-right: calc(var(--mr1) * var(--u)); } }

/* ── Habillage d'origine ─────────────────── */
/* Couleurs et positions de la maquette (logo_css/Main.dc.html) : les bandes partent sous
   le A (-33) et sous le I (-16) et y restent, couleur var(--accent), texte blanc calé à gauche. */
.ai-logo--brand {
  --ai-span: 836; --pl: 76; --pr: 93;
  --b1: 366; --b2: 178; --g1: -33; --g2: -34; --s1: -33; --s2: -34; --iw: 44;
  --open-delay: 1.4s; --open-dur: 1.5s; --open-ease: cubic-bezier(.65, 0, .25, 1);
  color: var(--accent, #2F6BFF);
  font: 700 calc(104 * var(--u)) / calc(146 * var(--u)) 'Fredoka', system-ui, sans-serif;
  animation: aiFade .9s .6s ease both;
}
.ai-logo--brand .ai-p-site { display: none; }
.ai-logo--brand .ai-frame path { stroke-width: 8; stroke-linejoin: round; }
/* Trapèze plein blanc, comme le favicon : équerres remplies, et un fond sous le segment
   central qui s'arrête à l'axe des filets (4 u) pour ne pas déborder sous le trait. */
.ai-logo--brand .ai-frame path { fill: #FFFFFF; }
.ai-logo--brand .ai-frame svg { position: relative; }
/* Ombre blanche discrète autour du trapèze, comme le halo du favicon. */
.ai-logo--brand .ai-frame { filter: drop-shadow(0 0 calc(9 * var(--u)) oklch(1 0 0 / .3)); }
.ai-logo--brand .ai-frame::before { content: ""; position: absolute;
  inset: calc(4 * var(--u)) calc(69 * var(--u)); background: #FFFFFF; }
.ai-logo--brand .ai-i { border-radius: calc(10 * var(--u)); }
.ai-logo--brand .ai-band { border-radius: 0 calc(16 * var(--u)) calc(16 * var(--u)) 0; background: currentColor; }
.ai-logo--brand .ai-band-1 { --tp: 26; } .ai-logo--brand .ai-band-2 { --tp: 20; }
/* La bande « Ito » sort par-dessus la barre du I et la remplace : pas de pavé vide avant le texte.
   Elle part 10 u à l'intérieur de la barre (au-delà de son arrondi de 10 u) : son bord et ses coins
   restent cachés dans la barre (sinon filet et coins qui dépassent au début du dépliage). */
.ai-logo--brand .ai-band-2 { z-index: 2; }
/* Le texte apparaît en fondu à la fin du dépliage au lieu d'être découvert par le bord de la bande
   (lettres tranchées « r », « I » pendant l'ouverture). */
.ai-logo--brand .ai-band > span { animation: aiTxt var(--open-dur) var(--open-delay) linear both; }
@keyframes aiTxt { 0%, 55% { opacity: 0; } 100% { opacity: 1; } }
.ai-logo--brand .ai-band > span { color: #FFFFFF; text-align: left; box-sizing: border-box;
  padding-left: calc(var(--tp) * var(--u)); }

/* ── Habillage adapté au site ────────────── */
.ai-logo--site {
  --ai-span: 846; --pl: 70; --pr: 87;
  --b1: 366; --b2: 150; --g1: -10; --g2: 7; --iw: 30;
  --open-delay: 1.1s; --open-dur: 1.2s; --open-ease: cubic-bezier(.77, 0, .175, 1);
  color: oklch(0.99 0.005 255);
  /* Roboto Thin, comme l'ancien nom du hero (graisses chargées par le site : 100, 300, 400, 500). */
  font: 100 calc(80 * var(--u)) / calc(150 * var(--u)) 'Roboto', system-ui, sans-serif;
}
.ai-logo--site .ai-p-brand, .ai-logo--site .ai-txt-i { display: none; }
.ai-logo--site .ai-frame { opacity: .55; animation: aiDraw .9s .5s cubic-bezier(.23, 1, .32, 1) both; }
.ai-logo--site .ai-frame path { stroke-width: 1px; vector-effect: non-scaling-stroke; stroke-linejoin: miter; }
.ai-logo--site .ai-a { animation: aiRiseI .9s .2s cubic-bezier(.16, 1, .3, 1) both; }
/* Le I prend le bleu de l'ancien séparateur « · », à la même place entre les deux mots. */
.ai-logo--site .ai-i { color: var(--accent, #2F6BFF); animation: aiRiseI .9s .4s cubic-bezier(.16, 1, .3, 1) both; }
/* Bandes en filet seul, comme les tags du site (ombre interne : rien ne dépasse quand elles sont repliées). */
.ai-logo--site .ai-band { box-shadow: inset 0 0 0 1px oklch(1 0 0 / .45); }
.ai-logo--site .ai-band > span { text-transform: uppercase; letter-spacing: .06em; text-indent: .06em; }
@media (max-width: 600px) { .ai-logo--site .ai-band > span { font-weight: 300; } }

@keyframes aiFade { from { opacity: 0; } }
@keyframes aiRise { from { opacity: 0; transform: translateY(calc(20 * var(--u))); } }
@keyframes aiRiseI {
  from { opacity: 0; transform: translateY(calc(20 * var(--u))) skewX(var(--skew)); }
  to { transform: translateY(0) skewX(var(--skew)); }
}
@keyframes aiDraw { from { clip-path: inset(0 50%); } to { clip-path: inset(-2px); } }

@media (prefers-reduced-motion: reduce) {
  :root, :root:has(.ai-logo) { --intro-end: 0s; }
  .ai-logo, .ai-logo * { animation-duration: 1ms !important; animation-delay: 0s !important; }
}

