/* ═══════════════════════════════════════════
   DESIGN SYSTEM
   ═══════════════════════════════════════════ */

/* ─── CUSTOM FONTS ─── */
@font-face {
  font-family: 'Risley Blur';
  src: url('fonts/RisleyBlur-Regular.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'Sichuan';
  src: url('fonts/Sichuan.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

:root {
  /* Palette */
  --bg:          #F7F6F3;
  --bg-subtle:   #EFEEEB;
  --text:        #1A1A1A;
  --text-muted:  #6B6B6B;
  --accent:      #1746EA;
  --accent-soft: rgba(23, 70, 234, 0.08);
  --border:      #E8E7E4;
  --white:       #FFFFFF;

  /* Typography */
  --font:        'Sichuan', 'Bricolage Grotesque', system-ui, sans-serif;
  --font-hero:   'Risley Blur', serif;

  /* Spacing */
  --space-xs:  0.5rem;
  --space-sm:  1rem;
  --space-md:  2rem;
  --space-lg:  4rem;
  --space-xl:  8rem;
  --space-2xl: 12rem;

  /* Layout */
  --max-w: 1200px;
  --radius: 12px;
  --radius-sm: 8px;
}

/* ─── RESET ─── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow: hidden; /* Lock scroll permanently */
  height: 100vh;
  position: relative;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

img {
  display: block;
  max-width: 100%;
}

/* ─── Background gradient blob ─── */
.bg-gradient {
  position: fixed;
  top: -20%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  max-width: 800px;
  max-height: 800px;
  background: radial-gradient(circle, rgba(23,70,234,0.04) 0%, rgba(23,70,234,0.01) 40%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(60px);
}

/* ═══════════════════════════════════════════
   NAVIGATION
   ═══════════════════════════════════════════ */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2.5rem;
  background: rgba(247, 246, 243, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.nav.scrolled {
  border-bottom-color: var(--border);
}

.nav__logo {
  display: flex;
  align-items: center;
}

.logo-img {
  height: 28px;
  width: auto;
  display: block;
}

.nav__links {
  display: flex;
  gap: 2rem;
  transition: opacity 0.5s ease;
}

body.gallery-mode .nav__links {
  opacity: 0;
  pointer-events: none;
}

.nav__links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s ease;
  letter-spacing: -0.01em;
}

.nav__links a:hover {
  color: var(--text);
}

/* ═══════════════════════════════════════════
   HERO
   ═══════════════════════════════════════════ */

.hero {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: var(--space-xl) var(--space-md) var(--space-lg);
  z-index: 10;
  transition: transform 0.8s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.8s ease;
}

body.gallery-mode .hero {
  transform: translateY(-30vh);
  opacity: 0;
  pointer-events: none;
}

.hero__content {
  max-width: 680px;
}

.hero__title {
  font-family: var(--font-hero);
  font-size: clamp(3.5rem, 8vw, 7rem);
  font-weight: 400; /* Custom fonts often look better at 400 */
  line-height: 0.92;
  letter-spacing: -0.01em; /* Adjusted for the blur look */
  margin-bottom: var(--space-md);
  color: var(--text);
}

.hero__sub {
  font-family: var(--font);
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  color: var(--text-muted);
  max-width: 440px;
  margin: 0 auto;
  line-height: 1.6;
  font-weight: 400;
}

.hero__scroll-cue {
  position: absolute;
  bottom: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
  opacity: 0.6;
  transition: opacity 0.4s ease;
}

.hero__scroll-cue span {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
}

.scroll-dot {
  animation: scrollDot 2s ease-in-out infinite;
}

@keyframes scrollDot {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50%      { transform: translateY(8px); opacity: 0.3; }
}

/* ═══════════════════════════════════════════
   3D SHOWCASE
   ═══════════════════════════════════════════ */

.showcase {
  position: absolute;
  top: 100vh;
  left: 0;
  width: 100%;
  height: 100vh;
  transition: transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
  padding: 0;
  display: flex;
  flex-direction: column;
  z-index: 5;
}

body.gallery-mode .showcase {
  transform: translateY(-100vh);
}

.showcase__filters {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 var(--space-md);
  margin-bottom: 0;
  flex-wrap: wrap;
  position: absolute;
  top: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 101;
  transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

body.gallery-mode .showcase__filters {
  top: 1.25rem;
}

.filter-btn {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.5rem 1.25rem;
  border-radius: 100px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
  letter-spacing: -0.01em;
}

.filter-btn:hover {
  color: var(--text);
  border-color: var(--text);
}

.filter-btn.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.showcase__stage {
  position: relative;
  width: 100%;
  flex: 1;
  perspective: 1200px;
  perspective-origin: 50% 50%;
  overflow: hidden;
  cursor: grab;
}

.showcase__stage:active {
  cursor: grabbing;
}

.showcase__depth-gradient {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: linear-gradient(to top, var(--bg), transparent);
  z-index: 5;
  pointer-events: none;
}

/* ─── Project Cards ─── */
.project-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 440px;
  aspect-ratio: 4 / 3;
  margin-left: -220px;
  margin-top: -165px;
  transform-style: preserve-3d;
  will-change: transform, opacity, filter;
  transition: filter 0.3s ease-out, box-shadow 0.3s ease-out;
  cursor: pointer;
  border-radius: var(--radius);
  overflow: hidden;
  border: none;
}

.project-card:hover {
  box-shadow: 0 30px 80px rgba(0,0,0,0.12);
}

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

.project-card__thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Card Text Overlay */
.project-card__text-wrapper {
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
  right: 0.75rem;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(0,0,0,0.05);
  border-radius: var(--radius-sm);
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.project-card:hover .project-card__text-wrapper {
  opacity: 1;
  transform: translateY(0);
}

.project-card__info {
  padding: 0.75rem 1rem 0.25rem;
}

.project-card__category {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.35rem;
  display: block;
}

.project-card__title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: 0.25rem;
}

.project-card__desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.project-card__meta {
  display: flex;
  justify-content: space-between;
  padding: 0 1rem 0.75rem;
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* ═══════════════════════════════════════════
   PROJECT DETAIL OVERLAY
   ═══════════════════════════════════════════ */

.project-detail {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(247, 246, 243, 0.97);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.project-detail.open {
  opacity: 1;
  pointer-events: all;
}

.project-detail__close {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--text);
  transition: all 0.2s ease;
  z-index: 10;
}

.project-detail__close:hover {
  background: var(--text);
  color: var(--white);
}

/* Scrollable centered container */
.project-detail__scroll-wrap {
  max-width: 900px;
  width: 90%;
  margin: 0 auto;
  padding: 96px 0 80px;
  transform: translateY(30px) scale(0.97);
  transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.project-detail.open .project-detail__scroll-wrap {
  transform: translateY(0) scale(1);
}

.project-detail__inner {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: var(--space-lg);
  align-items: center;
}

.project-detail__image {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: var(--radius);
  background-size: cover;
  background-position: center;
  background-color: var(--bg-subtle);
}

.project-detail__category {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 600;
  display: block;
  margin-bottom: 0.75rem;
}

.project-detail__title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 1rem;
}

.project-detail__desc {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.project-detail__meta {
  display: flex;
  gap: 2rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.project-detail__meta span {
  padding: 0.4rem 0;
  border-top: 1px solid var(--border);
}

/* ─── PROJECT GALLERY (masonry) ─── */
.project-detail__gallery {
  margin-top: 64px;
  padding-top: 52px;
  border-top: 1px solid var(--border);
}

.project-detail__gallery-grid {
  columns: 3;
  column-gap: 12px;
}

.project-detail__gallery-grid img {
  width: 100%;
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
  display: block;
  break-inside: avoid;
}

/* ═══════════════════════════════════════════
   CLIENTS
   ═══════════════════════════════════════════ */

.clients {
  position: relative;
  z-index: 1;
  padding: var(--space-xl) 0 var(--space-lg);
  overflow: hidden;
}

.clients__label {
  text-align: center;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
  font-weight: 500;
}

.clients__track {
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.clients__list {
  display: flex;
  gap: 4rem;
  white-space: nowrap;
  animation: marquee 25s linear infinite;
}

.clients__list span {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  opacity: 0.4;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

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

/* ═══════════════════════════════════════════
   ABOUT
   ═══════════════════════════════════════════ */

.about {
  position: relative;
  z-index: 1;
  padding: var(--space-xl) var(--space-md);
}

.about__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--space-lg);
}

.about__heading {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.about__text {
  max-width: 560px;
}

.about__text p {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 1.25rem;
}

.about__values {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}

.about__value {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.about__value-num {
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.about__value-label {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ═══════════════════════════════════════════
   CONTACT
   ═══════════════════════════════════════════ */

.contact {
  position: relative;
  z-index: 1;
  padding: var(--space-2xl) var(--space-md) var(--space-md);
  text-align: center;
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.contact__inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.contact__heading {
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: var(--space-md);
  max-width: 700px;
}

.contact__sub {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
}

.contact__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 2.5rem;
  background: var(--accent);
  color: var(--white);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 100px;
  letter-spacing: -0.01em;
  transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.contact__cta:hover {
  background: var(--text);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
}

.contact__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.contact__socials {
  display: flex;
  gap: 1.5rem;
}

.contact__socials a {
  transition: color 0.2s ease;
}

.contact__socials a:hover {
  color: var(--text);
}

/* ═══════════════════════════════════════════
   HIDING OTHER SECTIONS
   ═══════════════════════════════════════════ */
.clients, .about, .contact {
  display: none;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */

@media (max-width: 1024px) {
  .about__inner {
    grid-template-columns: 1fr;
  }

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

  .project-detail__inner {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .showcase__stage {
    height: 65vh;
  }

  .project-card {
    width: 260px;
  }
}

@media (max-width: 640px) {
  .nav {
    padding: 1rem 1.25rem;
  }

  .nav__links {
    gap: 1.25rem;
  }

  .hero {
    min-height: 50vh;
    padding: var(--space-xl) var(--space-sm) var(--space-md);
  }

  .hero__title {
    font-size: 3rem;
  }

  .showcase__filters {
    gap: 0.35rem;
    padding: 0 1rem;
  }

  .filter-btn {
    font-size: 0.72rem;
    padding: 0.4rem 0.9rem;
  }

  .showcase__stage {
    height: 55vh;
    min-height: 380px;
    perspective: 800px;
  }

  .project-card {
    width: 200px;
  }

  .project-card__info {
    padding: 0.75rem 1rem;
  }

  .project-card__title {
    font-size: 0.85rem;
  }

  .about__values {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
  }

  .contact__footer {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .clients__list {
    gap: 2.5rem;
  }

  .clients__list span {
    font-size: 0.9rem;
  }
}

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .clients__list {
    animation: none;
  }
}
