:root[data-mithrandir-theme="active"] {
  --paper: var(--theme-page);
  --paper-deep: var(--theme-surface);
  --ink: var(--theme-text);
  --blue-muted: var(--theme-text-muted);
  --line: var(--theme-border);
}

:root[data-mithrandir-theme="active"] body {
  background: var(--theme-page);
  color: var(--theme-text);
}

:root[data-mithrandir-theme="active"] .page-shell,
:root[data-mithrandir-theme="active"] .hero,
:root[data-mithrandir-theme="active"] .career-section,
:root[data-mithrandir-theme="active"] .case-section {
  background-color: var(--theme-page);
}

:root[data-mithrandir-theme="active"] .intro,
:root[data-mithrandir-theme="active"] .lower-grid p,
:root[data-mithrandir-theme="active"] .timeline-content p,
:root[data-mithrandir-theme="active"] .case-section p,
:root[data-mithrandir-theme="active"] .case-list li,
:root[data-mithrandir-theme="active"] .case-meta dd,
:root[data-mithrandir-theme="active"] .open-note {
  color: var(--theme-text-muted);
}

:root[data-mithrandir-theme="active"] .hero h1,
:root[data-mithrandir-theme="active"] .lower-grid h2,
:root[data-mithrandir-theme="active"] .primary-link,
:root[data-mithrandir-theme="active"] blockquote,
:root[data-mithrandir-theme="active"] .countdown,
:root[data-mithrandir-theme="active"] .career-hero h1,
:root[data-mithrandir-theme="active"] .case-hero h1,
:root[data-mithrandir-theme="active"] .career-summary strong,
:root[data-mithrandir-theme="active"] .career-anchors a,
:root[data-mithrandir-theme="active"] .career-link,
:root[data-mithrandir-theme="active"] .career-section-header h2,
:root[data-mithrandir-theme="active"] .case-section h2,
:root[data-mithrandir-theme="active"] .timeline-date,
:root[data-mithrandir-theme="active"] .timeline-content h3,
:root[data-mithrandir-theme="active"] .career-meta span,
:root[data-mithrandir-theme="active"] .case-meta dt,
:root[data-mithrandir-theme="active"] .case-section h3,
:root[data-mithrandir-theme="active"] .case-callout strong {
  color: var(--theme-text);
}

:root[data-theme="dark"][data-mithrandir-theme="active"] .countdown {
  color: var(--theme-maize) !important;
}

:root[data-mithrandir-theme="active"] .tool-card,
:root[data-mithrandir-theme="active"] .timeline-card,
:root[data-mithrandir-theme="active"] .career-summary,
:root[data-mithrandir-theme="active"] .case-callout {
  background: var(--theme-surface-raised);
}

:root[data-mithrandir-theme="active"] .countdown-card,
:root[data-mithrandir-theme="active"] .career-anchors,
:root[data-mithrandir-theme="active"] .timeline-media,
:root[data-mithrandir-theme="active"] .case-meta,
:root[data-mithrandir-theme="active"] .case-hero-image {
  background: var(--theme-surface);
}

:root[data-mithrandir-theme="active"] .career-summary,
:root[data-mithrandir-theme="active"] .timeline-card,
:root[data-mithrandir-theme="active"] .case-callout,
:root[data-mithrandir-theme="active"] .case-hero-image,
:root[data-mithrandir-theme="active"] .career-meta span {
  border-color: var(--theme-border);
}

:root[data-mithrandir-theme="active"] .career-meta span {
  background: var(--theme-focus-soft);
}

:root[data-theme="dark"][data-mithrandir-theme="active"] .hero,
:root[data-theme="dark"][data-mithrandir-theme="active"] .career-hero,
:root[data-theme="dark"][data-mithrandir-theme="active"] .case-hero {
  background:
    radial-gradient(circle at 78% 28%, rgba(255, 203, 5, 0.09), transparent 24%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.025), transparent 48%),
    var(--theme-page);
}

:root[data-theme="dark"][data-mithrandir-theme="active"] .declaration {
  background: var(--theme-navy-900);
  color: var(--theme-rail-text);
  box-shadow: 14px 14px 0 color-mix(in srgb, var(--theme-maize) 32%, transparent);
}

