/* ---- Kill fractional-pixel horizontal scrollbars ----
   On fractional-scaling displays (DPR 1.25/1.5/etc.) sub-pixel rounding of
   percentage/flex widths can round up past 100% and spawn a 1px horizontal
   scrollbar. overflow-x: clip suppresses it without creating a scroll
   container, so sticky positioning and vertical page scroll keep working. */
html,
body {
    overflow-x: clip;
}

/* ---- Splash / boot loader ---- */
#splash {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #040d1f 0%, #061633 50%, #040d1f 100%);
    transition:
        opacity 0.6s cubic-bezier(0.23, 1, 0.32, 1),
        visibility 0s 0.6s;
}

#splash.splash-gone {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-star {
    width: 80px;
    height: 80px;
    animation:
        splash-pulse 1.6s ease-in-out infinite,
        splash-spin 4s linear infinite;
}

@keyframes splash-pulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 0.85;
    }
    50% {
        transform: scale(1.15);
        opacity: 1;
    }
}

@keyframes splash-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.splash-wordmark {
    margin-top: 1.5rem;
    font-family: "Anton", Impact, sans-serif;
    font-size: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #fff;
    opacity: 0;
    animation: splash-text-in 0.8s 0.3s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes splash-text-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.splash-tagline {
    margin-top: 0.5rem;
    font-family: "Barlow", sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(246, 244, 239, 0.5);
    opacity: 0;
    animation: splash-text-in 0.8s 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.splash-stripes {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: repeating-linear-gradient(
        90deg,
        #bf0a30 0 9.09%,
        #f6f4ef 9.09% 18.18%
    );
    opacity: 0;
    animation: splash-text-in 0.6s 0.8s ease forwards;
}

.splash-progress {
    position: absolute;
    bottom: 4px;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #bf0a30, #f2c94c);
    border-radius: 0 2px 2px 0;
    animation: splash-load 1.8s 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes splash-load {
    0% {
        width: 0;
    }
    60% {
        width: 70%;
    }
    100% {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .splash-star {
        animation: none;
        opacity: 1;
    }
    .splash-wordmark,
    .splash-tagline,
    .splash-stripes {
        animation: none;
        opacity: 1;
    }
    .splash-progress {
        animation: none;
        width: 100%;
    }
}

/* ---- Base polish ---- */
html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

:focus-visible {
    outline: 2px solid #bf0a30;
    outline-offset: 2px;
}

/* ---- Liberian flag stripes (11 stripes: 6 red, 5 white) ---- */
.flag-stripes {
    background: repeating-linear-gradient(
        90deg,
        #bf0a30 0 32px,
        #f6f4ef 32px 64px
    );
}

.flag-stripes-v {
    background: repeating-linear-gradient(
        180deg,
        #bf0a30 0 9.0909%,
        #f6f4ef 9.0909% 18.1818%
    );
}

/* ---- Nav blue diagonal: the dark wedge tracks the logo at every width,
        while the blue bleeds to the right edge. ---- */

/* Mobile (< 640px): only the crest shows, so a slim wedge. */
.nav-diagonal {
    left: 64px;
}

/* >= 640px: the "Liberia Football Association" wordmark appears, so the
   wedge widens to clear the full logo. The offset is anchored to the left
   edge of the max-w-7xl (80rem) content column so it keeps tracking the
   logo as the column centres on wide screens. */
@media (min-width: 640px) {
    .nav-diagonal {
        left: calc((100vw - min(100vw, 80rem)) / 2 + 236px);
    }
}

/* ---- Hero backdrop: deep navy with red glow + grain ---- */
.hero-bg {
    background:
        radial-gradient(
            60rem 30rem at 85% -10%,
            rgba(191, 10, 48, 0.22),
            transparent 60%
        ),
        radial-gradient(
            50rem 28rem at -10% 110%,
            rgba(0, 40, 104, 0.55),
            transparent 60%
        ),
        linear-gradient(180deg, #040d1f 0%, #061633 100%);
}

.hero-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

/* ---- Pitch line texture ---- */
.pitch-lines {
    background-image: repeating-linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.35) 0 1px,
        transparent 1px 72px
    );
}

/* ---- Dot texture (diaspora tile) ---- */
.dots {
    background-image: radial-gradient(
        rgba(255, 255, 255, 0.5) 1.5px,
        transparent 1.5px
    );
    background-size: 18px 18px;
}

/* ---- Ticker marquee ---- */
@keyframes ticker-scroll {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-50%);
    }
}

.ticker {
    animation: ticker-scroll 28s linear infinite;
}

/* ---- Counties marquee ---- */
@keyframes counties-scroll {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-50%);
    }
}

.counties-track {
    animation: counties-scroll 34s linear infinite;
}
.counties-marquee:hover .counties-track,
.counties-track:focus-within {
    animation-play-state: paused;
}

.county-pill {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 30px;
    font-family: "Anton", Impact, sans-serif;
    font-size: 1rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #fff;
    white-space: nowrap;
}
.county-pill-dark {
    color: #0a1b3d;
}

@media (prefers-reduced-motion: reduce) {
    .counties-track {
        animation: none;
    }
}

