/* ==========================================================================
   style-footer.css
   Single source of truth for the site footer, loaded LAST on every page so
   it owns the cascade for footer components. Rides on the locked theme
   variables (--surface / --text / --accent / --surface-rgb / --text-rgb)
   from style-theme-fix.css — it does NOT introduce any new colors.
   ========================================================================== */

/* --------------------------------------------------------------------------
   0) Global overflow guard
   Decorative hero shapes extend past the viewport on small screens. Clip at
   both html and body level (clip — not hidden — so sticky headers, the admin
   sticky table head and position:sticky sidebars keep working).
   -------------------------------------------------------------------------- */
html,
body { overflow-x: clip; }

/* --------------------------------------------------------------------------
   1) Shell — layered panel with soft depth and a faint gold glow at the top
   -------------------------------------------------------------------------- */
.site-footer {
  position: relative;
  margin-top: 56px;
  padding: 0 !important;
  background:
    radial-gradient(900px 320px at 12% -60px, rgba(var(--text-rgb), 0.06), transparent 65%),
    radial-gradient(700px 280px at 88% -40px, rgba(var(--surface-rgb), 0.10), transparent 60%),
    var(--surface) !important;
  color: var(--text) !important;
  border-top: 0 !important;
  overflow: hidden;
  box-shadow: 0 -18px 60px -30px rgba(var(--text-rgb), 0.28);
}

/* Hairline gold accent running across the very top of the footer,
   with a slow shimmer sweep. */
.footer-accent-line {
  position: relative;
  height: 3px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--accent) 16%,
    var(--accent) 84%,
    transparent 100%);
  opacity: 0.9;
  overflow: hidden;
}

.footer-accent-line::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 140px;
  background: linear-gradient(90deg,
    transparent,
    rgba(var(--surface-rgb), 0.85),
    transparent);
  transform: translateX(-160px);
  animation: footer-line-sweep 4.5s ease-in-out infinite;
}

@keyframes footer-line-sweep {
  0%   { transform: translateX(-160px); }
  60%  { transform: translateX(calc(100vw + 160px)); }
  100% { transform: translateX(calc(100vw + 160px)); }
}

body.dark-theme .footer-accent-line { opacity: 0.8; }

/* Large soft watermark ring behind the brand column for visual depth. */
.footer-grid { position: relative; z-index: 1; }
.site-footer::before {
  content: "";
  position: absolute;
  left: -140px;
  top: -120px;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  border: 1px solid rgba(var(--text-rgb), 0.08);
  pointer-events: none;
}
.site-footer::after {
  content: "";
  position: absolute;
  right: -160px;
  bottom: -180px;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  border: 1px solid rgba(var(--text-rgb), 0.07);
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   2) Grid layout (brand / explore / company / connect)
   -------------------------------------------------------------------------- */
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr));
  gap: 40px 32px;
  padding: 56px 0 40px;
  align-items: start;
}

.footer-col { min-width: 0; }

/* Brand column */
.footer-brand {
  display: inline-flex;
  align-items: center;
  margin-bottom: 16px;
  text-decoration: none;
}
.footer-logo {
  height: 56px !important;
  width: auto !important;
  max-width: 180px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 6px 18px rgba(var(--text-rgb), 0.18));
  transition: transform 220ms ease, filter 220ms ease;
}
.footer-brand:hover .footer-logo {
  transform: translateY(-2px) scale(1.02);
  filter: drop-shadow(0 10px 24px rgba(var(--accent), 0.35));
}
body.dark-theme .footer-logo {
  filter: brightness(0) invert(1) drop-shadow(0 6px 18px rgba(0, 0, 0, 0.4));
}

.footer-brand-title {
  margin: 0;
  font-family: var(--font-display, 'Plus Jakarta Sans', sans-serif);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text) !important;
}
.footer-brand-sub {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--accent) !important;
}
.footer-brand-copy {
  margin: 14px 0 0;
  font-size: 13.5px;
  line-height: 1.65;
  max-width: 36ch;
  opacity: 0.86;
}

/* A small gold tick under the brand sub line. */
.footer-brand-col { position: relative; }

/* Link columns */
.footer-col-title {
  margin: 0 0 16px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text) !important;
  opacity: 0.6;
  position: relative;
  padding-bottom: 8px;
}
.footer-col-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 26px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.85;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.footer-links a {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 7px 0;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text) !important;
  opacity: 0.82;
  transition: opacity 160ms ease, transform 160ms ease;
}
.footer-links a::before {
  content: "";
  width: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  position: absolute;
  left: 0;
  bottom: 2px;
  opacity: 0;
  transition: width 200ms ease, opacity 200ms ease;
}
.footer-links a:hover {
  opacity: 1;
  transform: translateX(3px);
}
.footer-links a:hover::before { width: 18px; opacity: 1; }

