/* ========================================
   Portfolio - Styles CSS
   ======================================== */

/* THEME TOKENS */
:root{
  --bg: 0 0 0;
  --fg: 255 255 255;
  --muted: 209 213 219;
  --muted2: 156 163 175;
  --border: 255 255 255;
  --card: 255 255 255;
  --green: 74 222 128;
}

html.light{
  --bg: 255 255 255;
  --fg: 10 10 10;
  --muted: 60 60 60;
  --muted2: 90 90 90;
  --border: 0 0 0;
  --card: 0 0 0;
  --green: 34 197 94;
}

html, body {
  background-color: rgb(var(--bg) / 1);
  color: rgb(var(--fg) / 1);
  /* ↓ more subtle */
  transition: background-color 140ms ease, color 140ms ease;
}

/* Swap system (no layout shift) */
.theme-swap { position: relative; }
.theme-swap .swap-layer{
  transition: opacity 180ms ease;
  will-change: opacity;
}
/* default = DARK visible */
.theme-swap .swap-dark{ opacity: 1; }
.theme-swap .swap-light{ opacity: 0; pointer-events: none; }
html.light .theme-swap .swap-dark{ opacity: 0; pointer-events: none; }
html.light .theme-swap .swap-light{ opacity: 1; pointer-events: auto; }

@media (prefers-reduced-motion: reduce){
  html, body { transition: none !important; }
  .theme-swap .swap-layer{ transition: none !important; }
}

/* ---- Anti-halo for AI MP4s (premium) ---- */
.media-feather{
  -webkit-mask-image: radial-gradient(circle at center, rgba(0,0,0,1) 72%, rgba(0,0,0,0) 100%);
  mask-image: radial-gradient(circle at center, rgba(0,0,0,1) 72%, rgba(0,0,0,0) 100%);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}

/* Subtle "plate" only in light mode to hide detourage */
.media-plate{
  opacity: 0;
  transition: opacity 180ms ease;
  will-change: opacity;
  background:
    radial-gradient(70% 60% at 50% 45%, rgba(0,0,0,0.045) 0%, rgba(0,0,0,0) 70%),
    linear-gradient(to bottom, rgba(0,0,0,0.02), rgba(0,0,0,0));
}
html.light .media-plate{ opacity: 1; }

/* HERO */
.avatar-glow {
  background: radial-gradient(circle, rgba(74, 222, 128, 0.22) 0%, rgba(74, 222, 128, 0) 70%);
  filter: blur(60px);
  transform: translateZ(0);
}

.hero-vignette {
  background:
    radial-gradient(ellipse at center, rgba(74,222,128,0.06) 0%, rgba(0,0,0,0) 55%),
    linear-gradient(to top, rgb(var(--bg) / 0.95) 0%, rgb(var(--bg) / 0) 55%);
  pointer-events: none;
}

/* SECTION 2 */
.process-vignette {
  background:
    radial-gradient(ellipse at center, rgba(74,222,128,0.06) 0%, rgba(0,0,0,0) 55%),
    radial-gradient(circle at 30% 20%, rgba(74,222,128,0.05) 0%, rgba(0,0,0,0) 45%),
    radial-gradient(circle at 70% 75%, rgba(74,222,128,0.05) 0%, rgba(0,0,0,0) 45%);
  pointer-events: none;
}

/* Fade bas (thémable) */
.fade-bottom {
  background: linear-gradient(to top, rgb(var(--bg) / 1) 0%, rgb(var(--bg) / 0) 100%);
}

/* Zigzag scroll-draw */
#zigProgress {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.08s linear;
}

