:root {
  --primary: #d50000;
  --primary-dark: #a80000;
  --black: #111111;
  --gold: #c8a96b;
  --white: #ffffff;
  --light: #f8f8f8;
  --font-inter: "Inter", sans-serif;
  --font-heading: "Montserrat", sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  background: white;
  color: #111;
  overflow-x: hidden;
  font-family: var(--font-inter);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
}

p,
span,
button,
a {
  font-family: var(--font-inter);
}

/* ============ Scroll reveal (replaces framer-motion FadeUp / FadeReveal) ============ */
.reveal {
  opacity: 0;
  transform: translateY(60px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 1s ease, transform 1s ease;
}

.reveal-scale.revealed {
  opacity: 1;
  transform: scale(1);
}

/* ============ Hero load-in animation (replaces framer-motion initial/animate) ============ */
.load-in {
  opacity: 0;
  transform: translateY(40px);
  animation: loadIn 0.9s ease forwards;
}

@keyframes loadIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.load-in-fade {
  opacity: 0;
  animation: fadeInOnly 0.9s ease forwards;
}

/* ============ Hero banner hover interaction ============ */
.hero-banner {
  --pointer-x: 50%;
  --pointer-y: 50%;
  isolation: isolate;
}

.hero-banner-image {
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1), filter 0.8s ease;
  will-change: transform;
}

.hero-banner:hover .hero-banner-image {
  filter: saturate(1.08) contrast(1.04);
}

.hero-banner-glow {
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle 260px at var(--pointer-x) var(--pointer-y), rgba(255, 255, 255, 0.16), transparent 72%);
  transition: opacity 0.45s ease;
}

.hero-banner-grid {
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.14) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.14) 1px, transparent 1px);
  background-size: 62px 62px;
  background-position: center center;
  -webkit-mask-image: radial-gradient(circle 300px at var(--pointer-x) var(--pointer-y), black, transparent 78%);
  mask-image: radial-gradient(circle 300px at var(--pointer-x) var(--pointer-y), black, transparent 78%);
  transition: opacity 0.45s ease;
}

.hero-banner:hover .hero-banner-grid {
  opacity: 0.8;
}

.hero-banner:hover .hero-banner-glow {
  opacity: 1;
}

.hero-banner-content {
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

@keyframes fadeInOnly {
  to {
    opacity: 1;
  }
}

/* ============ Hover lift cards (replaces framer-motion whileHover) ============ */
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-12px) scale(1.03);
}

.hover-lift-sm:hover {
  transform: translateY(-8px);
}

.hover-lift-rotate {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift-rotate:hover {
  transform: translateY(-10px) scale(1.05);
}

/* ============ Mobile nav ============ */
#mobile-backdrop {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

#mobile-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

#mobile-menu {
  transform: translateX(100%);
  transition: transform 0.3s ease-in-out;
}

#mobile-menu.open {
  transform: translateX(0);
}

#mobile-menu a {
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#mobile-menu.open a {
  opacity: 1;
  transform: translateX(0);
}

#mobile-menu.open a:nth-child(1) { transition-delay: 0.08s; }
#mobile-menu.open a:nth-child(2) { transition-delay: 0.13s; }
#mobile-menu.open a:nth-child(3) { transition-delay: 0.18s; }
#mobile-menu.open a:nth-child(4) { transition-delay: 0.23s; }
#mobile-menu.open a:nth-child(5) { transition-delay: 0.28s; }

/* ============ Project card image carousel ============ */
.carousel-img {
  transition: opacity 0.35s ease;
}

.thumb-btn {
  border-color: transparent;
  opacity: 0.6;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.thumb-btn.active {
  border-color: var(--primary);
  opacity: 1;
}

.dot {
  transition: all 0.2s ease;
}

/* ============ Lightbox ============ */
.lightbox-backdrop {
  background: rgba(20, 24, 31, 0.82);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
  backdrop-filter: blur(18px) saturate(120%);
}

.lightbox-stage {
  height: min(64vh, 680px);
  min-height: 260px;
  overflow: hidden;
  touch-action: none;
  cursor: default;
}

.lightbox-stage:has(#lightbox-img[style*="scale(1)"]) {
  cursor: zoom-in;
}

.lightbox-stage.is-dragging {
  cursor: grabbing;
}

#lightbox-img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  transform-origin: center center;
  transition: opacity 0.35s ease, transform 0.08s ease;
  will-change: transform;
  user-select: none;
  pointer-events: none;
}

.lightbox-image {
  border-radius: 0.75rem;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

.lightbox-caption {
  z-index: 10;
}

#lightbox {
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.lightbox-content {
  flex: 0 0 auto;
}

@media (max-width: 640px) {
  header.fixed > div {
    min-height: 64px;
  }

  header.fixed img {
    width: 150px !important;
    max-width: 58vw;
  }

  .hero-banner h1 {
    font-size: clamp(2.5rem, 13vw, 4.5rem);
    line-height: 0.98;
  }

  .hero-banner p {
    letter-spacing: 0.12em;
  }

  .hero-banner-content {
    padding-top: 3rem;
  }

  .lightbox-content {
    max-width: 100%;
  }

  .lightbox-stage {
    height: min(56vh, 480px);
    min-height: 210px;
  }

  .lightbox-caption {
    font-size: 0.75rem;
    line-height: 1.2;
  }

  #lightbox-prev,
  #lightbox-next {
    padding: 0.65rem;
  }

  #lightbox-thumbs {
    justify-content: flex-start;
  }

  .project-card .carousel-click-area {
    height: 15rem;
  }
}

@media (max-width: 420px) {
  .hero-banner h1 {
    font-size: 2.35rem;
  }

  .hero-banner-content p {
    font-size: 0.9rem;
  }

  #lightbox .lightbox-content {
    padding-inline: 0.25rem;
  }
}

#lightbox.open {
  opacity: 1;
  pointer-events: auto;
}
