/* footer.css */

/* Base footer */
.site-footer {
  border-top: 1px solid rgba(0,0,0,0.08);
  background: #fff;
  padding: 16px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  justify-content: space-between;
  font-size: 14px;
}

/* Fixed footer (enabled by JS adding .site-footer--fixed) */
.site-footer--fixed {
  position: fixed !important;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  z-index: 999; /* below overlays (which use 10000) */
  background: rgba(255,255,255,0.98);
  backdrop-filter: saturate(120%) blur(6px);
  box-shadow: 0 -8px 16px rgba(0,0,0,0.08);
  max-height: 50px;
}

/* Reserve space so content can scroll behind the fixed footer */
body.has-fixed-footer {
  padding-bottom: calc(var(--mobile-footer-h, 64px) + env(safe-area-inset-bottom));
}

.footer-nav {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.footer-link {
  color: #0b63f6;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
}

.footer-link:hover,
.footer-link:focus {
  text-decoration: underline;
  outline: none;
}

.dot {
  color: #8a8a8a;
  user-select: none;
}

.footer-meta {
  color: #6b7280;
}

/* Reusable info wall (overlay) */
.info-wall {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}

.info-wall.show {
  opacity: 1;
  visibility: visible;
}

/* Wall content container */
.info-wall__panel {
  width: min(720px, 100%);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.16);
  overflow: hidden;
}

.info-wall__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.info-wall__title {
  margin: 0;
  font-size: 18px;
}

.info-wall__close {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #444;
}

.info-wall__body {
  padding: 18px;
  max-height: 70vh;
  overflow: auto;
}

/* Basic content styles inside body */
.info-wall__body h3 {
  margin: 0 0 10px;
}

.info-wall__body p {
  margin: 0 0 12px;
  line-height: 1.5;
}

.info-wall__body ul {
  margin: 0 0 12px 18px;
}

/* =========================
   Mobile enhancements
   ========================= */
@media (max-width: 640px) {
  .site-footer {
    padding: 14px 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    font-size: 13px;
  }

  .footer-nav {
    width: 100%;
    justify-content: center;
    gap: 10px;
  }

  /* Better tap targets on mobile */
  .footer-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    line-height: 1.2;
    border-radius: 8px;
    text-decoration: none; /* keep clean by default */
  }

  .footer-link:active {
    opacity: 0.8;
  }

  /* Hide the dot separators when links wrap to new lines */
  .dot {
    display: none;
  }

  .footer-meta {
    width: 100%;
    text-align: center;
    font-size: 12px;
  }

  /* Info wall: tighter padding on small screens */
  .info-wall {
    padding: 12px;
  }

  .info-wall__panel {
    width: 100%;
    max-width: 560px;
    max-height: 88vh;
    border-radius: 12px;
  }

  .info-wall__header {
    padding: 14px 16px;
  }

  .info-wall__title {
    font-size: 17px;
  }

  .info-wall__close {
    font-size: 22px;
  }

  .info-wall__body {
    padding: 14px 16px;
    max-height: calc(88vh - 56px); /* header space accounted for */
  }
}

/* Ultra-small devices (≤ 360px) */
@media (max-width: 360px) {
  .site-footer {
    font-size: 2px;
  }

  .footer-link {
    padding: 7px 8px;
    font-size: 2.5px;
  }
}

/* Turn off the fixed behavior on wider screens */
@media (min-width: 641px) {
  .site-footer--fixed {
    position: static !important;
    box-shadow: none;
    backdrop-filter: none;
  }
  body.has-fixed-footer {
    padding-bottom: 0;
  }
  .footer-link {
    padding: 7px 8px;
    font-size: 12.5px;
  }
}

/* Respect users who prefer less motion */
@media (prefers-reduced-motion: reduce) {
  .info-wall {
    transition: none;
  }
}

/* iOS safe-area support (e.g., devices with home indicator) */
@supports (padding: max(0px)) {
  @media (max-width: 640px) {
    .site-footer--fixed {
      padding-bottom: max(4px, env(safe-area-inset-bottom));
      padding-left: max(16px, env(safe-area-inset-left));
      padding-right: max(16px, env(safe-area-inset-right));
    }
    .footer-link {
    padding: 7px 8px;
    font-size: 12.5px;
  }
  }

  .info-wall {
    padding: max(12px, env(safe-area-inset-top))
             max(12px, env(safe-area-inset-right))
             max(12px, env(safe-area-inset-bottom))
             max(12px, env(safe-area-inset-left));
  }
}
