/*
 * Themes des sites FlowCorp et dscoelho.com : variables (polices et couleurs des anciens sites), puis les animations et
 * la frise. Aucune classe n'est utilisee par les vues : selecteurs de structure (#hero, sections), accroches `data-fcs-*`
 * posees par les composants, classes `fcs-*` ajoutees par webroot/js/sites.js et classes de la cell Timeline.
 * Mouvement : desactive si le visiteur demande moins d'animations (prefers-reduced-motion).
 */

/* ---------- FlowCorp ---------- */
body.showcase[data-theme="flowcorp"] {
  --font-title: "Fraunces", Georgia, serif;
  --font-text: "DM Sans", system-ui, sans-serif;
  --font-ui: "DM Sans", system-ui, sans-serif;
  --color-background: #f3f0e8;
  --color-surface: #faf8f2;
  --color-foreground: #07110c;
  --color-textdark: #07110c;
  --color-text: #07110c;
  --color-ink: #07110c;
  --color-ink-soft: #25342b;
  --color-muted-foreground: #5d6a61;
  --color-foreground-muted: #5d6a61;
  --color-muted: #e8e5dc;
  --color-border: #07110c33;
  --color-forest: #143f2d;
  --color-stamp: #c65b49;
  --fcs-sage: #84b89a;
  --fcs-paper: #f3f0e8;
  --fcs-ink: #07110c;
}

/* Accueil sombre, pleine largeur, avec les visuels de l'ancien site qui derivent lentement */
body.showcase[data-theme="flowcorp"] #hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-inline: calc(50% - 50vw);
  padding-inline: calc(50vw - 50%);
  min-height: min(88svh, 760px);
  display: flex;
  align-items: center;
  border-bottom: 0;
  background: var(--fcs-ink);
  --color-foreground: var(--fcs-paper);
  --color-textdark: var(--fcs-paper);
  --color-text: var(--fcs-paper);
  --color-muted-foreground: #dfe5e0;
  --color-foreground-muted: #dfe5e0;
  --color-ink: var(--fcs-paper);
  --color-border: #f3f0e866;
  --color-surface: transparent;
  color: var(--fcs-paper);
}

body.showcase[data-theme="flowcorp"] #hero::before,
body.showcase[data-theme="flowcorp"] #hero::after {
  content: "";
  position: absolute;
  inset: -4%;
  z-index: -1;
  background-repeat: no-repeat;
  background-size: cover;
  pointer-events: none;
}

body.showcase[data-theme="flowcorp"] #hero::before {
  background-image:
    linear-gradient(90deg, #07110cf2 0%, #07110cb3 38%, #07110c00 72%),
    url("../img/flowcorp/hero-flow-01.webp");
  background-position: 0 0, 70% 50%;
  opacity: .9;
  animation: fcsDrift 18s ease-in-out infinite alternate;
}

body.showcase[data-theme="flowcorp"] #hero::after {
  background-image: url("../img/flowcorp/hero-fibers.webp"), url("../img/flowcorp/hero-afterglow.webp");
  background-position: 85% 40%, 30% 70%;
  background-size: 60% auto, 70% auto;
  mix-blend-mode: screen;
  opacity: .35;
  animation: fcsDrift 26s ease-in-out -6s infinite alternate-reverse;
}

body.showcase[data-theme="flowcorp"] #hero h1 {
  max-width: 11ch;
  letter-spacing: -0.045em;
}

body.showcase[data-theme="flowcorp"] #hero > * {
  max-width: 44rem;
}

@keyframes fcsDrift {
  0% { transform: translate3d(0, -6px, 0) rotate(-1.2deg) scale(1.02); }
  100% { transform: translate3d(0, 8px, 0) rotate(1.4deg) scale(1.06); }
}

/* Mots-cles : tableau a volets (un mot bascule a la fois) */
[data-fcs-flap] > * {
  perspective: 600px;
  transition: background-color .3s ease, color .3s ease;
}

[data-fcs-flap] > .fcs-flap-on {
  background: var(--fcs-sage);
  color: var(--fcs-ink);
  border-color: var(--fcs-sage);
  animation: fcsFlap .56s cubic-bezier(.22, .78, .22, 1);
}

