/* ==========================================================================
   Dark Mode & Hero Layout Polish for MSUH Standalone Hero Landing
   Supports: [data-theme="dark"], body.dark-mode, and [data-theme="light"]
   ========================================================================== */

/* Keep header navigation centered when theme toggle button is present */
.site-header nav {
  margin-inline: auto;
}

@media (width <= 600px) {
  .site-header nav {
    margin-left: auto;
    margin-right: 14px;
  }
}

/* Clean bottom breathing room for standalone hero view */
.hero {
  padding-bottom: 28px;
}

/* Header Login link — plain nav-link typography matching "Meet the blobs" & "How it works" */
.header-login {
  color: #656778;
  font-size: 15px;
  white-space: nowrap;
  padding: 6px 2px;
  transition: color 0.2s;
}

.header-login:hover {
  color: var(--blue);
}

@media (width <= 800px) {
  .header-login {
    font-size: 12px;
  }
}

@media (width <= 600px) {
  .header-login {
    font-size: 11px;
  }
}

/* Theme Variables */
:root[data-theme="dark"],
body.dark-mode {
  color-scheme: dark;
  --paper: #0c0e14;
  --line: rgba(255, 255, 255, 0.09);
  --muted: #9499ad;
  --bg-main: #0c0e14;
  --bg-surface: #141722;
  --bg-surface-glass: rgba(22, 26, 38, 0.72);
  --bg-card: rgba(26, 30, 44, 0.75);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(255, 255, 255, 0.16);
  --text-primary: #f2f4f8;
  --text-secondary: #9499ad;
  --text-muted: #676c82;
  --accent: #5e91ff;
  --accent-soft: rgba(94, 145, 255, 0.15);
  background-color: #0c0e14;
  color: #f2f4f8;
}

:root[data-theme="light"] {
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0c0e14;
    --line: rgba(255, 255, 255, 0.09);
    --muted: #9499ad;
    background-color: #0c0e14;
    color: #f2f4f8;
  }
}

/* Base Body */
:root[data-theme="dark"] body,
body.dark-mode {
  background-color: #0c0e14;
  color: #f2f4f8;
}

/* Header & Brand */
:root[data-theme="dark"] .brand,
body.dark-mode .brand {
  color: #ffffff;
}

:root[data-theme="dark"] .site-header nav a,
:root[data-theme="dark"] .header-login,
body.dark-mode .site-header nav a,
body.dark-mode .header-login {
  color: #9499ad;
}

:root[data-theme="dark"] .site-header nav a:hover,
:root[data-theme="dark"] .header-login:hover,
body.dark-mode .site-header nav a:hover,
body.dark-mode .header-login:hover {
  color: #ffffff;
}

/* Hero Aurora & Stage Floor */
:root[data-theme="dark"] .hb i,
body.dark-mode .hb i {
  opacity: 0.34;
}

:root[data-theme="dark"] .hb:after,
body.dark-mode .hb:after {
  background: linear-gradient(
    180deg,
    #0c0e14 0%,
    rgba(12, 14, 20, 0) 11%,
    rgba(12, 14, 20, 0) 66%,
    rgba(12, 14, 20, 0.6) 80%,
    rgba(12, 14, 20, 0.88) 90%,
    #0c0e14 97%,
    #0c0e14 100%
  );
}

:root[data-theme="dark"] .hx-floor,
:root[data-theme="dark"] .hero:has(> .hb) .hx-floor,
body.dark-mode .hx-floor,
body.dark-mode .hero:has(> .hb) .hx-floor {
  background:
    linear-gradient(
      180deg,
      rgba(12, 14, 20, 0) 0%,
      rgba(12, 14, 20, 0) 38%,
      rgba(12, 14, 20, 0.6) 62%,
      rgba(12, 14, 20, 0.9) 80%,
      #0c0e14 90%,
      #0c0e14 100%
    ),
    radial-gradient(40% 36% at 50% 54%, rgba(94, 145, 255, 0.11), rgba(94, 145, 255, 0) 72%);
}

