/* =========================================================
   NORBEX — SLIDE FRAMEWORK
   Shared utilities & base components for slide templates
   ========================================================= */

@import url('./tokens.css');

/* ---------------------------------------------------------
   SLIDE BASE
   --------------------------------------------------------- */
.slide {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--slide-padding-y) var(--slide-padding-x);
  display: flex;
  overflow: hidden;
}

/* When slide is opened standalone (not inside slider) */
body.slide-standalone {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* Universal slide tag/label (top-left of every slide) */
.tag {
  position: absolute;
  top: var(--slide-padding-y);
  left: var(--slide-padding-x);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  z-index: 5;
}
.tag::before {
  content: '';
  width: 24px; height: 1px;
  background: currentColor;
  display: inline-block;
}

/* Ambient grain overlay for atmospheric depth */
.grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  mix-blend-mode: multiply;
  z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='3' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' /%3E%3C/svg%3E");
}
/* Tactile : une couche plein écran en mix-blend-mode par slide coûte trop
   cher à composer pendant le scroll — le grain (6% d'opacité) est invisible
   sur petit écran de toute façon. */
@media (hover: none) and (pointer: coarse) {
  .grain { display: none; }
}

/* Decorative numbered marker */
.slide-num {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 400;
  letter-spacing: 0.1em;
  opacity: 0.5;
}

/* ---------------------------------------------------------
   TYPOGRAPHY UTILITIES
   --------------------------------------------------------- */
.t-display {
  font-family: var(--font-display);
  font-weight: 400;
  font-optical-sizing: auto;
  font-variation-settings: "SOFT" 30, "WONK" 0;
  line-height: 0.95;
  letter-spacing: -0.025em;
}
.t-grotesk { font-family: var(--font-grotesk); font-weight: 800; letter-spacing: -0.04em; }
.t-mono { font-family: var(--font-mono); }
.t-serif { font-family: var(--font-serif); }
.t-italic { font-style: italic; }

.t-mega { font-size: var(--fs-mega); }
.t-3xl { font-size: var(--fs-3xl); }
.t-2xl { font-size: var(--fs-2xl); }
.t-xl  { font-size: var(--fs-xl); }
.t-lg  { font-size: var(--fs-lg); }
.t-md  { font-size: var(--fs-md); }
.t-base{ font-size: var(--fs-base); }
.t-sm  { font-size: var(--fs-sm); }
.t-xs  { font-size: var(--fs-xs); }

.t-up { text-transform: uppercase; letter-spacing: 0.05em; }
.t-tight { letter-spacing: -0.04em; }
.t-narrow { letter-spacing: -0.06em; }

/* ---------------------------------------------------------
   ANIMATION UTILITIES
   --------------------------------------------------------- */

