/* Elements and Bootstrap defaults, driven by tokens.css. */
html, body { font-family: var(--ea-font-body); }
body { background: var(--ea-paper); color: var(--ea-text); }

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { font-family: var(--ea-font-heading); font-weight: 600; }
h1:focus { outline: none; }

a { color: var(--ea-link); }

:focus-visible { outline: 2px solid var(--ea-link); outline-offset: 2px; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--ea-link); box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color); }

.content { padding-top: 1.1rem; }

.valid.modified:not([type=checkbox]) { outline: 1px solid var(--bs-success); }
.invalid { outline: 1px solid var(--bs-danger); }
.validation-message { color: var(--bs-danger-text-emphasis); }
.darker-border-checkbox.form-check-input { border-color: var(--ea-text-muted); }
.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder { color: var(--bs-secondary-color); text-align: end; }
.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder { text-align: start; }

.form-control, .form-select { background-color: var(--ea-surface); color: var(--ea-text); border-color: var(--ea-rule); }
.card, .dropdown-menu, .list-group-item, .modal-content { background-color: var(--ea-surface); color: var(--ea-text); border-color: var(--ea-rule); }

/* Bootstrap's fixed light/white helpers follow the theme */
.bg-white { background-color: var(--ea-surface) !important; }
.bg-light, .text-bg-light { background-color: var(--ea-stone) !important; color: var(--ea-text) !important; }
.table-light { --bs-table-bg: var(--ea-stone); --bs-table-color: var(--ea-text); --bs-table-border-color: var(--ea-rule); }

:root[data-theme="dark"] {
    .navbar-toggler-icon, .btn-close { filter: invert(1); }
    .form-select { --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23efe9df' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); }
}

/* Header theme switch: shows the icon of the theme you would switch to */
.theme-toggle { color: var(--ea-text); border: 0; line-height: 1; }
.theme-icon-sun, :root[data-theme="dark"] .theme-icon-moon { display: none; }
:root[data-theme="dark"] .theme-icon-sun { display: inline; }

@media print {
    header.site-header, footer.site-footer, .no-print, #blazor-error-ui { display: none !important; }
    main { padding: 0 !important; }
}

/* Bootstrap's stock danger red and grey miss 4.5:1 on the warm surfaces; these follow the theme's text tokens */
.text-danger { color: var(--bs-danger-text-emphasis) !important; }
.text-secondary { color: var(--ea-text-muted) !important; }
.btn-outline-danger { --bs-btn-color: var(--bs-danger-text-emphasis); --bs-btn-border-color: var(--bs-danger-text-emphasis); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #b02a37; --bs-btn-hover-border-color: #b02a37; }
