/* ============================================================
   CINEMATIC SCROLLYTELLING STYLES
   Desktop: horizontal scroll, pinned panels, parallax
   Mobile:  clip-path reveals, vertical stagger, kinetic type
   ============================================================ */

/* ── Mandatory Lenis Core & Strict Scrolling Resets ── */
html.lenis, html.lenis body {
  height: auto;
}
.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}
.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}
.lenis.lenis-stopped {
  overflow: hidden;
}
.lenis.lenis-scrolling iframe {
  pointer-events: none;
}

/* ── Core Page Container ── */
html, body {
  background-color: var(--bg);
  color: var(--ink);
}

@media (min-width: 1025px) {
  html, body {
    overscroll-behavior-y: none;
  }
}

body.modal-open {
  overflow: hidden !important;
  height: 100dvh !important;
}

#scrolly-container {
  position: relative;
  width: 100%;
  overflow-x: hidden;
}

.panel {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background-color: var(--bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

/* ── 1. Hero Section ── */
#hero {
  position: relative;
  height: 100dvh;
  justify-content: center;
  background: radial-gradient(circle at 50% 50%, var(--bg-card) 0%, var(--bg) 80%);
}

.hero-bg-canvas {
  position: absolute;
  inset: 0;
  opacity: 0.12;
  pointer-events: none;
  background-image: radial-gradient(circle at 30% 20%, var(--accent) 0%, transparent 40%),
                    radial-gradient(circle at 70% 80%, #6C3FE8 0%, transparent 45%);
  filter: blur(80px);
  z-index: 1;
  will-change: transform, opacity;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 1000px;
  text-align: center;
  padding: 0 var(--sp-6);
}

.display-title {
  font-family: var(--font-display);
  font-size: clamp(3rem, 7vw, 6.5rem);
  font-weight: 300;
  line-height: 1.05;
  color: var(--ink);
  letter-spacing: -0.03em;
  will-change: transform, opacity;
}

.split-word {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  margin-right: 0.25em;
}

.split-char {
  display: inline-block;
  transform: translateY(105%) rotate(5deg);
  opacity: 0;
}

/* ── 2. Horizontal Scroll Section (Featured Work) ── */
.horizontal-container {
  height: 100dvh;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  padding-left: 10vw;
  box-sizing: border-box;
}

.work-intro {
  flex-shrink: 0;
  width: 25vw;
  max-width: 400px;
  padding-right: var(--sp-12);
  z-index: 10;
}

.work-intro .section-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  font-weight: 300;
  line-height: 1.1;
  color: var(--accent);
  margin-bottom: var(--sp-4);
  font-style: italic;
}

.work-intro .section-desc {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--ink-muted);
  line-height: 1.6;
}

.horizontal-scroll-wrapper {
  display: flex;
  gap: 5vw;
  padding-right: 20vw;
  height: 60vh;
  align-items: center;
  flex-shrink: 0;
  width: max-content;
  will-change: transform;
}

.project-card {
  flex-shrink: 0;
  width: clamp(300px, 35vw, 550px);
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  outline: none;
}

.card-image-wrap {
  position: relative;
  width: 100%;
  height: 80%;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: border-color 0.4s var(--ease-smooth);
}

.card-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s var(--ease-expo);
  will-change: transform;
}

.project-card:hover .card-image-wrap {
  border-color: var(--accent);
}

.project-card:hover img {
  transform: scale(1.05);
}

.card-meta {
  margin-top: var(--sp-4);
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: start;
}

.card-meta .index {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--accent);
  margin-top: 2px;
}

.card-meta .title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 2px;
}

.card-meta .tagline {
  grid-column: 2;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--ink-muted);
}

/* ── 3. Stacking Capabilities Section ── */
.stacking-container {
  height: 100dvh;
  flex-direction: row;
  justify-content: space-between;
  align-items: stretch;
  padding: 0 10vw;
}

.services-left {
  width: 30%;
  display: flex;
  align-items: center;
}

.services-left .section-title {
  font-family: var(--font-display);
  font-size: clamp(3rem, 6vw, 5rem);
  font-weight: 300;
  color: var(--ink);
  line-height: 1.1;
}

.services-right {
  width: 60%;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
}

.service-card {
  position: absolute;
  width: 100%;
  max-width: 500px;
  height: 350px;
  background-color: var(--bg-card) !important;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: var(--sp-10);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  transform-origin: top center;
  will-change: transform, opacity;
}

.service-card .num {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--accent);
}

.service-card h3 {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 400;
  color: var(--ink);
  margin-top: var(--sp-4);
  margin-bottom: var(--sp-2);
}

.service-card p {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--ink-muted);
  line-height: 1.6;
}

/* ── 4. Split-Screen Parallax About ── */
.split-layout {
  height: 100dvh;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 0 10vw;
}

.about-info {
  width: 45%;
}

.about-info .section-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  font-weight: 300;
  color: var(--accent);
  margin-bottom: var(--sp-6);
  font-style: italic;
}

.about-info p {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  color: var(--ink-muted);
  line-height: 1.7;
}

.about-media-stack {
  width: 45%;
  height: 60vh;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  position: relative;
}

.about-media-stack img {
  width: 100%;
  height: 130%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
}

/* ── 5. Cinematic AJAX Details Modal ── */
.ajax-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(7, 7, 7, 0.94);
  backdrop-filter: blur(15px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s var(--ease-smooth);
  overflow-y: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: var(--sp-12) 0;
}

