/* ============================================================
   KARELAC — Creative Agency Portfolio
   styles.css
   ============================================================ */

/* ── Reset & Box Model ─────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  --bg:           #080808;
  --bg-raised:    #0f0f0f;
  --text:         #f0f0f0;
  --text-muted:   rgba(240, 240, 240, 0.45);
  --text-subtle:  rgba(240, 240, 240, 0.25);
  --accent:       #f0f0f0;
  --border:       rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.18);

  --nav-h:        64px;

  --font-sans:    'Inter', system-ui, -apple-system, sans-serif;
  --font-serif:   'Playfair Display', Georgia, serif;

  --ease-out:     cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:  cubic-bezier(0.45, 0, 0.55, 1);

  --section-px:   clamp(1.5rem, 5vw, 5rem);
  --section-py:   clamp(4rem, 10vw, 9rem);

  --grid-gap:     clamp(0.75rem, 1.5vw, 1.5rem);
}

/* ── Smooth Scroll ─────────────────────────────────────────── */
html {
  scroll-behavior: smooth;
  font-size: 16px;
}

/* ── Custom Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar            { width: 5px; }
::-webkit-scrollbar-track      { background: var(--bg); }
::-webkit-scrollbar-thumb      { background: rgba(255,255,255,0.15); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover{ background: rgba(255,255,255,0.3); }

/* ── Base ──────────────────────────────────────────────────── */
body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  opacity: 0;
  transition: opacity 0.6s var(--ease-out);
}

body.loaded { opacity: 1; }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }
button { cursor: pointer; background: none; border: none; font: inherit; color: inherit; }

/* ── Custom Cursor ─────────────────────────────────────────── */
.cursor {
  position: fixed;
  top: 0; left: 0;
  width: 8px; height: 8px;
  background: var(--text);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 0.25s var(--ease-out),
              height 0.25s var(--ease-out),
              opacity 0.3s ease;
  mix-blend-mode: difference;
}

.cursor-follower {
  position: fixed;
  top: 0; left: 0;
  width: 36px; height: 36px;
  border: 1px solid rgba(240, 240, 240, 0.4);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: width 0.35s var(--ease-out),
              height 0.35s var(--ease-out),
              border-color 0.35s ease,
              opacity 0.3s ease;
}

body.cursor-hover .cursor          { width: 12px; height: 12px; }
body.cursor-hover .cursor-follower { width: 56px; height: 56px; border-color: rgba(240,240,240,0.6); }

@media (hover: none) {
  .cursor, .cursor-follower { display: none; }
}

/* ── Reusable: Section Label ───────────────────────────────── */
.section-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.label-line {
  display: inline-block;
  width: 2rem;
  height: 1px;
  background: var(--text-muted);
  flex-shrink: 0;
}

/* ── Reusable: Buttons ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
  transition: all 0.35s var(--ease-out);
}

.btn-outline {
  padding: 0.85rem 2rem;
  border: 1px solid rgba(240,240,240,0.35);
  color: var(--text);
}
.btn-outline:hover {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.btn-text {
  color: var(--text);
  position: relative;
}
.btn-text::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease-out);
}
.btn-text:hover::after { transform: scaleX(1); }

/* ── Scroll-Reveal ─────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transition: opacity 0.85s var(--ease-out),
              transform 0.85s var(--ease-out);
  transition-delay: var(--delay, 0s);
}
.reveal.reveal-up    { transform: translateY(36px); }
.reveal.reveal-left  { transform: translateX(-36px); }
.reveal.reveal-right { transform: translateX(36px); }
.reveal.is-visible {
  opacity: 1;
  transform: translate(0, 0);
}

/* =============================================================
   NAVIGATION
============================================================= */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: var(--nav-h);
  border-bottom: 1px solid var(--border);
  background: rgba(8, 8, 8, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: background 0.4s ease,
              border-color 0.4s ease;
}

.nav.scrolled {
  background: rgba(8, 8, 8, 0.96);
  border-color: rgba(255,255,255,0.12);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 var(--section-px);
}