/* Social row */
.footer-social {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.footer-social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(var(--surface-rgb), 0.10) !important;
  border: 1px solid rgba(var(--text-rgb), 0.14) !important;
  color: var(--text) !important;
  text-decoration: none;
  transition: transform 180ms ease, background 180ms ease,
    border-color 180ms ease, box-shadow 180ms ease;
}
.footer-social-link svg { width: 20px; height: 20px; flex-shrink: 0; }
.footer-social-link:hover {
  transform: translateY(-3px);
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  box-shadow: 0 12px 26px -10px rgba(var(--text-rgb), 0.5),
    0 0 0 4px rgba(var(--surface-rgb), 0.35);
}
.footer-social-link:hover svg { stroke: #0D3444 !important; fill: #0D3444 !important; }

/* --------------------------------------------------------------------------
   3) Bottom bar
   -------------------------------------------------------------------------- */
.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
  padding: 18px 0 24px;
  border-top: 1px solid transparent;
  border-image: linear-gradient(90deg,
      transparent,
      rgba(var(--text-rgb), 0.22) 18%,
      rgba(var(--text-rgb), 0.22) 82%,
      transparent) 1;
}
.footer-copy {
  margin: 0 !important;
  padding-top: 0 !important;
  border-top: none !important;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.9;
}
.footer-copy #year { color: var(--accent); font-weight: 800; }
.footer-legal-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  max-width: 62ch;
  opacity: 0.68;
}

/* --------------------------------------------------------------------------
   4) Back-to-top button (injected by script-modern.js on every page)
   -------------------------------------------------------------------------- */
.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1px solid rgba(var(--accent), 0.55);
  background: linear-gradient(160deg,
      rgba(var(--surface-rgb), 0.95),
      rgba(var(--surface-rgb), 0.75));
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 14px 30px -12px rgba(var(--text-rgb), 0.42),
    0 0 0 0 rgba(var(--accent), 0.35);
  opacity: 0;
  transform: translateY(14px) scale(0.9);
  pointer-events: none;
  transition: opacity 200ms ease, transform 220ms cubic-bezier(.2,.9,.3,1),
    box-shadow 200ms ease, background 200ms ease, color 200ms ease;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.back-to-top svg { width: 22px; height: 22px; display: block; }

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 18px 36px -12px rgba(var(--text-rgb), 0.5),
    0 0 0 6px rgba(var(--accent), 0.18);
  animation: none;
}

body.dark-theme .back-to-top {
  background: linear-gradient(160deg, #123e50, #0b2b37);
  color: var(--accent);
  border-color: rgba(var(--accent), 0.6);
}
body.dark-theme .back-to-top:hover {
  color: #0D3444;
}
body.dark-theme .back-to-top:hover svg { stroke: #0D3444 !important; }

.back-to-top:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(var(--accent), 0.35),
    0 18px 36px -12px rgba(var(--text-rgb), 0.5);
}

/* Gently pulse the ring so it reads as "interactive". */
@keyframes back-to-top-pulse {
  0%, 100% { box-shadow: 0 14px 30px -12px rgba(var(--text-rgb), 0.42), 0 0 0 0 rgba(var(--accent), 0.22); }
  50%      { box-shadow: 0 14px 30px -12px rgba(var(--text-rgb), 0.42), 0 0 0 8px rgba(var(--accent), 0.06); }
}
.back-to-top.visible { animation: back-to-top-pulse 2.8s ease-in-out infinite; }

@media (max-width: 560px) {
  .back-to-top { right: 14px; bottom: 14px; width: 44px; height: 44px; }
  .back-to-top svg { width: 20px; height: 20px; }
}

/* --------------------------------------------------------------------------
   5) Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1020px) {
  .footer-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 32px 28px;
    padding: 44px 0 32px;
  }
  .footer-brand-col { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .site-footer { margin-top: 40px; }
  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    padding: 36px 0 26px;
  }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
  .footer-logo { height: 46px !important; }
  .footer-col-title::after { width: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .footer-links a,
  .footer-social-link,
  .footer-logo,
  .back-to-top { transition: none; }
  .footer-accent-line::after,
  .back-to-top.visible { animation: none; }
}
