/* Pride Prism is the joyful, high-saturation default theme. Wizard Skin's
   component rules provide the shared layout; these rules supply its own voice. */
[data-theme="pride-prism"] {
  color-scheme: dark;
  --pr-bg: #16091d;
  --pr-surface: #28122f;
  --pr-surface-2: #3a1942;
  --pr-surface-soft: rgba(255, 174, 225, 0.11);
  --pr-cyan: #6ff7f2;
  --pr-purple: #d6a2ff;
  --pr-gold: #ffd36e;
  --pr-text: #fff7fc;
  --pr-muted: #e9cde2;
  --pr-border: rgba(255, 164, 220, 0.3);
  --pr-glow-cyan: 0 0 30px rgba(111, 247, 242, 0.22);
  --pr-glow-purple: 0 0 34px rgba(239, 92, 190, 0.28);
  --pr-gradient-accent: linear-gradient(
    105deg,
    #ff5d8f 0%,
    #ff9f43 18%,
    #ffe56b 34%,
    #67e89b 50%,
    #62d8ff 66%,
    #ac8cff 82%,
    #ff76c8 100%
  );
  --gradient-mystic-flame: var(--pr-gradient-accent);
  --gradient-neon-dream: linear-gradient(110deg, #ff76c8, #d6a2ff 46%, #6ff7f2);

  --bg: var(--pr-bg);
  --surface: var(--pr-surface);
  --surface-variant: var(--pr-surface-2);
  --surface-raised: #461c4b;
  --text: var(--pr-text);
  --on-surface: var(--pr-text);
  --text-muted: var(--pr-muted);
  --primary: #ff82cf;
  --secondary: #a98bff;
  --tertiary: #71eee1;
  --accent: #ffd36e;
  --focus: #71eee1;
  --border: var(--pr-border);
  --border-strong: rgba(255, 199, 235, 0.48);
  --header-bg: rgba(41, 15, 48, 0.9);
  --header-text: var(--pr-text);
  --success: #75efa3;
  --warning: #ffd36e;
  --danger: #ff789b;
  --info: #75ddff;
  --dark-grid-neon-a: rgba(255, 93, 143, 0.22);
  --dark-grid-neon-b: rgba(170, 120, 255, 0.22);
  --dark-grid-neon-c: rgba(98, 216, 255, 0.17);
  --dark-grid-neon-d: rgba(255, 211, 110, 0.14);
  --dark-grid-neon-e: rgba(255, 118, 200, 0.19);
  --dark-grid-base: linear-gradient(160deg, #16091d 0%, #27102e 52%, #16132d 100%);
}

[data-theme="pride-prism"] body {
  background:
    radial-gradient(circle at 8% 3%, rgba(255, 93, 143, 0.3), transparent 31%),
    radial-gradient(circle at 92% 8%, rgba(172, 140, 255, 0.28), transparent 34%),
    radial-gradient(circle at 75% 80%, rgba(98, 216, 255, 0.2), transparent 35%),
    radial-gradient(circle at 15% 88%, rgba(255, 211, 110, 0.14), transparent 32%),
    linear-gradient(rgba(255, 159, 211, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(111, 247, 242, 0.03) 1px, transparent 1px),
    var(--dark-grid-base);
  background-attachment: fixed;
  background-size: auto, auto, auto, auto, 38px 38px, 38px 38px, auto;
}

[data-theme="pride-prism"] :is(.app-bar, .left-rail, .right-rail) {
  background:
    linear-gradient(135deg, rgba(255, 118, 200, 0.09), rgba(111, 247, 242, 0.035)),
    rgba(31, 12, 39, 0.9);
  border-color: rgba(255, 174, 225, 0.25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 16px 44px rgba(9, 2, 18, 0.28);
  backdrop-filter: blur(18px) saturate(135%);
}

[data-theme="pride-prism"] .app-bar {
  border-bottom: 2px solid transparent;
  border-image: var(--pr-gradient-accent) 1;
}

[data-theme="pride-prism"] :is(.card, .thread-card, .settings-accordion-item, .modal-content, .dropdown-menu) {
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.055), transparent 45%),
    rgba(40, 18, 47, 0.94);
  border-color: rgba(255, 164, 220, 0.25);
  box-shadow: 0 18px 46px rgba(10, 2, 19, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

[data-theme="pride-prism"] :is(.card, .thread-card, .settings-accordion-item):hover {
  border-color: rgba(255, 158, 218, 0.42);
}

[data-theme="pride-prism"] :is(.btn-primary, .pocket-filter-pill.is-active) {
  background: var(--pr-gradient-accent);
  background-size: 180% 100%;
  border-color: transparent;
  color: #26051e !important;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(237, 74, 175, 0.25), 0 0 26px rgba(111, 247, 242, 0.13);
}

[data-theme="pride-prism"] :is(.btn-primary, .pocket-filter-pill.is-active):hover {
  background-position: 100% 0;
  color: #26051e !important;
  filter: saturate(1.1) brightness(1.05);
}

[data-theme="pride-prism"] :is(.btn-outline-primary, .btn-outline-secondary) {
  border-color: rgba(255, 130, 207, 0.62);
  background: rgba(255, 118, 200, 0.08);
  color: #ffb3df;
}

[data-theme="pride-prism"] :is(.btn-outline-primary, .btn-outline-secondary):hover,
[data-theme="pride-prism"] :is(.rail-link, .nav-link).active,
[data-theme="pride-prism"] :is(.rail-link, .nav-link)[aria-current="page"] {
  background: linear-gradient(110deg, rgba(255, 93, 143, 0.92), rgba(172, 140, 255, 0.94), rgba(98, 216, 255, 0.88));
  border-color: transparent;
  color: #fffaff !important;
  text-shadow: 0 1px 2px rgba(34, 3, 28, 0.7);
  box-shadow: 0 8px 22px rgba(214, 73, 172, 0.23);
}

[data-theme="pride-prism"] :is(a, .text-primary):not(.btn) {
  color: #ff9fd8 !important;
}

[data-theme="pride-prism"] :is(a, .text-primary):not(.btn):hover {
  color: #8df7f1 !important;
}

[data-theme="pride-prism"] :is(.form-control, .form-select, textarea, input:not([type="range"]):not([type="checkbox"]):not([type="radio"])) {
  background-color: rgba(25, 8, 32, 0.76);
  border-color: rgba(255, 164, 220, 0.3);
  color: var(--pr-text);
}

[data-theme="pride-prism"] :is(.form-control, .form-select, textarea, input):focus {
  border-color: #ff82cf;
  box-shadow: 0 0 0 0.2rem rgba(255, 130, 207, 0.2), 0 0 20px rgba(111, 247, 242, 0.1);
}

[data-theme="pride-prism"] ::selection {
  background: #ff82cf;
  color: #25041c;
}

/* Always-visible shortcut in the app bar. */
:is([data-theme="wizard-skin"], [data-theme="pride-prism"]) .theme-quick-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.35rem;
  padding: 0.36rem 0.7rem 0.36rem 0.42rem;
  border: 1px solid var(--pr-border);
  border-radius: 999px;
  background: var(--pr-surface-soft);
  color: var(--pr-text);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

:is([data-theme="wizard-skin"], [data-theme="pride-prism"]) .theme-quick-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--pr-cyan);
  background: color-mix(in srgb, var(--pr-surface-soft) 70%, var(--pr-cyan) 12%);
}

:is([data-theme="wizard-skin"], [data-theme="pride-prism"]) .theme-quick-toggle:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent);
  outline-offset: 2px;
}

