/* ============================================================
   Joshua Trapani — Portfolio
   styles.css  ·  dark, luxurious, spring-based motion
   ============================================================ */

:root {
  --bg: #070708;
  --bg-soft: #0b0b0e;
  --fg: #ffffff;
  --muted: rgba(255, 255, 255, 0.55);
  --accent: #ff5b2e;

  /* spring-like cubic-béziers */
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);   /* ease-out-expo-ish  */
  --ease-spring-in: cubic-bezier(0.34, 1.56, 0.64, 1); /* back-out          */
  --dur: 0.6s;
}

/* Bitcount Prop Single — single-weight pixel font, always 350 */
.font-serif {
  font-weight: 400;
  letter-spacing: 0.02em;
}

* { box-sizing: border-box; }

html, body {
  background: var(--bg);
  color: var(--fg);
  overflow-x: hidden;
}

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* thin custom scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #0b0b0e; }
::-webkit-scrollbar-thumb { background: #26262f; border-radius: 8px; border: 2px solid #0b0b0e; }
::-webkit-scrollbar-thumb:hover { background: #34343f; }


/* ============================================================
   NAV
   ============================================================ */
#topnav.scrolled {
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  background: rgba(7, 7, 8, 0.55);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.nav-link { position: relative; }
.nav-link::after {
  content: "";
  position: absolute; left: 0; bottom: -4px;
  width: 0; height: 1px; background: var(--accent);
  transition: width 0.35s var(--ease-spring);
}
.nav-link:hover::after { width: 100%; }


/* ============================================================
   HERO  ·  layered parallax
   ============================================================ */
.hero { background: #000; will-change: transform; }

.hero-layer { will-change: transform, opacity; }

.hero-video {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
}

.hero-mask {
  z-index: 1;
  background:
    radial-gradient(120% 80% at 70% 30%, rgba(0,0,0,0) 0%, rgba(0,0,0,0.35) 55%, rgba(0,0,0,0.85) 100%),
    linear-gradient(to top, rgba(7,7,8,0.95) 0%, rgba(7,7,8,0.25) 38%, rgba(7,7,8,0.55) 100%),
    linear-gradient(to right, rgba(7,7,8,0.85) 0%, rgba(7,7,8,0.0) 45%);
}

.hero-grain {
  z-index: 2;
  background-image: 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.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
  pointer-events: none;
}

.hero-title { text-wrap: balance; }
.eyebrow { position: relative; padding-left: 28px; }
.eyebrow::before {
  content: ""; position: absolute; left: 0; top: 50%;
  width: 20px; height: 1px; background: var(--accent);
}

/* frosted glass profile card */
.glass-card {
  background: rgba(20, 20, 26, 0.45);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 1.5rem;
  box-shadow:
    0 30px 80px -30px rgba(0,0,0,0.8),
    inset 0 1px 0 rgba(255,255,255,0.08);
}
.hero-profile {
  border-radius: 1.1rem;
  /* grayscale at rest, gently fades to colour on card hover */
  filter: grayscale(1) saturate(0) brightness(0.9) contrast(1.05);
  transition: filter 1.2s cubic-bezier(0.42, 0, 0.25, 1);
}
.glass-card:hover .hero-profile {
  filter: grayscale(0) saturate(1.08) brightness(1) contrast(1.02);
}

.hero-cue { animation: cueFloat 2.4s var(--ease-spring) infinite; }
@keyframes cueFloat {
  0%, 100% { transform: translate(-50%, 0); opacity: 0.4; }
  50%      { transform: translate(-50%, 6px); opacity: 0.85; }
}


/* ============================================================
   MOUSE-TRACKING GRADIENT MESH
   (opacity 0 over hero, ramps up through body, peaks at footer)
   ============================================================ */
#cursor-mesh {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;                       /* JS ramps based on scroll/section */
  transition: opacity 0.6s var(--ease-spring);
  background:
    radial-gradient(420px 420px at var(--mx, 50%) var(--my, 50%),
      rgba(255, 91, 46, 0.18) 0%,
      rgba(255, 91, 46, 0.06) 35%,
      rgba(255, 91, 46, 0) 70%);
  mix-blend-mode: screen;
  will-change: background, opacity;
}


/* ============================================================
   ABOUT
   ============================================================ */
.tool-chip {
  font-size: 11px;
  font-weight: 350;
  padding: 6px 12px;
  border-radius: 999px;
  color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  transition: all 0.3s var(--ease-spring);
}
.tool-chip:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.2);
  transform: translateY(-2px);
}