/* Horizon line repositioned to character ground plane; softened so it grounds rather than slices */
:root[data-theme="dark"] .hx-floor:before,
body.dark-mode .hx-floor:before {
  background: linear-gradient(
    90deg,
    transparent 4%,
    rgba(94, 120, 200, 0.07) 20%,
    rgba(140, 165, 220, 0.18) 40% 60%,
    rgba(94, 120, 200, 0.07) 80%,
    transparent 96%
  );
  filter: blur(2px);
}

/* Character reflections: smooth dissolve well before the clip boundary */
:root[data-theme="dark"] .hx-mirror,
body.dark-mode .hx-mirror {
  opacity: 0.1;
  filter: blur(2.5px);
  -webkit-mask-image: linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.72) 0px,
    rgba(0, 0, 0, 0.3) 10px,
    rgba(0, 0, 0, 0.07) 22px,
    transparent 32px
  );
  mask-image: linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.72) 0px,
    rgba(0, 0, 0, 0.3) 10px,
    rgba(0, 0, 0, 0.07) 22px,
    transparent 32px
  );
}

:root[data-theme="dark"] .hx-shadow,
body.dark-mode .hx-shadow {
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.65), transparent);
}

/* Hero Copy & Footer Line */
:root[data-theme="dark"] .hero-copy h1,
body.dark-mode .hero-copy h1 {
  color: #ffffff;
}

:root[data-theme="dark"] .hero-copy > p,
body.dark-mode .hero-copy > p {
  color: #9da3ba;
}

:root[data-theme="dark"] .hero-foot,
body.dark-mode .hero-foot {
  color: #8b90a6;
}

:root[data-theme="dark"] .hero-foot a,
body.dark-mode .hero-foot a {
  color: #cbd2e8;
}

:root[data-theme="dark"] .hero-foot a:hover,
body.dark-mode .hero-foot a:hover {
  color: #ffffff;
}

/* Character Name Pills */
:root[data-theme="dark"] .hx-pill,
body.dark-mode .hx-pill {
  color: #f2f4f8;
  background: linear-gradient(170deg, rgba(28, 33, 48, 0.92), rgba(18, 22, 34, 0.88));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    0 6px 20px -6px rgba(0, 0, 0, 0.65);
}

:root[data-theme="dark"] .hx-pill small,
body.dark-mode .hx-pill small {
  color: #969db5;
}

:root[data-theme="dark"] .hx-status,
body.dark-mode .hx-status {
  color: #78a5ff;
}

:root[data-theme="dark"] .hx-item.is-open .hx-pill,
body.dark-mode .hx-item.is-open .hx-pill {
  box-shadow:
    inset 0 0 0 1px rgba(130, 175, 255, 0.55),
    0 0 0 4px rgba(120, 165, 255, 0.15),
    0 10px 28px -8px rgba(30, 64, 160, 0.65);
}

/* Quick-Start 3-Step Bar (#how) — Dark Mode */
:root[data-theme="dark"] .quick-start,
body.dark-mode .quick-start {
  background: linear-gradient(
    180deg,
    rgba(22, 26, 40, 0.84) 0%,
    rgba(16, 19, 30, 0.78) 100%
  );
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 20px 48px -24px rgba(0, 0, 0, 0.6);
}

:root[data-theme="dark"] .step + .step,
body.dark-mode .step + .step {
  border-color: rgba(255, 255, 255, 0.07);
}

:root[data-theme="dark"] .step:hover,
body.dark-mode .step:hover {
  background: rgba(255, 255, 255, 0.04);
}

:root[data-theme="dark"] .step-icon,
body.dark-mode .step-icon {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.09);
  color: #c8cfea;
  transition: background 0.22s, border-color 0.22s, color 0.22s, transform 0.22s, box-shadow 0.22s;
}

:root[data-theme="dark"] .step:hover .step-icon,
body.dark-mode .step:hover .step-icon {
  background: rgba(94, 145, 255, 0.14);
  border-color: rgba(94, 145, 255, 0.3);
  color: #a8c0ff;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -8px rgba(94, 145, 255, 0.35);
}

:root[data-theme="dark"] .step:hover .step-arrow,
body.dark-mode .step:hover .step-arrow {
  color: #7ba8ff;
}

:root[data-theme="dark"] .step-copy strong,
body.dark-mode .step-copy strong {
  color: #ffffff;
}

