html,
body {
    margin: 0;
    padding: 0;
}

#loading-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease;
}

#loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 52px;
    height: 52px;
    border: 5px solid #ddd;
    border-top-color: #017cc2;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

body {
    overflow-x: hidden;
    padding-top: var(--navbar-h, 56px);
    /* Push content above home-indicator bar on iOS/iPadOS */
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (max-width: 991.98px) {
    .navbar .container-fluid {
        position: relative;
    }

    .navbar-brand {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }
}

html {
    scroll-padding-top: var(--navbar-h, 56px);
    scroll-snap-type: y mandatory;
    overscroll-behavior-y: none;
}

#header {
    display: flex;
    width: 100vw;
    height: 6vh;
    position: fixed;
    background: lightblue;
}

.navbar {
    transition: box-shadow 0.3s ease;
}

.navbar.scrolled {
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.18) !important;
}

.navbar-nav .nav-link {
    position: relative;
}

.navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 0.5rem;
    right: 0.5rem;
    height: 2px;
    background-color: #017cc2;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.25s ease;
    border-radius: 1px;
}

.navbar-nav .nav-link:hover::after {
    transform: scaleX(1);
}

.section {
    width: 100%;
    /* 100vh fallback for browsers that don't support dvh */
    height: calc(100vh - var(--navbar-h, 0px));
    height: calc(100dvh - var(--navbar-h, 0px));
    min-height: calc(100svh - var(--navbar-h, 0px));
    box-sizing: border-box;
    overflow-y: auto;
    scroll-snap-align: start;
}

#hero {
    position: relative;
    /* 100vh fallback for browsers that don't support dvh */
    height: calc(100vh - var(--navbar-h, 0px));
    height: calc(100dvh - var(--navbar-h, 0px));
    min-height: calc(100svh - var(--navbar-h, 0px));
    width: 100%;
    overflow: hidden;
    background-image: url("/assets/images/lsJimShegstadLake.png");
    background-size: cover;
    background-position: right center;
    background-repeat: no-repeat;
    /* animation: heroZoom 45s ease-out forwards; */
}

#about {
    background-image: url("/assets/images/MinnesotaStateFlag.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

#about-menu-content {
    background-color: rgba(255, 255, 255, 0.78);
}

#about .container-fluid,
#about .row {
    height: 100%;
}

#about .container-fluid {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.about-nav-col {
    display: flex;
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

#about-menu {
    width: 100%;
    height: 100%;
    padding: 0.5rem;
    border-radius: 0.5rem;
    background-color: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(4px);
}

#about-menu .nav-link {
    text-align: left;
    font-size: 1.5rem;
    font-weight: 600;
    border-radius: 0.4rem;
    margin-bottom: 0.35rem;
    color: var(--bs-dark);
}

#about-menu .nav-link.active {
    color: var(--bs-white);
    background-color: var(--bs-primary);
}

.about-content-panel {
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: rgba(255, 255, 255, 0.84);
    backdrop-filter: blur(4px);
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.7s ease 0.2s, transform 0.7s ease 0.2s;
}

.about-content-panel .tab-pane {
    height: 100%;
    overflow-y: auto;
}

#about.in-view .about-nav-col {
    opacity: 1;
    transform: translateX(0);
}

#about.in-view .about-content-panel {
    opacity: 1;
    transform: translateX(0);
}

.about-content-panel h3 {
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.about-content-panel p {
    line-height: 1.6;
}

#civilservant {
    margin-top: 50px;
    border-radius: 50%;
    width: 20%;
}

.hero-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: right center;
    transform: scale(1);
    animation: heroZoom 45s ease-out forwards;
}

@keyframes heroZoom {
    from {
        background-size: auto 100%;
    }

    to {
        background-size: auto 112%;
    }
}

