:root {
    --ink: #16231f;
    --muted: #5b6a64;
    --paper: #fbfaf7;
    --surface: #ffffff;
    --line: #d9ded7;
    --green: #246b55;
    --green-dark: #174b3b;
    --teal: #2c7d8b;
    --coral: #c85b47;
    --gold: #c79a34;
    --danger: #a83232;
    --focus: #0f6fbd;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.55;
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: var(--green-dark);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1:focus {
    outline: none;
}

h1 {
    font-size: 3.4rem;
    line-height: 1.04;
    margin-bottom: 1.1rem;
}

h2 {
    font-size: 2rem;
    line-height: 1.15;
    margin-bottom: .85rem;
}

h3 {
    font-size: 1.25rem;
    line-height: 1.25;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 1.25rem;
    min-height: 76px;
    padding: .85rem 3rem;
    border-bottom: 1px solid rgba(22, 35, 31, .1);
    background: rgba(251, 250, 247, .96);
    backdrop-filter: blur(12px);
}

.brand img {
    width: 190px;
    height: auto;
}

.primary-nav,
.header-actions,
.button-row,
.account-links,
.row-actions,
.cookie-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.primary-nav {
    justify-content: center;
}

.primary-nav a,
.plain-link,
.text-link {
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
}

.primary-nav a {
    padding: .4rem .2rem;
}

.plain-link:hover,
.text-link:hover,
.primary-nav a:hover {
    color: var(--green);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: .7rem 1.05rem;
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button.primary {
    color: #fff;
    background: var(--green);
}

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

.button.secondary {
    color: var(--green-dark);
    background: #edf4f0;
    border-color: #bdd5cc;
}

.button.ghost {
    color: var(--ink);
    background: transparent;
    border-color: var(--line);
}

.button.danger {
    color: #fff;
    background: var(--danger);
}

.button.compact {
    min-height: 38px;
    padding: .5rem .72rem;
    font-size: .95rem;
}

.mobile-sticky-donate {
    display: none;
}

.hero,
.page-hero,
.feature-row,
.donate-layout,
.account-layout {
    display: grid;
    gap: 2rem;
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
}

.split-hero {
    grid-template-columns: minmax(0, 1fr) minmax(340px, .9fr);
    align-items: center;
    min-height: min(680px, calc(100vh - 150px));
    padding: 3rem 0 2rem;
}

.hero-copy p,
.page-hero p,
.closing-cta p,
.donate-copy p,
.lead {
    color: var(--muted);
    font-size: 1.12rem;
}

.hero-image,
.page-hero img,
.feature-row img,
.content-grid img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 8px;
}

.hero-image {
    min-height: 460px;
}

.eyebrow {
    color: var(--coral);
    font-size: .78rem;
    font-weight: 900;
    text-transform: uppercase;
    margin-bottom: .6rem;
}

.page-band,
.donation-strip,
.content-grid,
.closing-cta,
.policy-grid,
.admin-stats,
.admin-list,
.editor-shell,
.article-page {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
}

.page-band {
    padding: 4rem 0;
}

.page-band.narrow,
.article-page {
    width: min(860px, calc(100% - 2rem));
}

.impact-band,
.donation-strip {
    padding: 3.5rem 0;
}

.section-heading {
    max-width: 660px;
}

.impact-grid,
.content-grid,
.policy-grid,
.admin-stats,
.amount-grid,
.resource-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.impact-item,
.content-grid article,
.policy-grid article,
.admin-stats article,
.amount-card,
.account-panel,
.donation-form-shell,
.trust-box,
.editor-shell,
.admin-row,
.cookie-panel,
.account-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.impact-item {
    padding: 1.25rem;
    border-top: 4px solid var(--gold);
}

.feature-row,
.page-hero {
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
    align-items: center;
    padding: 4rem 0;
}

.feature-row > div,
.page-hero > div {
    max-width: 620px;
}

.donation-strip {
    display: grid;
    grid-template-columns: .5fr 1fr;
    align-items: start;
    gap: 1.5rem;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.amount-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.amount-card {
    min-height: 148px;
    padding: 1rem;
    color: var(--ink);
    text-decoration: none;
}

.amount-card strong {
    display: block;
    color: var(--teal);
    font-size: 1.7rem;
    margin-bottom: .55rem;
}

.amount-card span,
.content-grid p,
.impact-item p,
.policy-grid p,
.fact-list p {
    color: var(--muted);
}

.content-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 4rem 0;
}

.content-grid.no-images article {
    padding: 1.25rem;
}

.content-grid article {
    overflow: hidden;
}

.content-grid article > :not(img) {
    margin-left: 1rem;
    margin-right: 1rem;
}

.content-grid article > p:last-of-type {
    margin-bottom: 1rem;
}

.content-grid article .text-link {
    display: inline-flex;
    margin: 0 1rem 1.1rem;
}

.closing-cta {
    margin-bottom: 4rem;
    padding: 3rem;
    color: #fff;
    background: var(--green-dark);
    border-radius: 8px;
}

.closing-cta p,
.closing-cta .eyebrow {
    color: #eef8f4;
}

.closing-cta .button.secondary {
    background: #fff;
}

.two-column,
.account-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fact-list {
    display: grid;
    gap: .85rem;
}

.resource-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.resource-list article,
.policy-grid article,
.account-panel {
    padding: 1.25rem;
}

.donate-layout {
    grid-template-columns: minmax(280px, .45fr) minmax(0, .75fr);
    align-items: start;
    padding: 3rem 0 4rem;
}

.donate-copy {
    position: sticky;
    top: 96px;
}

.donate-copy img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 8px;
    margin: 1.25rem 0;
}

