/**
 * Landing Page Section Styles
 * ===========================
 * Animated image grid with stacking card reveal animation.
 * 
 * All selectors scoped to #landing-page to prevent style conflicts.
 * Uses --locked-vh from parent-viewport-stabilizer.js for stable heights.
 */

/* ========================================
   SECTION: LANDING PAGE / LOADER SCREEN
   ======================================== */

:root {
  --studio-font-size: max(1px, 0.9375vw);
  --header-font-size: max(1.1rem, 0.8vw);
  /* Increased from 1.0rem / 0.75vw */

  /* SEE ABOUT Button Variables - Grey gentle style matching footer */
  --see-about-color: rgba(43, 43, 43, 0.7);
  --see-about-color-hover: rgba(43, 43, 43, 0.9);
  --see-about-font-weight: 300;
  --see-about-font-size: 0.9rem;
  --see-about-letter-spacing: 0.05em;
}

/* ========================================
   GLOBAL HEADER (Adapted from Legacy)
   ======================================== */

header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 20px var(--layout-margin) 0 var(--layout-margin);
  display: block;
  box-sizing: border-box;
  pointer-events: none;
  /* Header container doesn't block clicks */
  z-index: 50;
  /* Above everything */
  transform: translateY(0);
  transition: transform 0.3s ease, top 0s;
}

header.header-hidden {
  transform: translateY(-100%);
  /* Slides completely off-screen */
}

header .header-nav {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  /* 4-column grid */
  align-items: center;
}

.header-item {
  opacity: 0;
  /* Initially hidden for entrance animation */
  transform: translateY(-20px);
  /* Slides down on load */
  pointer-events: auto;
  /* Buttons ARE clickable */
  font-weight: 700;
  font-size: var(--header-font-size);
  font-family: var(--font-primary);
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  cursor: pointer;
}

#header-name {
  text-transform: none;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.7);
  text-align: center;
  grid-column: 2 / span 2;
  /* Spans middle two columns */
  font-family: 'Hanken Grotesk', var(--font-primary);
}

#header-contact {
  text-align: right;
  justify-self: end;
  /* Anchored to right edge */
}

/* Underline Hover Effect */
.u-underline-hover {
  position: relative;
  cursor: pointer;
  display: inline-block;
  width: fit-content;
}

.u-underline-hover::after {
  content: '';
  position: absolute;
  width: 0%;
  height: 1px;
  background-color: var(--color-text);
  bottom: -5px;
  left: 0;
  transition: width 0.3s ease-out;
}

.u-underline-hover:hover::after,
.u-underline-hover:focus-visible::after {
  width: 100%;
}

@media (max-width: 1024px) {
  #header-name {
    display: none;
    /* Center compass hidden on tablets/mobile */
  }

  header .header-nav {
    grid-template-columns: 1fr 1fr;
    /* 2-column layout */
  }

  #header-about {
    grid-column: 1;
  }

  #header-contact {
    grid-column: 2;
  }
}

@media (max-width: 767px) {
  header {
    padding: 20px 30px 0 30px;
    /* Tighter margins */
    transition: none !important;
    /* No animation for manual control */
  }
}

#landing-page #loader-screen {
  position: relative;
  width: 100%;
  height: calc(var(--locked-vh, 1vh) * 100);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  z-index: 1;
  background-color: #F5F3EE;
  border-top: 1px solid transparent;
  transition: border-top-color 0.5s ease;
  contain: layout style;
}

/* ========================================
   IMAGE STACK (Animated Grid)
   ======================================== */

#landing-page #image-stack {
  width: 240px;
  height: 300px;
  position: relative;
  contain: layout style;
  pointer-events: auto;
}

#landing-page .stack-container {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  transform: rotate(0deg) scale(1);
  width: 240px;
  height: 300px;
  max-width: 90vw;
  max-height: 112.5vw;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: cursor 0.2s ease;
  pointer-events: auto !important;
}

/* First card: visible immediately and slightly rotated */
#landing-page #image-stack .stack-container:first-child {
  opacity: 1;
  transform: rotate(-4deg);
}

#landing-page .stack-container[data-category] {
  cursor: pointer;
}

#landing-page .stack-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  pointer-events: auto !important;
}

/* ========================================
   LANDING PAGE FOOTER
   ======================================== */

#landing-page .landing-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: var(--spacing-double) var(--layout-margin) var(--layout-margin) var(--layout-margin);
  box-sizing: border-box;
  pointer-events: none;
}

#landing-page .footer-content {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 100px;
  max-width: 100%;
}

#landing-page .footer-section {
  opacity: 0;
  transform: translateY(20px);
}

#landing-page .footer-section:first-child {
  align-self: end;
}

#landing-page .footer-section p {
  font-family: var(--font-primary);
  font-size: var(--studio-font-size);
  line-height: 1.4;
  font-weight: 500;
  margin: 0;
}

#landing-page .footer-section:first-child p {
  font-family: 'Hanken Grotesk', var(--font-primary);
  font-weight: 600;
  font-size: max(1.5rem, 2.4vw);
  line-height: 1.1;
  white-space: nowrap;
}

