/* Shared light design for all application pages. Page layouts, data visualisations
   and status meanings stay with their owning components. Loaded after page CSS,
   before the more specific home / whisky refinements in lighter-design.css. */
html:not([data-color-theme="dark"]) {
    color-scheme: only light;
    --site-line: #ded8cf;
    --success: #226d49;
    --danger: #a52e30;
    --warning: #805a10;
    --info: #256282;
    --bs-body-color: var(--text);
    --bs-body-bg: var(--bg-solid);
    --bs-border-color: var(--site-line);
    --bs-secondary-color: var(--muted);
    --bs-tertiary-bg: var(--bg-darker);
    --bs-primary: var(--gold);
    --font-body: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-heading: 'Spectral', Georgia, serif;
}

/* Typography and reusable Bootstrap components, including older templates. */
html:not([data-color-theme="dark"]) :is(h2, h3, h4, h5, h6) {
    font-family: var(--font-body);
    color: var(--text);
    letter-spacing: -.015em;
    line-height: 1.3;
}
html:not([data-color-theme="dark"]) h1 { line-height: 1.12; overflow-wrap: anywhere; }
html:not([data-color-theme="dark"]) :is(.card, .wk-card, .modal-content, .accordion-item, .list-group-item) {
    background: var(--surface);
    color: var(--text);
    border-color: var(--site-line) !important;
    box-shadow: none;
}
html:not([data-color-theme="dark"]) :is(.card, .wk-card) {
    border-radius: var(--radius-lg);
    transform: none;
}
html:not([data-color-theme="dark"]) :is(.card, .wk-card)::before { content: none; }
html:not([data-color-theme="dark"]) :is(.card-header, .card-footer, .modal-header, .modal-footer, .accordion-button) {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-color: var(--site-line) !important;
    font-family: var(--font-body);
    box-shadow: none;
}
html:not([data-color-theme="dark"]) .accordion-button:not(.collapsed) { background: var(--gold-light) !important; }
html:not([data-color-theme="dark"]) .border-gold { border-color: var(--site-line) !important; }
html:not([data-color-theme="dark"]) :is(.btn-secondary, .btn-outline-light, .btn-outline-secondary, .btn-ghost, .btn-wk-ghost) {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--site-line);
    box-shadow: none;
}
html:not([data-color-theme="dark"]) :is(.btn-secondary, .btn-outline-light, .btn-outline-secondary, .btn-ghost, .btn-wk-ghost):hover {
    background: var(--bg-darker);
    color: var(--text);
    border-color: var(--gold);
}
html:not([data-color-theme="dark"]) :is(.btn-ghost, .btn-wk-ghost)::after { content: none; }
html:not([data-color-theme="dark"]) :is(.form-control, .form-select, .input-group-text,
    input[type="text"], input[type="email"], input[type="password"], input[type="search"],
    input[type="url"], input[type="number"], input[type="date"], input[type="datetime-local"], textarea, select) {
    background-color: var(--surface) !important;
    color-scheme: only light;
    color: var(--text) !important;
    border: 1px solid var(--site-line) !important;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    box-shadow: none;
}
html:not([data-color-theme="dark"]) :is(.form-control, .form-select):focus {
    border-color: var(--gold) !important;
    outline: 2px solid var(--gold);
    outline-offset: 2px;
    box-shadow: none;
}
html:not([data-color-theme="dark"]) :is(.form-control, .form-select):disabled,
html:not([data-color-theme="dark"]) .form-control[readonly] { background-color: var(--bg-darker) !important; }
html:not([data-color-theme="dark"]) .form-control::placeholder { color: var(--muted); opacity: 1; font-style: normal; }
html:not([data-color-theme="dark"]) :is(.form-control, .form-select).is-invalid { border-color: var(--danger) !important; }
html:not([data-color-theme="dark"]) :is(.form-control, .form-select).is-valid { border-color: var(--success) !important; }
html:not([data-color-theme="dark"]) .form-check-input { border-color: var(--muted); }
html:not([data-color-theme="dark"]) .form-check-input:checked { background-color: var(--gold); border-color: var(--gold); }
html:not([data-color-theme="dark"]) :is(.text-muted, .text-white-50) { color: var(--muted) !important; }
html:not([data-color-theme="dark"]) :is(.form-label, label.text-gold) { color: var(--text) !important; }

