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

html {
  background: #fff;
  min-height: 100%;
  overscroll-behavior: none;
}

body {
  background: #fff;
  color: #000;
  font-family: 'Segoe UI', Arial, sans-serif;
  min-height: 100%;
  min-height: 100dvh;
  overscroll-behavior: none;
}

/* ========== NAVIGATION ========== */

#site-nav {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 200;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 1rem 1.5rem;
  pointer-events: none;
}

/* Nav logo (top-left) */
#nav-logo {
  margin-right: auto;
  pointer-events: auto;
  line-height: 0;
}

#nav-logo img {
  height: 36px;
  width: auto;
  transition: filter 0.3s ease;
}

/* Invert logo on dark sections */
#site-nav.nav-dark #nav-logo img {
  filter: invert(1) brightness(2);
}

/* Horizontal link bar (desktop) */
#nav-links {
  display: none;
  flex-wrap: nowrap;
  gap: 0.25rem;
  pointer-events: auto;
  flex: 1;
  min-width: 0;
}

#nav-links a {
  white-space: nowrap;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #000;
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}

#nav-links a:hover {
  background: rgba(0, 0, 0, 0.08);
}

/* Dark section link styles */
#site-nav.nav-dark #nav-links a {
  color: #fff;
}
#site-nav.nav-dark #nav-links a:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Hamburger button */
#nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
  pointer-events: auto;
  z-index: 201;
}

#nav-toggle span {
  display: block;
  width: 100%;
  height: 2.5px;
  background: #000;
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease, background 0.15s ease;
}

/* Dark section hamburger */
#site-nav.nav-dark #nav-toggle span {
  background: #fff;
}

/* Hamburger → X animation when open */
#nav-toggle.open span:nth-child(1) {
  transform: translateY(7.5px) rotate(45deg);
}
#nav-toggle.open span:nth-child(2) {
  opacity: 0;
}
#nav-toggle.open span:nth-child(3) {
  transform: translateY(-7.5px) rotate(-45deg);
}

/* When menu is open, always use white */
#nav-toggle.open span {
  background: #fff;
}

/* Full-screen menu overlay */
#nav-dropdown {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem 3rem;
  gap: 0.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 200;
}

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

#nav-dropdown a {
  display: block;
  padding: 0.6rem 0;
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 800;
  color: #fff;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  opacity: 0;
  filter: blur(12px);
  transform: translateY(20px);
  transition: opacity 0.5s ease, filter 0.5s ease, transform 0.5s ease, color 0.15s ease;
}

#nav-dropdown.open a {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
}

/* Staggered entrance for each link */
#nav-dropdown.open a:nth-child(1) { transition-delay: 0.05s; }
#nav-dropdown.open a:nth-child(2) { transition-delay: 0.1s; }
#nav-dropdown.open a:nth-child(3) { transition-delay: 0.15s; }
#nav-dropdown.open a:nth-child(4) { transition-delay: 0.2s; }
#nav-dropdown.open a:nth-child(5) { transition-delay: 0.25s; }
#nav-dropdown.open a:nth-child(6) { transition-delay: 0.3s; }
#nav-dropdown.open a:nth-child(7) { transition-delay: 0.35s; }
#nav-dropdown.open a:nth-child(8) { transition-delay: 0.4s; }

/* Reset delay on close so they fade out together */
#nav-dropdown a:nth-child(n) { transition-delay: 0s; }

#nav-dropdown a:hover {
  color: rgba(255, 255, 255, 0.5);
}

/* Blur page content when menu is open */
body.menu-open #scene,
body.menu-open #tools-section,
body.menu-open #final-section {
  filter: blur(20px);
  transition: filter 0.4s ease;
}

#scene,
#tools-section,
#final-section {
  transition: filter 0.4s ease;
}

/* Desktop: show horizontal links, hide hamburger if they fit */
@media (min-width: 900px) {
  #site-nav {
    padding: 1rem 2rem;
  }

  #nav-links {
    display: flex;
    overflow: clip;
  }

  /* When links fit, hide hamburger. JS adds .nav-overflow to show it */
  #nav-toggle {
    display: none;
  }

  #site-nav.nav-overflow #nav-toggle {
    display: flex;
  }

  #site-nav.nav-overflow #nav-links {
    display: none;
  }
}

/* ========== HERO ENTRANCE ANIMATION ========== */

@keyframes fadeInFromBlur {
  from {
    opacity: 0;
    filter: blur(12px);
  }
  to {
    opacity: 1;
    filter: blur(0);
  }
}

/* ========== SCENE (full viewport, no scroll) ========== */

#scene {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  touch-action: none;
  background: #fff;
}

/* ========== HERO CONTENT ========== */

#hero-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 4rem 2rem 2rem;
  text-align: center;
  z-index: 3;
  animation: fadeInFromBlur 1.2s ease-out forwards;
  will-change: opacity, filter;
}

.logo {
  width: 140px;
  margin-bottom: 1rem;
}

