body[data-seasonal-theme="aurora"], [data-swatch="aurora"] {
  --theme-ground: #092c2c;
  --theme-glow: #276451;
  --theme-accent: #a4ebbc;
  --theme-canvas: #eef6f1;
  --theme-active: #d9eee3;
  --theme-ink: #245942;
  --theme-art: url("../images/themes/aurora.svg");
  --theme-motion: aurora-veil;
}

body[data-seasonal-theme="autumn"], [data-swatch="autumn"] {
  --theme-ground: #3a211b;
  --theme-glow: #855039;
  --theme-accent: #f6c284;
  --theme-canvas: #f8f2ea;
  --theme-active: #f3e2ce;
  --theme-ink: #734025;
  --theme-art: url("../images/themes/autumn.svg");
  --theme-art-size: min(65%, 670px);
  --theme-motion: autumn-light;
}

body[data-seasonal-theme="coast"], [data-swatch="coast"] {
  --theme-ground: #102d46;
  --theme-glow: #357884;
  --theme-accent: #a8e4e0;
  --theme-canvas: #edf6f7;
  --theme-active: #dceef2;
  --theme-ink: #22546c;
  --theme-art: url("../images/themes/coast.svg");
  --theme-motion: coast-reflection;
}

body[data-seasonal-theme="nightshift"], [data-swatch="nightshift"] {
  --theme-ground: #131e34;
  --theme-glow: #3c5776;
  --theme-accent: #c5daf6;
  --theme-canvas: #eff2f8;
  --theme-active: #e0e8f6;
  --theme-ink: #304c75;
  --theme-art: url("../images/themes/nightshift.svg");
  --theme-motion: nightshift-window-light;
}

body.theme-winter, [data-swatch="winter"] {
  --theme-ground: #122e47;
  --theme-glow: #427389;
  --theme-accent: #c1e5ed;
  --theme-active: #deedf5;
  --theme-ink: #264d63;
  --theme-art: url("../images/themes/winter-forest.svg");
}

[data-swatch="summer"] {
  --theme-ground: #253c29;
  --theme-glow: #64763c;
  --theme-accent: #e8d78d;
  --theme-art: url("../images/themes/summer-landscape.svg");
}

[data-swatch="christmas"] {
  --theme-ground: #153629;
  --theme-glow: #44664d;
  --theme-accent: #f1ce91;
  --theme-art: url("../images/themes/christmas-header-premium-v2.webp");
}

[data-swatch="easter"] {
  --theme-ground: #395044;
  --theme-glow: #668069;
  --theme-accent: #f7e1a1;
  --theme-art: url("../images/themes/easter-eggs.svg");
}

[data-swatch="auto"] {
  --theme-ground: #283647;
  --theme-glow: #466f75;
  --theme-accent: #d0e7ed;
  --theme-art: repeating-linear-gradient(120deg, transparent 0 14px, #d6efea1f 14px 15px);
}

[data-swatch="off"] {
  --theme-ground: var(--navy-900);
  --theme-glow: var(--teal-700);
  --theme-accent: #a5dfd7;
  --theme-art: none;
}

.theme-scenic {
  --canvas: var(--theme-canvas);
}

.theme-scenic .app-header,
.theme-winter .app-header {
  background: radial-gradient(ellipse at 64% 105%, var(--theme-glow), transparent 73%), var(--theme-ground);
  box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--theme-accent) 68%, transparent), 0 4px 16px #10272e1c;
}

.theme-scenic .app-sidebar {
  background: color-mix(in srgb, var(--theme-canvas) 54%, white);
}

:is(.theme-scenic, .theme-winter) .app-sidebar .nav-label,
.app-sidebar .nav-label {
  color: var(--ink-800);
}

.app-sidebar a:focus-visible,
.mobile-nav a:focus-visible,
.theme-studio :is(a, button, select, textarea, input[type="checkbox"]):focus-visible {
  outline: 2px solid var(--teal-700);
  outline-offset: 2px;
}

