/* AiMusica palette: neutral charcoal surfaces with the requested orange accents. */
html[data-theme="dark"] {
  color-scheme: dark;
  --am-bg: #0B0B0D;
  --am-bg-2: #171719;
  --am-surface: #171719;
  --am-surface-2: #242428;
  --am-surface-3: #242428;
  --am-text: #FFFFFF;
  --am-text-soft: #A1A1AA;
  --am-muted: #A1A1AA;
  --am-on-accent: #0B0B0D;
  --am-orange: #FF7900;
  --am-orange-strong: #FF9A24;
  --am-orange-deep: #FF7900;
  --am-orange-highlight: #FFB347;
  --am-orange-soft: rgba(255, 121, 0, .12);
  --am-line: #333337;
  --am-line-strong: #333337;
  --am-line-orange: rgba(255, 121, 0, .3);
  --am-gradient: linear-gradient(105deg, #FF7900, #FF9500);
  --card: var(--am-surface);
  --card-strong: var(--am-surface-2);
  --line: var(--am-line);
  --line-strong: var(--am-line-strong);
  --hairline-input: var(--am-line);
  --hairline-table: var(--am-line);
  --accent-cool: var(--am-orange);
  --accent-cool-soft: var(--am-orange-soft);
  --success-soft: rgba(255, 121, 0, .1);
  scrollbar-color: #333337 #0B0B0D;
}

html[data-theme="dark"] body {
  background: var(--am-bg) !important;
}
html[data-theme="dark"] body::before,
html[data-theme="dark"] body::after {
  background: none !important;
  box-shadow: none !important;
}

html[data-theme="dark"] ::selection {
  color: var(--am-on-accent);
  background: #FFB347;
}

html[data-theme="dark"] :is(button, a, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 2px solid #FFB347 !important;
  outline-offset: 4px;
}

html[data-theme="dark"] .theme-toggle { display: none !important; }
html[data-theme="dark"] .status-pill.is-idle {
  color: #FFB347 !important;
  background: #242428 !important;
  border-color: var(--am-line-orange) !important;
}

/* Native controls should remain legible even before a page's UI enhancement runs. */
html[data-theme="dark"] :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]):not([type="submit"]):not([type="button"]), textarea, select) {
  color: var(--am-text);
  background-color: var(--am-surface-2);
  border-color: var(--am-line-strong);
  caret-color: var(--am-orange);
}
html[data-theme="dark"] :is(input, textarea)::placeholder { color: #A1A1AA; opacity: 1; }
html[data-theme="dark"] select option { background: #242428; color: #FFFFFF; }
html[data-theme="dark"] :is(input[type="checkbox"], input[type="radio"], input[type="range"]) { accent-color: #FF7900; }
html[data-theme="dark"] input:-webkit-autofill {
  -webkit-text-fill-color: #FFFFFF;
  caret-color: #FF7900;
  -webkit-box-shadow: 0 0 0 100px #242428 inset;
}

/* Shared navigation, mobile menu, and footer. */
html[data-theme="dark"] :is(.top-nav, .mobile-brand-header, .mobile-menu-panel, .mobile-bottom-nav) {
  color: var(--am-text);
  border-color: var(--am-line) !important;
}
html[data-theme="dark"] :is(.mobile-menu-panel, .mobile-bottom-nav) {
  background: #171719 !important;
  box-shadow: 0 12px 36px #0007 !important;
}
html[data-theme="dark"] :is(.top-nav-link, .mobile-menu-link, .mobile-bottom-nav-item) { color: var(--am-text-soft) !important; }
html[data-theme="dark"] :is(.top-nav-link, .mobile-menu-link, .mobile-bottom-nav-item):is(.active, .is-active, [aria-current="page"]) {
  color: #FF9A24 !important;
  background-color: var(--am-orange-soft) !important;
}
html[data-theme="dark"] :is(.mobile-menu-toggle, .mobile-menu-close, .mobile-brand-header-search) {
  color: var(--am-text) !important;
  min-width: 44px;
  min-height: 44px;
}
html[data-theme="dark"] .site-footer-panel {
  color: var(--am-text-soft);
  background: #171719 !important;
  border-color: var(--am-line) !important;
}
html[data-theme="dark"] :is(.site-footer-description, .site-footer-copy, .site-footer-note, .site-footer-links a, .site-footer-support-email) { color: var(--am-muted) !important; }
html[data-theme="dark"] .site-footer a:hover { color: #FF9A24 !important; }

html[data-theme="dark"] :is(.top-nav-brand-image, .mobile-brand-header-logo, .site-footer-logo, .gd-brand img, .gd-sidebar-head img, .gd-footer-brand img) {
  content: url("/aimusica-logo-dark.svg");
  filter: none !important;
}
html[data-theme="dark"] .site-footer .site-footer-panel { padding: 24px 20px !important; }
html[data-theme="dark"] .site-footer .site-footer-link-list {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 6px !important;
  padding-top: 0;
  min-width: 0;
}
html[data-theme="dark"] .site-footer :is(.site-footer-grid, .site-footer-section) { min-width: 0; }
html[data-theme="dark"] .site-footer :is(.site-footer-explore, .site-footer-legal) {
  border: 0 !important;
}
html[data-theme="dark"] .site-footer :is(.site-footer-explore, .site-footer-legal) .site-footer-section-title::after {
  display: none !important;
}
html[data-theme="dark"] .site-footer .site-footer-legal-dot { display: none; }
html[data-theme="dark"] .site-footer :is(.site-footer-explore-link, .site-footer-legal-link, .site-footer-support) {
  font-size: 13px !important;
  line-height: 1.6 !important;
  padding-block: 6px;
  white-space: normal !important;
  overflow-wrap: anywhere;
}
html[data-theme="dark"] .site-footer .site-footer-section-title { font-size: 14px !important; margin-bottom: 12px; }
html[data-theme="dark"] .site-footer :is(.site-footer-support-email, .site-footer-copyright) { font-size: 12px !important; line-height: 1.6; }

/* Consent is part of every page; avoid the inherited white-on-orange label. */
html[data-theme="dark"] .legal-consent-banner .legal-consent-accept-all {
  background: var(--am-gradient) !important;
  color: var(--am-on-accent) !important;
  font-weight: 700;
}
html[data-theme="dark"] .legal-consent-banner .legal-consent-essential {
  color: var(--am-text-soft) !important;
  background: #242428 !important;
  border-color: var(--am-line-strong) !important;
}
html[data-theme="dark"] .legal-consent-banner :is(button, a) { min-height: 44px; }

/* The primary action uses the same palette on every page, including admin. */
html[data-theme="dark"] .primary-button {
  background: var(--am-gradient) !important;
  color: var(--am-on-accent) !important;
  border-color: transparent !important;
}
html[data-theme="dark"] .primary-button > span { color: inherit; }
html[data-theme="dark"] .primary-button:not(:disabled):hover {
  background: #FF9A24 !important;
}
html[data-theme="dark"] body.admin-page :is(h1, h2, h3, h4, .section-kicker) {
  font-family: var(--font-ui, Inter, system-ui, sans-serif);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
}

@media (min-width: 861px) {
  html[data-theme="dark"] .top-nav :is(a, button) { font-size: 13px !important; }
}