h1 {
  font-size: 2.8rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.subtext {
  font-size: 1.3rem;
  font-weight: 400;
  color: #333;
  margin-bottom: 0;
}

.hero-house {
  max-width: 935px;
  width: 93.5%;
  height: auto;
  margin-top: 0;
}

.cta-button {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 1rem 2.5rem;
  background: #000;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 50px;
  transition: transform 0.2s ease, background 0.2s ease;
}

.cta-button:hover {
  background: #222;
  transform: scale(1.05);
}

/* ========== MOBILE HERO ADJUSTMENTS ========== */

@media (max-width: 768px) {
  .logo {
    width: 100px;
    margin-bottom: 0.5rem;
  }
  h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
  }
  .subtext {
    font-size: 1.1rem;
  }
  .cta-button {
    padding: 0.7rem 1.8rem;
    font-size: 0.95rem;
    margin-top: 1rem;
  }
  #hero-content {
    padding: 2.5rem 1.5rem 1rem;
  }
  .hero-house {
    width: 100%;
    max-width: none;
  }
}

/* ========== PROBLEM BACKGROUND ========== */

#problem-bg {
  position: absolute;
  inset: 0;
  background-image: url('public/Problem Background.jpg');
  background-size: cover;
  background-position: center;
  z-index: 1;
  opacity: 0;
  filter: blur(10px);
  will-change: opacity, filter;
  transition: opacity 1.2s ease, filter 1.2s ease;
}

#problem-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

#problem-bg.visible {
  opacity: 1;
  filter: blur(0);
}

/* ========== PROBLEM CONTENT ========== */

#problem-content {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  padding: 2rem;
  opacity: 0;
  will-change: opacity;
  transition: opacity 1s ease;
}

#problem-content.visible {
  opacity: 1;
}

#problem-content h2 {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.3;
  color: #fff;
  max-width: 700px;
  text-align: center;
}

/* ========== SECTION 3 ========== */

#section3-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 4;
  padding: 2rem;
  background: #fff;
  opacity: 0;
  will-change: opacity;
  transition: opacity 1.2s ease;
  pointer-events: none;
}

#section3-content.visible {
  opacity: 1;
  pointer-events: auto;
}

.section3-headline {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.3;
  color: #000;
  text-align: center;
  max-width: 600px;
  margin-bottom: 3rem;
  opacity: 0;
  filter: blur(10px);
  transition: opacity 1s ease 0.3s, filter 1s ease 0.3s;
}

#section3-content.visible .section3-headline {
  opacity: 1;
  filter: blur(0);
}

.scroll-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  position: absolute;
  bottom: 3rem;
  opacity: 0;
  filter: blur(10px);
  transition: opacity 1s ease 1s, filter 1s ease 1s;
}

#section3-content.visible .scroll-indicator {
  opacity: 1;
  filter: blur(0);
}

.scroll-label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #000;
}

#arrow-canvas {
  width: 60px;
  height: 100px;
}

/* ========== TOOLS SECTION (stacking cards) ========== */

#tools-section {
  display: none;
  position: relative;
  background: #000;
}

/* Scrollable mode: applied by JS when entering tools */
html.scroll-mode,
html.scroll-mode body {
  height: auto;
}

/* In scroll mode, scene becomes a sticky header behind tool cards */
html.scroll-mode #scene {
  position: sticky;
  top: 0;
  z-index: 0;
}

.tool-card-wrapper {
  height: 300vh;
  position: relative;
}

.tool-card-wrapper:not(:first-child) {
  margin-top: -100vh;
}

.tool-card-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.tool-card-image {
  position: absolute;
  inset: 0;
  will-change: transform;
  transform-origin: center center;
}

.tool-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tool-card-placeholder {
  background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
}

.tool-card-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 40%, transparent 100%);
}

.tool-card-text {
  position: absolute;
  bottom: 0;
  left: 0;
  padding: 3rem 4rem 4rem;
  max-width: 600px;
  z-index: 2;
  opacity: 0;
  transform: translateY(30px);
  will-change: opacity, transform;
}

.tool-card-text h3 {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
  margin-bottom: 0.75rem;
}

.tool-card-text p {
  font-size: 1.15rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.75);
}

.tool-card-btn {
  display: inline-block;
  margin-top: 1.2rem;
  padding: 0.75rem 2rem;
  background: #fff;
  color: #000;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 50px;
  transition: transform 0.2s ease, background 0.2s ease;
}

.tool-card-btn:hover {
  background: #e0e0e0;
  transform: scale(1.05);
}

/* ========== FINAL SECTION ========== */

#final-section {
  display: none;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background: #fff;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  padding: 4rem 2rem 2rem;
  z-index: 100;
}

#final-section.visible {
  display: flex;
}

#final-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  filter: blur(10px);
  transition: filter 1.2s ease, opacity 1.2s ease;
}

#final-content.entered {
  opacity: 1;
  filter: blur(0);
}

#final-content.blurred {
  filter: blur(4px);
  opacity: 0.45;
}

.final-headline {
  font-size: 2.8rem;
  font-weight: 700;
  line-height: 1.2;
  color: #000;
  margin-bottom: 0;
}

.final-house {
  margin-top: 0;
}

.final-cta {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 10;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.9);
  transition: opacity 0.8s ease, transform 0.8s ease;
  pointer-events: none;
  white-space: nowrap;
}

.final-cta.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

.final-cta.visible:hover {
  background: #222;
  transform: translate(-50%, -50%) scale(1.05);
}

.final-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 1.5rem 2rem;
  text-align: center;
  background: #fff;
  z-index: 5;
}

.final-footer p {
  font-size: 0.85rem;
  color: #999;
}
