/**
 * Restyles vendored Bootstrap 5.3.3 to the SMN brand palette/typography.
 * Loaded after bootstrap.min.css.
 *
 * Two tiers, because Bootstrap bakes hover/active/focus shades into each
 * component's own local custom properties at Sass-compile time — root
 * overrides alone do NOT reach .btn-primary, .form-control:focus,
 * .form-check-input:checked, or .pagination (confirmed by inspecting the
 * vendored bootstrap.min.css directly: these use literal hex, not var()).
 * Tier 1 (root) covers everything that genuinely does cascade via var():
 * links, .text-bg-primary, .alert-*, .focus-ring-*.
 */

:root {
	/* Brand color system */
	--bs-primary: #283b91;
	--bs-primary-rgb: 40, 59, 145;
	--bs-primary-text-emphasis: #1a2760;
	--bs-primary-bg-subtle: #e1e4f5;
	--bs-primary-border-subtle: #b7bfe0;

	--bs-success: #1e7e34;
	--bs-success-rgb: 30, 126, 52;
	--bs-success-text-emphasis: #0f4d1f;
	--bs-success-bg-subtle: #e6f4ea;
	--bs-success-border-subtle: #b8dfc2;

	--bs-warning: #a86400;
	--bs-warning-rgb: 168, 100, 0;
	--bs-warning-text-emphasis: #6b4000;
	--bs-warning-bg-subtle: #fdf3e3;
	--bs-warning-border-subtle: #f0d4a8;

	--bs-danger: #b3261e;
	--bs-danger-rgb: 179, 38, 30;
	--bs-danger-text-emphasis: #7a1a14;
	--bs-danger-bg-subtle: #fbe9e7;
	--bs-danger-border-subtle: #eab8b3;

	/* Glassline neutrals (designdotmd "glassline", SMN-hybrid): fog-grey
	   foundation, near-black text, one reserved accent — which for this
	   portal is SMN blue, not Glassline's cobalt. Headings stay serif per
	   the client's academic tone; Geist carries body/UI text. */
	--bs-body-color: #0f1419;
	--bs-body-bg: #f1f3f5;
	--bs-secondary-color: #4a5568;
	--bs-border-color: #e3e7eb;
	--bs-body-font-family: 'Geist', 'Segoe UI', system-ui, -apple-system, sans-serif;
	--bs-body-font-size: 0.95rem;
	--bs-body-line-height: 1.55;

	--bs-link-color: #283b91;
	--bs-link-color-rgb: 40, 59, 145;
	--bs-link-hover-color: #1f2f74;
	--bs-link-hover-color-rgb: 31, 47, 116;

	--bs-focus-ring-color: rgba(40, 59, 145, 0.25);
	--bs-border-radius: 10px;
	--bs-border-radius-lg: 16px;
	--bs-border-radius-sm: 6px;
}

/* Flat surfaces: cards sit on the neutral foundation with a hairline
   border, not a drop shadow (Glassline is flat on purpose). */
.card {
	--bs-card-border-radius: 16px;
	--bs-card-inner-border-radius: 15px;
	--bs-card-border-color: #e3e7eb;
}

/* ── Dark mode ───────────────────────────────────────────────────
   Bootstrap 5.3 flips its components off data-bs-theme="dark"; these
   re-declarations must come AFTER the light :root block above (which
   would otherwise win the cascade over Bootstrap's own dark values).
   Same Glassline structure, inverted: near-black foundation, graphite
   surfaces, SMN accent lightened where it sits on dark ground. */
:root[data-bs-theme='dark'] {
	--bs-body-bg: #0e1116;
	--bs-body-color: #e7eaee;
	--bs-secondary-color: #98a2ad;
	--bs-border-color: #2a313a;

	--bs-link-color: #8b9ce8;
	--bs-link-color-rgb: 139, 156, 232;
	--bs-link-hover-color: #a9b6ef;
	--bs-link-hover-color-rgb: 169, 182, 239;

	--bs-focus-ring-color: rgba(139, 156, 232, 0.3);

	--bs-primary-bg-subtle: #1a2233;
	--bs-primary-border-subtle: #2c3a5e;
	--bs-primary-text-emphasis: #b6c2e8;
}

[data-bs-theme='dark'] .card {
	--bs-card-bg: #171b21;
	--bs-card-border-color: #2a313a;
	--bs-card-color: #e7eaee;
}

[data-bs-theme='dark'] .form-control,
[data-bs-theme='dark'] .form-select {
	background-color: #1a1f26;
	border-color: #313a45;
	color: #e7eaee;
}

[data-bs-theme='dark'] .form-control::placeholder {
	color: #6b7684;
}

[data-bs-theme='dark'] .form-control:focus,
[data-bs-theme='dark'] .form-select:focus {
	border-color: #8b9ce8;
	box-shadow: 0 0 0 3px rgba(139, 156, 232, 0.18);
}

