/* ========================================
   GLOBAL FOOTER (Full Bleed 3-Panel)
   Namespaced under #footer for parent site integration
   ======================================== */

/* Footer-specific variable definitions */
#footer {
  /* Color palette - matching parent site */
  --footer-offwhite: rgb(245, 243, 238);
  --footer-color-bg: var(--footer-offwhite);
  --footer-color-representing: #F76B3B;
  --footer-off-white: #F7F7F4;

  /* Typography */
  --footer-font-primary: 'Hanken Grotesk', 'area-variable', sans-serif;

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

  /* "Illustrator Ratio" System Variables
     Using vw units for viewport-relative sizing (avoids nested % issues) */
  --footer-canvas-width: 1200;
  --footer-orange-panel-width: calc(253.439 / 1200 * 100%);
  --footer-content-padding-side: calc(137.748 / 1200 * 100vw);
  --footer-image-width: calc(102.628 / 1200 * 100vw);

  /* RESPONSIVE VERTICAL SPACING SYSTEM
     Uses clamp() with --locked-vh for viewport stabilization */
  --footer-bottom-line-height: clamp(24px, calc(var(--locked-vh, 1vh) * 3), 40px);
  --footer-content-gap-y: clamp(20px, calc(var(--locked-vh, 1vh) * 4), 48px);
  --footer-bottom-margin: clamp(24px, calc(var(--locked-vh, 1vh) * 4), 60px);
}

#footer .main-footer {
  width: 100%;
  margin: 0;
  padding: 0;
  background-color: var(--footer-color-bg);
  position: relative;
  z-index: 10;
  overflow: hidden;

  /* Fix for footer interactivity */
  pointer-events: auto;

  /* Aspect Ratio Logic with responsive bounds */
  height: auto;
  aspect-ratio: 1200 / 221.582;
  min-height: clamp(200px, calc(var(--locked-vh, 1vh) * 18), 280px);
}

#footer .footer-container {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

/* --- Panel System: Top/Bottom Split --- */
#footer .footer-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

/* Top Section: Grows to fill space, reserves space for absolute bottom */
#footer .footer-panel-top {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: calc(var(--footer-content-gap-y) + var(--footer-bottom-line-height) + var(--footer-bottom-margin));
  box-sizing: border-box;
}

/* Bottom Section: Pinned absolutely to ensure alignment with the line */
#footer .footer-panel-bottom {
  height: var(--footer-bottom-line-height);
  width: 100%;
  position: absolute;
  bottom: var(--footer-bottom-margin);
  left: 0;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  z-index: 5;
}

/* Unified underline - aligns with content edges (respects padding) */
#footer .footer-container::after {
  content: '';
  position: absolute;
  bottom: calc(var(--footer-bottom-margin) + 1px);
  left: var(--footer-content-padding-side);
  right: var(--footer-content-padding-side);
  height: 1px;
  background-color: #D4D2CA;
  pointer-events: none;
}

/* --- Panel 1: Left Sidebar (Orange) --- */
#footer .orange-panel {
  width: var(--footer-orange-panel-width);
  background-color: var(--footer-color-representing);
  flex-shrink: 0;
}

#footer .orange-panel-content-inner {
  padding-left: var(--footer-content-padding-side);
  margin-top: auto;
}

/* Image Sizing Fix - Viewport-relative to match design canvas */
#footer .footer-image-wrapper {
  width: var(--footer-image-width);
  aspect-ratio: 102.628 / 127.464;
  height: auto;
  overflow: hidden;
  filter: grayscale(100%);
  flex-shrink: 0;
  cursor: pointer;
}

#footer .footer-image-wrapper:hover .footer-contact-image {
  transform: scale(1.05);
}

#footer .footer-contact-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s ease;
}

/* Orange Panel Top - ensure image never touches footer top */
#footer .orange-panel .footer-panel-top {
  padding-top: clamp(12px, calc(var(--locked-vh, 1vh) * 2), 24px);
}