.nav-logo {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text);
  transition: opacity 0.3s ease;
}
.nav-logo:hover { opacity: 0.55; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2.5rem;
}

.nav-link {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  position: relative;
  transition: color 0.3s ease;
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--text);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease-out);
}
.nav-link:hover        { color: var(--text); }
.nav-link:hover::after { transform: scaleX(1); }

/* Hamburger */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  width: 32px;
  height: 32px;
  z-index: 1100;
}
.hamburger-line {
  display: block;
  width: 100%;
  height: 1px;
  background: var(--text);
  transition: transform 0.35s var(--ease-out),
              opacity 0.35s ease;
  transform-origin: center;
}
.nav-hamburger[aria-expanded="true"] .hamburger-line:nth-child(1) {
  transform: translateY(3.5px) rotate(45deg);
}
.nav-hamburger[aria-expanded="true"] .hamburger-line:nth-child(2) {
  transform: translateY(-3.5px) rotate(-45deg);
}

/* Mobile Nav Overlay */
.mobile-nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--nav-h) var(--section-px) var(--section-px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease-out);
}
.mobile-nav-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.mobile-nav-links { display: flex; flex-direction: column; gap: 0.25rem; }

.mobile-nav-link {
  display: block;
  font-size: clamp(2.5rem, 10vw, 5rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.1;
  padding: 0.3rem 0;
  transition: color 0.3s ease, padding-left 0.3s var(--ease-out);
}
.mobile-nav-link:hover {
  color: var(--text-muted);
  padding-left: 1rem;
}

.mobile-nav-footer {
  position: absolute;
  bottom: 3rem;
  left: var(--section-px);
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

/* =============================================================
   HERO
============================================================= */
.hero {
  min-height: 100svh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--nav-h) var(--section-px) 0;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -20%;
  right: -10%;
  width: 60vmax;
  height: 60vmax;
  background: radial-gradient(circle, rgba(240,240,240,0.022) 0%, transparent 70%);
  pointer-events: none;
}

.hero-inner {
  max-width: 960px;
  padding-top: clamp(3rem, 8vw, 7rem);
  padding-bottom: clamp(2rem, 5vw, 4rem);
}

.hero-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
}

.hero-headline {
  font-family: var(--font-sans);
  font-size: clamp(2.8rem, 7vw, 6.5rem);
  font-weight: 300;
  line-height: 1.06;
  letter-spacing: -0.035em;
  margin-bottom: 2rem;
  color: var(--text);
}
.hero-headline em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
}

.hero-sub {
  font-size: clamp(0.9rem, 1.6vw, 1.05rem);
  color: var(--text-muted);
  font-weight: 300;
  line-height: 1.75;
  margin-bottom: 3rem;
  max-width: 480px;
}

.hero-cta { margin-bottom: 1rem; }