/* ============================================================
   CATEGORY HEADERS
   ============================================================ */
.cat-head { align-items: flex-end; }
.cat-index {
  display: inline-block;
  font-family: "Bitcount Prop Single", monospace;
  font-weight: 350;
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 4px;
}
.cat-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}


/* ============================================================
   PROJECT CARD  ·  tactile hover system
   ============================================================ */
.project-card {
  position: relative;
  border-radius: 1.25rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.005));
  border: 1px solid rgba(255,255,255,0.06);
  overflow: hidden;
  transition:
    transform 0.55s var(--ease-spring),
    box-shadow 0.55s var(--ease-spring),
    border-color 0.55s var(--ease-spring),
    background 0.55s var(--ease-spring);
}

/* multi-property tactile hover */
.project-card[data-tactile]:hover {
  transform: translateY(-6px) scale(1.012);
  border-color: rgba(255,255,255,0.16);
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
  box-shadow:
    0 40px 90px -40px rgba(0,0,0,0.9),
    0 0 0 1px rgba(255,91,46,0.10),
    0 24px 60px -30px rgba(255,91,46,0.18);
}
.project-card[data-tactile]:hover .project-name { color: #fff; }
.project-card[data-tactile]:hover .project-media img,
.project-card[data-tactile]:hover .project-media video { transform: scale(1.04); }
.project-card[data-tactile]:hover .project-meta { transform: translateZ(0); }
.project-card[data-tactile]:hover .media-tag {
  background: rgba(255,91,46,0.18);
  border-color: rgba(255,91,46,0.35);
  color: #ffd9c8;
}

.project-link { display: block; }

.project-media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #0b0b0e;
}
.project-media img,
.project-media video {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.7s var(--ease-spring);
  display: block;
}

.media-tag {
  position: absolute;
  top: 14px; left: 14px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 999px;
  color: rgba(255,255,255,0.8);
  background: rgba(7,7,8,0.55);
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(6px);
  transition: all 0.4s var(--ease-spring);
  z-index: 3;
}

.project-meta { padding: 20px 22px 22px; }
.project-name {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: rgba(255,255,255,0.92);
  transition: color 0.4s var(--ease-spring);
}
.project-kind {
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.08em;
  font-weight: 500;
}
.project-desc {
  margin-top: 10px;
  font-size: 0.92rem;
  line-height: 1.6;
  color: rgba(255,255,255,0.55);
}
.project-disclaim {
  margin-top: 10px;
  font-size: 0.75rem;
  line-height: 1.5;
  color: rgba(255,255,255,0.32);
  font-style: italic;
}


/* ── video controls ──────────────────────────────────────── */
.mute-btn,
.expand-btn {
  position: absolute;
  bottom: 14px;
  z-index: 4;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 999px;
  background: rgba(7,7,8,0.55);
  border: 1px solid rgba(255,255,255,0.14);
  backdrop-filter: blur(8px);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transform: translateY(6px);
  transition: all 0.4s var(--ease-spring);
}
.mute-btn  { right: 14px; }
.expand-btn{ right: 62px; }

.project-media:hover .mute-btn,
.project-media:hover .expand-btn,
.project-media:focus-within .mute-btn,
.project-media:focus-within .expand-btn {
  opacity: 1;
  transform: translateY(0);
}
.mute-btn:hover,
.expand-btn:hover {
  background: rgba(255,91,46,0.85);
  border-color: rgba(255,91,46,1);
}

/* speaker glyphs (pure CSS so no extra assets) */
.mute-btn .mute-icon-muted,
.mute-btn .mute-icon-on {
  width: 18px; height: 18px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}
