/**
 * FRONTEND PROMPT 7 — Final polish: page load, hovers, nav underline, focus, buttons.
 * Scoped to body.mg-public. Load after sovereign-navbar.css and sovereign-home-sections.css.
 */

@keyframes mg-page-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: no-preference) {
  body.mg-public {
    animation: mg-page-in 0.4s ease;
  }
}

/* ─── Focus (WCAG-friendly, teal) ─── */
body.mg-public *:focus-visible {
  outline: 2px solid var(--teal-400, #12c491);
  outline-offset: 3px;
  border-radius: 4px;
}

body.mg-public .btn:focus-visible,
body.mg-public .form-control:focus-visible,
body.mg-public .form-select:focus-visible {
  border-radius: var(--radius-md, 8px);
}

/* Skip link — public marketing (matches mg-skip-link hook in base) */
body.mg-public .mg-skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--teal-500, #0e9e76);
  color: #fff;
  padding: 8px 16px;
  border-radius: 0 0 8px 8px;
  font-weight: 600;
  text-decoration: none;
  z-index: 10001;
  transition: top 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 12px rgba(10, 22, 40, 0.15);
}

body.mg-public .mg-skip-link:focus {
  top: 0;
  outline: 2px solid var(--teal-400, #12c491);
  outline-offset: 3px;
}

/* ─── Navbar: teal underline on hover / active ─── */
body.mg-public #navbar .navbar-links .nav-link {
  position: relative;
}

body.mg-public #navbar .navbar-links .nav-link::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--teal-400, #12c491);
  transition: width 0.22s ease, left 0.22s ease;
  pointer-events: none;
}

body.mg-public #navbar .navbar-links .nav-link:hover::after,
body.mg-public #navbar .navbar-links .nav-link:focus-visible::after {
  width: calc(100% - 16px);
  left: 8px;
}

body.mg-public #navbar .navbar-links .nav-link.active::after {
  width: calc(100% - 16px);
  left: 8px;
  background: var(--teal-500, #0e9e76);
}

/* ─── Home feature cards ─── */
body.mg-public .home-feature-card {
  position: relative;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  box-shadow: inset 0 0 0 0 transparent;
}

body.mg-public .home-feature-card:hover {
  box-shadow: inset 4px 0 0 0 var(--teal-500, #0e9e76), var(--shadow-card, 0 4px 24px rgba(10, 22, 40, 0.08));
}

body.mg-public .home-feature-card .home-feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-md, 12px);
  background: var(--teal-50, #e8fbf5);
  transition: background 0.2s ease;
}

body.mg-public .home-feature-card:hover .home-feature-icon {
  background: var(--teal-100, #d0f5eb);
}

/* ─── Features page grant cards ─── */
body.mg-public .feat-grant-card {
  transition: box-shadow 0.2s ease;
}

body.mg-public .feat-grant-card:hover {
  box-shadow: inset 4px 0 0 0 var(--teal-500, #0e9e76), var(--shadow-card, 0 4px 24px rgba(10, 22, 40, 0.08));
}

/* ─── Buttons: loading + ripple target ─── */
body.mg-public .btn.is-loading,
body.mg-public .mg-proposal-submit.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

body.mg-public .btn.is-loading::after,
body.mg-public .mg-proposal-submit.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: mg-spin 0.65s linear infinite;
}

body.mg-public .btn-outline-primary.is-loading::after,
body.mg-public .btn-outline-white.is-loading::after {
  border-color: rgba(14, 158, 118, 0.25);
  border-top-color: var(--teal-600, #0a7a5c);
}

@keyframes mg-spin {
  to {
    transform: rotate(360deg);
  }
}

body.mg-public .btn.mg-ripple-host,
body.mg-public .mg-proposal-submit.mg-ripple-host {
  position: relative;
  overflow: hidden;
}

body.mg-public .mg-ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  animation: mg-ripple-anim 0.55s ease-out forwards;
  background: rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

body.mg-public .btn-outline-primary .mg-ripple,
body.mg-public .btn-outline-white .mg-ripple {
  background: rgba(14, 158, 118, 0.25);
}

@keyframes mg-ripple-anim {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ─── Home inline illustrations layout ─── */
body.mg-public .home-illustration {
  display: block;
  width: 100%;
  max-width: 400px;
  height: auto;
  margin-inline: auto;
}

body.mg-public .home-problem-visual {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: var(--dt-space-8, 2rem);
}

body.mg-public .home-pillar-visual--svg {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}

body.mg-public .home-problem-grid {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

@media (min-width: 992px) {
  body.mg-public .home-problem-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    /* Top-align: stretch made the illustration column as tall as the cards column,
       leaving a large empty band inside .home-problem (often read as “blank page”). */
    align-items: start;
  }

  body.mg-public .home-problem-visual {
    margin-top: 0;
    align-self: start;
    display: flex;
    flex-direction: column;
  }

  body.mg-public .home-problem-visual-slot {
    flex: 0 0 auto;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  body.mg-public .home-problem-visual-slot .home-illustration.home-illustration--city {
    display: block;
    width: 100%;
    max-width: min(100%, 560px);
    height: auto;
    aspect-ratio: 400 / 480;
    margin-inline: auto;
  }
}
