/* =====================================================================================
   Accueil — vue classique (compléments) + vue 3D « l'archipel » (html.mode-3d)
   Chargé uniquement sur l'accueil, après style.css et modern.css.
   ===================================================================================== */

@font-face {
  font-family: "Space Grotesk";
  src: url("assets/fonts/space-grotesk-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --violet: #5b52ff;
  --lime: #dfff67;
  --coral: #ff765f;
  --night: #16123a;
  --night-deep: #0d0b26;
  --display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
}

/* ---------- Bascule de vue --------------------------------------------------------- */
html:not(.mode-3d) .only-3d { display: none !important; }
.mode-3d .only-classic { display: none !important; }
.no-webgl .view-toggle, .no-webgl .world-hint { display: none !important; }

.view-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border: 1px solid var(--line-strong); border-radius: 999px;
  color: var(--text); background: transparent; font: inherit; font-size: 12px; font-weight: 750;
  cursor: pointer; transition: border-color .25s ease, background .25s ease;
}
.view-toggle:hover { border-color: var(--violet); background: rgba(91, 82, 255, .07); }
.view-toggle:focus-visible, .world-hint__switch:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; }
.view-toggle__icon {
  width: 14px; height: 14px; border: 1.5px solid currentColor; border-radius: 3px;
  transform: rotate(45deg) scale(.86); box-shadow: inset 0 0 0 2px transparent;
}
.mode-3d .view-toggle__icon { border-radius: 50%; transform: none; }