.mute-btn .mute-icon-muted {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5L6 9H2v6h4l5 4V5z'/%3E%3Cline x1='23' y1='9' x2='17' y2='15'/%3E%3Cline x1='17' y1='9' x2='23' y2='15'/%3E%3C/svg%3E");
}
.mute-btn .mute-icon-on {
  display: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5L6 9H2v6h4l5 4V5z'/%3E%3Cpath d='M15.5 8.5a5 5 0 0 1 0 7'/%3E%3Cpath d='M19 5a9 9 0 0 1 0 14'/%3E%3C/svg%3E");
}
.mute-btn.unmuted .mute-icon-muted { display: none; }
.mute-btn.unmuted .mute-icon-on    { display: block; }
/* dynamic insertion */
.mute-btn .mute-icon-on { display: none; }
.mute-btn.unmuted::after { /* fallback */ }


/* ============================================================
   FOOTER
   ============================================================ */
.footer-glow {
  position: absolute;
  top: -20%; left: 50%;
  transform: translateX(-50%);
  width: 1100px; height: 700px;
  background: radial-gradient(closest-side, rgba(255,91,46,0.22), rgba(255,91,46,0.05) 60%, transparent 80%);
  filter: blur(20px);
  pointer-events: none;
  z-index: 0;
}

.footer-icon {
  width: 38px; height: 38px;
  opacity: 0.85;
  filter: grayscale(1) saturate(0) brightness(1);
  transition: all 0.45s var(--ease-spring);
}
.footer-icon:hover {
  opacity: 1;
  filter: grayscale(0) saturate(1.1) brightness(1.1);
  transform: translateY(-3px) scale(1.08);
}

.social-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 0.9rem;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
  color: rgba(255,255,255,0.8);
  font-size: 0.92rem;
  transition: all 0.4s var(--ease-spring);
}
.social-link:hover {
  border-color: rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.05);
  color: #fff;
  transform: translateX(4px);
}
.social-link:hover .social-icon { filter: grayscale(0) saturate(1.2) brightness(1.1); }
.social-icon {
  width: 26px; height: 26px;
  filter: grayscale(1) saturate(0) brightness(1);
  transition: filter 0.4s var(--ease-spring);
}
.social-handle { margin-left: auto; color: rgba(255,255,255,0.4); font-size: 0.8rem; }
.social-arrow { color: rgba(255,255,255,0.3); transition: transform 0.4s var(--ease-spring); }
.social-link:hover .social-arrow { transform: translate(2px,-2px); color: var(--accent); }


/* ============================================================
   LIGHTBOX (expanded video / native aspect ratio)
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 5vmin;
  background: rgba(5,5,6,0.85);
  backdrop-filter: blur(16px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s var(--ease-spring), visibility 0.45s var(--ease-spring);
}
.lightbox.open { opacity: 1; visibility: visible; }

.lightbox-stage {
  width: min(96vw, 1100px);
  max-height: 92vh;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 50px 120px -30px rgba(0,0,0,0.9);
  transform: scale(0.94);
  transition: transform 0.5s var(--ease-spring-in);
}
.lightbox.open .lightbox-stage { transform: scale(1); }
.lightbox-stage video {
  width: 100%; height: auto; max-height: 92vh;
  display: block; background: #000;
}

.lightbox-close {
  position: absolute;
  top: 24px; right: 24px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  cursor: pointer;
  transition: all 0.3s var(--ease-spring);
}
.lightbox-close:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: rotate(90deg);
}


/* ============================================================
   REVEAL (IntersectionObserver targets)
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s var(--ease-spring), transform 0.8s var(--ease-spring);
  transition-delay: calc(var(--reveal-i, 0) * 80ms);
}
.reveal.is-visible { opacity: 1; transform: none; }


/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .hero-video { display: none; }
}


/* ============================================================
   MOBILE TWEAKS
   ============================================================ */
@media (max-width: 768px) {
  .project-media { aspect-ratio: 4 / 5; }
  .hero-panel { margin-top: 0; }
  .mute-btn, .expand-btn { opacity: 1; transform: none; } /* always visible on touch */
}
