.theme-toggle:not([hidden]) {
  display: grid;
  flex: 0 0 2.75rem;
  width: 2.75rem;
  height: 2.75rem;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
}

.theme-toggle:hover { border-color: var(--orange); }
.theme-toggle:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.theme-toggle .theme-sun,
.theme-toggle[aria-pressed="true"] .theme-moon { display: none; }
.theme-toggle[aria-pressed="true"] .theme-sun { display: inline; }
.theme-label { display: none; }

@media (min-width: 1050px) {
  .theme-toggle:not([hidden]) {
    display: inline-flex;
    flex: 0 0 auto;
    width: auto;
    justify-content: center;
    gap: .45rem;
    padding-inline: .8rem;
  }
  .theme-label { display: inline; font-size: var(--ui-type); font-weight: 600; }
}

@media (min-width: 701px) and (max-width: 1050px) {
  .site-header { gap: clamp(.65rem, 1.5vw, 1.25rem); }
  .desktop-nav { gap: clamp(.5rem, 1.4vw, 1.1rem); }
}

@media (max-width: 700px) {
  .site-header { gap: .55rem; }
  .theme-toggle { margin-left: auto; }
  .theme-toggle:not([hidden]) + .menu-toggle { margin-left: 0; }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f2eee9;
  --muted: #c0b8bb;
  --paper: #1b1c1f;
  --white: #24252a;
  --line: #494751;
  --orange: #d4b8dd;
  --copy-color: #ded7d7;
  --secondary-color: #c0b8bb;
  --clay-panel: #26272c;
  --clay-raised: #2e2e35;
  --clay-active: #41374a;
  --clay-brand-action: #decce6;
  --clay-brand-action-text: #291f30;
  --clay-success: #c2e3c5;
  --clay-error: #ffc0b0;
  --shadow: 0 24px 70px rgba(0, 0, 0, .26);
}

[data-theme="dark"] body { background: var(--paper); }
[data-theme="dark"] .site-header.is-scrolled {
  border-color: var(--line);
  background: rgba(27, 28, 31, .94);
}
[data-theme="dark"] :is(.desktop-nav a, .mobile-nav a, .mobile-nav button, .eyebrow) { color: var(--copy-color); }
[data-theme="dark"] .desktop-nav a:hover { color: var(--orange); }
[data-theme="dark"] :is(.mobile-nav, .menu-toggle) { background: var(--clay-panel); }
[data-theme="dark"] .menu-toggle span { background: var(--ink); }
[data-theme="dark"] .brand-logo img,
[data-theme="dark"] .hero-logo { filter: brightness(1.65) saturate(.85); }