:root[data-theme="dark"][data-mithrandir-theme="active"] .career-hero::before,
:root[data-theme="dark"][data-mithrandir-theme="active"] .daily-quote {
  background: var(--theme-navy-950);
}

:root[data-mithrandir-theme="active"] .login-card {
  border-color: var(--theme-border-strong);
  background: var(--theme-surface-raised);
  color: var(--theme-text);
  box-shadow: var(--theme-shadow-strong);
}

:root[data-mithrandir-theme="active"] .login-card p {
  color: var(--theme-text-muted);
}

:root[data-mithrandir-theme="active"] .login-card input {
  border-color: var(--theme-border-strong);
  background: var(--theme-surface-muted);
  color: var(--theme-text);
}

:root[data-mithrandir-theme="active"] .login-card input:focus-visible,
:root[data-mithrandir-theme="active"] .login-card button:focus-visible {
  outline: 3px solid var(--theme-focus-soft);
  outline-offset: 2px;
}

:root[data-mithrandir-theme="active"] .login-card button {
  background: var(--theme-accent);
  color: var(--theme-accent-contrast);
}

:root[data-mithrandir-theme="active"] .login-card button:hover {
  background: var(--theme-accent-strong);
}

:root[data-mithrandir-theme="active"] .login-card .message {
  border: 1px solid var(--theme-danger-border);
  background: var(--theme-danger-surface);
  color: var(--theme-danger);
}

:root[data-mithrandir-theme="active"] .login-card .expired {
  border-color: var(--theme-border);
  background: var(--theme-surface-muted);
  color: var(--theme-text-muted);
}

:root[data-mithrandir-theme="active"] .login-card .home-link {
  color: var(--theme-text);
}

/* Keep the established dark card treatment while following holiday colors. */
:root[data-mithrandir-theme="active"]:is([data-palette="halloween"], [data-palette="christmas"]) .public-home-page .public-card,
:root[data-mithrandir-theme="active"]:is([data-palette="halloween"], [data-palette="christmas"]) .private-home-redesign .private-card {
  background: var(--theme-navy-800);
  border-color: var(--theme-rail-border);
}
:root[data-mithrandir-theme="active"]:is([data-palette="halloween"], [data-palette="christmas"]) .public-home-page .public-card--about {
  background: var(--theme-navy-900);
}
:root[data-mithrandir-theme="active"]:is([data-palette="halloween"], [data-palette="christmas"]) .public-home-page a.public-card:is(:hover, :focus-visible),
:root[data-mithrandir-theme="active"]:is([data-palette="halloween"], [data-palette="christmas"]) .private-home-redesign .private-card:is(:hover, :focus-visible) {
  background: var(--theme-rail-hover);
  border-color: var(--theme-maize);
}
:root:is([data-palette="halloween"], [data-palette="christmas"]) .quotes-page .quote-button:not(.quote-button--quiet):hover {
  background: var(--theme-navy-800);
}
:root:is([data-palette="halloween"], [data-palette="christmas"])[data-theme="light"] .private-home-redesign .private-hero-countdown .countdown,
:root:is([data-palette="halloween"], [data-palette="christmas"])[data-theme="light"] .private-home-redesign .private-hero-intro h1 em {
  color: var(--theme-accent);
}