/* ---------- Compléments de la vue classique ---------------------------------------- */
html:not(.mode-3d) .world-home .hero__title { font-size: clamp(3rem, 5.3vw, 5.5rem); }
@media (min-width: 761px) and (max-width: 1240px) {
  .site-navigation { gap: 18px; }
  .site-navigation > a { font-size: 12px; }
  .view-toggle { padding: 8px 11px; font-size: 11px; }
}
.hero__name {
  display: block; margin-bottom: .28em;
  color: var(--violet); font-size: .36em; letter-spacing: -.02em;
}
@media (min-width: 1101px) {
  .services-grid { grid-template-columns: repeat(4, 1fr); }
  .service-card:last-child { grid-column: auto; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .services-grid { grid-template-columns: 1fr 1fr; }
  .service-card:last-child { grid-column: auto; min-height: 0; }
}
.services-grid .service-card { min-height: 420px; }
.service-card h3 { font-size: 23px; }

.project-card__index {
  margin: 0 0 6px; color: #8b938e; font-size: 10px; font-weight: 800; letter-spacing: .12em;
}
.project-card__index span { color: var(--violet); }
.project-card__links { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; margin-top: 16px; }
.project-card__demo { color: #4f5752; font-size: 12px; font-weight: 800; }
.project-card__demo:hover { color: var(--violet); }
.project-card__demo span[aria-hidden] { color: var(--violet); }

/* Contact : texte + formulaire */
.contact-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; align-items: center; }
.contact-card h2 { font-size: clamp(2.5rem, 4.4vw, 4.4rem); }
.contact-card__intro > p:not(.eyebrow) { max-width: 560px; margin: 26px 0 0; color: rgba(255, 255, 255, .74); font-size: 16px; }
.contact-card__intro .contact-card__direct { font-size: 14px; }
.contact-card__direct a { color: var(--lime); font-weight: 750; text-decoration: underline; text-underline-offset: 3px; }

.contact-form { display: grid; gap: 14px; width: 100%; }
.contact-form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; gap: 7px; }
.field > span { color: rgba(255, 255, 255, .82); font-size: 12px; font-weight: 750; letter-spacing: .01em; }
.field small { color: rgba(255, 255, 255, .55); font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, .22); border-radius: 12px;
  color: #fff; background: rgba(255, 255, 255, .07);
  font: inherit; font-size: 15px; line-height: 1.4;
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, rgba(255,255,255,.75) 50%), linear-gradient(135deg, rgba(255,255,255,.75) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 38px; }
.field select option { color: #15171b; }
.field textarea { min-height: 128px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: rgba(255, 255, 255, .45); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--lime); background: rgba(255, 255, 255, .11); box-shadow: 0 0 0 3px rgba(223, 255, 103, .25); }
.field [aria-invalid="true"] { border-color: #ffb4a6; box-shadow: 0 0 0 3px rgba(255, 118, 95, .28); }
.field__error { color: #ffc9bf; font-size: 12px; font-weight: 700; }
.contact-form__trap { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.contact-form__footer { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 4px; }
.contact-form .button--primary { color: #15171b; background: var(--lime); border-color: var(--lime); box-shadow: 0 12px 34px rgba(223, 255, 103, .18); cursor: pointer; font: inherit; font-weight: 800; }
.contact-form .button--primary:hover { color: #15171b; background: #efffb0; }
.contact-form .button--primary[disabled] { opacity: .6; cursor: progress; transform: none; }
.contact-form__legal { flex: 1 1 200px; margin: 0; color: rgba(255, 255, 255, .6); font-size: 11.5px; line-height: 1.5; }
.contact-form__legal a { color: rgba(255, 255, 255, .85); text-decoration: underline; text-underline-offset: 2px; }
.contact-form__status { min-height: 1.4em; margin: 0; color: var(--lime); font-size: 14px; font-weight: 750; }
.contact-form__status.is-error { color: #ffc9bf; }
.contact-form.is-sent .contact-form__row, .contact-form.is-sent > .field, .contact-form.is-sent .contact-form__footer { display: none; }
.contact-form.is-sent .contact-form__status { padding: 22px; border: 1px solid rgba(223, 255, 103, .35); border-radius: 16px; background: rgba(223, 255, 103, .08); font-size: 17px; }

.site-footer p a { text-decoration: underline; text-underline-offset: 2px; }
.site-footer p a:hover { color: var(--violet); }

@media (max-width: 1024px) {
  .contact-card { grid-template-columns: 1fr; gap: 36px; }
}
@media (max-width: 760px) {
  .contact-card { min-height: 0; }
  .contact-card h2 { font-size: clamp(2.3rem, 10vw, 3.2rem); }
  .contact-form__row { grid-template-columns: 1fr; }
  .view-toggle { justify-content: center; margin-top: 18px; padding: 15px; font-size: 13px; }
}

/* Le rail de navigation et la scène n'existent qu'en 3D */
.world-stage, .world-rail { display: none; }

/* =====================================================================================
   VUE 3D
   ===================================================================================== */
html.mode-3d { scroll-behavior: auto; background: var(--night-deep); }
.mode-3d body.erwan-portfolio-theme { background: var(--night-deep); }

.mode-3d .world-stage { display: block; position: fixed; z-index: 0; inset: 0; pointer-events: auto; }
.mode-3d .world-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  opacity: 0; transition: opacity 1.2s ease;
  touch-action: pan-y;
}
.mode-3d.world-ready .world-canvas { opacity: 1; }
.mode-3d .world-stage::before {
  /* Ciel de secours, visible pendant le chargement de la 3D */
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 70% at 70% 100%, #ff8f6b 0%, #b2508a 22%, #3b2a7a 45%, var(--night) 70%, var(--night-deep) 100%);
}
.mode-3d .world-veil {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(13, 11, 38, .62) 0%, rgba(13, 11, 38, .34) 34%, rgba(13, 11, 38, 0) 58%);
}
.mode-3d .world-stage.is-hovering { cursor: pointer; }

.mode-3d .world-tooltip {
  position: absolute; z-index: 3; left: 0; top: 0;
  padding: 9px 13px; border-radius: 12px;
  color: #15171b; background: rgba(247, 246, 240, .95);
  box-shadow: 0 14px 40px rgba(8, 6, 30, .35);
  font-size: 13px; font-weight: 800; line-height: 1.25; white-space: nowrap;
  pointer-events: none; transform: translate(-50%, calc(-100% - 18px));
}
.mode-3d .world-tooltip small { display: block; margin-top: 2px; color: var(--violet); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }

/* Le contenu défile au-dessus de la scène ; seules les cartes captent la souris */
.mode-3d .portfolio-home { position: relative; background: transparent; }
.mode-3d .portfolio-home::before { display: none; }
.mode-3d .portfolio-home > section {
  position: relative; z-index: 1;
  padding: 0; overflow: visible; background: transparent; pointer-events: none;
  mask-image: none; -webkit-mask-image: none;
}
.mode-3d .portfolio-home > section::before, .mode-3d .portfolio-home > section::after,
.mode-3d .hero__ambient { display: none; }
.mode-3d .site-shell { width: auto; margin: 0; padding-inline: clamp(16px, 5.5vw, 96px); }
.mode-3d .world-stop { pointer-events: auto; }

.mode-3d .world-home h1, .mode-3d .world-home h2, .mode-3d .world-home h3 {
  font-family: var(--display); font-weight: 700; letter-spacing: -.035em;
}

/* Une étape = une carte, séparée de la suivante par un « trajet » vide */
.mode-3d .world-stop:not(.world-stop--hero) {
  position: relative;
  width: min(470px, 100%);
  margin: 0 0 78svh;
  padding: 30px 30px 28px;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 26px;
  color: var(--text);
  background: rgba(248, 247, 242, .93);
  box-shadow: 0 34px 90px rgba(8, 6, 30, .42), inset 0 1px 0 #fff;
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  transition: box-shadow .4s ease, transform .4s var(--ease), opacity .85s var(--ease);
}
.mode-3d .world-stop.is-current:not(.world-stop--hero) {
  box-shadow: 0 34px 90px rgba(8, 6, 30, .42), 0 0 0 3px rgba(223, 255, 103, .55), inset 0 1px 0 #fff;
}

/* --- Accueil --- */
.mode-3d .hero { min-height: 0; display: block; }
.mode-3d .hero__grid { display: block; }
.mode-3d .world-stop--hero {
  min-height: 100svh; max-width: 680px; margin-bottom: 30svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 120px 0 64px;
}
.mode-3d .hero .eyebrow { color: var(--lime); }
.mode-3d .hero .status-dot { background: var(--lime); }
.mode-3d .hero__title {
  max-width: 660px; margin: 0;
  color: #fff; font-size: clamp(2.7rem, 5vw, 4.9rem); line-height: .98;
  text-shadow: 0 6px 40px rgba(13, 11, 38, .55);
}
.mode-3d .hero__name { color: var(--lime); font-size: .4em; letter-spacing: 0; text-shadow: none; }
.mode-3d .hero .text-gradient,
.mode-3d .world-stop .text-gradient {
  background: linear-gradient(100deg, var(--lime) 0%, #fff3d6 48%, #ffb19e 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.mode-3d .world-stop:not(.world-stop--hero) .text-gradient {
  background: linear-gradient(100deg, var(--violet) 0%, #8a5cff 50%, #ff6a52 100%);
  -webkit-background-clip: text; background-clip: text;
}
.mode-3d .hero__lead { max-width: 560px; color: rgba(255, 255, 255, .84); font-size: clamp(1rem, 1.25vw, 1.14rem); text-shadow: 0 2px 18px rgba(13, 11, 38, .6); }
.mode-3d .hero__proof li { color: rgba(255, 255, 255, .72); }
.mode-3d .hero__proof span { color: var(--lime); }
.mode-3d .hero .button--primary { color: #15171b; background: var(--lime); box-shadow: 0 14px 40px rgba(223, 255, 103, .25); }
.mode-3d .hero .button--primary:hover { background: #efffb0; color: #15171b; }
.mode-3d .hero .button--ghost { color: #fff; border-color: rgba(255, 255, 255, .45); background: rgba(255, 255, 255, .06); }
.mode-3d .hero .button--ghost:hover { border-color: #fff; background: rgba(255, 255, 255, .14); }

.world-hint {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  margin: 38px 0 0; color: rgba(255, 255, 255, .74); font-size: 13px; font-weight: 650;
}
.world-hint__mouse { position: relative; width: 20px; height: 31px; flex: none; border: 1.5px solid rgba(255, 255, 255, .7); border-radius: 12px; }
.world-hint__mouse i { position: absolute; left: 50%; top: 6px; width: 3px; height: 7px; margin-left: -1.5px; border-radius: 2px; background: var(--lime); animation: worldWheel 1.8s ease-in-out infinite; }
@keyframes worldWheel { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(9px); opacity: 0; } 100% { opacity: 0; } }
.world-hint__switch {
  padding: 0; border: 0; color: #fff; background: none; font: inherit; font-weight: 750;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}

/* --- Services --- */
.mode-3d .section-heading { display: block; margin-bottom: 0; }
.mode-3d .section-heading h2, .mode-3d .about h2, .mode-3d .contact-card h2 { font-size: clamp(2rem, 3vw, 2.6rem); line-height: 1.02; }
.mode-3d .section-heading__copy { max-width: none; margin: 16px 0 0; color: #5c645f; font-size: 15px; }
.mode-3d .services-grid { display: block; }
.mode-3d .service-card { min-height: 0; overflow: hidden; }
.mode-3d .service-card:hover { transform: none; }
.mode-3d .service-card__icon { margin: 18px 0 22px; }
.mode-3d .service-card h3 { font-size: 28px; }
.mode-3d .service-card ul { margin-top: 20px; }
.mode-3d .world-stop.service-card--featured { background: rgba(23, 25, 29, .94); border-color: rgba(255, 255, 255, .12); }
.mode-3d .world-stop.service-card--featured.is-current { box-shadow: 0 34px 90px rgba(8, 6, 30, .5), 0 0 0 3px rgba(223, 255, 103, .7); }

/* --- Réalisations --- */
.mode-3d .section-heading--work .text-link { margin-top: 22px; }
.work-index {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px 16px;
  margin: 20px 0 0; padding: 16px 0 0; border-top: 1px solid var(--line); list-style: none;
}
.work-index a { display: flex; gap: 8px; padding: 5px 0; color: #2b2f2d; font-size: 13px; font-weight: 700; line-height: 1.3; }
.work-index a span { color: var(--violet); font-size: 10px; font-weight: 850; padding-top: 2px; }
.work-index a:hover { color: var(--violet); }
.mode-3d .projects-grid { display: block; }
.mode-3d .project-card__visual { display: none; }
.mode-3d .project-card__content { padding: 0; }
.mode-3d .project-card h3 { margin: 10px 0 10px; font-size: 26px; line-height: 1.08; }
.mode-3d .project-card p { font-size: 14.5px; line-height: 1.65; }
.mode-3d .project-card__meta span { font-size: 9.5px; }

/* --- Atelier & méthode --- */
.mode-3d .about { overflow: visible; }
.mode-3d .about__grid { display: block; }
.mode-3d .about__lead { margin: 18px 0 12px; font-size: 16.5px; }
.mode-3d .process { padding: 0; }
.mode-3d .process .section-heading { margin-bottom: 16px; }
.mode-3d .process-list li { grid-template-columns: 40px 1fr; gap: 12px; min-height: 0; padding: 14px 2px; }
.mode-3d .process-list li::after { display: none; }
.mode-3d .process-list li:hover { padding-inline: 2px; }
.mode-3d .process-list h3 { font-size: 19px; }

/* --- Phare / contact : carte sombre, plus large --- */
.mode-3d .contact { padding-bottom: 12svh; }
.mode-3d .contact-card.world-stop {
  width: min(560px, 100%); margin-bottom: 0;
  display: block; min-height: 0; padding: 34px 32px 30px;
  border-color: rgba(223, 255, 103, .25);
  background: rgba(22, 18, 58, .9);
  box-shadow: 0 40px 100px rgba(5, 4, 20, .6), 0 0 0 1px rgba(255, 255, 255, .05);
}
.mode-3d .contact-card::before, .mode-3d .contact-card__orb { display: none; }
.mode-3d .contact-card h2 { color: #fff; }
.mode-3d .contact-card .text-gradient {
  background: linear-gradient(100deg, var(--lime), #fff3d6 55%, #ffb19e);
  -webkit-background-clip: text; background-clip: text;
}
.mode-3d .contact-card__intro > p:not(.eyebrow) { margin-top: 16px; font-size: 15px; }
.mode-3d .contact-form { margin-top: 26px; }

.mode-3d .site-footer { position: relative; z-index: 1; background: rgba(13, 11, 38, .92); }
.mode-3d .site-footer__inner { border-color: rgba(255, 255, 255, .12); }
.mode-3d .site-footer .site-brand__text strong { color: #fff; }
.mode-3d .site-footer .site-brand__text small, .mode-3d .site-footer p { color: rgba(255, 255, 255, .62); }
.mode-3d .site-footer__contact { color: #fff; }

/* --- En-tête en verre clair au-dessus de la scène --- */
.mode-3d .site-topbar,
.mode-3d .site-topbar.is-scrolled {
  top: 14px; right: 14px; left: 14px; height: 66px;
  border: 1px solid rgba(255, 255, 255, .6); border-radius: 20px;
  background: rgba(248, 247, 242, .86);
  box-shadow: 0 18px 50px rgba(8, 6, 30, .3);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
}
.mode-3d .site-topbar__inner { padding-inline: 18px 12px; }
.mode-3d .site-topbar .site-shell { padding-inline: 18px 12px; }
.mode-3d .site-navigation { gap: 24px; }
.mode-3d.admin-bar .site-topbar { top: 46px; }

/* --- Rail des étapes (bureau) --- */
.mode-3d .world-rail {
  position: fixed; z-index: 5; right: 26px; top: 50%;
  display: flex; flex-direction: column; gap: 14px;
  transform: translateY(-50%);
}
.world-rail a {
  position: relative; display: flex; align-items: center; justify-content: flex-end;
  width: 22px; height: 22px;
}
.world-rail a::after {
  content: ""; width: 9px; height: 9px; border: 1.5px solid rgba(255, 255, 255, .75); border-radius: 50%;
  transition: transform .3s var(--ease), background .3s ease, border-color .3s ease;
}
.world-rail a.is-active::after { background: var(--lime); border-color: var(--lime); transform: scale(1.35); }
.world-rail a span {
  position: absolute; right: 30px; padding: 5px 10px; border-radius: 99px;
  color: #15171b; background: rgba(248, 247, 242, .92); font-size: 11px; font-weight: 800; white-space: nowrap;
  opacity: 0; transform: translateX(6px); transition: opacity .25s ease, transform .25s ease; pointer-events: none;
}
.world-rail a:hover span, .world-rail a:focus-visible span, .world-rail a.is-active span { opacity: 1; transform: none; }
.world-rail a:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; border-radius: 50%; }

/* --- Mobile : la scène en haut, les cartes en bas --- */
@media (max-width: 760px) {
  .mode-3d .world-veil { background: linear-gradient(0deg, rgba(13, 11, 38, .5) 0%, rgba(13, 11, 38, 0) 46%); }
  .mode-3d .site-topbar, .mode-3d .site-topbar.is-scrolled { top: 10px; right: 10px; left: 10px; height: 60px; border-radius: 18px; }
  .mode-3d .site-topbar__inner, .mode-3d .site-topbar .site-shell { padding-inline: 12px 8px; }
  .mode-3d .site-navigation { gap: 0; background: rgba(248, 247, 242, .98); }
  .mode-3d .site-shell { padding-inline: 14px; }
  .mode-3d .world-stop--hero { padding: 96px 0 40px; justify-content: flex-end; min-height: 100svh; margin-bottom: 24svh; }
  .mode-3d .hero__title { font-size: clamp(2.35rem, 11vw, 3.3rem); }
  .mode-3d .hero__lead { font-size: 15px; }
  .mode-3d .hero__actions { flex-direction: row; }
  .mode-3d .hero__actions .button { width: auto; flex: 1 1 auto; }
  .mode-3d .world-hint { margin-top: 24px; font-size: 12px; }
  .mode-3d .world-hint__mouse { display: none; }
  .mode-3d .world-stop:not(.world-stop--hero) { margin-bottom: 70svh; padding: 22px 20px; border-radius: 22px; background: rgba(248, 247, 242, .95); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .mode-3d .contact-card.world-stop { padding: 26px 20px; background: rgba(22, 18, 58, .96); }
  .mode-3d .world-stop.service-card--featured { background: rgba(23, 25, 29, .96); }
  .mode-3d .project-card h3 { font-size: 22px; }
  .mode-3d .service-card h3 { font-size: 24px; }
  .mode-3d .project-card p { font-size: 14px; }
  .work-index { grid-template-columns: 1fr; }
  .mode-3d .world-rail { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .world-hint__mouse i { animation: none; }
}