@keyframes valuesFadeIn {
    from { opacity: 0; transform: translateX(-24px); }
    to   { opacity: 1; transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
    #hero,
    .hero-image,
    .values-text span,
    .about-nav-col,
    .about-content-panel,
    #contact .card,
    #jimclose,
    .donate-content,
    #donate-img {
        animation: none !important;
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    .donate-stripe-wrap::before,
    #donate {
        animation: none !important;
    }

    .navbar-nav .nav-link::after {
        transition: none !important;
    }
}

.section:nth-child(even) {
    background-color: #e0e0e0;
}

.header-copyright {
    width: 100%;
    text-align: center;
    font-size: 0.75rem;
    color: #6c757d;
    padding-bottom: 0.25rem;
}

.hero-tagline {
    position: absolute;
    top: 1rem;
    left: 1.25rem;
    right: 1.25rem;
    color: white;
    font-size: clamp(1.35rem, 3.5vw, 1.75rem);
    font-weight: 600;
    line-height: 1.4;
    max-width: 480px;
    pointer-events: none;
    z-index: 1;
}

.hero-tagline.typewriter-active::after {
    content: '|';
    display: inline-block;
    margin-left: 2px;
    animation: taglineCursor 0.7s step-start infinite;
}

@keyframes taglineCursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@media (max-width: 767.98px) {
    .hero-tagline {
        text-align: center;
        max-width: 100%;
    }
}

@media (min-width: 768px) and (max-width: 1023.98px) {
    .hero-tagline {
        max-width: 60%;
        font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    }
}

.hero-values {
    display: none;
}

@keyframes mobileValuesCycle {
    0%, 30% {
        opacity: 1;
    }

    33%, 100% {
        opacity: 0;
    }
}

@media (max-width: 767.98px) {
    .hero-values {
        position: absolute;
        top: 5.5rem;
        left: 0;
        right: 0;
        bottom: 0;
        display: flex;
        align-items: flex-start;
        justify-content: center;
        text-align: center;
        pointer-events: none;
    }

    .values-text {
        display: none;
        position: relative;
        margin: 0;
        min-height: 1.4em;
        width: 100%;
        font-size: clamp(2rem, 9vw, 3rem);
        font-weight: 800;
        line-height: 1.1;
        text-transform: uppercase;
    }

    #civilservant {
        display: none;
    }

    .values-text span {
        position: absolute;
        inset: 0;
        opacity: 0;
        animation: mobileValuesCycle 9s infinite;
    }

    .values-text span:nth-of-type(1) {
        animation-delay: 0s;
    }

    .values-text span:nth-of-type(2) {
        animation-delay: 3s;
    }

    .values-text span:nth-of-type(3) {
        animation-delay: 6s;
    }

    .values-text span:nth-of-type(4) {
        animation-delay: 8s;
    }
}

@media (min-width: 768px) and (max-width: 1023.98px) {
    .hero-values {
        position: absolute;
        inset: 0;
        display: flex;
        align-items: flex-end;
        justify-content: center;
        text-align: center;
        padding: 1.5rem 2rem;
        pointer-events: none;
    }

    .values-text {
        margin: 0;
        font-size: clamp(2rem, 4.5vw, 3.5rem);
        font-weight: 800;
        line-height: 1.05;
        text-transform: uppercase;
    }

    .values-text span {
        display: block;
    }
}

@media (min-width: 1024px) {
    .hero-values {
        position: absolute;
        inset: 0;
        display: flex;
        align-items: flex-end;
        justify-content: flex-start;
        text-align: left;
        padding: 2rem 3rem;
        pointer-events: none;
    }

    .values-text {
        margin: 0;
        font-size: clamp(2.25rem, 6vw, 5rem);
        font-weight: 800;
        line-height: 1.05;
        text-transform: uppercase;
    }

    .values-text span {
        display: block;
        opacity: 0;
        animation: valuesFadeIn 0.7s ease forwards;
    }
    .values-text span:nth-of-type(1) { animation-delay: 0.8s; }
    .values-text span:nth-of-type(2) { animation-delay: 1.5s; }
    .values-text span:nth-of-type(3) { animation-delay: 2.2s; }
}