:root[data-theme="dark"] .step-copy > span,
body.dark-mode .step-copy > span {
  color: #9499ad;
}

:root[data-theme="dark"] .step-copy small,
body.dark-mode .step-copy small {
  color: #6b7188;
}

/* Section Rule */
:root[data-theme="dark"] .section-rule,
body.dark-mode .section-rule {
  color: #676c82;
}

:root[data-theme="dark"] .section-rule > span:first-child:before,
body.dark-mode .section-rule > span:first-child:before {
  background: rgba(255, 255, 255, 0.22);
}

/* Swarm Builder Placeholders in Dark Mode */
:root[data-theme="dark"] .sw-ph,
body.dark-mode .sw-ph {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0.11) 40%,
    rgba(255, 255, 255, 0.05) 80%
  ) 0 0 / 250% 100%;
}

:root[data-theme="dark"] .sw-ghost,
body.dark-mode .sw-ghost {
  background: color-mix(in srgb, var(--c) 14%, rgba(20, 24, 36, 0.65));
}

:root[data-theme="dark"] .sw-box i,
body.dark-mode .sw-box i {
  background: #141724;
}

/* Buttons in Dark Mode */
:root[data-theme="dark"] .button.dark,
body.dark-mode .button.dark {
  background: #ffffff;
  color: #0c0e14;
  box-shadow: 0 4px 16px rgba(255, 255, 255, 0.14);
}

:root[data-theme="dark"] .button.dark:hover,
body.dark-mode .button.dark:hover {
  background: #e6e9f2;
  box-shadow: 0 6px 22px rgba(255, 255, 255, 0.22);
}

:root[data-theme="dark"] .button.quiet,
body.dark-mode .button.quiet {
  background: rgba(255, 255, 255, 0.07);
  color: #f2f4f8;
  border-color: rgba(255, 255, 255, 0.12);
}

:root[data-theme="dark"] .button.quiet:hover,
body.dark-mode .button.quiet:hover {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.22);
}

/* Download Modal Dialog */
:root[data-theme="dark"] dialog,
body.dark-mode dialog {
  background: #141724;
  color: #f2f4f8;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.75);
}

:root[data-theme="dark"] dialog::backdrop,
body.dark-mode dialog::backdrop {
  background: rgba(6, 8, 14, 0.68);
}

:root[data-theme="dark"] dialog h2,
body.dark-mode dialog h2 {
  color: #ffffff;
}

:root[data-theme="dark"] dialog > p:not(.eyebrow),
body.dark-mode dialog > p:not(.eyebrow) {
  color: #9da3ba;
}

:root[data-theme="dark"] dialog .eyebrow,
body.dark-mode dialog .eyebrow {
  color: #7d84a3;
}

:root[data-theme="dark"] .dialog-close,
body.dark-mode .dialog-close {
  color: #9499ad;
}

:root[data-theme="dark"] .dialog-close:hover,
body.dark-mode .dialog-close:hover {
  color: #ffffff;
}

:root[data-theme="dark"] .dialog-note,
body.dark-mode .dialog-note {
  color: #6e748a;
}

/* Interactive Header Theme Toggle Pill */
.dark-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.85);
  color: #141724;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 9999px;
  min-height: 42px;
  padding: 0 15px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  user-select: none;
  flex-shrink: 0;
}

.dark-mode-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.11);
}

:root[data-theme="dark"] .dark-mode-toggle,
body.dark-mode .dark-mode-toggle {
  background: rgba(28, 32, 46, 0.88);
  color: #f2f4f8;
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

:root[data-theme="dark"] .dark-mode-toggle:hover,
body.dark-mode .dark-mode-toggle:hover {
  background: rgba(38, 43, 62, 0.95);
  border-color: rgba(255, 255, 255, 0.24);
}

@media (width <= 800px) {
  .dark-mode-toggle {
    min-height: 40px;
    padding: 0 12px;
    font-size: 12px;
  }
}

@media (width <= 600px) {
  .dark-mode-toggle {
    gap: 0;
    width: 38px;
    min-height: 38px;
    padding: 0;
    justify-content: center;
  }
  .dark-mode-toggle span:last-child {
    display: none;
  }
}