/* ---- Heartbeat quote carousel ---- */
.qslide {
    display: none;
}
.qslide.is-active {
    display: block;
}
.qdot {
    width: 9px;
    height: 9px;
    border-radius: 9999px;
    background: #cbd5e1;
    transition: background 0.2s;
    cursor: pointer;
}
.qdot.is-active {
    background: #0a1b3d;
}

/* ---- Progress bar fill ---- */
.progress-fill {
    transition: width 1.6s cubic-bezier(0.23, 1, 0.32, 1);
}

@keyframes pulse-glow {
    0%,
    100% {
        box-shadow: 0 0 6px rgba(191, 10, 48, 0.3);
    }
    50% {
        box-shadow: 0 0 14px rgba(191, 10, 48, 0.6);
    }
}

.progress-fill.is-active {
    box-shadow: 0 0 8px rgba(191, 10, 48, 0.4);
    animation: pulse-glow 2s ease-in-out 1.6s infinite;
}

/* ---- Donor pill rotation ---- */
.donor-pill-item {
    opacity: 0;
    transform: translateY(12px);
    transition:
        opacity 0.4s ease,
        transform 0.4s ease;
}

.donor-pill-item.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.donor-pill-item.is-exiting {
    opacity: 0;
    transform: translateY(-12px);
}

/* ---- Press feedback ---- */
.btn-press:active {
    transform: scale(0.97);
}

/* ---- Staggered hero entrance ---- */
@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stagger > * {
    animation: rise-in 500ms cubic-bezier(0.23, 1, 0.32, 1) both;
}
.stagger > *:nth-child(1) {
    animation-delay: 0ms;
}
.stagger > *:nth-child(2) {
    animation-delay: 80ms;
}
.stagger > *:nth-child(3) {
    animation-delay: 160ms;
}
.stagger > *:nth-child(4) {
    animation-delay: 240ms;
}

/* ---- Donor brick wall ---- */
.brick-wall {
    background: linear-gradient(180deg, #071224, #050d1c);
    box-shadow:
        inset 0 2px 10px rgba(0, 0, 0, 0.5),
        0 1px 0 rgba(255, 255, 255, 0.06);
}

.brick {
    position: relative;
    display: flex;
    min-height: 4rem;
    flex-direction: column;
    justify-content: center;
    border-radius: 5px;
    padding: 0.5rem 0.9rem;
    overflow: hidden;
    /* top highlight + bottom shade make each brick read as fired clay */
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        inset 0 -4px 0 rgba(0, 0, 0, 0.28),
        inset 2px 0 0 rgba(255, 255, 255, 0.05);
}

.brick::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.16;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2'/%3E%3C/filter%3E%3Crect width='90' height='90' filter='url(%23n)' opacity='0.7'/%3E%3C/svg%3E");
}

.brick-gold {
    background: linear-gradient(180deg, #f2c94c, #d9a425);
    color: #3a2a05;
    flex: 2.1 1 15rem;
}
.brick-gold .brick-meta {
    color: rgba(58, 42, 5, 0.7);
}

.brick-red {
    background: linear-gradient(180deg, #d01236, #96092a);
    color: #fff;
    flex: 1.7 1 12.5rem;
}

.brick-clay {
    background: linear-gradient(180deg, #b04a31, #84331f);
    color: #fff;
    flex: 1.3 1 11rem;
}

.brick-navy {
    background: linear-gradient(180deg, #17407f, #002868);
    color: #fff;
    flex: 1 1 9.5rem;
}

.brick-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
    font-size: 0.85rem;
    line-height: 1.25;
}

.brick-meta {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.75);
    font-variant-numeric: tabular-nums;
}

.brick-ghost {
    flex: 1 1 9.5rem;
    border: 2px dashed rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.55);
    box-shadow: none;
    align-items: center;
    text-align: center;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition:
        border-color 150ms,
        color 150ms,
        background 150ms;
}
.brick-ghost::after {
    display: none;
}

@media (hover: hover) and (pointer: fine) {
    .brick-ghost:hover {
        border-color: rgba(255, 255, 255, 0.6);
        color: #fff;
        background: rgba(191, 10, 48, 0.25);
    }
    .brick[title]:hover {
        filter: brightness(1.08);
    }
}

.brick-swatch {
    display: inline-block;
    height: 0.8rem;
    width: 1.4rem;
    border-radius: 3px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.25),
        inset 0 -2px 0 rgba(0, 0, 0, 0.25);
}

/* ---- Donor tifo: cards in the stands forming the lone star ---- */
/* Light "graph paper" backdrop for the donor wall */
.wall-grid-bg {
    background-color: #f7f8fa;
    background-image:
        linear-gradient(rgba(4, 13, 31, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(4, 13, 31, 0.05) 1px, transparent 1px);
    background-size: 132px 132px;
    background-position: center top;
}

/* Legend pills */
.legend-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 9px;
    padding: 5px 12px;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 1px 2px rgba(4, 13, 31, 0.12);
}