/* Scroll Indicator */
.hero-scroll-indicator {
  position: absolute;
  bottom: 2.5rem;
  left: var(--section-px);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.scroll-line {
  width: 1px;
  height: 50px;
  background: linear-gradient(to bottom, transparent, var(--text-muted));
  animation: scrollLine 2.2s ease-in-out infinite;
}

@keyframes scrollLine {
  0%, 100% { opacity: 0.3; transform: scaleY(0.6) translateY(-20%); }
  50%       { opacity: 1;   transform: scaleY(1)   translateY(0); }
}

.scroll-label {
  font-size: 0.65rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

/* Hero Marquee */
.hero-marquee {
  position: absolute;
  bottom: 0;
  left: 0; right: 0;
  border-top: 1px solid var(--border);
  overflow: hidden;
  height: 44px;
  display: flex;
  align-items: center;
}

.marquee-track {
  display: flex;
  align-items: center;
  gap: 2rem;
  white-space: nowrap;
  animation: marquee 30s linear infinite;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.marquee-track:hover { animation-play-state: paused; }
.marquee-dot { opacity: 0.3; }

@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* =============================================================
   WORK GRID
============================================================= */
.work {
  padding: var(--section-py) var(--section-px);
  border-top: 1px solid var(--border);
}

.work-header { margin-bottom: 2.5rem; }

.section-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

/* Filter Buttons */
.work-filters {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 3.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.5rem 1.25rem;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  border: 1px solid transparent;
  border-radius: 999px;
  transition: all 0.3s var(--ease-out);
}
.filter-btn:hover {
  color: var(--text);
  border-color: var(--border-hover);
}
.filter-btn.active {
  color: var(--bg);
  background: var(--text);
  border-color: var(--text);
}

/* Grid */
.work-grid {
  display: flex;
  flex-direction: column;
  gap: var(--grid-gap);
}

.project-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--grid-gap);
}

/* ── Project Card ── */
.project-card { overflow: hidden; }

.project-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.project-image {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  cursor: pointer;
}

.project-card--full .project-image {
  aspect-ratio: 16 / 7;
}

.project-image-inner {
  position: absolute;
  inset: 0;
  transition: transform 0.7s var(--ease-out);
}

.project-card-link:hover .project-image-inner {
  transform: scale(1.04);
}

/* Overlay slides up from bottom */
.project-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.project-overlay-inner {
  width: 100%;
  padding: 2rem clamp(1.25rem, 3vw, 2rem);
  background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.55) 65%, transparent 100%);
  transform: translateY(101%);
  transition: transform 0.5s var(--ease-out);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.project-card-link:hover .project-overlay-inner {
  transform: translateY(0);
}

.project-overlay-category {
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(240,240,240,0.6);
}

.project-overlay-title {
  font-size: clamp(1.1rem, 2.5vw, 1.75rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
}

.project-overlay-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(240,240,240,0.75);
  margin-top: 0.25rem;
  transition: gap 0.3s ease, color 0.3s ease;
}
.project-overlay-link:hover { gap: 0.7rem; color: var(--text); }

/* Info strip below image */
.project-info {
  padding: 1rem 0 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.project-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.project-name {
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.project-year {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.project-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.project-tag {
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.22rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
}

/* Filtered-out cards */
.project-card.is-hidden { display: none; }

/* =============================================================
   ABOUT
============================================================= */
.about {
  padding: var(--section-py) var(--section-px);
  border-top: 1px solid var(--border);
}

.about-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(3rem, 6vw, 7rem);
  margin-bottom: clamp(3.5rem, 7vw, 6rem);
  align-items: start;
}

.about-heading {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  font-weight: 300;
  line-height: 1.2;
  letter-spacing: -0.025em;
}
.about-heading em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
}

.about-right {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-top: 0.5rem;
}

.about-text {
  font-size: clamp(0.88rem, 1.4vw, 1rem);
  color: var(--text-muted);
  line-height: 1.85;
  font-weight: 300;
}

/* Stats */
.about-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--border);
}

.stat {
  padding: clamp(1.5rem, 3vw, 2.5rem) clamp(1.25rem, 2.5vw, 2rem);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.stat:last-child { border-right: none; }

.stat-number {
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 300;
  letter-spacing: -0.04em;
  line-height: 1;
}

.stat-label {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* =============================================================
   SERVICES
============================================================= */
.services {
  padding: var(--section-py) var(--section-px);
  border-top: 1px solid var(--border);
}

.services-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 3rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.services-list {
  display: flex;
  flex-direction: column;
}

.service-item {
  position: relative;
  border-top: 1px solid var(--border);
  overflow: hidden;
}
.service-item:last-child { border-bottom: 1px solid var(--border); }

/* Animated fill line on hover */
.service-line {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 1px;
  width: 0;
  background: rgba(240,240,240,0.25);
  transition: width 0.55s var(--ease-out);
}
.service-item:hover .service-line { width: 100%; }

.service-inner {
  display: grid;
  grid-template-columns: 4rem 1fr auto;
  align-items: center;
  gap: 2rem;
  padding: clamp(1.5rem, 3vw, 2.5rem) 0;
}

.service-number {
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  font-weight: 500;
}

.service-content { display: flex; flex-direction: column; gap: 0.4rem; }

.service-title {
  font-size: clamp(1.3rem, 2.8vw, 2.2rem);
  font-weight: 300;
  letter-spacing: -0.025em;
  transition: color 0.3s ease;
  line-height: 1.15;
}

.service-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 500px;
  font-weight: 300;
}

.service-arrow {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all 0.35s var(--ease-out);
}
.service-item:hover .service-arrow {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  transform: rotate(45deg);
}

/* =============================================================
   CONTACT
============================================================= */
.contact {
  padding: var(--section-py) var(--section-px);
  border-top: 1px solid var(--border);
  background: var(--bg-raised);
}

.contact-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: clamp(3rem, 6vw, 8rem);
  align-items: start;
}