.app-header :is(a, button):focus-visible {
  outline: 2px solid var(--theme-accent, #d9f4ef);
  outline-offset: 2px;
}

.skip-link:focus {
  transition: none;
  outline: 2px solid var(--teal-700);
  outline-offset: 2px;
}

.app-version-mobile { color: var(--ink-600); }

.theme-scenic .app-sidebar a.active,
.theme-scenic .mobile-nav a.active,
.theme-winter .app-sidebar a.active,
.theme-winter .mobile-nav a.active {
  background: var(--theme-active);
  color: var(--theme-ink);
}

.theme-winter .login-card {
  border-color: #c5dbe7;
  box-shadow: 0 18px 52px #12344a22;
}

.theme-scenic .dashboard-hero,
.theme-scenic .login-intro,
.theme-scenic .appearance-heading {
  isolation: isolate;
  background: radial-gradient(ellipse at 92% 88%, var(--theme-glow), transparent 76%), var(--theme-ground);
}

.theme-scenic .dashboard-hero {
  min-height: 272px;
  padding-inline-end: clamp(240px, 35%, 400px);
}

.theme-scenic .dashboard-hero > :not(.theme-scenery),
.theme-scenic .appearance-heading > :not(.theme-scenery) {
  position: relative;
  z-index: 1;
}

.theme-scenic .login-intro {
  padding-block-end: clamp(190px, 25vw, 340px);
}

.theme-scenic .dashboard-hero::after,
.theme-scenic .login-intro::before,
.theme-scenic .login-intro::after {
  display: none;
}

.theme-scenic .dashboard-hero .eyebrow,
.theme-scenic .appearance-heading .eyebrow {
  color: var(--theme-accent) !important;
}

.theme-scenic .theme-scenery {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}

.theme-scenery::before, .theme-scenery::after {
  position: absolute;
  content: "";
}

.theme-scenery::before {
  inset: 0;
  background: var(--theme-art) right bottom / var(--theme-art-size, min(72%, 810px)) auto no-repeat;
  mask-image: linear-gradient(90deg, transparent 30%, #000 68%);
}

.login-intro .theme-scenery::before {
  background-size: min(100%, 810px) auto;
  mask-image: linear-gradient(180deg, transparent 18%, #000 70%);
}

.theme-scenery::after {
  inset: 8% -5% 0 44%;
  background: radial-gradient(ellipse, color-mix(in srgb, var(--theme-accent) 38%, transparent), transparent 66%);
  opacity: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .theme-scenic:not(.theme-static) .theme-scenery::after {
    animation: var(--theme-motion) 3.5s ease-in-out both;
  }
}

@keyframes aurora-veil {
  0%, 100% { opacity: 0; transform: translate(7%, 16%) scale(.84); }
  42% { opacity: .8; transform: translate(-7%, -19%) scale(1.12); }
}

@keyframes autumn-light {
  0% { opacity: 0; transform: translate(18%, 10%) scale(.84); }
  42% { opacity: .72; }
  100% { opacity: 0; transform: translate(-16%, -16%) scale(1.06); }
}

@keyframes coast-reflection {
  0% { opacity: 0; transform: translateX(14%) scaleY(.22); }
  52% { opacity: .9; }
  100% { opacity: 0; transform: translateX(-24%) scaleY(.3); }
}

@keyframes nightshift-window-light {
  0%, 100% { opacity: 0; transform: scale(.78); }
  55% { opacity: .78; transform: scale(1.06); }
}

html:has(.theme-studio) { scroll-behavior: auto; }

.theme-studio :is(button, input, select, textarea) {
  scroll-margin-block: calc(var(--header-height) + 12px) 84px;
}

.theme-studio .page-heading h1 {
  font-size: clamp(2.1rem, 4.4vw, 3.3rem);
  letter-spacing: -.045em;
}

.theme-studio .breadcrumb,
.theme-studio .breadcrumb span,
.theme-studio .section-heading p,
.theme-studio .page-heading p:not(.eyebrow) {
  color: var(--ink-800);
}

.theme-scenic .appearance-heading {
  position: relative;
  padding: 24px 34% 24px 24px;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-lg);
  color: white;
}

.theme-scenic .theme-studio .appearance-heading p:not(.eyebrow) {
  color: #e0eaed;
}

.appearance-heading .theme-scenery::before {
  background-size: min(64%, 580px) auto;
  mask-image: linear-gradient(90deg, transparent 34%, #000 76%);
}

.theme-studio .appearance-status-grid article {
  border-block-start: 2px solid var(--theme-active, var(--teal-100));
  box-shadow: none;
}

.theme-studio .appearance-status-grid article > span {
  color: var(--ink-600);
}

.theme-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 148px), 1fr));
  gap: 12px;
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.theme-option {
  position: relative;
  min-inline-size: 0;
  display: flex;
  cursor: pointer;
}