/* Orange Bottom Content */
#footer .orange-panel .footer-panel-bottom {
  padding-left: var(--footer-content-padding-side);
}

#footer .footer-contact-text {
  font-family: var(--footer-font-primary);
  font-weight: 700;
  text-transform: uppercase;
  font-size: clamp(12px, 1.2vw, 14px);
  letter-spacing: 0.05em;
  color: #000;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  z-index: 2;
}

/* SEE ABOUT in orange panel - hidden on desktop, shown only on mobile */
#footer .footer-see-about-mobile {
  /* Styles now applied via .intermediate-about-btn */
  /* Visibility controlled by wrapper's display property */
}

#footer .orange-panel .footer-panel-bottom .intermediate-button-wrapper {
  display: none !important;
}

/* Hide default cursor when custom cursor is active on footer image */
#footer .footer-image-wrapper.cursor-active,
#footer .footer-image-wrapper.cursor-active * {
  cursor: none !important;
}

/* --- Panel 2: Center Content (Off-White) --- */
#footer .white-panel {
  flex-grow: 1;
  background-color: var(--footer-off-white);
}

#footer .white-panel .footer-panel-top {
  padding-left: 4vw;
  padding-right: calc(var(--footer-content-padding-side) - 60px);
  padding-top: clamp(12px, calc(var(--locked-vh, 1vh) * 2), 24px);
}

#footer .white-panel-content-inner {
  width: 100%;
  position: relative;
  margin-top: auto;
}

#footer .footer-see-about-top {
  position: absolute;
  top: 0;
  right: calc(var(--footer-content-padding-side) - 60px);
  font-family: var(--footer-font-primary);
  font-weight: 700;
  text-transform: uppercase;
  font-size: clamp(12px, 1.2vw, 14px);
  letter-spacing: 0.05em;
  color: #000;
  cursor: pointer;
}

#footer .footer-links-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.5fr;
  gap: 40px;
  width: 100%;
}

#footer .footer-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#footer .footer-header {
  font-family: var(--footer-font-primary);
  font-weight: 700;
  font-size: clamp(14px, 1.4vw, 18px);
  text-transform: uppercase;
  color: #7A7974;
  margin-bottom: 8px;
  letter-spacing: 0.05em;
}

#footer .footer-link {
  font-family: var(--footer-font-primary);
  font-weight: 400;
  font-size: clamp(14px, 1.4vw, 18px);
  color: #000;
  text-decoration: none;
  display: inline-block;
  line-height: 1.4;
}

#footer .footer-text-bold {
  font-family: var(--footer-font-primary);
  font-weight: 700;
  font-size: clamp(14px, 1.4vw, 18px);
  text-transform: uppercase;
  color: #000;
}

#footer .footer-text-sub {
  font-family: var(--footer-font-primary);
  font-size: clamp(14px, 1.4vw, 18px);
  color: #000;
}

#footer .footer-text-faint {
  font-size: clamp(14px, 1.4vw, 18px);
  color: #7A7974;
  font-weight: 300;
  text-align: right;
}

#footer .footer-text-italic {
  font-family: var(--footer-font-primary);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(12px, 1.2vw, 16px);
  color: #7A7974;
  text-transform: uppercase;
  margin-top: auto;
  text-align: right;
}

/* White Bottom Content */
#footer .white-panel .footer-panel-bottom {
  justify-content: flex-end;
  padding-right: calc(var(--footer-content-padding-side) - 60px);
}

/* Desktop: White panel See About button styled to match Contact button */
@media (min-width: 769px) {
  #footer .white-panel .footer-panel-bottom .intermediate-button-wrapper button.intermediate-about-btn {
    font-weight: 700 !important;
    font-size: clamp(12px, 1.2vw, 14px) !important;
    color: #000 !important;
  }

  #footer .white-panel .footer-panel-bottom .intermediate-button-wrapper .caret-icon-svg {
    opacity: 1 !important;
    filter: none !important;
  }

  #footer .white-panel .footer-panel-bottom .intermediate-button-wrapper button.intermediate-about-btn:hover {
    color: #000 !important;
  }
}