/* Fade-up reveal — staggered via animation-delay */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes slideRight {
  from { opacity: 0; transform: translateX(-32px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes drawLine {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(var(--rot, 0deg)); }
  50%      { transform: translateY(-10px) rotate(var(--rot, 0deg)); }
}
@keyframes imgReveal {
  from { clip-path: inset(0 0 100% 0); transform: scale(1.08); }
  to   { clip-path: inset(0 0 0% 0);   transform: scale(1); }
}

.reveal { opacity: 0; }
/* Trigger reveal as soon as the slide is even partially visible
   (.has-revealed is added by the reveal IntersectionObserver and
   never removed, so animations never replay or flicker).        */
.has-revealed .reveal,
.is-active .reveal,
body.slide-standalone .reveal {
  animation: fadeUp 500ms var(--ease-cinematic) forwards;
}
.has-revealed .reveal-1, .is-active .reveal-1, body.slide-standalone .reveal-1 { animation-delay: 0s; }
.has-revealed .reveal-2, .is-active .reveal-2, body.slide-standalone .reveal-2 { animation-delay: 0.05s; }
.has-revealed .reveal-3, .is-active .reveal-3, body.slide-standalone .reveal-3 { animation-delay: 0.10s; }
.has-revealed .reveal-4, .is-active .reveal-4, body.slide-standalone .reveal-4 { animation-delay: 0.15s; }
.has-revealed .reveal-5, .is-active .reveal-5, body.slide-standalone .reveal-5 { animation-delay: 0.20s; }
.has-revealed .reveal-6, .is-active .reveal-6, body.slide-standalone .reveal-6 { animation-delay: 0.25s; }

/* Marquee component */
.marquee {
  display: flex;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
}
.marquee__track {
  display: flex;
  gap: var(--space-8);
  animation: marquee 30s linear infinite;
  flex-shrink: 0;
}
.marquee:hover .marquee__track { animation-play-state: paused; }

/* ---------------------------------------------------------
   COMPONENT: BUTTON / CTA
   --------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.9rem 1.6rem;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: var(--radius-pill);
  background: var(--fg);
  color: var(--bg);
  transition: transform var(--dur-fast) var(--ease-out-expo),
              box-shadow var(--dur-fast) var(--ease-out-expo);
  border: 1px solid var(--fg);
}
.btn:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hard);
}
.btn--ghost {
  background: transparent;
  color: var(--fg);
}
.btn--ghost:hover {
  background: var(--fg);
  color: var(--bg);
}
.btn__arrow {
  width: 14px; height: 14px;
  transition: transform var(--dur-fast) var(--ease-out-expo);
}
.btn:hover .btn__arrow { transform: translateX(4px); }

/* ---------------------------------------------------------
   COMPONENT: STAT / METRIC
   --------------------------------------------------------- */
.stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.stat__num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-2xl);
  line-height: 0.9;
  letter-spacing: -0.04em;
}
.stat__label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.7;
}

/* ---------------------------------------------------------
   WOW UTILITIES — orbital badges, spinning stars, animated
   rules, floating stars, magnetic CTAs, kinetic type, tilt
   cards. Reusable across slides for editorial micro-magic.
   --------------------------------------------------------- */

/* Rotating orbit badge — wraps an SVG textPath that spins */
.orbit {
  position: relative;
  display: inline-block;
  width: clamp(120px, 14vw, 170px);
  aspect-ratio: 1;
  animation: orbitSpin 22s linear infinite;
}
.orbit svg { width: 100%; height: 100%; display: block; }
.orbit__core {
  position: absolute;
  top: 50%; left: 50%;
  width: clamp(36px, 4vw, 52px);
  height: clamp(36px, 4vw, 52px);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: 1rem;
  letter-spacing: 0;
  background: var(--accent, var(--fl-gold));
  color: var(--fl-ink);
  animation: orbitCorePulse 4s var(--ease-cinematic) infinite;
}
@keyframes orbitSpin { to { transform: rotate(360deg); } }
@keyframes orbitCorePulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50%      { transform: translate(-50%, -50%) scale(1.07); }
}

/* 8-point star (decorative, slowly spins) */
.deco-star {
  display: inline-block;
  width: clamp(28px, 3vw, 48px);
  height: clamp(28px, 3vw, 48px);
  flex-shrink: 0;
  animation: starSpin 16s linear infinite;
}
.deco-star path { fill: currentColor; }
@keyframes starSpin { to { transform: rotate(360deg); } }

/* Floating ✦ symbol (drifts up/down) */
.deco-float {
  display: inline-block;
  animation: floatY 5s var(--ease-cinematic) infinite;
  will-change: transform;
}
.deco-float--alt { animation-delay: -2.5s; }
@keyframes floatY {
  0%, 100% { transform: translateY(0) rotate(0); }
  50%      { transform: translateY(-10px) rotate(8deg); }
}

/* Hairline rule that draws across when slide activates */
.deco-rule {
  position: relative;
  height: 1px;
  background: currentColor;
  opacity: 0.35;
  transform: scaleX(0);
  transform-origin: left center;
}
.has-revealed .deco-rule,
.is-active .deco-rule,
body.slide-standalone .deco-rule {
  animation: drawLine 1.2s var(--ease-cinematic) 0.1s forwards;
}

/* Vertical scrolling micro-ribbon */
.ribbon-vert {
  position: absolute;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  opacity: 0.55;
}