#carouselExampleIndicators {
    width: 100%;
    height: 50vh;
    max-height: 50vh;
    background: transparent;
}

#carouselExampleIndicators .carousel-inner,
#carouselExampleIndicators .carousel-item {
    height: 100%;
    background: transparent;
}

#carouselExampleIndicators .carousel-item img {
    height: 100%;
    width: auto;
    max-width: 100%;
    margin: 0 auto;
    object-fit: contain;
    background: transparent;
}

#pictures {
    scroll-margin-top: 0;
}

.pictures-image {
    width: 100%;
    height: auto;
    display: block;
}

#contact {
    background-image: url("/assets/images/lucas-sankey-gdQ_az6CSPo-unsplash.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

#contact .card {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

#contact.in-view .card {
    opacity: 1;
    transform: translateY(0);
}

#jimclose {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.9s ease 0.3s, transform 0.9s ease 0.3s;
}

#contact.in-view #jimclose {
    opacity: 1;
    transform: translateX(0);
}

.card-body {
    border-radius: 50px;
}

.jimclose {
    border-radius: 50px;
}

#donate {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #00264d 0%, #017cc2 60%, #003d6b 100%);
    background-size: 250% 250%;
    animation: donateBgShift 14s ease infinite;
}

#donate::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(
        -45deg,
        rgba(255, 255, 255, 0.035) 0px,
        rgba(255, 255, 255, 0.035) 1px,
        transparent 1px,
        transparent 22px
    );
    pointer-events: none;
    z-index: 0;
}

#donate > * {
    position: relative;
    z-index: 1;
}

@keyframes donateBgShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#donate h2 {
    color: #fff;
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 800;
    letter-spacing: 0.01em;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
    position: relative;
    padding-bottom: 0.65rem;
}

#donate h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, #c9a227, transparent);
    border-radius: 2px;
    transition: width 0.9s ease 0.5s;
}

#donate.in-view h2::after {
    width: 70%;
}

.donate-tagline {
    color: rgba(255, 255, 255, 0.82);
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    font-style: italic;
    letter-spacing: 0.03em;
    margin-bottom: 1.75rem;
}

.donate-content {
    opacity: 0;
    transform: translateY(36px);
    transition: opacity 0.75s ease, transform 0.75s ease;
}

#donate.in-view .donate-content {
    opacity: 1;
    transform: translateY(0);
}

#donate-img {
    max-height: 70vh;
    width: 100%;
    object-fit: contain;
    object-position: center bottom;
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 1s ease 0.35s, transform 1s ease 0.35s;
    filter: drop-shadow(-8px 0 24px rgba(0, 0, 0, 0.35));
}

#donate.in-view #donate-img {
    opacity: 1;
    transform: translateX(0);
}

.donate-stripe-wrap {
    position: relative;
    display: inline-block;
}

.donate-stripe-wrap::before {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 14px;
    border: 2px solid rgba(201, 162, 39, 0.65);
    animation: donatePulse 2.8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes donatePulse {
    0%, 100% { opacity: 0.65; transform: scale(1); }
    50%       { opacity: 0.12; transform: scale(1.07); }
}

/* About section: mobile & tablet layout */
@media (max-width: 1023.98px) {
    /* Stack nav + content as a true column, letting content fill remaining height */
    #about .row {
        flex-direction: column;
        flex-wrap: nowrap;
    }

    .about-nav-col {
        flex: 0 0 auto;
        width: 100%;
        height: auto;
    }

    /* Content col fills whatever height remains after the select */
    #about .col-12.col-lg-10 {
        flex: 1 1 0;
        min-height: 0;
        width: 100%;
        overflow: hidden;
    }

    .about-content-panel {
        height: 100%;
    }

    .about-content-panel .fs-2 {
        font-size: 1.1rem !important;
    }

    .about-content-panel .fs-4 {
        font-size: 0.875rem !important;
    }

    .about-content-panel ul,
    .about-content-panel li {
        font-size: 0.875rem;
    }

    .about-menu-select {
        font-size: 0.9rem;
    }
}