/* Intermediate Button Wrapper - Scroll-triggered animation container */
#footer .footer-panel-bottom .intermediate-button-wrapper {
  display: flex !important;
  justify-content: flex-end !important;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
  position: relative;
  z-index: 5;
  pointer-events: auto;
  width: auto !important;
  margin: 0 !important;
}

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

/* Button label text - ensure no parent styles interfere */
#footer .footer-panel-bottom .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;
}

/* Button styling - grey color for gentle appearance */
/* High specificity to override parent site button styles */
/* Uses footer-scoped CSS variables to prevent parent site conflicts */
#footer .footer-panel-bottom .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(--footer-font-primary) !important;
  font-size: var(--footer-see-about-font-size) !important;
  font-weight: var(--footer-see-about-font-weight) !important;
  letter-spacing: var(--footer-see-about-letter-spacing) !important;
  color: var(--footer-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;
}

#footer .footer-panel-bottom .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 */
#footer .footer-panel-bottom .intermediate-button-wrapper button.intermediate-about-btn:hover {
  color: var(--footer-see-about-color-hover) !important;
  transition: color 0.3s ease !important;
}

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

/* Legacy class maintained for JavaScript selectors */
#footer .footer-see-about {
  /* Styles now applied via .intermediate-about-btn */
}

/* --- Panel 3: Back to Top Strip --- */
#footer .back-to-top-panel {
  width: 60px;
  background-color: #F2F1ED;
  flex-shrink: 0;
  cursor: pointer;
  border-left: 1px solid rgba(0, 0, 0, 0.05);
}

/* Reuse section-tag structure but override layout */
#footer .back-to-top-panel .section-tag-wrapper {
  position: relative;
  top: auto;
  height: 100%;
  width: 100%;
  margin: 0;
  background: transparent;
  z-index: 10;
}

#footer .back-to-top-panel .section-tag {
  height: auto;
  width: 100%;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-top: 20px;
  padding-bottom: 0;
  box-sizing: border-box;
  background-color: #F2F1ED !important;
}

#footer .back-to-top-panel .section-tag-text {
  transform: none;
  font-family: var(--footer-font-primary);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 15px;
  color: #7A7974;
}

#footer .back-to-top-panel .back-to-top-arrow {
  color: #000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#footer .desktop-arrow-left {
  width: 1em;
  height: 1em;
  transform: none;
  display: block;
}

#footer .footer-arrow-icon {
  width: 0.8em;
  height: 0.8em;
  margin-left: 4px;
  vertical-align: middle;
  transform: translateY(-1px);
}

/* Mobile Back to Top Trigger */
#footer .back-to-top-trigger {
  cursor: pointer;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

#footer .back-to-top-trigger img {
  width: 24px;
  height: 24px;
}

/* ========================================
   Hover Effect Utility
   ======================================== */
#footer .u-underline-hover {
  position: relative;
  display: inline-block;
}

#footer .u-underline-hover::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background-color: currentColor;
  transition: width 0.3s ease;
}

#footer .u-underline-hover:hover::after {
  width: 100%;
}

/* ========================================
   Responsive: Desktop/Mobile Visibility
   ======================================== */
#footer .desktop-only {
  display: block;
}

#footer .mobile-only {
  display: none;
}

