/* Loaded last in both public and administrative layouts. */
:root {
  color-scheme: light;
  --theme-surface: #fff;
  --theme-raised: #edf1e7;
  --theme-text: #213d34;
  --theme-line: #d9ded4;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #121722;
  --ink: #e8edf5;
  --muted: #a9b4c6;
  --green: #3c5278;
  --line: #3b485e;
  --white: #1b2331;
  --theme-surface: #1b2331;
  --theme-raised: #273244;
  --theme-text: #e8edf5;
  --theme-line: #3b485e;
  --theme-accent: #c9dca6;
  --theme-warm: #f2c18d;
  --theme-danger: #f2aa97;
  /* Administrative layouts use their own palette names. */
  --bg: var(--paper);
  --panel: var(--theme-surface);
  --panel-2: var(--theme-raised);
  --text: var(--ink);
  --stroke: var(--line);
  --accent: var(--green);
  --accent-2: var(--theme-accent);
}
.theme-toggle {
  display: inline-grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid var(--theme-line);
  border-radius: 12px;
  background: var(--theme-surface);
  color: var(--theme-text);
  cursor: pointer;
}
.theme-toggle[hidden] { display: none; }
.theme-toggle svg { display: block; width: 22px; height: 22px; }
.theme-toggle .theme-sun, [data-theme="dark"] .theme-toggle .theme-moon { display: none; }
[data-theme="dark"] .theme-toggle .theme-sun { display: block; }
/* Reveal the new page from the toggle, with the previous palette underneath. */
html[data-theme-transition="reveal"]::view-transition { pointer-events: none; }
html[data-theme-transition="reveal"]::view-transition-group(root) { animation: none; }
html[data-theme-transition="reveal"]::view-transition-image-pair(root) { isolation: isolate; }
html[data-theme-transition="reveal"]::view-transition-old(root),
html[data-theme-transition="reveal"]::view-transition-new(root) { mix-blend-mode: normal; }
html[data-theme-transition="reveal"]::view-transition-old(root) { animation: none; z-index: 1; }
html[data-theme-transition="reveal"]::view-transition-new(root) {
  z-index: 2;
  animation: theme-reveal 640ms cubic-bezier(.22, 1, .36, 1) both;
}
html[data-theme-transition="fade"], html[data-theme-transition="fade"] * {
  transition: background-color 300ms ease, color 300ms ease, border-color 300ms ease;
}
html[data-theme-transition] .theme-toggle svg { animation: theme-icon-turn 500ms cubic-bezier(.22, 1, .36, 1) both; }
@keyframes theme-reveal {
  from { clip-path: circle(0px at var(--theme-reveal-x) var(--theme-reveal-y)); }
  to { clip-path: circle(var(--theme-reveal-radius) at var(--theme-reveal-x) var(--theme-reveal-y)); }
}
@keyframes theme-icon-turn {
  from { opacity: .4; transform: rotate(-70deg) scale(.65); }
  to { opacity: 1; transform: rotate(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  html[data-theme-transition]::view-transition-old(root),
  html[data-theme-transition]::view-transition-new(root),
  html[data-theme-transition] .theme-toggle svg { animation: none !important; }
  html[data-theme-transition="fade"], html[data-theme-transition="fade"] * { transition: none !important; }
}
.theme-toggle:focus-visible { outline: 3px solid #719453; outline-offset: 3px; }
@media (hover: hover) { .theme-toggle:hover { background: var(--theme-raised); } }
.site-header { column-gap: 24px; }
@media (min-width: 721px) { .site-header .language-switch { margin-left: auto; } }
@media (max-width: 720px) {
  .site-header { grid-template-columns: minmax(0, 1fr) auto auto; column-gap: 10px; }
  .site-header > .theme-toggle { grid-column: 3; grid-row: 1; }
  .admin-header-top { gap: 10px; }
}

/* Surfaces, inputs and navigation keep the same layout in either theme. */
[data-theme="dark"] :is(.search-panel, .event-card, .booking-card, .login-card,
  .map-panel, .map-selection, .source-info, .setup-form, .personal-notice,
  .language-switch, .view-switch, .save-button, .event-save-button,
  .quick-plans a, .app-card, .android-app .app-settings,
  .detail-main .event-location, .event-location-label) {
  background: var(--theme-surface);
  border-color: var(--line);
}
[data-theme="dark"] :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  color: var(--ink);
  background-color: var(--theme-surface);
  border-color: var(--line);
}
[data-theme="dark"] :is(input, textarea)::placeholder { color: var(--muted); }
[data-theme="dark"] :is(.search-redesign .search-input, .date-field--localized,
  .city-choice, .personal-panel, .personal-empty, .interest-reason, .empty-state,
  .count, .mobile-results-toolbar, .mobile-results-toolbar a,
  .card-bottom > a, .search-redesign #city-search, .city-entry .text-button,
  .search-filters > summary) {
  background: var(--theme-raised);
  border-color: var(--line);
}
/* Keep unselected interest surfaces separate from the group with ID selectors,
   whose specificity would otherwise override the checked state below. */
[data-theme="dark"] .preference-options .filter-chip input:not(:checked) + span {
  background: var(--theme-raised);
  border-color: var(--line);
}
[data-theme="dark"] :is(.card-bottom, .search-options, .review-card, .review-form,
  .event-facts dl > div, .youtube-card, .app-building-note) { border-color: var(--line); }
[data-theme="dark"] :is(.hero h1 em, .card-date, .card-map-link:hover,
  .personal-result-label, .interest-reason, .search-filters > summary,
  .search-redesign .location-message, .event-location-label, .city-note,
  .city-motion-toggle, .app-install, .apps-intro .eyebrow) { color: var(--theme-accent); }
[data-theme="dark"] :is(.save-button, .event-save-button, .saved-nav-link > .heart-icon,
  .mobile-language) { color: var(--ink); }
[data-theme="dark"] .app-description { color: var(--muted); }
[data-theme="dark"] :is(.wordmark i, .admin-wordmark i, .empty-symbol,
  .setup-decoration span, .app-ready-sticker, .type-icon) { color: #213d34; }
[data-theme="dark"] :is(.price-pill, .demo-label, .app-phone, .detail-placeholder) { color: #213d34; }
[data-theme="dark"] .app-badge { background: var(--theme-raised); color: var(--theme-accent); }
[data-theme="dark"] :is(.app-badge-building, .status-pill, .notice) {
  background: #3c3022;
  color: var(--theme-warm);
  border-color: #6c5335;
}
[data-theme="dark"] .app-building-note { color: var(--theme-warm); }
[data-theme="dark"] :is(.source-age, .event-loader[data-error="true"] .event-load-status) { color: var(--theme-warm); }
[data-theme="dark"] :is(.city-note, .skip-link) { background: var(--theme-surface); border-color: var(--line); }
[data-theme="dark"] :is(.button-light:hover, .city-choice:hover, .city-motion-toggle:hover) {
  background: var(--theme-raised);
  border-color: var(--theme-accent);
}
[data-theme="dark"] :is(.button-dark:hover, .btn.primary:hover, .app-download:hover) {
  background: #48638e;
}
[data-theme="dark"] .youtube-play { background: var(--green); }
[data-theme="dark"] :is(.filter-chip input:checked + span,
  .search-filters[open] > summary, .view-switch button.active,
  .language-switch button[aria-pressed="true"]) {
  color: #fff;
  background: var(--green);
  border-color: #719453;
}
[data-theme="dark"] :is(.quick-plans a[aria-current], .free-filter input:checked + span) {
  background: var(--lime);
  color: #213d34;
}
[data-theme="dark"] :is(.save-button.is-saved, .event-save-button.is-saved,
  .save-button:hover, .event-save-button:hover) {
  color: var(--theme-danger);
  background: #422d28;
  border-color: #805449;
}
[data-theme="dark"] .saved-nav-link[aria-current="page"] > .heart-icon { color: var(--theme-danger); }
[data-theme="dark"] .search-redesign #radius-select,
[data-theme="dark"] .mobile-language {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23e8edf5' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
}
[data-theme="dark"] :is(.search-free input, .interest-visible input) { accent-color: var(--theme-accent); }
[data-theme="dark"] :is(a, button, input, select, textarea, summary):focus-visible { outline-color: var(--theme-accent); }
[data-theme="dark"] .toast { background: var(--theme-raised); border: 1px solid var(--line); color: var(--ink); }
@media (max-width: 720px) {
  [data-theme="dark"] .site-header nav { background: var(--theme-surface); border-color: var(--line); }
  [data-theme="dark"] .site-header nav a[aria-current] { background: var(--theme-raised); }
}

/* Keep map tiles and photos intact; adapt the surrounding controls and labels. */
[data-theme="dark"] :is(#results-map, .event-location-map, .map, .panorama-frame) { background: var(--theme-raised); }
[data-theme="dark"] :is(.leaflet-bar a, .leaflet-control-layers,
  .leaflet-popup-content-wrapper, .leaflet-popup-tip) { background: var(--theme-surface); color: var(--ink); }
[data-theme="dark"] .leaflet-bar a { border-color: var(--line); }
[data-theme="dark"] .leaflet-bar a:hover { background: var(--theme-raised); }
[data-theme="dark"] .leaflet-control-attribution { background: var(--theme-surface); color: var(--muted); }
[data-theme="dark"] .leaflet-control-attribution a { color: var(--theme-accent); }

/* Shared administrative pages, including import and event editing. */
[data-theme="dark"] :is(.admin-header, .section, .form-card, .card, .map-card,
  .btn, .input, .file-upload .file-picker, .results-list .event-card,
  .menu-panel, .admin-tool) { background: var(--theme-surface); border-color: var(--line); }
[data-theme="dark"] :is(.admin-nav, .type-card, .type-collapse, .file-thumb,
  .media-item, .file-upload, .map-fallback, .import-file, .import-format pre,
  .import-counts > span, .admin-header .menu-toggle, .results-fullscreen) {
  background: var(--theme-raised);
  border-color: var(--line);
}
[data-theme="dark"] :is(.btn:hover, .admin-tool:hover, .admin-nav-link:hover,
  .file-upload .file-picker:hover) { background: var(--theme-raised); }
[data-theme="dark"] .btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
[data-theme="dark"] :is(.btn.secondary, .btn.active,
  .admin-header .menu-details[open] .menu-toggle) { background: var(--lime); color: #213d34; }
[data-theme="dark"] .admin-nav-link.active,
[data-theme="dark"] .admin-nav-link.active:hover {
  background: var(--theme-accent);
  border-color: var(--theme-accent);
  color: #1b2331;
  font-weight: 700;
  box-shadow: none;
}
[data-theme="dark"] :is(.link, .event-date, .import-format summary,
  .import-row summary, .import-counts b, .import-changes, .copy-feedback) { color: var(--theme-accent); }
[data-theme="dark"] :is(.banner, .status.ok, .interest-notice, #copy-prompt[data-state="success"]) {
  background: #263b2e;
  color: var(--theme-accent);
  border-color: #52684a;
}
[data-theme="dark"] :is(.status.warn, .import-warning) {
  background: #3c3022;
  color: var(--theme-warm);
  border-color: #6c5335;
}
[data-theme="dark"] :is(.btn.danger, .status.off, .file-remove, .lightbox-close,
  .import-error, .interest-error, .admin-logout:hover) {
  background: #422d28;
  color: var(--theme-danger);
  border-color: #805449;
}
[data-theme="dark"] :is(.table th, .table td, .admin-nav, .results-header) { border-color: var(--line); }