/* Kinetic title — RGB split that pulses in idle */
.t-kinetic {
  position: relative;
  display: inline-block;
}
.t-kinetic::before,
.t-kinetic::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}
.t-kinetic::before { color: var(--accent, var(--fl-gold)); transform: translate(-2px, 0); }
.t-kinetic::after  { color: var(--fl-rust);                  transform: translate(2px, 0); }
.is-active .t-kinetic::before,
.is-active .t-kinetic::after,
body.slide-standalone .t-kinetic::before,
body.slide-standalone .t-kinetic::after {
  animation: kineticPulse 6s steps(1) infinite;
}
@keyframes kineticPulse {
  0%, 96%, 100% { opacity: 0; transform: translate(0, 0); }
  97% { opacity: 0.45; transform: translate(-3px, 0); }
  98% { opacity: 0.45; transform: translate(3px, 0); }
}

/* Tilt-on-hover card */
.tilt {
  transition: transform 700ms var(--ease-cinematic),
              box-shadow 700ms var(--ease-cinematic);
}
.tilt:hover {
  transform: translateY(-6px) rotate(-0.6deg);
  box-shadow: 0 30px 60px rgba(11,10,8,0.18);
}

/* Magnetic CTA — slight stretch on hover */
.btn-magnet {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: 1rem 1.8rem;
  border: 1px solid currentColor;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  overflow: hidden;
  isolation: isolate;
  transition: transform 400ms var(--ease-cinematic),
              color 400ms var(--ease-cinematic);
}
.btn-magnet::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent, var(--fl-gold));
  transform: translateY(101%);
  transition: transform 600ms var(--ease-cinematic);
  z-index: -1;
}
.btn-magnet:hover { color: var(--fl-ink); transform: translateY(-3px); }
.btn-magnet:hover::before { transform: translateY(0); }

/* Image reveal mask (clip-path) */
.img-reveal { clip-path: inset(0 0 100% 0); transform: scale(1.06); }
.has-revealed .img-reveal,
.is-active .img-reveal,
body.slide-standalone .img-reveal {
  animation: imgReveal 1s var(--ease-cinematic) 0.15s forwards;
}

/* Counter stat (animates up via JS data attribute, but the
   underlying typography is still stylable here) */
.counter {
  font-family: var(--font-display);
  font-weight: 200;
  font-size: clamp(2.6rem, 5vw, 4.5rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
  font-feature-settings: "tnum" 1;
}
.counter sup {
  font-size: 0.4em;
  vertical-align: super;
  font-style: italic;
  color: var(--accent, var(--fl-gold));
  margin-left: 0.05em;
}

/* ---------------------------------------------------------
   GALLERY (shared by all category slides — mariage, corporate,
   portrait, artistique). Theming is per-slide via CSS vars.
   --------------------------------------------------------- */
.gal {
  flex-direction: column;
  gap: var(--space-6);
}
.gal__head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: var(--space-6);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid currentColor;
  border-color: rgba(255,255,255,0.12);
}
.gal--light .gal__head { border-color: rgba(11,10,8,0.15); }

.gal__lbl {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.55;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.gal__lbl::before {
  content: '';
  width: 28px; height: 1px;
  background: currentColor;
}
.gal__title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(2.6rem, 6.5vw, 5.6rem);
  letter-spacing: -0.025em;
  line-height: 0.96;
}
.gal__title em {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  letter-spacing: -0.02em;
}
.gal__title__amp {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  opacity: 0.5;
  margin: 0 0.05em;
}
.gal__intro {
  max-width: 32ch;
  font-size: var(--fs-sm);
  line-height: 1.55;
  opacity: 0.7;
  align-self: end;
  font-family: var(--font-sans);
}

.gal__cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.95rem 1.6rem;
  border: 1px solid currentColor;
  border-radius: var(--radius-pill);
  transition: background var(--dur-fast) var(--ease-cinematic),
              color var(--dur-fast) var(--ease-cinematic);
  white-space: nowrap;
}
.gal__cta__arrow {
  width: 14px; height: 14px;
  transition: transform var(--dur-base) var(--ease-cinematic);
}
.gal__cta:hover { background: var(--fg); color: var(--bg); }
.gal__cta:hover .gal__cta__arrow { transform: translateX(6px); }