@media (max-width: 768px) {
  /* ========================================
     MOBILE LAYOUT - Vertical Stack
     ======================================== */

  /* Hide desktop elements */
  #footer .desktop-only {
    display: none;
  }

  #footer .mobile-only {
    display: block;
  }

  /* --- Main Footer: Remove desktop aspect ratio --- */
  #footer .main-footer {
    aspect-ratio: auto;
    min-height: auto;
    height: auto;
  }

  /* --- Container: Stack vertically --- */
  #footer .footer-container {
    flex-direction: column;
  }

  /* Remove the underline pseudo-element on mobile or adjust position */
  #footer .footer-container::after {
    display: none;
  }

  /* --- Orange Panel: Full width, stacked layout --- */
  #footer .orange-panel {
    width: 100%;
    min-height: 280px;
    position: relative;
  }

  #footer .orange-panel .footer-panel-top {
    padding-top: 40px;
    padding-bottom: 80px;
    /* Space for bottom buttons */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    /* Align to left */
    justify-content: flex-start;
  }

  #footer .orange-panel-content-inner {
    padding-left: 20px;
    /* Left padding for image */
    margin-top: 0;
    display: flex;
    justify-content: flex-start;
    /* Left align */
    width: 100%;
  }

  /* Image: Larger and centered on mobile */
  #footer .footer-image-wrapper {
    width: 120px;
    aspect-ratio: 102.628 / 127.464;
  }

  /* Bottom panel with buttons - positioned absolutely */
  #footer .orange-panel .footer-panel-bottom {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: auto;
  }

  #footer .footer-contact-text {
    font-size: 14px;
  }

  /* SEE ABOUT mobile - show wrapper on mobile */
  #footer .orange-panel .intermediate-button-wrapper {
    display: flex !important;
    justify-content: flex-end !important;
    margin-left: auto !important;
  }

  /* Mobile button inherits from parent selector but ensure visibility */
  #footer .orange-panel .footer-panel-bottom .intermediate-button-wrapper button.intermediate-about-btn {
    /* All styles inherited from main button.intermediate-about-btn rule above */
    /* Font size slightly adjusted for mobile readability */
    font-size: var(--footer-see-about-font-size-mobile) !important;
  }

  /* --- White Panel: Full width, stacked content --- */
  #footer .white-panel {
    width: 100%;
  }

  #footer .white-panel .footer-panel-top {
    padding: 30px 20px 20px 20px;
    position: relative;
    /* For absolute positioning of arrow */
  }

  #footer .white-panel-content-inner {
    margin-top: 0;
  }

  /* Links grid: Single column on mobile */
  #footer .footer-links-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  #footer .footer-col {
    gap: 6px;
  }

  #footer .footer-header {
    font-size: 14px;
    margin-bottom: 4px;
  }

  #footer .footer-link {
    font-size: 16px;
  }

  #footer .footer-text-bold {
    font-size: 16px;
  }

  #footer .footer-text-sub {
    font-size: 16px;
  }

  #footer .footer-text-faint {
    font-size: 14px;
    text-align: left;
  }

  #footer .footer-text-italic {
    font-size: 12px;
    text-align: left;
    margin-top: 4px;
  }

  /* Copyright column - make it relative for arrow positioning */
  #footer .footer-col:last-child {
    position: relative;
    padding-right: 50px;
    /* Space for arrow */
  }

  /* Hide the desktop SEE ABOUT in white panel bottom */
  #footer .white-panel .footer-panel-bottom {
    display: none;
  }

  /* Back to top trigger on mobile - positioned on same line as copyright */
  #footer .back-to-top-trigger {
    position: absolute;
    right: 20px;
    bottom: 20px;
    /* Align with the bottom of white panel content */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
  }

  /* Gentle jump animation every 5s */
  @keyframes jump-cycle {

    0%,
    90%,
    100% {
      transform: translateY(0);
    }

    92% {
      transform: translateY(-12px);
    }

    94% {
      transform: translateY(0);
    }

    96% {
      transform: translateY(-6px);
    }

    98% {
      transform: translateY(0);
    }
  }

  #footer .back-to-top-trigger svg {
    width: 32px;
    height: 32px;
    stroke: #000;
    animation: jump-cycle 5s infinite ease-out;
  }
}