#landing-page .footer-section:first-child .footer-portfolio-label {
  font-size: var(--studio-font-size);
  font-weight: 500;
  margin-bottom: 1.5em;
  line-height: 1.4;
}

/* ========================================
   HOVER EFFECTS (scoped to landing page)
   ======================================== */


/* ========================================
   RESPONSIVE: TABLET
   ======================================== */

@media (max-width: 1024px) {
  #landing-page .footer-content {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

/* ========================================
   RESPONSIVE: MOBILE
   ======================================== */

@media (max-width: 767px) {

  /* Hide footer text on mobile */
  #landing-page .footer-section {
    display: none;
  }

  #landing-page .footer-content {
    display: none;
  }

  /* Scale down stacking animation images for mobile */
  #landing-page #image-stack {
    width: 60vw;
    height: 75vw;
    max-width: 240px;
    max-height: 300px;
    position: relative;
  }

  /* After animation: expand grid container */
  #landing-page #image-stack.grid-expanded {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
  }

  #landing-page .stack-container {
    width: 60vw;
    height: 75vw;
    max-width: 240px;
    max-height: 300px;
  }

  /* After animation: containers sized by JavaScript */
  #landing-page #image-stack.grid-expanded .stack-container {
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
  }

  #landing-page .stack-container[data-category] {
    cursor: default;
    pointer-events: none;
  }

  #landing-page .stack-image {
    object-fit: contain;
    width: 100%;
    height: 100%;
  }
}

/* ========================================
   INTERMEDIATE SECTION: Mobile-only text
   ======================================== */

#intermediate-section {
  min-height: auto;
  padding: var(--spacing-double) var(--layout-margin);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #F5F3EE;
}

/* Hide intermediate section on desktop - only show on mobile */
@media (min-width: 768px) {
  #intermediate-section {
    display: none;
  }
}

.intermediate-content {
  width: 100%;
  max-width: 800px;
  text-align: center;
}

.intermediate-text {
  margin: 0;
  line-height: 1.4;
}

.intermediate-name {
  display: block;
  font-family: 'Hanken Grotesk', var(--font-primary);
  font-weight: 600;
  font-size: 18px;
  line-height: 1.1;
  margin-bottom: 9px;
}

.intermediate-description {
  display: block;
  font-family: var(--font-primary);
  font-weight: 500;
  font-size: 12px;
  line-height: 1.4;
}

/* ========================================
   MOBILE ABOUT BUTTON (Intermediate Section)
   Styled to match footer SEE ABOUT buttons
   ======================================== */

/* Wrapper - hidden by default on desktop */
#intermediate-section .intermediate-button-wrapper {
  display: none;
}

/* Mobile-only: show wrapper and apply scroll-triggered animation */
@media (max-width: 767px) {
  #intermediate-section .intermediate-button-wrapper {
    display: flex !important;
    justify-content: center !important;
    margin-top: 40px !important;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    width: 100% !important;
    position: relative;
    z-index: 5;
    pointer-events: auto;
  }

  #intermediate-section .intermediate-button-wrapper.is-revealed {
    opacity: 1;
    transform: translateY(0);
  }

  /* Button styling - grey color matching footer */
  #intermediate-section .intermediate-button-wrapper button.intermediate-about-btn {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
    background: none !important;
    border: none !important;
    padding: 0 0 4px 0 !important;
    margin: 0 !important;
    font-family: var(--font-primary) !important;
    font-size: var(--see-about-font-size) !important;
    font-weight: var(--see-about-font-weight) !important;
    letter-spacing: var(--see-about-letter-spacing) !important;
    color: var(--see-about-color) !important;
    cursor: pointer !important;
    text-transform: uppercase !important;
    line-height: normal !important;
    text-decoration: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    outline: none !important;
    width: auto !important;
    height: auto !important;
    min-width: auto !important;
    min-height: auto !important;
    max-width: none !important;
    max-height: none !important;
  }

  /* Button label text */
  #intermediate-section .intermediate-button-wrapper button.intermediate-about-btn .btn-label {
    font-family: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    color: inherit !important;
    letter-spacing: inherit !important;
    text-transform: inherit !important;
    line-height: inherit !important;
    margin: 0 !important;
    padding: 0 !important;
    display: inline !important;
  }

  /* Caret icon - grey to match text */
  #intermediate-section .intermediate-button-wrapper .caret-icon-svg {
    display: block !important;
    width: 10px !important;
    height: 10px !important;
    flex-shrink: 0 !important;
    opacity: 0.7 !important;
    filter: brightness(0) saturate(100%) invert(17%) sepia(0%) saturate(0%) hue-rotate(180deg) brightness(94%) contrast(90%) !important;
  }

  /* Hover state - subtle darkening of grey color */
  #intermediate-section .intermediate-button-wrapper button.intermediate-about-btn:hover {
    color: var(--see-about-color-hover) !important;
    transition: color 0.3s ease !important;
  }

  #intermediate-section .intermediate-button-wrapper button.intermediate-about-btn:hover .caret-icon-svg {
    opacity: 0.9 !important;
    transition: opacity 0.3s ease !important;
  }
}