/* Grid */
.gal__grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1rem, 2vw, 1.6rem);
  min-height: 0;
}
.gal__card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  cursor: pointer;
  overflow: hidden;
  min-height: 0;
}
.gal__card__frame {
  position: relative;
  aspect-ratio: 3 / 4;
  max-height: 56vh;
  overflow: hidden;
  background: rgba(255,255,255,0.04);
}
.gal--light .gal__card__frame { background: rgba(11,10,8,0.05); }
.gal__card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.9) contrast(1.02);
  transform: scale(1.001);
  transition: transform 1400ms var(--ease-cinematic),
              filter   900ms var(--ease-cinematic);
}
.gal__card:hover .gal__card__img {
  transform: scale(1.05);
  filter: saturate(1.05) contrast(1.05);
}
.gal__card__frame::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 50%, rgba(0,0,0,0.55) 100%);
  pointer-events: none;
  opacity: 0.65;
  transition: opacity var(--dur-base) var(--ease-cinematic);
}
.gal__card:hover .gal__card__frame::after { opacity: 0.9; }

.gal__card__index {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.18em;
  color: var(--fl-white);
  z-index: 2;
  mix-blend-mode: difference;
}
.gal__card__year {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.18em;
  color: var(--fl-white);
  z-index: 2;
  mix-blend-mode: difference;
}

.gal__card__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.gal__card__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(1.4rem, 2vw, 1.8rem);
  letter-spacing: -0.015em;
  line-height: 1.05;
}
.gal__card__sub {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.6;
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.gal__card__sub span + span::before {
  content: '·';
  margin-right: var(--space-3);
  opacity: 0.5;
}
.gal__card__desc {
  font-size: var(--fs-sm);
  line-height: 1.5;
  opacity: 0.7;
  margin-top: var(--space-1);
  font-family: var(--font-sans);
}

/* Empty / loading state */
.gal__loading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.4;
  padding: var(--space-10) 0;
}

/* Skeleton card placeholders (shown instantly while images load) */
.gal__skeleton {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.gal__skeleton__frame {
  position: relative;
  aspect-ratio: 3 / 4;
  max-height: 56vh;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 100%);
  background-size: 200% 200%;
  animation: skelShimmer 2.4s var(--ease-cinematic) infinite;
}
.gal--light .gal__skeleton__frame {
  background:
    linear-gradient(135deg, rgba(11,10,8,0.04) 0%, rgba(11,10,8,0.08) 50%, rgba(11,10,8,0.04) 100%);
  background-size: 200% 200%;
}
.gal__skeleton__line {
  height: 14px;
  border-radius: 2px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.12) 50%, rgba(255,255,255,0.06) 100%);
  background-size: 200% 100%;
  animation: skelShimmer 2.4s var(--ease-cinematic) infinite;
}
.gal--light .gal__skeleton__line {
  background:
    linear-gradient(90deg, rgba(11,10,8,0.05) 0%, rgba(11,10,8,0.1) 50%, rgba(11,10,8,0.05) 100%);
  background-size: 200% 100%;
}
.gal__skeleton__line--sm { width: 40%; height: 9px; }
.gal__skeleton__line--md { width: 70%; height: 14px; }
@keyframes skelShimmer {
  0%   { background-position: 200% 50%; }
  100% { background-position: -200% 50%; }
}

/* Image fade-in once loaded */
.gal__card__img {
  opacity: 0;
  transition: opacity 700ms var(--ease-cinematic),
              transform 1400ms var(--ease-cinematic),
              filter   900ms var(--ease-cinematic);
}
.gal__card__img.is-loaded { opacity: 1; }

@media (max-width: 900px) {
  .gal__head { grid-template-columns: 1fr; }
  .gal__intro { max-width: 100%; }
  .gal__cta { align-self: flex-start; }
  .gal__grid { grid-template-columns: 1fr 1fr; }
  .gal__card__frame { aspect-ratio: 3 / 4; }
}
@media (max-width: 600px) {
  .gal__grid { grid-template-columns: 1fr; gap: var(--space-5); }
  .gal__card__frame { aspect-ratio: 4 / 5; }
}

/* ---------------------------------------------------------
   PRINT (just in case)
   --------------------------------------------------------- */
@media print {
  .slide { page-break-after: always; }
  .chrome, .controls, .indicator { display: none !important; }
}
