/* =============================================================================
   fx.css — the atmospheric layer: ambient aurora, film grain and scanlines,
   terminal eyebrows, card glare/tilt, neon thumbnail grading,
   skills marquee and the contact finale. Loaded after site.css.
   ========================================================================== */

/* ── Hero arm glow: a cheap CSS 'bloom' on the transparent WebGL canvas ──── */
@media (hover: hover) and (pointer: fine) {
  :root:not([data-theme="light"]) #hero-canvas { filter: drop-shadow(0 0 10px rgba(0, 255, 156, 0.35)); }
}

/* ── Ambient aurora (fixed behind everything) ────────────────────────────── */
/* Two large blurred neon blooms drift slowly; --aurora-x/--aurora-y are
   nudged per section by motion.js so the light follows the story. */
body::before {
  content: ''; position: fixed; inset: -20vmax; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38vmax 32vmax at calc(18% + var(--aurora-x, 0%)) calc(22% + var(--aurora-y, 0%)), rgba(0, 255, 156, 0.13), transparent 70%),
    radial-gradient(34vmax 28vmax at calc(82% - var(--aurora-x, 0%)) calc(68% - var(--aurora-y, 0%)), rgba(0, 200, 255, 0.08), transparent 70%),
    radial-gradient(26vmax 22vmax at 55% 105%, rgba(182, 255, 59, 0.06), transparent 70%);
  animation: aurora-drift 28s ease-in-out infinite alternate;
  transition: background-position 1.2s;
}
@keyframes aurora-drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(3vmax, -2vmax, 0) scale(1.06); }
  100% { transform: translate3d(-2vmax, 2vmax, 0) scale(1.02); }
}
:root[data-theme="light"] body::before { opacity: 0.55; }

/* ── Film grain + scanlines (fixed on top, never interactive) ────────────── */
body::after {
  content: ''; position: fixed; inset: 0; z-index: 90; pointer-events: none;
  background-image:
    repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 3px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.07; mix-blend-mode: overlay;
}
:root[data-theme="light"] body::after { opacity: 0.05; mix-blend-mode: multiply; }

/* ── Terminal eyebrows + decoding headings ───────────────────────────────── */
.eyebrow, .section-head .eyebrow {
  margin: 0 0 14px; font-family: var(--mono); font-size: 0.9rem; line-height: 1.4;
  color: var(--neon); letter-spacing: 0.02em;
}
.eyebrow::before { content: '> '; color: var(--text-dim); }
.eyebrow::after {
  content: '_'; margin-left: 2px; animation: caret 1.1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }
[data-decode].is-decoding { color: var(--neon); text-shadow: var(--text-glow); }

/* ── Cards: cursor glare + tilt (pointer devices only) ───────────────────── */
@media (hover: hover) and (pointer: fine) {
  .project-card, .w-feature { transform-style: preserve-3d; will-change: transform; }
  .project-card::after, .w-feature::after, .w-row::after {
    content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none;
    border-radius: inherit; opacity: 0; transition: opacity 0.3s;
    background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(0, 255, 156, 0.16), transparent 45%);
  }
  .project-card:hover::after, .w-feature:hover::after, .w-row:hover::after { opacity: 1; }
}

/* ── Thumbnail grading (all devices) ─────────────────────────────────────── */
/* A neon duotone unifies sim captures and YouTube art. Pointer devices lift
   it on hover; touch devices lift it while the card is mid-screen (.is-lit). */
.card-media img, .w-thumb img, .reel-tab img {
  filter: grayscale(1) contrast(1.15) brightness(0.8);
  transition: filter 0.45s, transform 0.6s var(--ease-out);
}
.card-media::after, .w-thumb::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 3px),
    linear-gradient(160deg, rgba(0, 255, 156, 0.55), rgba(0, 60, 40, 0.55));
  mix-blend-mode: color; transition: opacity 0.45s;
}
/* The featured card is large enough that a light thumbnail turns into a pale
   mint slab, so it gets a deeper grade with near-black shadows. */