.ajax-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  width: 90vw;
  max-width: 1100px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-12);
  margin: auto;
  position: relative;
  transform: translateY(40px);
  transition: transform 0.6s var(--ease-expo);
  box-shadow: var(--shadow-2xl);
}

.ajax-modal.active .modal-container {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: var(--sp-8);
  right: var(--sp-8);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s var(--ease-smooth);
}

.modal-close:hover {
  background: var(--ink);
  color: var(--bg);
  transform: rotate(90deg);
}


/* ═══════════════════════════════════════════════════════════
   MOBILE / TABLET — Cinematic Vertical Layouts
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {

  /* ── Hero ── */
  #hero {
    height: 100dvh;
  }

  /* Remove heavy blur filter on mobile — use a static gradient instead */
  .hero-bg-canvas {
    filter: none;
    background-image: radial-gradient(circle at 30% 30%, rgba(212, 175, 55, 0.15) 0%, transparent 50%),
                      radial-gradient(circle at 70% 70%, rgba(108, 63, 232, 0.12) 0%, transparent 55%);
    transform: translate3d(0, 0, 0);
  }

  .display-title {
    font-size: clamp(2.2rem, 8vw, 3.5rem);
  }

  /* ── Featured Work — Horizontal Scroll ── */
  .horizontal-container {
    flex-direction: row;
    height: 100dvh;
    min-height: 100dvh;
    justify-content: flex-start;
    align-items: center;
    padding: 0 0 0 8vw;
    box-sizing: border-box;
    overflow: hidden;
  }

  .work-intro {
    flex-shrink: 0;
    width: 75vw;
    max-width: 320px;
    padding-right: var(--sp-6);
    z-index: 10;
    margin-bottom: 0;
  }

  .horizontal-scroll-wrapper {
    height: 55dvh;
    flex-direction: row;
    display: flex;
    gap: 6vw;
    align-items: center;
    flex-shrink: 0;
    width: max-content;
    padding-right: 15vw;
    will-change: transform;
  }

  .horizontal-scroll-wrapper .project-card {
    width: 75vw;
    max-width: 360px;
    height: 100%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    outline: none;
    will-change: transform, opacity;
  }

  .horizontal-scroll-wrapper .card-image-wrap {
    height: 75%;
    border-radius: var(--r-md);
    overflow: hidden;
  }

  .horizontal-scroll-wrapper .card-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    will-change: transform;
  }

  .card-meta {
    grid-template-columns: 35px 1fr;
    margin-top: var(--sp-3);
  }

  .card-meta .title {
    font-size: clamp(1.2rem, 4.5vw, 1.6rem);
  }

  /* ── Capabilities — Vertical Stacking Card Deck ── */
  .stacking-container {
    flex-direction: column;
    height: 100dvh;
    min-height: 100dvh;
    padding: var(--sp-12) var(--sp-6) var(--sp-6);
    justify-content: flex-start;
    align-items: stretch;
    box-sizing: border-box;
    overflow: hidden;
  }

  .services-left {
    width: 100%;
    margin-bottom: var(--sp-4);
  }

  .services-left .section-title {
    position: static;
    font-size: clamp(2.2rem, 7vw, 3rem);
    margin: 0;
  }

  .services-right {
    width: 100%;
    height: calc(100dvh - 180px);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: auto 0;
  }

  .service-card {
    position: absolute;
    width: 100%;
    max-width: 480px;
    height: 280px;
    padding: var(--sp-8) var(--sp-6);
    box-sizing: border-box;
    background-color: var(--bg-card) !important;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    transform-origin: top center;
    will-change: transform, opacity;
  }

  .service-card .num {
    will-change: clip-path;
  }

  .service-card h3 {
    font-size: clamp(1.5rem, 5vw, 1.8rem);
    margin-top: var(--sp-3);
  }

  /* ── About — Stacked Vertical ── */
  .split-layout {
    flex-direction: column;
    height: auto;
    min-height: auto;
    padding: var(--sp-16) var(--sp-6) var(--sp-20);
    gap: var(--sp-8);
  }

  .about-info,
  .about-media-stack {
    width: 100%;
  }

  .about-media-stack {
    height: 45dvh;
    border-radius: var(--r-md);
  }

  .about-media-stack img {
    will-change: transform, opacity;
    transform: translate3d(0, 0, 0);
  }

  .about-info .section-title {
    font-size: clamp(2rem, 6vw, 2.8rem);
  }

  /* ── CTA ── */
  #contact.panel {
    min-height: 60dvh;
    padding: var(--sp-20) var(--sp-6);
  }

  /* ── Modal (mobile refinements) ── */
  .ajax-modal {
    padding: var(--sp-4) 0;
    backdrop-filter: blur(10px);
  }

  .modal-container {
    width: 95vw;
    padding: var(--sp-8) var(--sp-6);
    border-radius: var(--r-md);
  }

  .modal-close {
    top: var(--sp-4);
    right: var(--sp-4);
    width: 40px;
    height: 40px;
  }
}

/* ── Very small phones (< 400px) ── */
@media (max-width: 400px) {
  .card-image-wrap {
    height: 180px;
  }

  .service-card {
    padding: var(--sp-6) var(--sp-4);
    min-height: 180px;
  }

  .service-card h3 {
    font-size: 1.3rem;
  }

  .about-media-stack {
    height: 35dvh;
  }

  #contact.panel {
    min-height: 50dvh;
  }
}
