/* Layout mirrors the Chorus Treasurer Tracking site (top nav, centered content,
   card forms); the palette swaps its navy for evergreen + cranberry. */
:root {
    --green: #1f4d2b;
    --green-dark: #163a20;
    --red: #b3202a;
    --red-dark: #8f1820;
    --gold: #d9a441;
    --cream: #fbf7ef;
    --ink: #2a2118;
    --muted: #6b5d4f;
    --card: #ffffff;
    --border: #eadfcd;
    --festive-font: "Mountains of Christmas", Georgia, serif;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid var(--red);
}

.validation-message {
    color: var(--red);
    font-weight: normal;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: var(--red);
    padding: 1rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e6dccb;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: var(--red);
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    color: var(--green);
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

body {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    margin: 0;
    color: var(--ink);
    background: var(--cream);
}

a {
    color: var(--red);
}

.page {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ---------- Gentle snowfall (decorative, behind everything) ---------- */
.snow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        radial-gradient(3px 3px at 20px 30px, rgba(31, 77, 43, 0.18), transparent),
        radial-gradient(2px 2px at 90px 120px, rgba(179, 32, 42, 0.14), transparent),
        radial-gradient(3px 3px at 160px 60px, rgba(31, 77, 43, 0.14), transparent),
        radial-gradient(2px 2px at 230px 170px, rgba(217, 164, 65, 0.22), transparent),
        radial-gradient(3px 3px at 290px 20px, rgba(31, 77, 43, 0.12), transparent);
    background-size: 320px 220px;
    animation: snowfall 30s linear infinite;
}

@keyframes snowfall {
    from { background-position: 0 0; }
    to { background-position: 60px 660px; }
}

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

/* ---------- Top nav (same structure as the treasurer site) ---------- */
.topnav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 0.75rem 1.5rem;
    background: var(--green);
    color: white;
}

.topnav a {
    color: #e3efe5;
    text-decoration: none;
}

.topnav a:hover, .topnav a.active {
    color: white;
    text-decoration: underline;
}

.topnav .brand-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
    min-width: 0;
}

.topnav .brand-link:hover {
    text-decoration: none;
}

.topnav .brand-logo {
    height: 36px;
    width: auto;
    border-radius: 4px;
    flex-shrink: 0;
}

.topnav .brand {
    font-family: var(--festive-font);
    font-weight: 700;
    font-size: 1.6rem;
    line-height: 1.1;
}

.topnav .spacer {
    flex: 1;
}

.topnav a.nav-cta {
    background: var(--red);
    color: white;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    font-weight: 600;
}

.topnav a.nav-cta:hover, .topnav a.nav-cta.active {
    background: var(--red-dark);
    text-decoration: none;
}

.candy-stripe {
    height: 8px;
    background: repeating-linear-gradient(-45deg, var(--red) 0 12px, #fff 12px 24px);
}

.topnav-links {
    display: contents;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    margin-left: auto;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .topnav {
        flex-wrap: wrap;
        padding: 0.75rem 1rem;
    }

    .topnav .brand {
        font-size: 1.3rem;
    }

    .menu-toggle {
        display: block;
    }

    .topnav-links {
        display: none;
        flex-basis: 100%;
    }

    .topnav-links.open {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        width: 100%;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
    }

    .topnav-links.open .spacer {
        display: none;
    }

    .topnav-links.open a {
        padding: 0.4rem 0;
    }

    .topnav-links.open a.nav-cta {
        text-align: center;
        padding: 0.6rem 0.9rem;
    }
}

.content {
    padding: 1.5rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    flex: 1;
}

.site-footer {
    text-align: center;
    padding: 1.5rem 1rem 2rem;
    color: var(--muted);
    font-size: 0.9rem;
}

/* ---------- Home ---------- */
.hero {
    text-align: center;
    padding: 1rem 0 1.5rem;
}

.hero h1, .form-page h1, .empty-state h1 {
    font-family: var(--festive-font);
    font-weight: 700;
    color: var(--green);
    font-size: clamp(2.2rem, 6vw, 3.4rem);
    line-height: 1.1;
    margin: 0 0 0.5rem;
}

.hero p {
    color: var(--muted);
    max-width: 36rem;
    margin: 0 auto 1.25rem;
}

.button-primary {
    display: inline-block;
    background: var(--red);
    color: white;
    text-decoration: none;
    font-weight: 600;
    padding: 0.7rem 1.4rem;
    border-radius: 999px;
    box-shadow: 0 3px 10px rgba(179, 32, 42, 0.25);
    transition: background 0.15s ease;
}

.button-primary:hover {
    background: var(--red-dark);
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0.5rem 0 1.25rem;
}

.search {
    flex: 1;
    max-width: 24rem;
    padding: 0.6rem 0.9rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: white;
    box-sizing: border-box;
}

.search:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(31, 77, 43, 0.15);
}

.count {
    color: var(--muted);
    font-size: 0.9rem;
    white-space: nowrap;
}

.cookie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
    gap: 1.25rem;
}

.cookie-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(42, 33, 24, 0.07);
    display: flex;
    flex-direction: column;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cookie-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(42, 33, 24, 0.12);
}

.cookie-image-link {
    display: block;
    aspect-ratio: 4 / 3;
    background: #f3eadb;
    border-bottom: 4px solid var(--green);
}

.cookie-image-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cookie-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 4rem;
}

.cookie-body {
    padding: 0.9rem 1rem 1rem;
}

.cookie-body h2 {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
}

.cookie-body h2 a {
    color: var(--green);
    text-decoration: none;
}

.cookie-body h2 a:hover {
    color: var(--red);
    text-decoration: underline;
}

.cookie-brought-by {
    margin: 0 0 0.5rem;
    color: var(--red);
    font-size: 0.9rem;
    font-weight: 600;
}

.cookie-description {
    margin: 0 0 0.5rem;
    color: var(--ink);
    font-size: 0.95rem;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.cookie-source {
    margin: 0;
    font-size: 0.8rem;
    color: var(--muted);
}

.cookie-source a {
    color: var(--muted);
}

.status-text {
    color: var(--muted);
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--muted);
}

.error-message {
    color: var(--red);
    margin: 0.5rem 0;
}

/* ---------- Share form (card-form styling from the treasurer site) ---------- */
.form-page {
    max-width: 560px;
    margin: 0 auto;
}

.form-page > .status-text {
    margin-bottom: 1.25rem;
}

.card-form {
    background: var(--card);
    border: 1px solid var(--border);
    border-top: 6px solid var(--red);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 16px rgba(42, 33, 24, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

@media (max-width: 480px) {
    .card-form {
        padding: 1.25rem;
    }
}

.card-form label {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--green-dark);
}

.card-form .optional {
    font-weight: normal;
    color: var(--muted);
}

.card-form input:not([type=file]),
.card-form textarea {
    padding: 0.65rem 0.75rem;
    font-size: 1rem;
    font-family: inherit;
    border: 1px solid #d8ccb8;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.card-form input[type=file] {
    font-size: 0.95rem;
    font-weight: normal;
}

.card-form input:focus,
.card-form textarea:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(31, 77, 43, 0.15);
}

.image-preview {
    max-width: 100%;
    max-height: 260px;
    object-fit: contain;
    border-radius: 8px;
    align-self: flex-start;
}

.card-form button[type="submit"] {
    background: var(--green);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.card-form button[type="submit"]:hover:not(:disabled) {
    background: var(--green-dark);
}

.card-form button[type="submit"]:disabled {
    opacity: 0.7;
    cursor: default;
}