/* ---- Donor wall grid ---- */
.tifo {
    display: grid;
    grid-template-columns: repeat(9, minmax(0, 1fr));
    gap: 5px;
    padding: 14px;
    border-radius: 24px;
    background: #0a1b3d;
    box-shadow:
        0 24px 60px -24px rgba(4, 13, 31, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
@media (min-width: 640px) {
    .tifo {
        grid-template-columns: repeat(12, minmax(0, 1fr));
        gap: 6px;
        padding: 18px;
    }
}
@media (min-width: 1024px) {
    .tifo {
        grid-template-columns: repeat(15, minmax(0, 1fr));
    }
}

.tifo-card {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 5px 6px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px);
}

.tifo.raised .tifo-card {
    animation: card-raise 450ms cubic-bezier(0.23, 1, 0.32, 1) forwards;
    animation-delay: var(--d, 0ms);
}

@keyframes card-raise {
    to {
        opacity: 1;
        transform: none;
    }
}

.tz-g {
    background: #f5b824;
    color: #fff;
}
.tz-b {
    background: #1763c6;
    color: #fff;
}
.tz-r {
    background: #e0342b;
    color: #fff;
}
.tz-w {
    background: #fff;
    color: #0a1b3d;
}

.tifo-named {
    z-index: 1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.tifo-named:active {
    transform: scale(0.95);
}

.tifo-name {
    font-size: 0.55rem;
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: 0.01em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}

.tifo-amt {
    align-self: flex-end;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.tz-ghost {
    background: rgba(255, 255, 255, 0.03);
    border: 1.5px dashed rgba(255, 255, 255, 0.28);
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    transition:
        border-color 150ms,
        color 150ms,
        background 150ms;
}

.tifo-plus {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
}

@media (hover: hover) and (pointer: fine) {
    .tifo-card[title]:hover {
        filter: brightness(1.08);
    }
    .tz-ghost:hover {
        border-color: rgba(255, 255, 255, 0.7);
        color: #fff;
        background: rgba(191, 10, 48, 0.3);
    }
}

.tifo-found {
    outline: 3px solid #f5b824;
    outline-offset: 2px;
    z-index: 2;
    animation: found-pulse 1.1s ease-in-out 3;
}

@keyframes found-pulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(245, 184, 36, 0.65);
    }
    50% {
        box-shadow: 0 0 0 12px rgba(245, 184, 36, 0);
    }
}

@media (max-width: 520px) {
    .tifo {
        gap: 3px;
        padding: 10px;
    }
    .tifo-name {
        display: none;
    }
    .tifo-amt {
        font-size: 0.6rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tifo-card {
        opacity: 1;
        transform: none;
    }
}

/* ---- New donor wall entry flash ---- */
@keyframes donor-flash {
    0% {
        opacity: 0;
        transform: translateY(-8px);
        background: rgba(191, 10, 48, 0.35);
    }
    40% {
        opacity: 1;
        transform: translateY(0);
        background: rgba(191, 10, 48, 0.35);
    }
    100% {
        background: rgba(255, 255, 255, 0.05);
    }
}

.donor-chip-new {
    animation: donor-flash 1.6s cubic-bezier(0.23, 1, 0.32, 1) both;
}

/* ---- Photo tiles ---- */
.tile img,
.photo-frame img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    outline: 1px solid rgba(255, 255, 255, 0.08);
    outline-offset: -1px;
}

@media (hover: hover) and (pointer: fine) {
    .tile img {
        transition: transform 500ms cubic-bezier(0.23, 1, 0.32, 1);
    }
    .tile:hover img {
        transform: scale(1.05);
    }
}

/* ---- Selected amount chip ---- */
.amount-btn[aria-checked="true"] {
    background: #010629;
    border-color: #010629;
    color: white;
    box-shadow: 0 8px 24px rgba(1, 6, 41, 0.35);
}

/* ---- Full-bleed photo carousel ---- */
.carousel-track {
    display: flex;
    width: max-content;
    animation: carousel-scroll 40s linear infinite;
}

.carousel-track:hover {
    animation-play-state: paused;
}

@keyframes carousel-scroll {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-50%);
    }
}

.carousel-slide {
    flex: 0 0 auto;
    width: 420px;
    height: 280px;
    overflow: hidden;
    border-radius: 12px;
    margin-right: 12px;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 600ms cubic-bezier(0.23, 1, 0.32, 1);
}

.carousel-slide:hover img {
    transform: scale(1.06);
}

@media (max-width: 640px) {
    .carousel-slide {
        width: 300px;
        height: 200px;
        border-radius: 8px;
        margin-right: 8px;
    }
}

/* ---- Mini photo grid ---- */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 180px);
    gap: 8px;
}

.photo-grid .grid-item {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
}

.photo-grid .grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 600ms cubic-bezier(0.23, 1, 0.32, 1);
}

.photo-grid .grid-item:hover img {
    transform: scale(1.05);
}

.photo-grid .grid-span-2 {
    grid-column: span 2;
}

@media (max-width: 768px) {
    .photo-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(4, 140px);
        gap: 6px;
    }
    .photo-grid .grid-span-2 {
        grid-column: span 1;
    }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    .ticker,
    .carousel-track,
    .stagger > * {
        animation: none !important;
    }
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
    }
}