.trust-box {
    padding: 1.1rem;
    border-left: 4px solid var(--teal);
}

.donation-form-shell,
.editor-shell {
    padding: 1.5rem;
}

.steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .5rem;
    padding: 0;
    margin: 0 0 1.5rem;
    list-style: none;
}

.steps li {
    padding: .7rem;
    border-radius: 8px;
    background: #edf4f0;
    color: var(--green-dark);
    font-weight: 800;
    text-align: center;
}

fieldset {
    border: 0;
    padding: 0;
    margin: 0 0 1.5rem;
}

legend {
    width: 100%;
    margin-bottom: .75rem;
    font-size: 1.2rem;
    font-weight: 900;
}

.amount-selector,
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .85rem;
}

.amount-option {
    min-height: 132px;
    padding: .9rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}

.amount-option.selected {
    border-color: var(--green);
    box-shadow: inset 0 0 0 2px var(--green);
}

.amount-option strong {
    display: block;
    color: var(--teal);
    font-size: 1.4rem;
    margin-bottom: .4rem;
}

.field {
    display: grid;
    gap: .35rem;
    margin-bottom: .85rem;
    font-weight: 800;
}

.field input,
.field textarea,
.field select {
    width: 100%;
    min-height: 46px;
    border: 1px solid #cbd3cc;
    border-radius: 8px;
    padding: .7rem .8rem;
    color: var(--ink);
    background: #fff;
    font: inherit;
    font-weight: 500;
}

.field textarea {
    min-height: 130px;
    resize: vertical;
}

.field .large-textarea {
    min-height: 320px;
}

.field.wide {
    grid-column: 1 / -1;
}

.check-row,
.toggle-row {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    margin: .65rem 0;
    color: var(--ink);
}

.check-row input,
.toggle-row input {
    width: 1.15rem;
    height: 1.15rem;
    margin-top: .2rem;
    flex: 0 0 auto;
}

.form-submit {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.form-submit strong {
    display: block;
    font-size: 1.7rem;
}

.form-submit span,
small {
    color: var(--muted);
}

.donation-faq,
.policy-grid,
.admin-stats,
.admin-list,
.account-layout {
    padding-bottom: 4rem;
}

.summary-list {
    display: grid;
    gap: .75rem;
    margin: 1.5rem 0;
}

.summary-list div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem 0;
    border-bottom: 1px solid var(--line);
}

.summary-list dt {
    font-weight: 900;
}

.article-page {
    padding: 3rem 0 4rem;
}

.article-hero {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.article-body {
    font-size: 1.1rem;
}

.account-layout {
    align-items: start;
}

.account-panel {
    min-height: 280px;
}

.admin-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.admin-stats article {
    padding: 1.25rem;
}

.admin-stats span {
    display: block;
    color: var(--teal);
    font-size: 2rem;
    font-weight: 900;
}

.admin-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    margin-bottom: 1rem;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
}

th,
td {
    padding: .8rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--green-dark);
    background: #edf4f0;
}

.policy-table {
    padding-bottom: 2rem;
}

.contact-list {
    padding: 1rem 0;
}

.alert {
    padding: .9rem 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.alert.error,
.validation-message {
    color: var(--danger);
}

.alert.error {
    background: #fff1f1;
}

.alert.success,
.success-text {
    color: #13513e;
}

.alert.success {
    background: #edf8f2;
}

.account-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 1rem;
    background: #edf4f0;
}

.account-card {
    width: min(480px, 100%);
    padding: 1.5rem;
}

.account-card h1 {
    font-size: 2.3rem;
    margin-top: 1rem;
}

.account-links {
    margin-top: 1rem;
}