/* Reveal rows */
.reveal-row .reveal-col {
  opacity: 0;
  transform: translateY(18px);
  filter: blur(6px);
  transition:
    opacity 650ms cubic-bezier(.2,.8,.2,1),
    transform 650ms cubic-bezier(.2,.8,.2,1),
    filter 650ms cubic-bezier(.2,.8,.2,1);
  will-change: opacity, transform, filter;
}
.reveal-row .reveal-col:nth-child(2) { transition-delay: 90ms; }
.reveal-row.is-inview .reveal-col {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

/* SECTION 3 — lignes premium (wipe L->R) */
.case-lines .case-line {
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
  transition: transform 900ms cubic-bezier(.2,.9,.2,1);
}
.case-lines.is-inview .case-line { transform: scaleX(1); }

@media (prefers-reduced-motion: reduce) {
  #zigProgress { transition: none !important; }
  .reveal-row .reveal-col {
    transition: none !important;
    transform: none !important;
    filter: none !important;
    opacity: 1 !important;
  }
  .case-lines .case-line {
    transition: none !important;
    transform: scaleX(1) !important;
  }
}

/* ========================================
    Additional Custom Styles
    ======================================== */

/* Theme toggle fixed positioning and animation */
.theme-toggle-attention {
  position: relative;
  isolation: isolate;
}

/* Consistent keyboard focus across both colour themes. */
:focus-visible {
  outline: 3px solid rgb(var(--green));
  outline-offset: 4px;
}

body.menu-open {
  overflow: hidden;
}

.theme-toggle-attention::after {
  content: '';
  position: absolute;
  inset: 3px;
  z-index: -1;
  border-radius: inherit;
  background: rgb(var(--green) / 0.36);
  opacity: 0;
  transform: scale(0.7);
  pointer-events: none;
}

/* A brief, light-like cue: it attracts attention without constantly distracting. */
.theme-toggle-attention.is-attention,
#themeToggle.theme-toggle-attention {
  animation: theme-toggle-glow 1.8s ease-out 2;
}

.theme-toggle-attention.is-attention::after,
#themeToggle.theme-toggle-attention::after {
  animation: theme-toggle-halo 1.8s ease-out 2;
}

@keyframes theme-toggle-glow {
  0%, 100% { filter: brightness(1); }
  16%, 42% { filter: brightness(1.45) drop-shadow(0 0 7px rgb(var(--green) / 0.85)); }
  28%, 56% { filter: brightness(1); }
}

@keyframes theme-toggle-halo {
  0%, 100% { opacity: 0; transform: scale(0.7); }
  16%, 42% { opacity: 0.8; transform: scale(1.35); }
  28%, 56% { opacity: 0; transform: scale(1.5); }
}

.theme-toggle-fixed {
  position: absolute;
  right: -60px; /* Start hidden off-screen */
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, right 0.3s ease, transform 0.3s ease;
  z-index: 10;
}

/* When visible, show next to contact button (desktop only) */
@media (min-width: 768px) {
  body.toggle-visible .theme-toggle-fixed {
    opacity: 1;
    pointer-events: all;
    right: 1rem; /* Position with proper spacing from right edge */
  }
}

/* Mobile: Theme toggle centered in header on scroll */
@media (max-width: 767px) {
  body.toggle-visible .theme-toggle-fixed {
    opacity: 1;
    pointer-events: all;
    right: 50%;
    transform: translate(-50%, -50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle-attention,
  .theme-toggle-attention::after {
    animation: none !important;
  }
}

/* Mobile menu overlay */
#mobileMenuOverlay {
  background: rgba(var(--bg) / 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Mobile menu links */
#mobileMenuOverlay a {
  display: block;
  text-align: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(var(--border) / 0.2);
}

#mobileMenuOverlay a:last-child {
  border-bottom: none;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.sr-only:focus {
  position: absolute;
  width: auto;
  height: auto;
  padding: 0.5rem 1rem;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
  background: white;
  color: black;
  z-index: 9999;
  top: 1rem;
  left: 1rem;
}

/* Navigation blur on scroll */
nav.backdrop-blur,
nav.bg-brand-bg\/50 {
  background: rgba(var(--bg), 0.5);
  backdrop-filter: blur(10px);
}

/* PERSONAS SECTION */
.personas-card {
  position: relative;
  transition: border-color 0.3s ease;
}

.personas-image {
  transition: opacity 0.3s ease-in-out;
}

.personas-nav-vignettes {
  background: rgba(var(--bg) / 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid rgb(var(--border) / 0.05);
}

.vignette {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid transparent;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0.4;
  cursor: pointer;
  padding: 0;
  background: none;
}

.vignette:hover {
  opacity: 0.8;
  transform: translateY(-2px);
}

.vignette.active {
  border-color: rgb(var(--green));
  opacity: 1;
  transform: scale(1.1);
  box-shadow: 0 10px 15px -3px rgba(var(--green), 0.2);
}

.vignette img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
