/* ========================================
   Design Tokens
   ======================================== */
:root {
  --color-bg: #f1e6da;
  --color-text: #303030;
  --color-text-secondary: #5b5044;
  --color-text-inverted: #ffffff;
  --font-heading: 'Lora', serif;
  --font-body: 'Onest', sans-serif;
  --container-max: 1140px;
  --section-py: 64px;
  --px-mobile: 20px;
  --px-desktop: 24px;
}

/* ========================================
   Reset & Base
   ======================================== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.3;
  color: var(--color-text);
  background-color: var(--color-bg);
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { text-decoration: none; color: inherit; }

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 500;
  line-height: 1.1;
}

/* ========================================
   Container
   ======================================== */
.container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--px-mobile);
}

.centered {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 768px) {
  body { font-size: 18px; }
  .container { padding: 0 clamp(32px, 10.4vw, 150px); }
}

/* ========================================
   Header
   ======================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-bg);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.site-header.scrolled {
  background-color: #ffffff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 32px;
  padding-bottom: 20px;
}

.logo img { width: 96px; height: auto; }
.logo { margin-left: 3px; }

@media (min-width: 768px) {
  .logo img { width: 116px; }
}

.main-nav {
  display: flex;
  gap: 36px;
  align-items: center;
}

.main-nav a {
  font-size: 18px;
  color: var(--color-text);
  transition: opacity 0.2s;
}

.main-nav a:hover { opacity: 0.7; }

/* Hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 101;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--color-text);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

.nav-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 767px) {
  .nav-toggle { display: flex; }

  .main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: auto;
    background-color: #ffffff;
    flex-direction: column;
    align-items: center;
    padding: 80px 20px 32px;
    gap: 20px;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    z-index: 99;
  }

  .main-nav.open { transform: translateY(0); }
  .main-nav a { font-size: 18px; }
}

/* ========================================
   Hero
   ======================================== */
.hero {
  overflow: hidden;
}

/* Mobile: stacked centered */
.hero-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  padding-top: 24px;
  padding-bottom: 24px;
  max-width: 420px;
  margin: 0 auto;
}

.hero-text h1 {
  font-size: 32px;
  color: var(--color-text);
}

.hero-text p {
  font-size: 16px;
  color: var(--color-text-secondary);
}

.app-store-link img {
  width: 163px;
  height: auto;
  transition: transform 0.2s;
}

.app-store-link:hover img { transform: scale(1.05); }

.hero-image {
  display: flex;
  justify-content: center;
  margin: 0 calc(-1 * var(--px-mobile));
  overflow: hidden;
}

.hero-image img {
  width: 150%;
  max-width: none;
  height: auto;
  object-fit: contain;
  margin-left: -25%;
}

/* Tablet: left-align text, larger type */
@media (min-width: 768px) {
  .hero-text {
    align-items: flex-start;
    text-align: left;
    gap: 20px;
    max-width: 420px;
    margin: 0;
    margin-bottom: -80px;
    position: relative;
    z-index: 1;
  }

  .hero-text h1 { font-size: 42px; }
  .hero-text p { font-size: 18px; }

  .hero-image {
    margin: 0;
  }

  .hero-image img {
    width: 100%;
    max-width: none;
    margin-left: 0;
  }
}

/* Desktop: text overlaps image, image bleeds from left */
@media (min-width: 1024px) {
  .hero {
    padding-top: clamp(2rem, 5vw, 100px);
    padding-bottom: 0;
  }

  .hero-text {
    position: relative;
    z-index: 1;
    align-items: flex-start;
    text-align: left;
    gap: 24px;
    max-width: 600px;
    margin: 0;
    margin-bottom: -240px;
    padding-bottom: 0;
  }

  .hero-text h1 { font-size: 48px; }
  .hero-text p { font-size: 18px; max-width: 480px; }

  .hero-image {
    justify-content: flex-start;
    margin: 0;
    overflow: visible;
  }

  .hero-image img {
    max-width: none;
    width: 90%;
    margin-left: 0;
  }
}

/* ========================================
   Shared Section Styles
   ======================================== */
.section-header {
  max-width: 420px;
  margin-bottom: 24px;
}

.section-header h2 {
  font-size: 32px;
  color: var(--color-text);
  margin-bottom: 16px;
}

.section-header p {
  font-size: 16px;
  color: var(--color-text-secondary);
}

@media (min-width: 768px) {
  .section-header { margin-bottom: clamp(2rem, 5vw, 3.5rem); }
  .section-header h2 { font-size: clamp(2rem, 3.5vw, 3rem); margin-bottom: 20px; }
  .section-header p { font-size: 18px; }
}

@media (min-width: 1024px) {
  .section-header { max-width: 600px; }
}

/* ========================================
   Feature: Identify
   ======================================== */
.feature-identify {
  padding: var(--section-py) 0;
}

.identify-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.identify-image-wrapper {
  max-width: 520px;
  width: 100%;
}

.identify-main-image {
  width: 100%;
  height: auto;
}

@media (min-width: 1024px) {
  .identify-image-wrapper { max-width: 700px; }
}

