:root {
    --bg: #d5e5ef;
    --surface: #c6dae7;
    --text: #4f0f24;
    --muted: #6e3a4c;
    --brand: #4f0f24;
    --brand-strong: #330815;
    --pastel: #9fbdd2;
    --pastel-soft: #ebf2f7;
    --panel-border: #9fbdd2;
    --header-bg: var(--pastel);
    --header-text: #4f0f24;
    --header-link: var(--brand);
    --header-active: rgba(255, 255, 255, 0.45);
    --header-rule: rgba(79, 15, 36, 0.18);
    --on-brand: #ffffff;
    --field-bg: #ffffff;
    --border: #aac5d7;
    --error: #b42318;
    --success-bg: #e3f1e6;
    --radius: 8px;
    --wrap: 68rem;
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

/* Full-height column so the footer sits at the bottom of the screen on short pages. */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 1.0625rem/1.65 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

img { max-width: 100%; height: auto; }
a { color: var(--brand); }
a:hover { color: var(--brand-strong); }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }

.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 16px; top: 8px; background: var(--bg); padding: 8px 12px; z-index: 10; }

/* Header and main menu (after the original Cornerstone header) */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.site-header { background: var(--header-bg); color: var(--header-text); }
.header-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; padding-top: 16px; padding-bottom: 16px; }
.logo { display: block; background: #ffffff; border: 3px solid #4f0f24; border-radius: var(--radius); padding: 2px; line-height: 0; color: var(--text); text-decoration: none; }
.logo img { display: block; height: 160px; width: auto; }
.logo .brand-name { display: block; padding: 12px; font-size: 1.35rem; font-weight: 700; line-height: 1.2; }
.header-contact { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-align: right; font-size: 1.05rem; }
.header-contact p { margin: 0; }
.header-email a { color: var(--header-link); }
.header-email a:hover { color: var(--brand-strong); }
.header-actions { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.header-facebook { color: var(--brand); line-height: 0; }
.header-facebook:hover { color: #3b5998; }
.header-button { display: inline-block; padding: 8px 18px; border-radius: var(--radius); background: var(--brand); color: var(--on-brand); font-weight: 600; text-decoration: none; }
.header-button:hover { background: var(--brand-strong); color: var(--on-brand); }
.main-nav-bar { border-top: 1px solid var(--header-rule); }
.main-nav { list-style: none; margin: 0 auto; padding-top: 6px; padding-bottom: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.main-nav a { display: block; padding: 6px 10px; border-radius: var(--radius); color: var(--header-text); text-decoration: none; font-weight: 500; }
.main-nav a:hover { color: var(--header-link); text-decoration: underline; text-underline-offset: 4px; }
.main-nav a[aria-current] { background: var(--header-active); }

@media (max-width: 640px) {
    .header-top { justify-content: center; }
    .logo img { height: 110px; }
    .header-contact { align-items: center; text-align: center; font-size: 0.95rem; }
}

.form-anchor { scroll-margin-top: 5rem; }

main.wrap { flex: 1 0 auto; padding-top: 32px; padding-bottom: 48px; }

h1, h2, h3 { line-height: 1.25; color: var(--text); }
h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); margin: 0 0 24px; }
h2 { font-size: 1.5rem; margin: 40px 0 12px; }
h3 { font-size: 1.15rem; }

.prose { max-width: 46rem; }
.prose > :first-child { margin-top: 0; }
.prose blockquote { margin: 24px 0; padding: 12px 20px; border-left: 4px solid var(--brand); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; font-style: italic; }
.prose blockquote p { margin: 4px 0; }

.prose table { width: 100%; margin: 24px 0; border-collapse: collapse; }
.prose th, .prose td { padding: 10px 12px; border: 1px solid var(--border); text-align: left; vertical-align: top; overflow-wrap: break-word; }
.prose td a { overflow-wrap: anywhere; }
.prose th { background: var(--pastel); color: var(--header-text); }
.prose tr:nth-child(odd) td { background: var(--surface); }
.prose td:first-child { width: 32%; }
.prose th p, .prose td p { margin: 0; }
.prose th p + p, .prose td p + p { margin-top: 8px; }
@media (max-width: 640px) {
    .prose th, .prose td { padding: 8px; }
}

.panel { margin: 32px 0; padding: 4px 24px; border: 2px solid var(--panel-border); border-radius: var(--radius); background: var(--pastel-soft); }
.panel > :first-child { margin-top: 20px; }
.panel > :last-child { margin-bottom: 20px; }

.image-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 16px; margin: 24px 0; }
.image-row figure { margin: 0; }
.image-row img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--radius); }

.button { display: inline-block; padding: 10px 20px; border: 0; border-radius: var(--radius); background: var(--brand); color: var(--on-brand); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.button:hover { background: var(--brand-strong); color: var(--on-brand); }

/* News */
.news-list { list-style: none; padding: 0; margin: 16px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); gap: 24px; }
.news-list a { text-decoration: none; }
.news-list img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--radius); }
.news-list h3 { margin: 10px 0 4px; color: var(--brand); }
.news-list time, .post-meta { color: var(--muted); font-size: 0.9rem; }
.news-excerpt { margin: 6px 0 0; font-size: 0.95rem; }
.post .featured { display: block; max-height: 420px; width: 100%; object-fit: cover; border-radius: var(--radius); margin-bottom: 24px; }
.pagination { display: flex; justify-content: space-between; }
.tags { color: var(--muted); }

/* Contact form */
.contact-form { max-width: 36rem; margin: 16px 0 24px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
.field .required { font-weight: 400; color: var(--muted); }
.field input, .field textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; background: var(--field-bg); color: var(--text); }
.field input:focus, .field textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.field textarea { min-height: 10rem; }
.field-error { color: var(--error); margin: 4px 0 0; font-size: 0.9rem; }
.form-errors { border: 1px solid var(--error); color: var(--error); border-radius: var(--radius); padding: 8px 16px; margin-bottom: 16px; }
.form-success { background: var(--success-bg); border-radius: var(--radius); padding: 12px 16px; }
.hp { position: absolute; left: -9999px; }

.site-footer { background: var(--surface); color: var(--muted); font-size: 0.9rem; padding: 16px 0; }

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f1a2a;
        --surface: #16243a;
        --text: #e9e4e6;
        --muted: #b4a9ad;
        --brand: #9ccbef;
        --brand-strong: #c4e1f7;
        --on-brand: #0f1a2a;
        --pastel: #1d3557;
        --pastel-soft: #16243a;
        --panel-border: #2e4b74;
        --header-text: #e9e4e6;
        --header-active: rgba(255, 255, 255, 0.1);
        --header-rule: rgba(255, 255, 255, 0.12);
        --field-bg: #16243a;
        --border: #2e4466;
        --error: #ff8a80;
        --success-bg: #1f3324;
        color-scheme: dark;
    }
}
