/* ===================================
   LAYOUT - Grid, Header, Footer, Container (Optimized)
   =================================== */

/* Header and Footer Grid */
.header,
.footer {
  position: absolute;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  padding: 1.5rem;
  z-index: 10000;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--spacing-base);
  box-sizing: border-box;
  contain: layout style;
}

.header {
  top: 0;
  background-color: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: none;
}

/* FIXED: Only apply difference blend mode on index page, not project pages */
body:not(.project-page) .header {
  mix-blend-mode: difference;
  isolation: isolate;
}

/* FIXED: Project pages get normal blend mode to prevent black outline issue */
.project-page .header {
  mix-blend-mode: normal;
  isolation: auto;
}

.footer {
  bottom: 0;
  background-color: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-top: none;
  mix-blend-mode: normal;
}

/* Header text white for difference blend mode on index */
body:not(.project-page) .header * {
  color: #ffffff !important;
  font-weight: 600 !important;
}

body:not(.project-page) .header a {
  color: #ffffff !important;
  font-weight: 700 !important;
}

body:not(.project-page) .header p {
  font-weight: 600 !important;
}

/* Project page header text - solid white, normal rendering */
.project-page .header * {
  color: #ffffff !important;
  font-weight: 600 !important;
  mix-blend-mode: normal !important;
}

.project-page .header a {
  color: #ffffff !important;
  font-weight: 700 !important;
  mix-blend-mode: normal !important;
}

.project-page .header p {
  color: #ffffff !important;
  font-weight: 600 !important;
  mix-blend-mode: normal !important;
}

/* Footer text - solid white, no blend modes */
.footer * {
  color: #ffffff !important;
  font-weight: 600 !important;
  mix-blend-mode: normal !important;
}

.footer a {
  color: #ffffff !important;
  font-weight: 700 !important;
  mix-blend-mode: normal !important;
}

.footer p {
  color: #ffffff !important;
  font-weight: 600 !important;
  mix-blend-mode: normal !important;
}

/* Header Grid Sections */
.nav-section {
  grid-column: 1 / span 3;
}

.values-section {
  grid-column: 5 / span 2;
}

.values-section p,
.values-section h3 {
  font-family: var(--font-primary);
  font-size: var(--font-size-base);
  font-weight: 600;
  letter-spacing: -0.01rem;
  -webkit-font-smoothing: antialiased;
}

.location-section {
  grid-column: 7 / span 2;
}

.location-section p,
.location-section h3 {
  font-family: var(--font-primary);
  font-size: var(--font-size-base);
  font-weight: 600;
  letter-spacing: -0.01rem;
  -webkit-font-smoothing: antialiased;
}

.contact-section {
  grid-column: 9 / span 2;
}

.contact-section p,
.contact-section h3 {
  font-family: var(--font-primary);
  font-size: var(--font-size-base);
  font-weight: 600;
  letter-spacing: -0.01rem;
  -webkit-font-smoothing: antialiased;
}

.social-section {
  grid-column: 11 / span 2;
  text-align: right;
}

.social-section p,
.social-section h3 {
  font-family: var(--font-primary);
  font-size: var(--font-size-base);
  font-weight: 600;
  letter-spacing: -0.01rem;
  -webkit-font-smoothing: antialiased;
}

/* Footer Grid Sections */
.coordinates-section {
  grid-column: 1 / span 3;
  font-family: var(--font-mono);
}

.coordinates-section p {
  font-family: var(--font-mono);
  font-size: var(--font-size-base);
  font-weight: 600;
  letter-spacing: -0.01rem;
  color: #ffffff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.info-section {
  grid-column: 9 / span 4;
  text-align: right;
}

.info-section p {
  font-family: var(--font-mono);
  font-size: var(--font-size-base);
  font-weight: 600;
  letter-spacing: -0.01rem;
  color: #ffffff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.footer p {
  font-family: var(--font-mono);
  font-size: var(--font-size-base);
  font-weight: 600;
  letter-spacing: -0.01rem;
  color: #ffffff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Main Container */
.container {
  position: relative;
  width: 100%;
  max-width: 100vw;
  height: 100vh;
  overflow: hidden;
  cursor: grab;
  box-sizing: border-box;
  contain: layout style;
}

.canvas {
  position: absolute;
  will-change: transform;
}

/* Project Page Layout */
.project-page {
  overflow-x: hidden;
  overflow-y: auto;
  height: 100vh;
  width: 100%;
  max-width: 100vw;
  background-color: #000000;
}

.project-page .header {
  position: fixed;
}

.project-hero {
  width: 100%;
  height: 100vh;
  position: relative;
  overflow: hidden;
  background-color: #000000;
  contain: layout style paint;
}

/* OPTIMIZED: Reduced vignette blur */
.project-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, 0.3) 70%, rgba(0, 0, 0, 0.7) 100%);
  z-index: 5;
  pointer-events: none;
}