/* Tables retain horizontal scrolling where the data needs it. */
html:not([data-color-theme="dark"]) :is(.table, .table-dark) {
    --bs-table-color: var(--text);
    --bs-table-bg: var(--surface);
    --bs-table-border-color: var(--site-line);
    --bs-table-striped-bg: var(--bg-solid);
    --bs-table-striped-color: var(--text);
    --bs-table-hover-bg: var(--gold-light);
    --bs-table-hover-color: var(--text);
    --bs-table-active-bg: var(--gold-light);
    --bs-table-active-color: var(--text);
    color: var(--text);
    border-color: var(--site-line);
}
html:not([data-color-theme="dark"]) .table > thead > tr > th {
    background: var(--bg-solid);
    color: var(--text-secondary);
    border-color: var(--site-line);
    font-family: var(--font-body);
    font-weight: 600;
}
html:not([data-color-theme="dark"]) .page-link { background: var(--surface) !important; color: var(--gold-strong) !important; border-color: var(--site-line) !important; }
html:not([data-color-theme="dark"]) .page-item.active .page-link { background: var(--gold) !important; color: #fff !important; }
html:not([data-color-theme="dark"]) .page-item.disabled .page-link { background: var(--bg-darker) !important; color: var(--muted) !important; }

/* Quiet headings across directories, personal tools, editorial pages and admin. */
html:not([data-color-theme="dark"]) :is(
    .distillery-directory-hero, .distillery-resume-hero, .bottler-page-hero,
    .whiskybar-page-hero, .quick-rating-hero, .rating-page-hero, .resume-hero,
    .about-hero, .performance-hero, .learn-hero, .release-detail-header,
    .news-editor-hero, .event-editor-hero, .global-search-page-hero
) {
    min-height: 0;
    padding: .5rem 0 1.5rem;
    margin-bottom: 1.5rem;
    border: 0;
    border-bottom: 1px solid var(--site-line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
html:not([data-color-theme="dark"]) :is(
    .distillery-directory-hero, .distillery-resume-hero, .bottler-page-hero,
    .whiskybar-page-hero, .quick-rating-hero, .rating-page-hero, .resume-hero,
    .about-hero, .performance-hero, .learn-hero, .release-detail-header,
    .news-editor-hero, .event-editor-hero, .global-search-page-hero
) h1 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 500; line-height: 1.15; }
html:not([data-color-theme="dark"]) :is(
    .distillery-directory-hero, .distillery-resume-hero, .bottler-page-hero,
    .whiskybar-page-hero, .quick-rating-hero, .rating-page-hero, .resume-hero,
    .about-hero, .learn-hero
)::after { content: none; }
html:not([data-color-theme="dark"]) :is(
    .distillery-directory-hero-mark, .distillery-resume-hero-mark, .bottler-page-hero-mark,
    .whiskybar-page-hero-mark, .quick-rating-hero-mark, .rating-page-hero-mark,
    .resume-hero-mark, .register-intro-mark
) { display: none; }
html:not([data-color-theme="dark"]) :is(
    .distillery-directory-hero, .distillery-resume-hero, .bottler-page-hero,
    .whiskybar-page-hero, .quick-rating-hero, .rating-page-hero, .resume-hero
) { grid-template-columns: minmax(0, 1fr); }

/* Named content surfaces: don't target arbitrary *-card classes (some are states
   or grid wrappers), and leave charts, photo overlays and map markers intact. */
html:not([data-color-theme="dark"]) :is(
    .distillery-card, .distillery-resume-toc, .distillery-resume-side-card, .distillery-resume-article,
    .distillery-production-card, .distillery-admin-card, .distillery-create-submit-card,
    .bottler-panel, .bottler-form-card, .whiskybar-card, .whiskybar-panel,
    .whiskybar-review-card, .whiskybar-form-card, .whiskybar-admin-card,
    .collection-summary-card, .collection-search-panel, .collection-overview-panel,
    .dashboard-stat-card, .dashboard-complete-panel, .dashboard-panel, .dashboard-recommendation-card,
    .wishlist-summary-card, .wishlist-item-card, .shared-collections-panel, .shared-collection-card,
    .sharing-setting-panel, .sharing-viewers-panel, .sharing-viewer-card,
    .quick-rating-panel, .quick-score-card, .quick-optional-panel, .quick-dictation-dock, .rating-whisky-card,
    .add-whisky-panel, .add-whisky-save-progress-card, .resume-panel, .resume-toggle-card,
    .report-form-card, .report-details-panel, .news-card, .news-form-section,
    .release-card, .release-form-section, .release-admin-section, .event-card, .event-form-section,
    .calendar-toolbar, .lexicon-card, .help-intro-card, .about-feature, .about-collection, .about-cta,
    .learn-cask-card, .learn-quick-start, .learn-country-card, .learn-exercise,
    .mail-admin-card, .mail-group-panel, .ai-pricing-card, .ai-usage-section,
    .scan-log-card, .scan-log-data-panel, .user-log-card, .user-log-detail-panel,
    .whiskybot-log-card, .image-admin-card, .image-review-card, .analytics-journey-card,
    .wk-admin-overview-group, .global-search-card, .global-search-page-form, .global-search-starters
) {
    background: var(--surface);
    border-color: var(--site-line);
    border-radius: var(--radius-lg);
    box-shadow: none;
}
html:not([data-color-theme="dark"]) :is(
    .distillery-card-trigger, .bottler-card .distillery-card-trigger, .whiskybar-form-card-header,
    .bottler-form-card-header, .rating-whisky-header, .scan-log-card-header, .whiskybot-card-header,
    .user-log-card-main, .mail-card-header, .distillery-admin-card-header, .ai-pricing-card-header,
    .wishlist-item-header
) { background: transparent; border-color: var(--site-line); box-shadow: none; }
html:not([data-color-theme="dark"]) :is(
    .distillery-card, .whiskybar-card, .release-card, .news-card, .event-card,
    .shared-collection-card, .lexicon-card, .wishlist-item-card, .about-feature
):hover { transform: none; box-shadow: var(--shadow); border-color: var(--gold); }
html:not([data-color-theme="dark"]) :is(
    .ai-pricing-summary article, .ai-usage-primary-stats article, .scan-log-stats article,
    .user-log-stats article, .whiskybot-log-stats article, .user-admin-summary > div
) { background: var(--surface); border-color: var(--site-line); box-shadow: none; }

/* Forms and authentication. Keep success/error signals distinct from decoration. */
html:not([data-color-theme="dark"]) .register-layout { border-color: var(--site-line); border-radius: var(--radius-lg); box-shadow: none; }
html:not([data-color-theme="dark"]) .register-intro { background: var(--bg-solid); padding: clamp(1.25rem, 3vw, 2.5rem); }
html:not([data-color-theme="dark"]) .register-page::before,
html:not([data-color-theme="dark"]) .register-intro::after { content: none; }
html:not([data-color-theme="dark"]) .register-intro h1 { font-size: clamp(2rem, 3.5vw, 2.8rem); }
html:not([data-color-theme="dark"]) :is(.alert-success, #quick-alert.alert-success) { color: #205b3d !important; background: #eaf4ee !important; border-color: #accdb9 !important; }
html:not([data-color-theme="dark"]) :is(.alert-danger, .register-alert-danger) { color: #87282a !important; background: #fbeeed !important; border-color: #e4b7b6 !important; }
html:not([data-color-theme="dark"]) .alert-warning { color: #765311 !important; background: #fff5dc !important; border-color: #e1ca92 !important; }
html:not([data-color-theme="dark"]) .alert-info { color: #265d77 !important; background: #edf5f9 !important; border-color: #b8d0dc !important; }
html:not([data-color-theme="dark"]) .badge.bg-warning { color: #765311 !important; background-color: #fff0c9 !important; }
html:not([data-color-theme="dark"]) .badge.bg-info { color: #265d77 !important; background-color: #e2eff5 !important; }
html:not([data-color-theme="dark"]) .quick-score-fade-top { background: linear-gradient(var(--surface), transparent); }
html:not([data-color-theme="dark"]) .quick-score-fade-bottom { background: linear-gradient(transparent, var(--surface)); }
html:not([data-color-theme="dark"]) :is(#quickUploadModal, #quickUrlModal) .modal-content { background: var(--surface); }
html:not([data-color-theme="dark"]) :is(.resume-log-body, .resume-log .card-body, #progress-log .card-body) { background: var(--bg-solid) !important; color: var(--text) !important; }
html:not([data-color-theme="dark"]) :is(.editor-toolbar, .CodeMirror, .editor-preview, .editor-preview-side, .select2-dropdown, .select2-selection) {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-color: var(--site-line) !important;
}
html:not([data-color-theme="dark"]) .CodeMirror-cursor { border-left-color: var(--text); }
html:not([data-color-theme="dark"]) .select2-container--default .select2-selection__rendered { color: var(--text); }

/* Map chrome, dialogs and search overlays use the same surfaces. Geographic
   categories and credits over photos retain their own contrasting colours. */
html:not([data-color-theme="dark"]) :is(
    .map-toolbar, .map-filter-panel, .map-detail-panel, .map-results-panel,
    .map-result-summary, .map-panel-close, .map-filter-section, .nearby-header,
    .experience-dialog, .experience-locality-picker, .experience-locality-results,
    .global-search-submit-panel, .global-search-dialog, .action-confirm__surface,
    .action-feedback, .pwa-install-help, .pwa-update-banner
) { background: var(--surface); color: var(--text); border-color: var(--site-line); box-shadow: var(--shadow); }
html:not([data-color-theme="dark"]) :is(.experience-form input, .experience-form textarea, .experience-form select, .experience-filters input, .experience-filters select) {
    background: var(--surface); color: var(--text); border-color: var(--site-line);
}
html:not([data-color-theme="dark"]) .experience-image-controls [aria-pressed=true] { color: #fff; }
html:not([data-color-theme="dark"]) :is(.map-filter-count, .map-exit-fullscreen, .map-result-type-mark, .map-place-type, .map-toolbar-toggle),
html:not([data-color-theme="dark"]) .map-page .map-popup-release,
html:not([data-color-theme="dark"]) .map-page .map-popup-release a,
html:not([data-color-theme="dark"]) .nearby-tabs .btn[aria-selected="true"],
html:not([data-color-theme="dark"]) .map-page .popup-close-btn:is(:hover, :focus-visible),
html:not([data-color-theme="dark"]) :is(.map-filter-chip, .map-panel-close, .map-toolbar-close):is(:hover, :focus-visible) { color: #fff; }
html:not([data-color-theme="dark"]) :is(.pwa-install-help button, .pwa-update-banner__apply) { color: #fff; background: var(--gold); border-color: var(--gold); border-radius: var(--radius-sm); }
html:not([data-color-theme="dark"]) .pwa-update-banner__dismiss { color: var(--text); }
html:not([data-color-theme="dark"]) .permission-mail-plain { background: var(--bg-darker); color: var(--text); }
html:not([data-color-theme="dark"]) .analytics-consent {
    background: var(--surface); color: var(--text); border-color: var(--site-line);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-xl);
}
html:not([data-color-theme="dark"]) .analytics-consent__accept { color: #fff; background: var(--gold); border-color: var(--gold); }
html:not([data-color-theme="dark"]) .analytics-consent__decline { color: var(--text); border-color: var(--site-line); }
html:not([data-color-theme="dark"]) .analytics-consent__details { background: var(--bg-solid); border-color: var(--site-line); }
html:not([data-color-theme="dark"]) .analytics-consent__status.is-error { color: var(--danger); }
html:not([data-color-theme="dark"]) #quick-alert:not(.alert-success) { color: #87282a; background: #fbeeed; border-color: #e4b7b6; }
html:not([data-color-theme="dark"]) :is(.speech-section-btn.active, .speech-section-btn.btn-gold,
    .global-search-modal-submit, .global-search-submit-stages .is-active .global-search-submit-step,
    .global-search-page-numbers a:is(:hover, :focus-visible, .is-current), .global-search-feedback .is-active) { color: #fff; }
html:not([data-color-theme="dark"]) :is(.global-search-complete-icon,
    .global-search-submit-stages .is-complete .global-search-submit-step,
    .activity-job--completed .activity-job__status) { color: var(--success); }
html:not([data-color-theme="dark"]) :is(.activity-center__empty--error, .activity-job--failed .activity-job__status, .activity-job__error) { color: var(--danger); }
html:not([data-color-theme="dark"]) .wk-activity-badge { background: var(--gold); color: #fff; }
html:not([data-color-theme="dark"]) :is(.collection-overview-count, .collection-filter-panel-count, .dashboard-status-row strong, .release-type,
    .news-featured-label, .home-news-media > span, .home-release-media > span,
    .performance-period a.is-active, .wishlist-priority-medium),
html:not([data-color-theme="dark"]) .add-whisky-progress .is-active b,
html:not([data-color-theme="dark"]) .collection-card-rating-action:is(:hover, :focus-visible),
html:not([data-color-theme="dark"]) .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable { color: #fff; }
html:not([data-color-theme="dark"]) .event-agent-workspace { --line: var(--site-line); }
html:not([data-color-theme="dark"]) .wk-admin-workspace { --admin-border: var(--site-line); }
html:not([data-color-theme="dark"]) .distillery-resume-page { --resume-border: var(--site-line); }
html:not([data-color-theme="dark"]) .image-admin-page { --image-line: var(--site-line); }

/* Custom actions and panels used outside Bootstrap. */
html:not([data-color-theme="dark"]) :is(.user-admin-create, .mail-send-action,
    .ai-pricing-setting-form button, .ai-pricing-model-form footer button, .ai-pricing-refresh) {
    background: var(--gold); color: #fff; border-color: var(--gold);
    border-radius: var(--radius-sm); box-shadow: none;
}
html:not([data-color-theme="dark"]) :is(.user-admin-create, .mail-send-action,
    .ai-pricing-setting-form button, .ai-pricing-model-form footer button, .ai-pricing-refresh):hover {
    background: var(--gold-strong); color: #fff; transform: none;
}
html:not([data-color-theme="dark"]) :is(.dashboard-next-action, .news-card-copy,
    .distillery-admin-selector, .distillery-admin-workspace-empty, .wk-mobile-collection) {
    background: var(--surface); border-color: var(--site-line); box-shadow: none;
}
html:not([data-color-theme="dark"]) .distillery-directory.help-page .help-intro-card {
    background: var(--surface); border-color: var(--site-line); box-shadow: none;
}
html:not([data-color-theme="dark"]) .collection-page .collection-bottle {
    background: var(--surface); border-color: var(--site-line); box-shadow: none;
}

/* Allow the wordmark to wrap when mobile text is enlarged. */
@media (max-width: 767.98px) {
    .wk-navbar .navbar-brand { min-width: 0; max-width: calc(100% - 70px); white-space: normal; }
    .wk-navbar .wk-brand-name { min-width: 0; overflow-wrap: anywhere; line-height: 1.2; }
}

@media (max-width: 767.98px) {
    html:not([data-color-theme="dark"]) :is(
        .distillery-directory-hero, .distillery-resume-hero, .bottler-page-hero,
        .whiskybar-page-hero, .quick-rating-hero, .rating-page-hero, .resume-hero,
        .about-hero, .performance-hero, .learn-hero, .release-detail-header,
        .news-editor-hero, .event-editor-hero, .global-search-page-hero
    ) { padding-block: .25rem 1rem; margin-bottom: 1rem; gap: 1rem; }
    html:not([data-color-theme="dark"]) .register-intro { padding: 1.25rem; }
}
