/* Theme tokens populated by assets/theme.js. */
:root {
  color-scheme: light dark;
  --bg: #0f172a;
  --bg-alt: #0b1220;
  --panel: #1e293b;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-soft: #cbd5e1;
  --text-bright: #f8fafc;
  --text-inverted: #0f172a;
  --muted: var(--text-muted);
  --accent: #22c55e;
  --accent-strong: #16a34a;
  --accent-soft: #4ade80;
  --accent-highlight: #a7f3d0;
  --accent-secondary: #0ea5e9;
  --accent-contrast: #0f172a;
  --highlight: #bef264;
  --danger: #ef4444;
  --danger-soft: #f87171;
  --surface: #ffffff;
  --overlay: #0f172a;
  --shadow: #000000;
  --bg-rgb: 15, 23, 42;
  --accent-rgb: 34, 197, 94;
  --accent-secondary-rgb: 14, 165, 233;
  --highlight-rgb: 190, 242, 100;
  --surface-rgb: 255, 255, 255;
  --overlay-rgb: 15, 23, 42;
  --shadow-rgb: 0, 0, 0;
}

/* Color scheme hints for OS-level form controls. */
:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

/* Global box-sizing reset. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Base page layout shared across public and GM pages. */
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header layout used on GM tools and some public pages. */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-header h1 {
  margin: 0;
}

.page-header .home-link {
  margin-bottom: 0;
}

/* Collapsible menu button used across template pages. */
.menu-toggle {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  background: rgba(var(--surface-rgb), 0.08);
  border: 1px solid rgba(var(--surface-rgb), 0.2);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.menu-toggle:hover {
  background: rgba(var(--surface-rgb), 0.12);
}

.menu-icon {
  width: 18px;
  height: 2px;
  background: currentColor;
  position: relative;
  border-radius: 999px;
}

.menu-icon::before,
.menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 999px;
}

.menu-icon::before {
  top: -6px;
}

.menu-icon::after {
  top: 6px;
}

/* Screen-reader-only utility class. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.menu-wrapper {
  position: relative;
}

/* Menu popover styling for nested navigation. */
.menu {
  position: absolute;
  top: 48px;
  left: 0;
  min-width: 220px;
  background: var(--bg-alt);
  border: 1px solid rgba(var(--surface-rgb), 0.1);
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 24px 60px rgba(var(--shadow-rgb), 0.45);
  z-index: 20;
}

.menu[hidden] {
  display: none;
}

/* Menu list styles inside the popover. */
.menu-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 4px;
}

.menu-list a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.menu-list a:hover {
  background: rgba(var(--surface-rgb), 0.08);
}

/* Stale data indicator for timestamps. */
.meta.is-stale,
.timestamp.is-stale {
  color: var(--danger);
}

/* Link base color to match theme highlight. */
a {
  color: var(--accent-highlight);
}

/* Normalize typography for interactive controls. */
button,
input,
select,
textarea {
  font: inherit;
}

/* Footer container injected by theme.js when needed. */
.site-footer {
  margin-top: auto;
  padding: 20px 24px;
  border-top: 1px solid rgba(var(--surface-rgb), 0.12);
  background: rgba(var(--surface-rgb), 0.04);
}

.site-footer .footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer-text {
  color: var(--text-muted);
  /* Designed by Tostig.The.DM. All rights reserved. */
  font-size: 0.75rem;
}

.site-footer .footer-links {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
}

.site-footer .footer-links a {
  color: var(--text-soft);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.site-footer .footer-links a:hover {
  color: var(--accent-soft);
}

.footer-watermark {
  width: 150px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(var(--surface-rgb), 0.2);
  border-radius: 8px;
  background: rgba(var(--surface-rgb), 0.08);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  overflow: hidden;
}

.footer-watermark img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.footer-watermark.empty {
  opacity: 0.65;
}