.contact-headline {
  font-size: clamp(3.5rem, 10vw, 8.5rem);
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.04em;
  margin-bottom: 1.5rem;
}
.contact-headline em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
}

.contact-sub {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.75;
  max-width: 420px;
  margin-bottom: 2.5rem;
  font-weight: 300;
}

.contact-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.25rem;
}

.contact-email {
  font-size: clamp(0.9rem, 1.8vw, 1.1rem);
  letter-spacing: 0.04em;
  color: var(--text);
  position: relative;
  display: inline-block;
}
.contact-email::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--text);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease-out);
}
.contact-email:hover::after { transform: scaleX(1); }

.contact-details {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  min-width: 200px;
  padding-top: 0.5rem;
}

.contact-detail-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.contact-detail-label {
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.contact-detail-value {
  font-size: 0.88rem;
  color: var(--text);
}

/* =============================================================
   FOOTER
============================================================= */
.footer {
  padding: 3rem var(--section-px) 2rem;
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 3rem;
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.footer-logo {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  transition: opacity 0.3s ease;
}
.footer-logo:hover { opacity: 0.5; }

.footer-tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 300;
}

.footer-nav ul {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.footer-nav a {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 0.3s ease;
}
.footer-nav a:hover { color: var(--text); }

.footer-social {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-social-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  transition: color 0.3s ease;
}
.footer-social-link:hover { color: var(--text); }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.footer-copy {
  font-size: 0.68rem;
  color: var(--text-subtle);
  letter-spacing: 0.06em;
}

.footer-legal {
  display: flex;
  gap: 1.5rem;
}
.footer-legal a {
  font-size: 0.68rem;
  color: var(--text-subtle);
  letter-spacing: 0.06em;
  transition: color 0.3s ease;
}
.footer-legal a:hover { color: var(--text-muted); }

/* =============================================================
   RESPONSIVE — TABLET (≤1024px)
============================================================= */
@media (max-width: 1024px) {
  .about-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .stat:nth-child(2) { border-right: none; }
  .stat:nth-child(3) { border-top: 1px solid var(--border); }
  .stat:nth-child(4) { border-right: none; border-top: 1px solid var(--border); }

  .contact-inner { grid-template-columns: 1fr; gap: 3rem; }
  .contact-details { flex-direction: row; flex-wrap: wrap; gap: 2rem; padding-top: 0; }
}

/* =============================================================
   RESPONSIVE — MOBILE (≤768px)
============================================================= */
@media (max-width: 768px) {
  :root { --nav-h: 56px; }

  .nav-links     { display: none; }
  .nav-hamburger { display: flex; }

  .hero-scroll-indicator { display: none; }
  .hero-headline         { font-size: clamp(2.2rem, 9vw, 3.5rem); }
  .hero-sub br           { display: none; }

  .project-row { grid-template-columns: 1fr; }
  .project-card--full .project-image { aspect-ratio: 4 / 3; }

  .about-inner  { grid-template-columns: 1fr; gap: 2rem; }
  .about-stats  { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: none; }
  .stat:nth-child(3) { border-top: 1px solid var(--border); }
  .stat:nth-child(4) { border-right: none; border-top: 1px solid var(--border); }

  .services-header { flex-direction: column; align-items: flex-start; }
  .service-inner   { grid-template-columns: 3rem 1fr auto; gap: 1rem; }
  .service-desc    { display: none; }

  .contact-headline { font-size: clamp(3rem, 13vw, 5rem); }
  .contact-inner    { grid-template-columns: 1fr; }
  .contact-details  { flex-direction: column; gap: 1.5rem; }

  .footer-inner  { flex-direction: column; gap: 2.5rem; }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
}

/* =============================================================
   RESPONSIVE — SMALL MOBILE (≤480px)
============================================================= */
@media (max-width: 480px) {
  .filter-btn { padding: 0.4rem 0.9rem; font-size: 0.65rem; }
  .project-overlay-inner { padding: 1.25rem; }
  .about-stats { grid-template-columns: 1fr 1fr; }
  .stat-number { font-size: 2rem; }
}

/* =============================================================
   REDUCED MOTION
============================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1 !important; transform: none !important; }
}


@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }

  .about-inner {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .about-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat { border-right: none; border-bottom: 1px solid var(--border); }
  .stat:nth-child(odd) { border-right: 1px solid var(--border); }
  .stat:nth-last-child(-n+2) { border-bottom: none; }

  .contact-inner {
    grid-template-columns: 1fr;
    gap: 60px;
  }

  .contact-details { padding-top: 0; }
}

@media (max-width: 640px) {
  :root { --section-px: 1.25rem; }

  .project-row {
    grid-template-columns: 1fr;
  }

  .project-card--full .project-image {
    aspect-ratio: 4 / 3;
  }

  .hero-scroll-indicator { display: none; }

  .service-content {
    flex-direction: column;
    gap: 8px;
  }

  .about-stats {
    grid-template-columns: 1fr 1fr;
  }

  .footer-inner {
    flex-direction: column;
    gap: 40px;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}


/* ============================================================
   ANIMATIONS v2 — Lenis + GSAP enhancements
   ============================================================ */

/* Scroll progress bar */
#scroll-progress {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 2px;
  background: var(--text);
  transform-origin: left center;
  transform: scaleX(0);
  z-index: 2000;
  pointer-events: none;
}

/* Text split: word reveal */
.word-wrap {
  overflow: hidden;
  display: inline-block;
  vertical-align: top;
  line-height: inherit;
}
.word {
  display: inline-block;
  will-change: transform;
}

/* Horizontal scroll — work section (desktop) */
@media (min-width: 1025px) {
  .work-h-outer {
    overflow: hidden;
    width: 100%;
  }
  .work-h-track {
    display: flex;
    gap: clamp(1rem, 2vw, 2rem);
    width: max-content;
    align-items: flex-start;
    will-change: transform;
    padding: 0 clamp(1.5rem, 5vw, 5rem);
  }
  .work-h-track .project-card--full {
    width: clamp(600px, 55vw, 800px);
    flex-shrink: 0;
  }
  .work-h-track .project-card {
    width: clamp(320px, 30vw, 450px);
    flex-shrink: 0;
  }
  /* Hide vertical layout on desktop when h-scroll active */
  .work-h-active #work-grid {
    display: none;
  }
}

