:root {
    color-scheme: light;
}

body {
    transition: background-color 180ms ease, color 180ms ease;
}

body.dark-mode {
    color-scheme: dark;
    background-color: #333333;
    color: #f2f2f2;
}

/* Keep every sidebar page below the fixed 48px Bootstrap navbar. */
.container-fluid > .row > [role="main"] {
    padding-top: 4.5rem !important;
}

.navbar-brand {
    display: flex;
    align-items: center;
    height: 48px;
    gap: 0.45rem;
    overflow: hidden;
    padding: 0.3rem 0.6rem;
    background:
        radial-gradient(circle at 88% 0%, rgba(54, 190, 194, 0.2), transparent 42%),
        linear-gradient(135deg, #062c40 0%, #084b5c 100%);
}

.navbar-brand:hover,
.navbar-brand:focus {
    color: #ffffff;
    text-decoration: none;
}

.navbar-brand-lockup__emblem {
    display: block;
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    filter: drop-shadow(0 4px 8px rgba(0, 13, 21, 0.3));
}

.navbar-brand-lockup__wordmark {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    text-shadow: 0 2px 8px rgba(0, 12, 20, 0.45);
}

.navbar-brand-lockup__title {
    max-width: 100%;
    overflow: hidden;
    color: #ffffff;
    font-size: clamp(0.68rem, 1vw, 0.86rem);
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.navbar-brand-lockup__subtitle {
    max-width: 100%;
    margin-top: 0.22rem;
    overflow: hidden;
    color: #b8ebe7;
    font-size: clamp(0.35rem, 0.45vw, 0.43rem);
    font-weight: 750;
    letter-spacing: 0.055em;
    line-height: 1;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.navbar-brand-lockup__rule {
    width: 100%;
    height: 1px;
    margin-top: 0.24rem;
    background: linear-gradient(90deg, #ff765f, #ff9a72 18%, #43c4cc 62%, transparent 100%);
    box-shadow: 0 0 7px rgba(67, 196, 204, 0.32);
}

@media (max-width: 767.98px) {
    .navbar-brand-lockup__title {
        font-size: 0.68rem;
    }

    .navbar-brand-lockup__subtitle {
        display: none;
    }
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    margin-left: auto;
    padding: 0.48rem 0.68rem;
    border: 1px solid rgba(11, 61, 87, 0.16);
    border-radius: 999px;
    background: #ffffff;
    color: #0b3d57;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    line-height: 1.5;
    box-shadow: 0 7px 20px rgba(3, 24, 36, 0.08);
    cursor: pointer;
    transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.theme-toggle__icon {
    width: 1.3rem;
    height: 0.96rem;
    overflow: visible;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.45;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: 0 0 auto;
}

.theme-toggle__track {
    position: relative;
    width: 1.8rem;
    height: 0.82rem;
    border: 1px solid rgba(11, 61, 87, 0.24);
    border-radius: 999px;
    background: linear-gradient(90deg, #ffd08a, #45c5cc 48%, #0d526f);
    box-shadow: inset 0 1px 3px rgba(3, 24, 36, 0.16);
    flex: 0 0 auto;
}

.theme-toggle__knob {
    position: absolute;
    top: 50%;
    left: 0.11rem;
    width: 0.58rem;
    height: 0.58rem;
    border: 1px solid rgba(11, 61, 87, 0.18);
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(3, 24, 36, 0.3);
    transform: translateY(-50%);
    transition: left 180ms ease, background-color 180ms ease;
}

.theme-toggle.is-deep .theme-toggle__knob {
    left: calc(100% - 0.69rem);
}

.theme-toggle__beam {
    fill: rgba(67, 196, 204, 0.18);
    stroke: #26aeb8;
}

.theme-toggle__sun {
    stroke: #ef8d31;
}

.theme-toggle:hover,
.theme-toggle:focus {
    transform: translateY(-1px);
    border-color: rgba(8, 125, 130, 0.34);
    background: #eaf7f7;
    color: #075970;
    text-decoration: none;
}

.theme-toggle:focus-visible {
    outline: 3px solid rgba(8, 125, 130, 0.3);
    outline-offset: 2px;
}

.theme-toggle--floating {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
}

.theme-toggle--heading {
    position: absolute;
    top: 1.15rem;
    right: 1.25rem;
    z-index: 2;
    margin: 0;
}

body.dark-mode .theme-toggle {
    border-color: rgba(147, 201, 217, 0.22);
    background: #132936;
    color: #eaf9fd;
    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.22);
}

body.dark-mode .theme-toggle:hover,
body.dark-mode .theme-toggle:focus {
    border-color: rgba(100, 203, 200, 0.4);
    background: #1a3947;
    color: #ffffff;
}

body.dark-mode .theme-toggle__sun {
    stroke: #ffb34f;
}

body.dark-mode .theme-toggle__track {
    border-color: rgba(218, 244, 250, 0.28);
}

@media (max-width: 767.98px) {
    .theme-toggle--heading {
        position: static;
        margin-top: 0.9rem;
        margin-left: 0;
    }
}