[data-theme="dark"] .hero {
  background:
    radial-gradient(ellipse at 76% 24%, #392c40, transparent 45%),
    radial-gradient(ellipse at 28% 74%, #243b38, transparent 49%),
    radial-gradient(ellipse at 80% 85%, #3b322b, transparent 43%),
    var(--paper);
}
[data-theme="dark"] .hero::before { background: radial-gradient(circle, #5f456247, transparent 68%); }
[data-theme="dark"] .hero::after,
[data-theme="dark"] :is(.hero-orbit, .hero-bottom, .hero-stamp, .text-link) { border-color: var(--line); }
[data-theme="dark"] .hero-stamp { background: rgba(36, 37, 42, .78); }
[data-theme="dark"] .hero-stamp small,
[data-theme="dark"] :is(.hero-side-note, .hero-year, .hero-bottom h2 span, .about-content h2 span, .about-side span, .voting-intro h2 span) { color: var(--secondary-color); }
[data-theme="dark"] :is(.eyebrow-line, .scroll-line) { background: var(--line); }

[data-theme="dark"] :is(.participant-ticker, .marquee, .footer) { background: #212226; }
[data-theme="dark"] :is(.ticker-card, .participant-card, .nomination-card) {
  border-color: var(--line);
  background: var(--clay-panel);
  color: var(--ink);
}
[data-theme="dark"] :is(.ticker-poster, .voting-candidate-art) { background: var(--clay-raised); }
[data-theme="dark"] :is(.ticker-placeholder, .voting-candidate-art > span) { color: var(--secondary-color); }
[data-theme="dark"] :is(.participant-card.is-selected, .nomination-card.is-active) {
  border-color: var(--orange);
  background: var(--clay-active);
}
[data-theme="dark"] :is(.participant-card:hover, .nomination-card:hover) { border-color: var(--orange); }
[data-theme="dark"] .filter-chip:is(:hover, .is-active) {
  background: var(--clay-brand-action);
  color: var(--clay-brand-action-text);
}
[data-theme="dark"] .filter-range::-webkit-slider-runnable-track {
  background: linear-gradient(to right, var(--orange) 0, var(--orange) var(--scroll-progress), var(--line) var(--scroll-progress), var(--line) 100%);
}
[data-theme="dark"] .filter-range::-moz-range-track { background: var(--line); }
[data-theme="dark"] .filter-range::-moz-range-progress { background: var(--orange); }
[data-theme="dark"] .filter-range::-webkit-slider-thumb { border-color: var(--paper); background: var(--orange); }
[data-theme="dark"] .filter-range::-moz-range-thumb { border-color: var(--paper); background: var(--orange); }

[data-theme="dark"] :is(.participant-detail, .mobile-detail) { background: var(--clay-panel); }
[data-theme="dark"] .participant-detail::before { background: radial-gradient(circle, #68435365, transparent 70%); }
[data-theme="dark"] :is(.participant-detail.is-nomination, .nomination-overview-count, .detail-nomination-head, .nomination-bottom) { border-color: var(--line); }
[data-theme="dark"] :is(.nomination-overview p, .nomination-overview-count) { color: var(--copy-color); }
[data-theme="dark"] :is(.nomination-overview-icon, .nomination-icon, .detail-nominations button) {
  border-color: var(--line);
  background: var(--clay-raised);
  color: var(--orange);
}
[data-theme="dark"] .detail-nominations button { color: var(--ink); }
[data-theme="dark"] .detail-nominations button i { color: var(--orange); }
[data-theme="dark"] .detail-partnership { background: var(--clay-raised); }
[data-theme="dark"] .detail-socials a:hover,
[data-theme="dark"] :is(.detail-partnership a, .support-links a, .account-footer-links a) { color: var(--orange); }
[data-theme="dark"] :is(.participant-card .avatar, .detail-avatar) { color: #292333; }
[data-theme="dark"] .detail-avatar i { border-color: var(--clay-panel); }

[data-theme="dark"] .voting-section {
  background:
    radial-gradient(ellipse at 87% 9%, #3b3045, transparent 52%),
    radial-gradient(ellipse at 6% 44%, #233a37, transparent 50%),
    #202125;
}
[data-theme="dark"] .voting-countdown:not([hidden]) {
  border-color: #6e6175;
  background: linear-gradient(135deg, #2d403d, #382d43 72%);
  color: var(--ink);
}
[data-theme="dark"] :is(.voting-countdown-title, .voting-countdown-label) { color: var(--copy-color); }
[data-theme="dark"] .voting-countdown-separator { color: var(--orange); }
[data-theme="dark"] :is(.voting-tabs-block, .voting-panel) {
  border-color: var(--line);
  background: rgba(36, 37, 42, .91);
  box-shadow: var(--shadow);
}
[data-theme="dark"] :is(.voting-tab, .voting-candidate, .writein-invite, .writein-results, .final-voting-result, .voting-empty) {
  border-color: var(--line);
  background: var(--clay-raised);
}
[data-theme="dark"] .voting-tab.is-active { background: var(--clay-active); border-color: var(--orange); }
[data-theme="dark"] :is(.voting-tab-icon, .voting-tab.is-active .voting-tab-count, .writein-category) { color: var(--orange); }
[data-theme="dark"] :is(.voting-tab.has-vote:not(.is-active), .voting-category-state:not(.is-closed), .voting-success, .voting-candidate.is-voted) {
  border-color: #638168;
  background: #2b402f;
  color: var(--clay-success);
}
[data-theme="dark"] :is(.voting-category-state.is-closed, .voting-closed) {
  border-color: var(--line);
  background: #292930;
  color: var(--secondary-color);
}
[data-theme="dark"] :is(.voting-progress-track, .voting-result-track, .writein-result-track) { background: var(--line); }
[data-theme="dark"] :is(.nomination-results, .voting-continue, .voting-success-mark, .account-writein-note, .writein-status) { color: var(--clay-success); }
[data-theme="dark"] :is(.voting-continue, .voting-success-mark) { border-color: #638168; background: #314a36; }
[data-theme="dark"] .voting-continue:hover { background: #406044; }
[data-theme="dark"] :is(.writein-results h4, .writein-result span, .final-voting-result small) { color: var(--secondary-color); }
[data-theme="dark"] .writein-result { border-color: var(--line); }
[data-theme="dark"] .final-voting-result > span:first-child { color: var(--orange); }
[data-theme="dark"] :is(.button-dark, .voting-candidate-action) { background: var(--clay-brand-action); color: var(--clay-brand-action-text); }
[data-theme="dark"] :is(.button-dark, .voting-candidate-action):is(:hover, :focus-visible):not(:disabled) { background: #eddcf5; }
[data-theme="dark"] :is(.voting-candidate-action, .writein-open):disabled { background: var(--clay-panel); color: var(--secondary-color); opacity: 1; }
[data-theme="dark"] .voting-candidate.is-voted .voting-candidate-action:disabled { background: #3b5840; color: var(--clay-success); }

[data-theme="dark"] :is(.about-mark, .footer-note span:last-child, .footer-thanks p, .footer-links a, .footer-bottom a) { color: var(--ink); }
[data-theme="dark"] .footer-thanks p span { color: var(--secondary-color); }
[data-theme="dark"] :is(.footer-thanks, .footer-bottom) { border-color: var(--line); }

[data-theme="dark"] .modal-backdrop { background: rgba(6, 6, 9, .73); }
[data-theme="dark"] :is(.auth-modal, .account-modal, .writein-modal) {
  border: 1px solid var(--line);
  background: var(--clay-panel);
  color: var(--ink);
}
[data-theme="dark"] #writein-vote-form input,
[data-theme="dark"] :is(.auth-provider, .account-link-provider, .account-provider, .account-logout, .writein-open) {
  border-color: var(--line);
  background: var(--clay-raised);
  color: var(--ink);
}
[data-theme="dark"] :is(.auth-provider, .account-link-provider, .account-logout, .writein-open):hover:not(:disabled) { border-color: var(--orange); background: var(--clay-active); }
[data-theme="dark"] :is(.modal-close, .account-profile-header p, .account-provider span, #writein-vote-form label) { color: var(--copy-color); }
[data-theme="dark"] :is(.provider-icon, .google-provider .provider-icon) { color: var(--orange); }
[data-theme="dark"] .account-profile-header { background: var(--clay-raised); }
[data-theme="dark"] :is(.account-registration, .account-vote, .account-footer-links) { border-color: var(--line); }
[data-theme="dark"] :is(.auth-status, .writein-status.is-error) { color: var(--clay-error); }
[data-theme="dark"] .toast { border: 1px solid var(--line); background: var(--clay-active); color: var(--ink); }
[data-theme="dark"] :is(button, a, input):focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
[data-theme="dark"] .auth-provider.vk-provider { border-color: #278aff; background: #0067df; color: #fff; }
[data-theme="dark"] .auth-provider.vk-provider:hover:not(:disabled) { border-color: #67adff; background: #005abb; }
[data-theme="dark"] .auth-provider.vk-provider:disabled { border-color: #5e84ad; background: #315d8d; color: #e8f1fa; }
[data-theme="dark"] .auth-provider.vk-provider .vk-icon { color: #fff; }

[data-theme="dark"] .auth-documents { border-color: var(--line); }
[data-theme="dark"] .auth-check-row a { color: var(--orange); }
[data-theme="dark"] .auth-check-row input { accent-color: var(--orange); }

/* The enclosed A of the original 541 × 339 logo has an opaque white fill.
   Keep the element at the image's aspect ratio so the cutout scales with it. */
.brand-logo img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
}

.brand-logo img,
.hero-logo {
  clip-path: polygon(evenodd,
    0 0, 100% 0, 100% 100%, 0 100%, 0 0,
    65.62% 19.17%, 66.54% 20.06%, 66.91% 23.01%, 67.28% 29.79%,
    67.47% 38.64%, 67.28% 42.48%, 66.73% 43.66%, 63.40% 44.25%,
    61.92% 43.95%, 61.37% 42.77%, 61.37% 40.41%, 62.29% 34.22%,
    63.22% 26.84%, 64.14% 22.12%, 64.88% 20.06%, 65.62% 19.17%
  );
}