/* Magnetic button — smooth transition on leave */
[data-magnetic] {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  will-change: transform;
}

/* Clip path project images — initial state set by GSAP */
.project-image {
  clip-path: inset(0 0 0 0); /* GSAP overrides to inset(0 100% 0 0) on init */
}

/* Counter number */
.stat-number[data-count] {
  font-variant-numeric: tabular-nums;
}

/* Section label line — GSAP animates scaleX */
.label-line {
  transform-origin: left center;
  /* CSS transition fallback (when GSAP not loaded) */
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reduced motion: disable all GSAP / CSS animations */
@media (prefers-reduced-motion: reduce) {
  .word { transform: none !important; opacity: 1 !important; }
  #scroll-progress { display: none; }
  .project-image { clip-path: none !important; }
  [data-magnetic] { transition: none !important; }
  .label-line { transition: none !important; transform: scaleX(1) !important; }
}

/* =============================================================
   MEDIA: HERO, PROJECTS, SERVICES
============================================================= */

/* ── Hero media layer ───────────────────────────────────────── */
.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  will-change: opacity; /* promote to own layer to avoid repaints during scroll */
  transform: translateZ(0);
}

/* Images and self-hosted videos */
.hero-media > img,
.hero-media > video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: brightness(0.55) saturate(0.85);
  display: block;
  position: relative;
  z-index: 0;
}

