/**
 * 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, #4cc3f0);
  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, #0a6fa3);
  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, #4cc3f0);
  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, #4cc3f0);
  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, #0a6fa3);
}

/* ─── 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, #0a6fa3), 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, #eef7fc);
  transition: background 0.2s ease;
}

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

/* ─── 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, #0a6fa3), 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(10, 111, 163, 0.25);
  border-top-color: var(--teal-600, #0a5a85);
}

@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(10, 111, 163, 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;
}

/* Shared product screenshot frame (problem + grant pillars) */
body.mg-public .home-showcase-visual {
  display: flex;
  min-width: 0;
}

body.mg-public .home-showcase-frame {
  position: relative;
  width: 100%;
  display: flex;
  padding: 6px;
  border-radius: 16px;
  background: linear-gradient(
    155deg,
    rgba(20, 184, 166, 0.14) 0%,
    rgba(10, 22, 40, 0.05) 42%,
    rgba(255, 255, 255, 0.92) 100%
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 10px 36px rgba(10, 22, 40, 0.1);
  transition:
    box-shadow 0.35s ease,
    transform 0.35s ease;
}

body.mg-public .home-showcase-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(13, 148, 136, 0.18);
}

body.mg-public .home-showcase-frame:hover {
  transform: translateY(-3px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 18px 48px rgba(10, 22, 40, 0.14);
}

body.mg-public .home-showcase-screenshot {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  border-radius: var(--radius-lg, 12px);
  border: 1px solid rgba(10, 22, 40, 0.08);
  box-shadow: 0 6px 20px rgba(10, 22, 40, 0.1);
  transition: box-shadow 0.35s ease;
}

body.mg-public .home-showcase-frame:hover .home-showcase-screenshot {
  box-shadow: 0 10px 28px rgba(10, 22, 40, 0.14);
}

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

@media (min-width: 992px) {
  body.mg-public .home-showcase-visual {
    align-self: stretch;
    height: 100%;
  }

  body.mg-public .home-showcase-frame {
    flex: 1;
    align-items: stretch;
    min-height: 0;
  }

  body.mg-public .home-showcase-screenshot {
    height: 100%;
    object-fit: contain;
    object-position: top center;
  }
}

@media (max-width: 991px) {
  body.mg-public .home-showcase-screenshot {
    height: auto;
    object-fit: contain;
    object-position: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.mg-public .home-showcase-frame,
  body.mg-public .home-showcase-screenshot {
    transition: none;
  }

  body.mg-public .home-showcase-frame:hover {
    transform: none;
  }
}

/* P4 — institutional card depth (less flat / generic) */
body.mg-public .home-feature-card,
body.mg-public .home-problem-card {
  border: 1px solid var(--border-light, #e8ecf0);
  box-shadow: var(--shadow-card, 0 4px 24px rgba(10, 22, 40, 0.08));
}

body.mg-public .btn-primary {
  font-weight: 600;
  letter-spacing: 0.01em;
}