:is([data-theme="wizard-skin"], [data-theme="pride-prism"]) .theme-quick-toggle__swatch {
  width: 1.45rem;
  height: 1.45rem;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  background: conic-gradient(#ff5d8f, #ffb44a, #ffe56b, #67e89b, #62d8ff, #ac8cff, #ff76c8, #ff5d8f);
  box-shadow: 0 0 12px rgba(255, 118, 200, 0.3);
}

/* Shared theme chooser */
:is([data-theme="wizard-skin"], [data-theme="pride-prism"]) .settings-theme-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 0;
  padding: 0;
  border: 0;
}

:is([data-theme="wizard-skin"], [data-theme="pride-prism"]) .settings-theme-option {
  position: relative;
  display: grid;
  grid-template-columns: 3.4rem 1fr auto;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
  padding: 0.9rem;
  border: 1px solid var(--pr-border);
  border-radius: 16px;
  background: var(--pr-surface-soft);
  color: var(--pr-text);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

:is([data-theme="wizard-skin"], [data-theme="pride-prism"]) .settings-theme-option:hover {
  transform: translateY(-2px);
  border-color: var(--pr-purple);
}

:is([data-theme="wizard-skin"], [data-theme="pride-prism"]) .settings-theme-option:has(input:checked) {
  border-color: var(--pr-cyan);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--pr-cyan) 22%, transparent), var(--pr-glow-purple);
}

:is([data-theme="wizard-skin"], [data-theme="pride-prism"]) .settings-theme-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

:is([data-theme="wizard-skin"], [data-theme="pride-prism"]) .settings-theme-option input:focus-visible + .settings-theme-swatch {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

:is([data-theme="wizard-skin"], [data-theme="pride-prism"]) .settings-theme-swatch {
  width: 3.4rem;
  aspect-ratio: 1;
  border: 2px solid rgba(255, 255, 255, 0.48);
  border-radius: 14px;
  box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.13), 0 5px 16px rgba(0, 0, 0, 0.24);
}

.settings-theme-swatch--pride {
  background: linear-gradient(135deg, #ff5d8f, #ffb44a 22%, #ffe56b 38%, #67e89b 53%, #62d8ff 69%, #ac8cff 84%, #ff76c8);
}

.settings-theme-swatch--wizard {
  background: linear-gradient(135deg, #17182f, #78e6cf 42%, #c68cff 70%, #f2b86b);
}

:is([data-theme="wizard-skin"], [data-theme="pride-prism"]) .settings-theme-copy {
  display: grid;
  min-width: 0;
  gap: 0.12rem;
}

:is([data-theme="wizard-skin"], [data-theme="pride-prism"]) .settings-theme-copy small {
  color: var(--pr-muted);
  font-size: 0.74rem;
  line-height: 1.35;
}

:is([data-theme="wizard-skin"], [data-theme="pride-prism"]) .settings-theme-check {
  color: var(--pr-cyan);
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 150ms ease, transform 150ms ease;
}

:is([data-theme="wizard-skin"], [data-theme="pride-prism"]) .settings-theme-option:has(input:checked) .settings-theme-check {
  opacity: 1;
  transform: scale(1);
}

@media (max-width: 640px) {
  :is([data-theme="wizard-skin"], [data-theme="pride-prism"]) .settings-theme-picker {
    grid-template-columns: 1fr;
  }

  :is([data-theme="wizard-skin"], [data-theme="pride-prism"]) .theme-quick-toggle {
    width: 2.35rem;
    padding: 0.38rem;
  }

  :is([data-theme="wizard-skin"], [data-theme="pride-prism"]) .theme-quick-toggle__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  :is([data-theme="wizard-skin"], [data-theme="pride-prism"]) .settings-theme-option,
  :is([data-theme="wizard-skin"], [data-theme="pride-prism"]) .settings-theme-check {
    transition: none;
  }
}
