/* Dark default: deep gradient mesh, glass-friendly tokens, cyan/violet accents. Light: html[data-theme="light"] */

:root {
  --page-bg: #04060d;
  --surface: rgba(14, 20, 36, 0.68);
  --elevated: rgba(22, 30, 50, 0.52);
  --border: rgba(148, 163, 184, 0.16);
  --muted: #94a3b8;
  --cream: #e2e8f0;
  --detail-prose: #cbd5e1;
  --heading: #f8fafc;
  --btn-on-accent: #f8fafc;
  --checkbox-border: rgba(148, 163, 184, 0.38);
  --danger: #f87171;
  --alert: #fbbf24;
  --accent: #38bdf8;
  --accent-muted: #34d399;
  --accent-light: #7dd3fc;
  --tan: #fbbf24;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --bg: transparent;
  --card: rgba(14, 20, 36, 0.68);
  --line: rgba(148, 163, 184, 0.14);
  --ink: var(--cream);
  --green: var(--accent-muted);
  --amber: var(--tan);
  --gray: #64748b;
  --theme-cog-shadow: rgba(0, 0, 0, 0.55);
  --dark-green: var(--gray);
  --mid-green: var(--accent-muted);
  --light-green: var(--accent-light);
  --gold: var(--tan);
  --dark-gold: var(--tan);
  --warm-white: var(--surface);
  --warm-cream: var(--elevated);
}

html {
  min-height: 100%;
  background-color: var(--page-bg);
}

html[data-theme="dark"] {
  background-image: linear-gradient(
    168deg,
    #03050a 0%,
    #0a1022 38%,
    #060a14 72%,
    #04060d 100%
  );
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  box-shadow: none;
}

html[data-theme="dark"] body::before {
  background: radial-gradient(
      ellipse 95% 70% at 4% -8%,
      rgba(56, 189, 248, 0.24),
      transparent 58%
    ),
    radial-gradient(
      ellipse 80% 55% at 96% 4%,
      rgba(139, 92, 246, 0.18),
      transparent 54%
    ),
    radial-gradient(
      ellipse 60% 45% at 48% 102%,
      rgba(45, 212, 191, 0.12),
      transparent 58%
    ),
    linear-gradient(
      118deg,
      transparent 34%,
      rgba(255, 255, 255, 0.04) 47%,
      rgba(255, 255, 255, 0.1) 50%,
      rgba(255, 255, 255, 0.04) 53%,
      transparent 66%
    );
  background-size: 100% 100%, 100% 100%, 100% 100%, 260% 260%;
  background-position: 0 0, 0 0, 0 0, 12% 42%;
  animation: loh-ambient-shine 20s ease-in-out infinite;
  opacity: 0.97;
}

@keyframes loh-ambient-shine {
  0%,
  100% {
    background-position: 0 0, 0 0, 0 0, 8% 38%;
    opacity: 0.92;
  }
  50% {
    background-position: 6% 4%, -4% 2%, 0 -4%, 92% 62%;
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-theme="dark"] body::before {
    animation: none;
    background-position: 0 0, 0 0, 0 0, 50% 50%;
    opacity: 0.95;
  }
}

html[data-theme="light"] {
  background-image: none;
  --page-bg: #f6f8fa;
  --surface: #ffffff;
  --elevated: #eaeef2;
  --border: #d0d7de;
  --muted: #656d76;
  --cream: #1f2328;
  --detail-prose: #24292f;
  --heading: #1f2328;
  --btn-on-accent: #ffffff;
  --checkbox-border: #afb8c1;
  --danger: #cf222e;
  --alert: #bc4c00;
  --accent: #0969da;
  --accent-muted: #1a7f37;
  --accent-light: #0550ae;
  --tan: #9a6700;
  --bg: var(--page-bg);
  --card: var(--surface);
  --line: var(--border);
  --ink: var(--cream);
  --green: var(--accent-muted);
  --amber: var(--tan);
  --gray: #8c959f;
  --theme-cog-shadow: rgba(31, 35, 40, 0.12);
}

html[data-theme="light"] body::before {
  animation: none;
  opacity: 0;
  background: none;
}

/* Leave horizontal room for the fixed cog (project pages only) */
body:has(#lohThemeRoot) .wrap {
  padding-left: 56px;
}

/* Fixed settings cog + appearance menu (injected on project pages) */
#lohThemeRoot {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 100001;
  font-family: Inter, system-ui, sans-serif;
}
#lohThemeCog {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 0.5px solid var(--line);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 2px 12px var(--theme-cog-shadow);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

html[data-theme="dark"] #lohThemeCog {
  background: rgba(14, 20, 36, 0.62);
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
}
#lohThemeCog:hover {
  color: var(--accent-light);
  border-color: var(--accent);
  background: var(--elevated);
}
#lohThemeCog:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
#lohThemeCog svg {
  width: 20px;
  height: 20px;
  display: block;
}
#lohThemeMenu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 200px;
  padding: 10px 0;
  border-radius: 12px;
  border: 0.5px solid var(--line);
  background: var(--card);
  box-shadow: 0 12px 40px var(--theme-cog-shadow);
}

html[data-theme="dark"] #lohThemeMenu {
  background: rgba(14, 20, 36, 0.92);
  border-color: rgba(148, 163, 184, 0.2);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
#lohThemeMenu[hidden] {
  display: none !important;
}
.loh-theme-menu-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 14px 10px;
}
#lohThemeMenu button[data-set-theme] {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 16px;
  border: none;
  background: none;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--cream);
  cursor: pointer;
  transition: background 0.12s;
}
#lohThemeMenu button[data-set-theme]:hover {
  background: var(--elevated);
}
#lohThemeMenu button[data-set-theme].is-active {
  color: var(--accent-light);
  font-weight: 600;
}

/* Milestone status (Complete / In Progress / Pending) */
.ms-status-sel {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 999px;
  padding: 4px 10px;
  border: 0.5px solid var(--line);
  cursor: pointer;
  background: var(--elevated);
  color: var(--heading);
  font-family: Inter, system-ui, sans-serif;
}
.ms-status-sel:hover {
  border-color: var(--accent);
}
.ms-status-sel:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@supports (backdrop-filter: blur(12px)) {
  html[data-theme="dark"] .card {
    backdrop-filter: blur(18px) saturate(1.15);
    -webkit-backdrop-filter: blur(18px) saturate(1.15);
  }
}