@keyframes fcsFlap {
  0% { transform: rotateX(0); filter: blur(0); }
  46% { transform: rotateX(-86deg); filter: blur(1px); }
  54% { transform: rotateX(86deg); filter: blur(1px); }
  100% { transform: rotateX(0); filter: blur(0); }
}

/* Realisations : cartes qui se soulevent, captures des sites */
body.showcase[data-theme="flowcorp"] #realisations .grid > * {
  transition: transform .35s cubic-bezier(.22, .78, .22, 1), box-shadow .35s cubic-bezier(.22, .78, .22, 1);
  border-color: var(--fcs-ink);
}

body.showcase[data-theme="flowcorp"] #realisations .grid > *:hover {
  transform: translateY(-6px);
  box-shadow: 9px 9px 0 var(--color-forest);
}

body.showcase[data-theme="flowcorp"] #realisations img {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  object-position: top center;
  border: 1px solid var(--fcs-ink);
  background: #fff;
}

/* ---------- dscoelho.com ---------- */
body.showcase[data-theme="dscoelho"] {
  --font-title: "Instrument Serif", Georgia, serif;
  --font-text: "Hanken Grotesk", system-ui, sans-serif;
  --font-ui: "Hanken Grotesk", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --color-background: #f2efe8;
  --color-surface: #f7f5ef;
  --color-foreground: #161614;
  --color-textdark: #161614;
  --color-text: #161614;
  --color-ink: #161614;
  --color-ink-soft: #4a4944;
  --color-muted-foreground: #6b6a64;
  --color-foreground-muted: #6b6a64;
  --color-muted: #e8e4da;
  --color-border: #cfcabd;
  --color-forest: #161614;
  --color-stamp: #c8361e;
}

body.showcase[data-theme="dscoelho"] .showcase-main h1 {
  font-size: clamp(3rem, 9vw, 6.5rem);
  letter-spacing: -0.02em;
}

body.showcase[data-theme="dscoelho"] .font-mono {
  font-family: var(--font-mono);
}

/* Frise du parcours (cell FlowCorpShowcase.Timeline) */
.fcs-timeline {
  margin: 0 0 1rem;
}

.fcs-timeline svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.fcs-timeline__tick { stroke: #c9c5ba; stroke-width: 1; }
.fcs-timeline__rule { stroke: #e0dcd2; stroke-width: 1; }
.fcs-timeline__year { font: 11px var(--font-mono, monospace); fill: #6b6a64; }
.fcs-timeline__label { font: 600 13px var(--font-ui); fill: var(--color-foreground); }
.fcs-timeline__bar { transform-box: fill-box; transform-origin: left center; }
.fcs-timeline__bar--current { fill: var(--color-stamp); }
.fcs-timeline__bar--done { fill: var(--color-foreground); }
.fcs-timeline__bar--education { fill: transparent; stroke: var(--color-foreground); stroke-width: 1.5; }

.fcs-timeline__legend {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.5rem;
  margin-top: 1rem;
  font: 11px var(--font-mono, monospace);
  color: #6b6a64;
}

.fcs-timeline__legend span { display: inline-flex; align-items: center; gap: .5rem; }
.fcs-timeline__key { display: inline-block; width: 18px; height: 10px; }
.fcs-timeline__key--current { background: var(--color-stamp); }
.fcs-timeline__key--done { background: var(--color-foreground); }
.fcs-timeline__key--education { border: 1.5px solid var(--color-foreground); }

@media (max-width: 639px) {
  .fcs-timeline { display: none; }
}

/* ---------- Apparition au defilement (classes posees par sites.js) ---------- */
body.fcs-anim .fcs-reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .85s cubic-bezier(.22, .78, .22, 1), transform .85s cubic-bezier(.22, .78, .22, 1);
}

body.fcs-anim .fcs-reveal.is-in {
  opacity: 1;
  transform: none;
}

body.fcs-anim .fcs-timeline .fcs-timeline__bar { transform: scaleX(0); transition: transform 1.1s cubic-bezier(.22, .78, .22, 1); }
body.fcs-anim .fcs-timeline.is-in .fcs-timeline__bar { transform: scaleX(1); }

@media (prefers-reduced-motion: reduce) {
  body.showcase[data-theme="flowcorp"] #hero::before,
  body.showcase[data-theme="flowcorp"] #hero::after,
  [data-fcs-flap] > .fcs-flap-on { animation: none; }
}