[data-bs-theme='dark'] .table {
	--bs-table-color: #e7eaee;
	--bs-table-border-color: #2a313a;
	--bs-table-hover-bg: #1d232b;
	--bs-table-hover-color: #e7eaee;
}

/* Utility classes bake literal colors with !important — retarget them. */
[data-bs-theme='dark'] .bg-white {
	background-color: #171b21 !important;
}

[data-bs-theme='dark'] .bg-light {
	background-color: #12161c !important;
}

[data-bs-theme='dark'] h1,
[data-bs-theme='dark'] h2,
[data-bs-theme='dark'] h3,
[data-bs-theme='dark'] h4,
[data-bs-theme='dark'] h5,
[data-bs-theme='dark'] h6,
[data-bs-theme='dark'] .h1,
[data-bs-theme='dark'] .h2,
[data-bs-theme='dark'] .h3,
[data-bs-theme='dark'] .h4,
[data-bs-theme='dark'] .h5,
[data-bs-theme='dark'] .h6 {
	color: #eef1f4;
}

[data-bs-theme='dark'] .btn-outline-primary {
	--bs-btn-color: #a9b6ef;
	--bs-btn-border-color: #46538f;
	--bs-btn-hover-bg: #283b91;
	--bs-btn-hover-border-color: #283b91;
	--bs-btn-hover-color: #ffffff;
	--bs-btn-active-bg: #283b91;
	--bs-btn-active-border-color: #283b91;
}

[data-bs-theme='dark'] .dropdown-menu {
	--bs-dropdown-bg: #171b21;
	--bs-dropdown-border-color: #2a313a;
}

h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
	font-family: Georgia, 'Iowan Old Style', 'Palatino Linotype', ui-serif, serif;
	letter-spacing: -0.01em;
	color: #0f1419;
}

/* Tier 2 — components that bake literal hex at build time */

.btn-primary {
	--bs-btn-bg: #283b91;
	--bs-btn-border-color: #283b91;
	--bs-btn-hover-bg: #1f2f74;
	--bs-btn-hover-border-color: #1f2f74;
	--bs-btn-focus-shadow-rgb: 40, 59, 145;
	--bs-btn-active-bg: #1a2760;
	--bs-btn-active-border-color: #1a2760;
	--bs-btn-disabled-bg: #283b91;
	--bs-btn-disabled-border-color: #283b91;
}

.btn-outline-primary {
	--bs-btn-color: #283b91;
	--bs-btn-border-color: #283b91;
	--bs-btn-hover-bg: #283b91;
	--bs-btn-hover-border-color: #283b91;
	--bs-btn-active-bg: #283b91;
	--bs-btn-active-border-color: #283b91;
	--bs-btn-disabled-color: #283b91;
	--bs-btn-disabled-border-color: #283b91;
}

.btn-danger {
	--bs-btn-bg: #b3261e;
	--bs-btn-border-color: #b3261e;
	--bs-btn-hover-bg: #8f1e18;
	--bs-btn-hover-border-color: #8f1e18;
	--bs-btn-focus-shadow-rgb: 179, 38, 30;
	--bs-btn-active-bg: #7a1a14;
	--bs-btn-active-border-color: #7a1a14;
}

.btn-link {
	--bs-btn-color: #283b91;
	--bs-btn-hover-color: #1f2f74;
}

/* Glassline input surface: generous padding, 1.5px hairline, md radius
   (inherited from --bs-border-radius). Small variants keep Bootstrap's
   compact sizing. */
.form-control:not(.form-control-sm),
.form-select:not(.form-select-sm) {
	border: 1.5px solid #dde2e7;
	font-size: 0.95rem;
}

.form-control:not(.form-control-sm) {
	padding: 10px 13px;
}

/* Selects keep Bootstrap's wide right padding — the chevron lives there. */
.form-select:not(.form-select-sm) {
	padding-top: 10px;
	padding-bottom: 10px;
	padding-left: 13px;
}

.form-control:focus,
.form-select:focus {
	border-color: #283b91;
	box-shadow: 0 0 0 3px rgba(40, 59, 145, 0.12);
}

.form-check-input:checked {
	background-color: #283b91;
	border-color: #283b91;
}

.form-check-input:focus {
	border-color: #7c86c4;
	box-shadow: 0 0 0 0.25rem rgba(40, 59, 145, 0.25);
}

.pagination {
	--bs-pagination-active-bg: #283b91;
	--bs-pagination-active-border-color: #283b91;
	--bs-pagination-focus-box-shadow: 0 0 0 0.25rem rgba(40, 59, 145, 0.25);
}

.navbar-brand,
.navbar-brand:hover {
	color: #283b91;
}