/* ========================================
   Feature: Collect
   ======================================== */
.feature-collect {
  padding: var(--section-py) 0 0;
}

/* Mobile: single column, centered */
.collect-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
  margin-bottom: 0;
}

.collect-text {
  max-width: 420px;
  margin: 0 auto;
}

.collect-text h2 {
  font-size: 32px;
  color: var(--color-text);
  margin-bottom: 16px;
}

.collect-text p {
  font-size: 16px;
  color: var(--color-text-secondary);
}

.collect-fan img {
  width: 100%;
  max-width: 336px;
  height: auto;
}

.collect-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.collect-chain img {
  width: 100%;
  max-width: 243px;
  height: auto;
}

/* Hide forest floor on mobile — not in mobile Figma */
.collect-forest { display: none; }

@media (min-width: 768px) {
  .collect-top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
    text-align: left;
    margin-bottom: clamp(1rem, 3vw, 2rem);
  }

  .collect-text h2 { font-size: clamp(2rem, 3.5vw, 3rem); margin-bottom: 20px; }
  .collect-text p { font-size: 18px; max-width: 420px; }
  .collect-fan img { max-width: 466px; margin-left: auto; }

  .collect-bottom {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 48px;
    align-items: center;
  }

  .collect-chain img { max-width: 100%; }
  .collect-forest { display: block; }
  .collect-forest img { width: 100%; max-width: 950px; height: auto; }
}

@media (min-width: 1024px) {
  .collect-text { max-width: 600px; }
  .badges-text-col { max-width: 600px; }
}

/* ========================================
   Feature: Badges
   ======================================== */
.feature-badges {
  padding: var(--section-py) 0;
}

/* Mobile: stacked */
.badges-inner {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.badges-text-col { order: -1; }
.badges-visual { order: 1; margin-top: -24px; }

.badges-text-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
  max-width: 420px;
  margin: 0 auto;
}

.badges-text h2 {
  font-size: 32px;
  color: var(--color-text);
  margin-bottom: 16px;
}

.badges-text p {
  font-size: 16px;
  color: var(--color-text-secondary);
}

.nightwatch-image {
  margin-bottom: 0;
  margin-left: calc(-1 * var(--px-mobile));
  margin-right: calc(-1 * var(--px-mobile));
}

.nightwatch-image img {
  width: 100%;
  max-width: none;
  height: auto;
}

.badge-grid-img {
  width: 100%;
  max-width: 312px;
  height: auto;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .badges-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 64px;
    align-items: start;
  }

  .badges-text-col {
    padding-top: 0;
    text-align: left;
    order: unset;
  }

  .badges-visual {
    order: unset;
    margin-top: 0;
  }

  .badges-text h2 { font-size: clamp(2rem, 3.5vw, 3rem); margin-bottom: 20px; }
  .badges-text p { font-size: 18px; max-width: 420px; }
  .badges-visual {
    position: relative;
    z-index: 1;
  }

  .nightwatch-image {
    position: relative;
    z-index: 0;
    margin-top: -8px;
    margin-left: -140px;
    margin-right: 0;
  }

  .nightwatch-image img {
    max-width: none;
    width: calc(90% + 54px);
  }
  .badge-grid-img { max-width: 462px; }
}

/* ========================================
   Footer (CTA + Tropical Background)
   ======================================== */
.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.footer-cta {
  text-align: center;
  max-width: 420px;
  padding: 40px 20px 32px;
  position: relative;
  z-index: 1;
}

.footer-cta h2 {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 32px;
  line-height: 1.1;
  color: var(--color-text);
  margin-bottom: 16px;
}

.footer-cta p {
  font-size: 16px;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
}

.footer-cta .app-store-link {
  display: inline-block;
  margin-bottom: 0;
}

.footer-cta .app-store-link img {
  margin: 0 auto;
}

.footer-bg {
  width: 100%;
  overflow: hidden;
}

.footer-bg img {
  width: 140%;
  max-width: none;
  height: auto;
  display: block;
  margin-left: -20%;
}

@media (min-width: 768px) {
  .footer-cta {
    max-width: 420px;
    padding: 0 24px 0;
    margin-bottom: -40px;
  }

  .footer-cta h2 {
    font-size: clamp(2rem, 3.5vw, 3rem);
    margin-bottom: 20px;
  }

  .footer-cta p { font-size: 18px; }

  .footer-bg img {
    width: 120%;
    margin-left: -10%;
  }
}

@media (min-width: 1024px) {
  .footer-cta {
    max-width: 600px;
    margin-bottom: -100px;
  }

  .footer-bg img {
    width: 100%;
    margin-left: 0;
  }
}

/* ========================================
   Scroll Reveal Animations
   ======================================== */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.8s cubic-bezier(0.25, 0.1, 0.25, 1),
              transform 0.8s cubic-bezier(0.25, 0.1, 0.25, 1);
  will-change: opacity, transform;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children within the same section */
.reveal:nth-child(2) { transition-delay: 0.12s; }
.reveal:nth-child(3) { transition-delay: 0.24s; }

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
