/* ============================================================
   components.css — boutons, icônes, cartes, badges, formulaire
   ============================================================ */

.icon {
  width: 1.25em;
  height: 1.25em;
  fill: currentColor;
  flex-shrink: 0;
}

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.8em 1.6em;
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.2s var(--ease-out), background 0.2s, border-color 0.2s,
    box-shadow 0.2s, color 0.2s;
}

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

.btn--primary {
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: var(--shadow-md);
}

.btn--primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-lg);
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* ---------- Bascule de thème et burger ---------- */
.theme-toggle,
.burger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.theme-toggle:hover,
.burger:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* L'icone affichee suit le MODE choisi, pas le theme rendu : en mode auto
   on montre le moniteur, meme si le theme resolu est sombre. C'est ce qui
   permet au visiteur de savoir qu'il suit son systeme. */
.theme-toggle__auto,
.theme-toggle__sun,
.theme-toggle__moon {
  display: none;
}

[data-theme-mode="auto"] .theme-toggle__auto,
[data-theme-mode="light"] .theme-toggle__sun,
[data-theme-mode="dark"] .theme-toggle__moon {
  display: block;
}

.burger {
  display: none;
}

.burger__close,
.burger.is-open .burger__open {
  display: none;
}

.burger.is-open .burger__close {
  display: block;
}

/* ---------- Réseaux sociaux ---------- */
.social {
  display: flex;
  gap: var(--space-3);
}

.social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: color 0.2s var(--ease-out), border-color 0.2s, background 0.2s,
    transform 0.2s var(--ease-out);
}

.social a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-3px);
}

/* ============================================================
   Carrousel des services

   Etat par defaut : blocs empiles, tous lisibles. carousel.js ajoute
   .carousel--ready pour passer en horizontal. Faire l'inverse ne
   montrerait qu'un seul bloc si le JS echoue.
   ============================================================ */
.carousel {
  position: relative;
}

.carousel__track {
  display: grid;
  gap: var(--space-6);
}

.service {
  display: grid;
  grid-template-columns: 1.02fr 0.98fr;
  align-items: center;
  gap: var(--space-12);
  padding: var(--space-12);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
}

.service:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
}

.service__content {
  min-width: 0;
}

.service__visual {
  min-width: 0;
}

/* Illustration dessinee avec les jetons du theme : elle suit le mode clair
   comme le mode sombre sans fichier supplementaire ni requete reseau. */
.service__art {
  width: 100%;
  height: auto;
  max-height: 340px;
}

.service__icon {
  width: 52px;
  height: 52px;
  fill: var(--accent);
  margin-bottom: var(--space-6);
}

.service__title {
  font-size: var(--fs-2xl);
  margin-bottom: var(--space-6);
  max-width: 20ch;
}

.service__text {
  font-size: var(--fs-base);
  color: var(--text-muted);
  max-width: 58ch;
}

.service__text + .service__text {
  margin-top: var(--space-4);
}

.service__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-8);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--accent);
  align-self: flex-start;
}

.service__link:hover {
  text-decoration: underline;
}

/* ---------- Mode carrousel ---------- */
/* En mode carrousel, la bordure passe du bloc au cadre : les bords lateraux
   d'un bloc large de 100 % tombent pile sur le rognage et seraient coupes.
   `:has()` permet de la colorer au survol du bloc qu'elle entoure. */
.carousel--ready .carousel__viewport {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
}

.carousel--ready .carousel__viewport:has(.service:hover) {
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
}

.carousel--ready .carousel__track {
  display: flex;
  gap: 0;
  transition: transform 0.7s var(--ease-out);
  will-change: transform;
}

.carousel--ready .service {
  flex: 0 0 100%;
  min-height: 60vh;
  border: none;
  border-radius: 0;
  /* Gouttiere laterale : les chevrons flottent au-dessus du bloc, il leur
     faut leur propre couloir sinon ils se posent sur le texte. */
  padding-inline: var(--space-24);
}

.carousel--ready .service:hover {
  box-shadow: none;
}

/* ---------- Chevrons ---------- */
.carousel__arrow {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.2s var(--ease-out);
}

.carousel--ready .carousel__arrow {
  display: inline-flex;
}

.carousel__arrow:hover {
  color: var(--accent-contrast);
  background: var(--accent);
  border-color: var(--accent);
}

.carousel__arrow--prev {
  left: var(--space-4);
}

.carousel__arrow--next {
  right: var(--space-4);
}

.carousel__arrow--prev:hover {
  transform: translateY(-50%) translateX(-3px);
}

.carousel__arrow--next:hover {
  transform: translateY(-50%) translateX(3px);
}

/* ---------- Puces ---------- */
.carousel__controls {
  display: none;
}