/* Authentication screens share the selected appearance without needing a rail. */
:root[data-mithrandir-theme="active"] .auth-page main {
  background: var(--theme-surface-raised); color: var(--theme-text); border-color: var(--theme-border-strong);
}
:root[data-mithrandir-theme="active"] .auth-page input {
  background: var(--theme-control); color: var(--theme-text); border-color: var(--theme-border-strong);
}
:root[data-mithrandir-theme="active"] .auth-page button {
  background: var(--theme-accent); color: var(--theme-accent-contrast);
}
:root[data-mithrandir-theme="active"] .auth-page .message { background: var(--theme-surface-muted); }
:root[data-mithrandir-theme="active"] .auth-page :is(.error,.bad) {
  background: var(--theme-danger-surface); color: var(--theme-danger);
}
:root[data-mithrandir-theme="active"] .auth-page .ok { color: #eaf6ee; }
:root[data-mithrandir-theme="active"] .auth-page :is(input,button,a):focus-visible {
  outline: 3px solid var(--theme-accent); outline-offset: 3px;
}
:root[data-mithrandir-theme="active"]:is([data-palette="halloween"], [data-palette="christmas"]) :is(body.account-site-shell,body.session-site-shell) {
  background: var(--theme-page); color: var(--theme-text);
}
:root[data-mithrandir-theme="active"]:is([data-palette="halloween"], [data-palette="christmas"]) :is(.account-shell,.session-shell) :is(h1,h2,label,strong) {
  color: var(--theme-text);
}
:root[data-mithrandir-theme="active"]:is([data-palette="halloween"], [data-palette="christmas"]) :is(.account-card,.session-card) {
  background: var(--theme-surface-raised); color: var(--theme-text); border-color: var(--theme-border);
}
:root[data-mithrandir-theme="active"]:is([data-palette="halloween"], [data-palette="christmas"]) :is(.account-shell,.session-shell) a { color: var(--theme-accent-strong); }
:root[data-mithrandir-theme="active"]:is([data-palette="halloween"], [data-palette="christmas"]) .account-shell input {
  background: var(--theme-control); color: var(--theme-text); border-color: var(--theme-border-strong);
}
:root[data-mithrandir-theme="active"]:is([data-palette="halloween"], [data-palette="christmas"]) .account-shell input:disabled { color: var(--theme-text-muted); }
:root[data-mithrandir-theme="active"]:is([data-palette="halloween"], [data-palette="christmas"]) :is(.account-shell,.session-shell) button {
  background: var(--theme-accent); color: var(--theme-accent-contrast); -webkit-text-fill-color: var(--theme-accent-contrast); border-color: var(--theme-accent);
}
:root[data-mithrandir-theme="active"]:is([data-palette="halloween"], [data-palette="christmas"]) :is(.account-shell,.session-shell) button:hover { background: var(--theme-accent-strong); }

:root:is([data-palette="halloween"], [data-palette="christmas"]) :is(.hero h1 em,.career-hero h1 em,.case-hero h1 em) { color: var(--theme-accent); }

:root:is([data-palette="halloween"], [data-palette="christmas"]) .m156-pivot-link { color: var(--theme-accent); }
:root:is([data-palette="halloween"], [data-palette="christmas"]) .m156-pivot-link:is(:hover,:focus-visible) { color: var(--theme-accent-strong); }

:root:is([data-palette="halloween"], [data-palette="christmas"]) :is(.public-card .card-number,.public-card-number,.private-card-number) { color: #ff7900; }

:root[data-mithrandir-theme="active"][data-palette="christmas"] :is(.hero,.career-hero,.case-hero) {
  background: radial-gradient(ellipse at 85% 5%, rgba(116, 174, 131, 0.12), transparent 60%), var(--theme-page);
}
:root[data-mithrandir-theme="active"][data-palette="christmas"] :is(.public-home-page .public-card,.private-home-redesign .private-card) {
  background: linear-gradient(135deg, #164b35, #0b3023);
  border-color: var(--theme-rail-border);
  box-shadow: inset 0 3px var(--theme-christmas-red);
}
:root[data-palette="christmas"] :is(.public-card .card-number,.public-card-number,.private-card-number) {
  color: var(--theme-rail-text);
}
:root[data-palette="christmas"] :is(.hero h1 em,.career-hero h1 em,.case-hero h1 em) {
  text-decoration: underline;
  text-decoration-color: var(--theme-christmas-bright);
  text-decoration-thickness: 3px;
  text-underline-offset: 0.14em;
}
:root[data-mithrandir-theme="active"][data-palette="christmas"] :is(.login-card button,.auth-page button,.account-shell button,.session-shell button) {
  background: var(--theme-christmas-red);
  border-color: var(--theme-christmas-red);
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
}
:root[data-mithrandir-theme="active"][data-palette="christmas"] :is(.login-card button,.auth-page button,.account-shell button,.session-shell button):hover {
  background: var(--theme-christmas-red-hover);
}