.w-feature .w-thumb img { filter: grayscale(1) contrast(1.25) brightness(0.48); }
.w-feature .w-thumb::after {
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px),
    linear-gradient(160deg, rgba(0, 255, 156, 0.5), rgba(0, 26, 16, 0.7));
}
.w-feature .w-thumb::before {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 40%, rgba(0, 18, 11, 0.25), rgba(0, 10, 6, 0.75));
  mix-blend-mode: multiply; transition: opacity 0.45s;
}
.w-feature.is-lit .w-thumb::before { opacity: 0; }
@media (hover: hover) and (pointer: fine) { .w-feature:hover .w-thumb::before { opacity: 0; } }
:root[data-theme="light"] .w-feature .w-thumb::before { opacity: 0.4; }
.w-badge { z-index: 2; }
.reel-tab[aria-selected="true"] img,
.project-card.is-lit .card-media img, .w-feature.is-lit .w-thumb img, .w-row.is-lit .w-thumb img { filter: none; }
.project-card.is-lit .card-media::after, .w-feature.is-lit .w-thumb::after, .w-row.is-lit .w-thumb::after { opacity: 0; }
@media (hover: hover) and (pointer: fine) {
  .project-card:hover .card-media img, .w-feature:hover .w-thumb img, .w-row:hover .w-thumb img,
  .project-card:focus-visible .card-media img, .reel-tab:hover img { filter: none; }
  .project-card:hover .card-media::after, .w-feature:hover .w-thumb::after, .w-row:hover .w-thumb::after,
  .project-card:focus-visible .card-media::after { opacity: 0; }
}
:root[data-theme="light"] .card-media::after, :root[data-theme="light"] .w-thumb::after { opacity: 0.6; }

/* ── Skills marquee ──────────────────────────────────────────────────────── */
.marquee {
  --speed: 48s;
  position: relative; overflow: hidden; padding: 6px 0;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee + .marquee { margin-top: 14px; }
.marquee-track {
  display: flex; gap: 12px; width: max-content; list-style: none; margin: 0; padding: 0;
  animation: marquee var(--speed) linear infinite;
}
.marquee.reverse .marquee-track { animation-direction: reverse; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(calc(-50% - 6px)); } }

.skill {
  display: inline-flex; align-items: center; gap: 10px; white-space: nowrap;
  padding: 12px 20px; border-radius: 999px;
  border: 1px solid var(--rule-strong); background: color-mix(in srgb, var(--surface) 70%, transparent);
  font-size: clamp(1rem, 1.6vw, 1.25rem); font-weight: 600;
  transition: border-color 0.2s, box-shadow 0.2s, color 0.2s;
}
.skill:hover { border-color: var(--neon); box-shadow: var(--glow); color: var(--neon); }
.skill .k {
  font-family: var(--mono); font-size: 0.72rem; font-weight: 500;
  color: var(--accent-2); padding: 2px 8px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent-2) 40%, transparent);
}
.skill.is-core { border-color: color-mix(in srgb, var(--neon) 55%, transparent); }

/* ── Contact finale ──────────────────────────────────────────────────────── */
.contact { text-align: left; position: relative; }
.contact h2.mega {
  max-width: none; margin-bottom: 40px;
  font-size: clamp(3rem, 11vw, 10rem); line-height: 0.92; letter-spacing: -0.03em;
  font-variation-settings: 'wdth' 125; font-weight: 900;
  color: var(--neon);
  filter: drop-shadow(0 0 22px rgba(0, 255, 156, 0.25));
}
/* fx.js wraps each word; each one fills left to right in reading order. */
.contact h2.mega .w {
  display: inline-block; padding: 0 0.06em 0.16em 0; margin-bottom: -0.16em;
  color: transparent; -webkit-text-stroke: 1.5px var(--neon);
  background: linear-gradient(90deg, var(--neon) 0 50%, transparent 50% 100%) no-repeat;
  background-size: 200% 100%; background-position: calc(100% - var(--fill, 0%)) 0;
  -webkit-background-clip: text; background-clip: text;
}
:root[data-theme="light"] .contact h2.mega { filter: none; }
/* Magnetic elements get their transform from JS; keep it smooth. */
[data-magnetic] { will-change: transform; }

/* ── Highlights: graded footage + HUD frame ──────────────────────────────── */
/* The clips are colour-graded at encode time; at rest they dim slightly
   and come up to full brightness while a clip is playing. */
.reel-video { filter: brightness(0.85) saturate(0.85); transition: opacity 0.45s, filter 0.8s; }
.reel.is-playing .reel-video { filter: none; }
.reel-stage::before {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 3px),
    linear-gradient(160deg, rgba(0, 255, 156, 0.12), rgba(0, 40, 30, 0.18));
  mix-blend-mode: soft-light;
}
.hud-frame { position: absolute; inset: 14px; z-index: 2; pointer-events: none; }
.hud-frame::before, .hud-frame::after { box-sizing: border-box; }
.hud-frame::before, .hud-frame::after {
  content: ''; position: absolute; width: 28px; height: 28px;
  border: 2px solid #00FF9C; filter: drop-shadow(0 0 6px #00FF9C);
}
.hud-frame::before { left: 0; top: 0; border-right: 0; border-bottom: 0; }
.hud-frame::after { right: 0; top: 0; border-left: 0; border-bottom: 0; }
.reel-caption, .reel-toggle { z-index: 3; }