.carousel--ready .carousel__controls {
  display: flex;
  justify-content: center;
  margin-top: var(--space-6);
}

.carousel__dots {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.carousel__dots button {
  display: block;
  width: 36px;
  height: 4px;
  padding: 0;
  border: none;
  border-radius: var(--radius-full);
  background: var(--border-strong);
  cursor: pointer;
  transition: background 0.3s var(--ease-out), width 0.3s var(--ease-out);
}

.carousel__dots button:hover {
  background: var(--accent-hover);
}

.carousel__dots button.is-active {
  width: 56px;
  background: var(--accent);
}

/* Mouvement reduit : pas de glissement, pas de defilement automatique
   (coupe aussi dans carousel.js), et les blocs se reempilent. */
@media (prefers-reduced-motion: reduce) {
  .carousel--ready .carousel__track {
    display: grid;
    gap: var(--space-6);
    transform: none !important;
    transition: none;
  }

  .carousel--ready .carousel__viewport {
    overflow: visible;
  }

  .carousel--ready .service {
    min-height: 0;
    border-radius: var(--radius-lg);
    border-inline: 1px solid var(--border);
  }

  .carousel--ready .carousel__controls {
    display: none;
  }
}

/* ---------- Carte ---------- */
.card {
  display: flex;
  flex-direction: column;
  padding: var(--space-8);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: transform 0.3s var(--ease-out), border-color 0.3s, box-shadow 0.3s;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
}

.card__icon {
  width: 40px;
  height: 40px;
  fill: var(--accent);
  margin-bottom: var(--space-4);
}

.card__title {
  font-size: var(--fs-lg);
  margin-bottom: var(--space-3);
}

.card__text {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  flex-grow: 1;
}

.card__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--accent);
}

.card__link:hover {
  text-decoration: underline;
}

/* ---------- Timeline ---------- */
.timeline {
  position: relative;
  padding-left: var(--space-12);
}

.timeline__line {
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border-strong);
  transform-origin: 50% 0;
}

.timeline__item {
  position: relative;
  padding-bottom: var(--space-16);
}

.timeline__item:last-child {
  padding-bottom: 0;
}

.timeline__dot {
  position: absolute;
  left: calc(var(--space-12) * -1);
  top: 6px;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  background: var(--bg);
  border: 3px solid var(--accent);
  z-index: 1;
}

.timeline__period {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-2);
}

.timeline__role {
  font-size: var(--fs-xl);
}

.timeline__company {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

.timeline__list {
  display: grid;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.timeline__list li {
  position: relative;
  padding-left: var(--space-6);
  font-size: var(--fs-sm);
  color: var(--text-muted);
  /* Sur un conteneur elargi, ces puces atteindraient plus de 130 caracteres
     par ligne : l'oeil perd le debut de la ligne suivante. */
  max-width: 88ch;
}

.timeline__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--accent);
  opacity: 0.5;
}

.timeline__list strong {
  color: var(--text);
  font-weight: 600;
}

/* ---------- Étiquettes ---------- */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.tag {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  padding: 0.35em 0.8em;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid transparent;
}

/* ============================================================
   Projets — piste de panneaux

   Etat par defaut : piste VERTICALE. La bascule horizontale est ajoutee
   par animations.js via la classe .projects--horizontal, et seulement
   si GSAP est charge, l'ecran large et le mouvement non reduit.
   Faire l'inverse laisserait 9 panneaux cote a cote en debordement
   des qu'un CDN tombe.
   ============================================================ */
.projects {
  background: var(--surface);
  padding-block: var(--space-24);
  overflow: hidden;
}

.projects__head {
  margin-bottom: var(--space-8);
}

.projects__track {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* En vertical, la piste reprend la largeur du conteneur. */
.projects__viewport {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.projects__footer {
  display: none;
}

/* ---------- Panneau ---------- */
.panel {
  min-width: 0;
}

.panel__inner {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: var(--space-12);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 100%;
}

.panel__visual {
  position: relative;
  align-self: stretch;
  min-height: 260px;
  overflow: hidden;
  background: var(--surface-2);
}

.panel__visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease-out);
}

.panel:hover .panel__visual img {
  transform: scale(1.04);
}

/* Visuels mobiles (e-Wari, LONIA) : l'image tient entiere dans le cadre.
   En `cover`, un mockup de telephone dans un cadre paysage serait reduit a
   une bande horizontale inexploitable. */
.panel__visual--contain {
  background: var(--surface-2);
}

/* Boite explicite plutot qu'un `height: 100%` dans une grille centree, qui
   ne se resolvait pas et laissait l'image sortir a sa taille naturelle.
   Les dimensions sont calculees et non deduites des ancrages : sur un
   element remplace, `width: auto` retient la taille intrinseque et non
   l'etirement, ce qui faisait cette fois s'effondrer l'image a 0. */