/* YouTube / external iframe — cover-fit technique */
.hero-media > iframe {
  position: absolute;
  width: 177.78vh;   /* 16:9 at full height */
  min-width: 100%;
  height: 56.25vw;   /* 9:16 at full width */
  min-height: 100%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  border: none;
  filter: brightness(0.55) saturate(0.85);
  z-index: 0;
}

/* Controllable dark scrim (admin-adjustable via --hero-scrim-opacity) */
.hero-media-scrim {
  position: absolute;
  inset: 0;
  background: #080808;
  opacity: var(--hero-scrim-opacity, 0.42);
  pointer-events: none;
  z-index: 1;
}

/* Fixed bottom-fade gradient — always present for legibility near marquee */
.hero-media::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 55%, rgba(8,8,8,0.92) 100%);
  pointer-events: none;
  z-index: 2;
}

/* Ensure all hero content sits above the media layer */
.hero-inner,
.hero-scroll-indicator,
.hero-marquee {
  position: relative;
  z-index: 1;
}

/* ── Project card media ─────────────────────────────────────── */
.project-image-inner img,
.project-image-inner video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  /* inherit the scale transform from existing hover rule */
}

/* ── Services preview panel ─────────────────────────────────── */
.services-inner {
  display: grid;
  grid-template-columns: 1fr minmax(0, 360px);
  gap: clamp(3rem, 7vw, 7rem);
  align-items: start;
}

.services-preview {
  position: sticky;
  top: calc(var(--nav-h) + 3rem);
  aspect-ratio: 3 / 4;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-raised);
  border: 1px solid var(--border);
}

.services-preview-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
  display: block;
}

.services-preview-img.is-active {
  opacity: 1;
  transform: scale(1);
}

/* Label overlay on preview panel */
.services-preview-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.5rem;
  background: linear-gradient(to top, rgba(8,8,8,0.85) 0%, transparent 100%);
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  z-index: 2;
  transition: opacity 0.3s;
  pointer-events: none;
}

/* Hide preview panel on smaller screens */
@media (max-width: 1024px) {
  .services-inner {
    grid-template-columns: 1fr;
  }
  .services-preview {
    display: none;
  }
}

/* ── Mobile reveal system ───────────────────────────────────
   On mobile the JS fallback path uses IntersectionObserver to
   add .is-visible. The CSS .reveal transition handles the fade.
   No GSAP runs on mobile so no inline opacity/transform to fight.
   Desktop GSAP adds data-reveal-init once it takes over an element.
──────────────────────────────────────────────────────────── */

/* Clip-path is desktop-only (GSAP-driven). On mobile keep images fully visible. */
@media (max-width: 768px) {
  .project-image {
    clip-path: none !important;
  }
  /* YouTube iframes never autoplay on mobile — hide them */
  .hero-media > iframe {
    display: none;
  }
}

/* body.loaded ensures hero and non-observed reveals are visible when
   JS has run but an element was never observed (e.g. above the fold) */
body.loaded .hero .reveal {
  opacity: 1;
  transform: none;
}

/* Hard safety net: if neither GSAP nor IntersectionObserver has touched
   a reveal element 5 s after page load, show it anyway.
   (Handled by JS timeout; this is a pure-CSS last resort.) */
body.js-ready .reveal:not([data-observed]):not([data-reveal-init]) {
  opacity: 1;
  transform: none;
  transition-delay: 0s;
}