/* ── Work: sticky company panel fills the right-hand column ──────────────── */
.work-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 56px; align-items: start; }
.work-aside { position: sticky; top: calc(var(--header-h) + 48px); }
.work-badge {
  position: relative; padding: 28px; border: 1px solid var(--rule);
  background: color-mix(in srgb, var(--surface) 75%, transparent); backdrop-filter: blur(6px);
}
.work-badge::before, .work-badge::after {
  content: ''; position: absolute; width: 18px; height: 18px; border: 2px solid var(--neon);
  filter: drop-shadow(0 0 6px var(--neon));
}
.work-badge::before { left: -1px; top: -1px; border-right: 0; border-bottom: 0; }
.work-badge::after { right: -1px; bottom: -1px; border-left: 0; border-top: 0; }
.work-badge-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 28px; }
.work-logo { width: 88px; height: 56px; padding: 8px; }
.work-step { font-family: var(--mono); font-size: 0.8rem; color: var(--text-dim); }
.work-step b { color: var(--neon); font-weight: 600; }
.work-badge p { margin: 0; }
.work-metric {
  font-size: clamp(3rem, 5vw, 4.4rem); font-weight: 900; line-height: 0.95;
  font-variation-settings: 'wdth' 120; letter-spacing: -0.02em;
  color: var(--neon); text-shadow: var(--text-glow);
}
.work-metric-label { margin-top: 12px !important; color: var(--text-dim); line-height: 1.45; }
.work-ticks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 28px; }
.work-ticks i { height: 3px; border-radius: 2px; background: var(--rule-strong); transition: background-color 0.4s, box-shadow 0.4s; }
.work-ticks i.is-on { background: var(--neon); box-shadow: var(--glow); }
.work-badge.is-swapping { opacity: 0; transform: translateY(8px); }
.work-badge { transition: opacity 0.25s, transform 0.25s var(--ease-out); }
@media (max-width: 1100px) {
  .work-layout { grid-template-columns: 1fr; }
  .work-aside { display: none; }
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer { align-items: center; }
.footer-status { font-family: var(--mono); font-size: 0.82rem; display: flex; align-items: center; gap: 8px; }
.footer-status .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--neon);
  box-shadow: var(--glow); animation: blink 2.4s ease-in-out infinite;
}
@keyframes blink { 50% { opacity: 0.35; } }
.to-top { color: var(--text); text-decoration: none; font-weight: 600; }
.to-top:hover { color: var(--neon); }

/* ── Work: role dates and highlight bullets ─────────────────────────────── */
.tl-when { display: inline-block; white-space: nowrap; margin-left: 8px; font-family: var(--mono); font-size: 0.78rem; font-weight: 400; color: var(--text-dim); text-shadow: none; }
.tl-points { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 10px; max-width: var(--measure); }
.tl-points li { position: relative; padding-left: 20px; color: var(--text-dim); line-height: 1.55; }
.tl-points li::before {
  content: ''; position: absolute; left: 0; top: 0.62em; width: 8px; height: 8px;
  border: 1.5px solid var(--neon); transform: rotate(45deg);
}
.tl-points strong { color: var(--text); font-weight: 650; }

/* ── Inline role metric (shown where the sticky panel is hidden) ─────────── */
.tl-metric {
  display: inline-flex; align-items: baseline; gap: 10px; margin: 0 0 16px !important;
  padding: 8px 14px; border: 1px solid var(--rule-strong); border-radius: var(--radius-s);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--text-dim) !important; font-size: 0.92rem;
}
.tl-metric b {
  color: var(--neon); font-size: 1.35rem; font-weight: 850; white-space: nowrap;
  font-variation-settings: 'wdth' 118; text-shadow: var(--text-glow);
}
@media (min-width: 1101px) { .tl-metric { display: none; } }

/* ── Small screens / reduced motion ──────────────────────────────────────── */
@media (max-width: 760px) {
  .filter-bar {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter);
  }
  .filter-bar::-webkit-scrollbar { display: none; }
  .filter-btn { flex-shrink: 0; white-space: nowrap; }
  .contact h2.mega { line-height: 1.16; }
  body::after { opacity: 0.05; }
}
@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
  .marquee { mask-image: none; }
  .marquee-track { animation: none; flex-wrap: wrap; width: auto; }
  .marquee-track [aria-hidden="true"] { display: none; }
  .eyebrow::after, .footer-status .dot { animation: none; }
}