.panel__visual--contain img {
  position: absolute;
  top: var(--space-6);
  left: var(--space-6);
  width: calc(100% - var(--space-6) * 2);
  height: calc(100% - var(--space-6) * 2);
  object-fit: contain;
}

.panel:hover .panel__visual--contain img {
  transform: none;
}

/* Panneau sans capture : degrade + monogramme.
   Plus utilise aujourd'hui — les dix projets ont une capture — mais
   conserve pour le prochain projet qui arriverait sans visuel. */
.panel__visual--mono {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
}

.panel__mono {
  font-family: var(--font-mono);
  font-size: clamp(2.5rem, 7vw, 5rem);
  font-weight: 500;
  letter-spacing: 0.06em;
  color: #fff;
  opacity: 0.92;
}

.panel__content {
  padding: var(--space-8) var(--space-8) var(--space-8) 0;
  min-width: 0;
}

.panel__index {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.panel__index span {
  color: var(--accent);
  font-size: var(--fs-lg);
  font-weight: 500;
}

.panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.panel__title {
  font-size: var(--fs-2xl);
}

.panel__text {
  color: var(--text-muted);
  margin-bottom: var(--space-6);
  max-width: 52ch;
}

.panel__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-6);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--accent);
}

.panel__link:hover {
  text-decoration: underline;
}

/* ---------- Mode horizontal ---------- */
.projects--horizontal {
  padding-block: 0;
}

.projects--horizontal .projects__stage {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-6);
  padding-block: calc(var(--header-h) + var(--space-6)) var(--space-8);
}

.projects--horizontal .projects__head {
  margin-bottom: 0;
  flex-shrink: 0;
}

.projects--horizontal .projects__head .section-title {
  margin-bottom: 0;
}

.projects--horizontal .projects__viewport {
  flex: 1 1 auto;
  min-height: 0;
  max-width: none;
  padding-inline: 0;
  overflow: hidden;
}

.projects--horizontal .projects__track {
  flex-direction: row;
  gap: 0;
  height: 100%;
  will-change: transform;
}

.projects--horizontal .panel {
  flex: 0 0 100%;
  height: 100%;
  padding-inline: var(--space-6);
}

.projects--horizontal .panel__inner {
  max-width: var(--container);
  margin-inline: auto;
}

.projects--horizontal .projects__footer {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  flex-shrink: 0;
}

.projects__counter {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--text-muted);
  white-space: nowrap;
}

.projects__counter span {
  color: var(--accent);
  font-size: var(--fs-lg);
  font-weight: 500;
}

.projects__bar {
  flex: 1 1 auto;
  height: 3px;
  border-radius: var(--radius-full);
  background: var(--border-strong);
  overflow: hidden;
}

.projects__bar-fill {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

/* ---------- Badges de statut ---------- */
.badge {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  padding: 0.3em 0.7em;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--text-muted);
  white-space: nowrap;
}

.badge--live {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
}

[data-theme="dark"] .badge--live {
  background: rgba(74, 222, 128, 0.16);
  color: #4ade80;
}

.badge--pro,
.badge--wip {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge--academic {
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
}

[data-theme="dark"] .badge--academic {
  background: rgba(251, 191, 36, 0.16);
  color: #fbbf24;
}

/* ---------- Compétences ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-8);
  margin-bottom: var(--space-16);
}

.skill-block__title {
  font-size: var(--fs-base);
  font-weight: 600;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

/* ---------- Marquee ---------- */
.marquee {
  overflow: hidden;
  padding-block: var(--space-4);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
}

.marquee__track {
  display: flex;
  gap: var(--space-12);
  width: max-content;
  will-change: transform;
}

.marquee__item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--fs-base);
  color: var(--text-muted);
  white-space: nowrap;
}

/* Le logo porte la couleur de marque via .tech--<nom> (tech-icons.css) ;
   le libelle reste dans le gris du texte secondaire pour ne pas
   transformer la bande en arc-en-ciel illisible. */
.marquee__logo {
  width: 28px;
  height: 28px;
  fill: currentColor;
  flex-shrink: 0;
}

/* ---------- Formulaire ---------- */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.field__label {
  font-size: var(--fs-sm);
  font-weight: 500;
}

.field__optional {
  color: var(--text-muted);
  font-weight: 400;
}

.field__input {
  width: 100%;
  padding: 0.85em 1em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.field__input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.field__input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea.field__input {
  resize: vertical;
  min-height: 140px;
}

/* ---------- Retour en haut ---------- */
.social--sm a {
  width: 38px;
  height: 38px;
}

.to-top {
  position: fixed;
  right: var(--space-6);
  bottom: var(--space-6);
  z-index: 90;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out),
    visibility 0.3s;
}

.to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