.cookie-panel {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 50;
    width: min(640px, calc(100% - 2rem));
    padding: 1.25rem;
    box-shadow: 0 22px 60px rgba(22, 35, 31, .18);
}

.cookie-options {
    display: grid;
    gap: .5rem;
    margin: 1rem 0;
}

.toggle-row {
    justify-content: space-between;
    padding: .75rem;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.toggle-row span {
    display: grid;
    gap: .2rem;
}

.toggle-row small {
    display: block;
}

.cookie-settings {
    min-height: 38px;
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: 8px;
    padding: .45rem .7rem;
    color: #fff;
    background: transparent;
    font-weight: 800;
    cursor: pointer;
}

.site-footer {
    display: grid;
    grid-template-columns: minmax(0, .7fr) minmax(0, 1fr);
    gap: 2rem;
    padding: 2rem 3rem 5rem;
    color: #fff;
    background: #172d27;
}

.site-footer img {
    width: 210px;
    padding: .35rem;
    border-radius: 6px;
    background: #fff;
}

.site-footer p {
    max-width: 520px;
    color: #d7e5df;
    margin-top: 1rem;
}

.site-footer nav {
    display: flex;
    justify-content: flex-end;
    gap: .85rem 1.1rem;
    flex-wrap: wrap;
}

.site-footer a {
    color: #fff;
    text-decoration: none;
    font-weight: 800;
}

#blazor-error-ui {
    display: none;
}

@media (max-width: 980px) {
    h1 {
        font-size: 2.55rem;
    }

    .site-header {
        grid-template-columns: 1fr;
        padding: .9rem 1rem;
    }

    .primary-nav {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: .2rem;
    }

    .header-actions {
        justify-content: space-between;
    }

    .split-hero,
    .page-hero,
    .feature-row,
    .donate-layout,
    .donation-strip,
    .two-column,
    .account-layout,
    .site-footer {
        grid-template-columns: 1fr;
    }

    .split-hero {
        min-height: 0;
    }

    .hero-image {
        min-height: 320px;
    }

    .donate-copy {
        position: static;
    }

    .impact-grid,
    .amount-grid,
    .admin-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .content-grid,
    .policy-grid,
    .resource-list {
        grid-template-columns: 1fr;
    }

    .site-footer nav {
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    body:not(.account-body) {
        padding-bottom: calc(74px + env(safe-area-inset-bottom));
    }

    h1 {
        font-size: 2.15rem;
    }

    h2 {
        font-size: 1.55rem;
    }

    .site-header {
        grid-template-columns: auto minmax(0, 1fr);
        gap: .55rem;
        min-height: 0;
        padding: .6rem 1rem .7rem;
    }

    .brand {
        grid-column: 1;
        grid-row: 1;
    }

    .brand img {
        width: 142px;
    }

    .button {
        width: 100%;
    }

    .primary-nav {
        grid-column: 1 / -1;
        grid-row: 2;
        flex-wrap: nowrap;
        gap: 1rem;
        margin-inline: -.15rem;
        padding-bottom: 0;
        scrollbar-width: none;
    }

    .primary-nav::-webkit-scrollbar {
        display: none;
    }

    .primary-nav a {
        padding: .15rem 0;
        font-size: .93rem;
        white-space: nowrap;
    }

    .header-actions {
        grid-column: 2;
        grid-row: 1;
        gap: .4rem;
        justify-content: flex-end;
    }

    .header-actions .plain-link {
        font-size: .92rem;
    }

    .header-donate {
        display: none;
    }

    .mobile-sticky-donate {
        display: inline-flex;
        position: fixed;
        right: .85rem;
        bottom: calc(.85rem + env(safe-area-inset-bottom));
        left: .85rem;
        z-index: 45;
        width: auto;
        min-height: 54px;
        box-shadow: 0 14px 36px rgba(23, 75, 59, .28);
    }

    .amount-grid,
    .impact-grid,
    .form-grid,
    .amount-selector,
    .steps,
    .admin-stats {
        grid-template-columns: 1fr;
    }

    .page-band,
    .content-grid,
    .feature-row,
    .page-hero,
    .donate-layout {
        padding-top: 2.5rem;
        padding-bottom: 2.5rem;
    }

    .closing-cta {
        padding: 1.4rem;
    }

    .form-submit,
    .summary-list div,
    .admin-row,
    .cookie-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .row-actions {
        align-items: stretch;
    }

    .cookie-panel {
        right: .5rem;
        bottom: calc(5.3rem + env(safe-area-inset-bottom));
        width: calc(100% - 1rem);
        max-height: calc(100vh - 6rem - env(safe-area-inset-bottom));
        overflow: auto;
    }

}