.project-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(1.05) saturate(1.1);
  transform: scale(1.02) translate3d(0, 0, 0);
}

.project-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 2rem;
  background-color: #000000;
  contain: layout style;
}

.project-description {
  max-width: 800px;
  margin: 0 auto 4rem;
}

.project-description p {
  font-size: 16px;
  line-height: 1.8;
  font-weight: 400;
  margin-bottom: 1rem;
  color: #ffffff;
}

/* Image Gallery Layouts */
.image-gallery {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2rem;
  margin-bottom: 4rem;
}

.image-full {
  grid-column: 1 / -1;
  contain: layout style;
  background-color: #000000;
}

.image-half {
  grid-column: span 6;
  contain: layout style;
  background-color: #000000;
}

.image-gallery img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  transform: translate3d(0, 0, 0);
  background-color: #000000;
}

/* Project Footer */
.project-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 2rem;
  text-align: center;
  margin-top: 4rem;
  background-color: #000000;
}

.project-footer p {
  font-family: var(--font-mono);
  font-size: 12px;
  opacity: 0.6;
  color: #ffffff;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .header,
  .footer {
    grid-template-columns: repeat(6, 1fr);
  }
  
  .nav-section {
    grid-column: 1 / span 6;
    margin-bottom: 1rem;
  }
  
  .values-section {
    grid-column: 1 / span 3;
  }
  
  .location-section {
    grid-column: 4 / span 3;
  }
  
  .contact-section {
    grid-column: 1 / span 3;
  }
  
  .social-section {
    grid-column: 4 / span 3;
    text-align: left;
  }
}

/* ================================
   MOBILE CRITICAL RULES
   ================================ */
@media (max-width: 768px) {
  .header {
    padding: 0.75rem 1.5rem;
    position: fixed;
    background-color: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    grid-template-columns: 1fr;
    gap: 0;
    mix-blend-mode: normal !important;
  }
  
  .footer {
    padding: 0.75rem 1.5rem;
    position: fixed;
    background-color: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-top: none;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    z-index: 10000;
    mix-blend-mode: normal;
  }
  
  .nav-section {
    grid-column: 1 / -1;
    margin-bottom: 0;
  }
  
  .header .values-section,
  .header .location-section,
  .header .contact-section,
  .header .social-section,
  .values-section,
  .location-section,
  .contact-section,
  .social-section {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    position: absolute !important;
    left: -9999px !important;
  }
  
  .header-dropdown,
  .dropdown-toggle,
  .dropdown-content,
  .header .header-dropdown,
  .header .dropdown-toggle,
  .header .dropdown-content {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    position: absolute !important;
    left: -9999px !important;
  }
  
  .footer {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
  }
  
  .coordinates-section,
  .info-section {
    grid-column: 1 / -1;
    text-align: left;
  }
  
  .info-section {
    text-align: right;
  }
  
  .footer p {
    font-size: var(--font-size-base);
    font-weight: 600;
    letter-spacing: -0.01rem;
    color: #ffffff;
  }
  
  .footer-mobile {
    padding: 0.75rem 1.5rem;
    background-color: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-top: none;
    z-index: 10000;
    mix-blend-mode: normal;
  }
  
  .footer-mobile * {
    font-size: var(--font-size-base) !important;
    font-weight: 600 !important;
    letter-spacing: -0.01rem !important;
    color: #ffffff !important;
    mix-blend-mode: normal !important;
  }
  
  .footer-mobile p {
    color: #ffffff !important;
    mix-blend-mode: normal !important;
  }
  
  .image-half {
    grid-column: 1 / -1;
  }
  
  .project-description h1 {
    font-size: 32px;
  }
  
  .project-content {
    padding: 3rem 1.5rem;
  }
  
  .project-hero {
    min-height: 70vh;
    height: auto;
  }
  
  .hero-title-overlay h1 {
    font-size: clamp(28px, 8vw, 48px);
  }
  
  .scroll-indicator {
    bottom: 1rem;
  }
}