lune-site-footer { display: block; }

/* The homepage footer already receives this breathing room from the page's
   main container. Landing-page footers sit directly under body, so mirror the
   same desktop and mobile spacing here without doubling it on the homepage. */
body > lune-site-footer .site-footer { margin-bottom: 120px; }

.site-footer {
  width: min(calc(100% - 40px), 940px);
  max-width: 940px;
  margin: clamp(56px, 8vw, 88px) auto 0;
  padding: 24px 26px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    radial-gradient(circle at 10% 20%, rgba(100, 168, 255, 0.12), transparent 32%),
    radial-gradient(circle at 90% 80%, rgba(164, 123, 255, 0.12), transparent 34%),
    rgba(8, 17, 34, 0.72);
  box-shadow: var(--glow, 0 18px 50px rgba(74, 119, 255, 0.12));
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 22px;
  position: relative;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
}

html[data-theme="light"] .site-footer {
  background:
    radial-gradient(circle at 10% 20%, rgba(79, 132, 214, 0.1), transparent 32%),
    radial-gradient(circle at 90% 80%, rgba(127, 99, 214, 0.1), transparent 34%),
    rgba(255, 253, 250, 0.94);
  border-color: rgba(127, 99, 214, 0.2);
  box-shadow: 0 18px 30px rgba(151, 164, 192, 0.12), inset 0 0 0 1px rgba(255, 255, 255, 0.26);
}

.site-footer__identity {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.site-footer__mark {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 9px;
  object-fit: cover;
  box-shadow: 0 0 22px rgba(164, 123, 255, 0.26);
}

.site-footer__copy {
  display: grid;
  gap: 2px;
  line-height: 1.35;
}

.site-footer__copy strong {
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  letter-spacing: 0.03em;
}

.site-footer__copy span { color: var(--muted); }

.site-footer nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.site-footer nav a {
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.site-footer nav a:hover,
.site-footer nav a:focus-visible {
  color: var(--text);
  border-color: rgba(164, 123, 255, 0.24);
  background: rgba(164, 123, 255, 0.08);
}

.site-footer__directory {
  flex: 1 0 100%;
  display: grid;
  gap: 26px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(164, 123, 255, 0.14);
}

.site-footer__section + .site-footer__section {
  padding-top: 24px;
  border-top: 1px solid rgba(164, 123, 255, 0.1);
}

.site-footer__section h2,
.site-footer__section h3 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-sans);
}

.site-footer__section h2 { font-size: 18px; }
.site-footer__section h3 { font-size: 12px; }

.site-footer__link-groups {
  display: grid;
  gap: 24px;
  margin-top: 18px;
}

.site-footer__link-groups--subjects { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.site-footer__link-groups--tests,
.site-footer__link-groups--audiences { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.site-footer__link-groups nav {
  display: grid;
  align-content: start;
  justify-content: stretch;
  gap: 4px;
}

.site-footer__link-groups nav a { padding: 5px 10px; }

.site-footer__powered-by,
.site-footer__note {
  flex: 1 0 100%;
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid rgba(164, 123, 255, 0.14);
  color: var(--muted);
  line-height: 1.55;
  text-align: center;
}

.site-footer__powered-by strong {
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 700;
}

html[data-theme="light"] .site-footer__powered-by,
html[data-theme="light"] .site-footer__note { border-top-color: rgba(127, 99, 214, 0.14); }

@media (max-width: 640px) {
  .site-footer {
    width: min(calc(100% - 28px), 940px);
    justify-content: center;
    padding: 22px 20px;
    text-align: center;
  }

  .site-footer > * {
    width: 100%;
    min-width: 0;
    margin-right: 0;
    margin-left: 0;
  }

  .site-footer nav {
    justify-content: center;
    width: 100%;
  }

  .site-footer__section { text-align: left; }

  .site-footer__link-groups--subjects,
  .site-footer__link-groups--tests,
  .site-footer__link-groups--audiences {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .site-footer__link-groups nav {
    justify-content: stretch;
    text-align: left;
  }

  .site-footer__identity { justify-content: center; }
}

@media (max-width: 900px) {
  body > lune-site-footer .site-footer { margin-bottom: 96px; }
}