.theme-option > input {
  position: absolute;
  z-index: 1;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  margin: 0;
  appearance: none;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  cursor: pointer;
}

.theme-option-card {
  position: relative;
  display: grid;
  grid-template-rows: 78px 1fr;
  inline-size: 100%;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.theme-thumb {
  display: flex;
  align-items: flex-end;
  padding: 8px;
  overflow: hidden;
  background: var(--theme-art, none) right bottom / 89% auto no-repeat,
    radial-gradient(ellipse at 76% 78%, var(--theme-glow, var(--teal-700)), transparent 77%),
    var(--theme-ground, var(--navy-900));
}

.theme-thumb-window {
  position: relative;
  display: block;
  width: 34px;
  height: 26px;
  border: 1px solid #ffffff75;
  border-radius: 5px;
  background: #ffffffdc;
  box-shadow: 0 2px 9px #10272e3a;
}

.theme-thumb-window::before,
.theme-thumb-window::after {
  position: absolute;
  content: "";
}

.theme-thumb-window::before {
  inset: 4px auto 4px 4px;
  width: 5px;
  border-radius: 2px;
  background: var(--theme-ground, var(--navy-900));
}

.theme-thumb-window::after {
  inset: 5px 5px auto 13px;
  height: 4px;
  border-radius: 2px;
  background: var(--theme-accent, #a5dfd7);
  box-shadow: 0 7px 0 #10272e25, 0 13px 0 #10272e17;
}

.theme-option-copy {
  display: grid;
  align-content: start;
  gap: 3px;
  padding: 10px;
}

.theme-option-copy strong { color: var(--ink-950); font-size: .94rem; }
.theme-option-copy small { color: var(--ink-600); font-size: .8rem; line-height: 1.35; }

.theme-option-check {
  position: absolute;
  inset: 7px 7px auto auto;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  color: var(--teal-700);
  opacity: 0;
}

.theme-option-check .icon { width: 15px; height: 15px; }
.theme-option:hover .theme-option-card { border-color: var(--teal-600); }
.theme-option > input:checked + .theme-option-card { border-color: var(--teal-700); box-shadow: 0 0 0 1px var(--teal-700); }
.theme-option > input:checked + .theme-option-card .theme-option-check { opacity: 1; }
.theme-option > input:focus-visible { outline: 2px solid var(--teal-700); outline-offset: 3px; }

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  body:not(.theme-static) .theme-option-card { transition: transform .16s ease, border-color .16s ease; }
  body:not(.theme-static) .theme-option:hover .theme-option-card { transform: translateY(-2px); }
}

.theme-preview-controls, .theme-save-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
}

.theme-preview-controls .form-actions {
  justify-content: flex-end;
  margin: 0;
}

.theme-studio .form-actions button {
  min-height: 44px;
}

@media (max-width: 760px) {
  .theme-scenic .dashboard-hero {
    min-height: 0;
    padding-inline-end: clamp(26px, 4vw, 42px);
    padding-block-end: clamp(135px, 29vw, 205px);
  }

  .theme-scenic .login-intro { padding-block-end: clamp(100px, 29vw, 180px); }
  .theme-scenic .appearance-heading { padding: 20px; }
  .appearance-heading .theme-scenery::before { opacity: .55; }

  .theme-scenery::before {
    background-size: min(100%, 600px) auto;
    mask-image: linear-gradient(180deg, transparent 25%, #000 85%);
  }

  .theme-preview-controls, .theme-save-fields { grid-template-columns: minmax(0, 1fr); }
  .theme-preview-controls .form-actions { justify-content: flex-start; }
}

@media (max-width: 700px) {
  .theme-studio .appearance-status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .theme-studio .appearance-status-grid article { padding: 12px; }

  .theme-studio .appearance-status-grid article:last-child {
    grid-column: 1 / -1;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: baseline;
    column-gap: 8px;
  }

  .theme-studio .appearance-status-grid article:last-child small { grid-column: 1 / -1; }
}

@media (max-width: 480px) {
  .theme-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .theme-option-card { grid-template-rows: 61px 1fr; }
  .theme-option-copy { padding: 8px; }
  .theme-option-copy strong { overflow-wrap: anywhere; }
  .theme-studio .form-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    justify-content: stretch;
  }
}

@media print {
  .theme-scenery { display: none !important; }
}
