/* =========================================================================
   Waypoints Foundation - main stylesheet
   Brand vocabulary inverted from waypointsteaching.com:
   dark Woodsmoke base, generous Gull Gray + Raw Umber, blues as accents.
   ========================================================================= */

/* ---------- 1. Design tokens ---------- */

:root {
    /* Palette */
    --color-woodsmoke: #13171b;
    --color-woodsmoke-soft: #1c2126;
    --color-iron: #e4e5e7;
    --color-gull-gray: #92a0b2;
    --color-raw-umber: #9e643c;
    --color-raw-umber-hover: #b3764a;
    --color-danube: #5d91c6;
    --color-st-tropaz: #2f5496;

    /* Semantic */
    --bg-page: var(--color-woodsmoke);
    --bg-alt: var(--color-gull-gray);
    --bg-accent: var(--color-st-tropaz);
    --text-on-dark: var(--color-iron);
    --text-on-light: var(--color-woodsmoke);
    --text-muted-on-dark: #a9b3c1;
    --text-muted-on-light: #3a424d;

    /* Typography
       Body font is Roboto per Tom (matching waypointsteaching.com).
       Roboto ships 100/300/400/500/700/900, so "semibold" maps to 500
       and any heavier emphasis uses 700. */
    --font-body: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 500;
    --font-weight-bold: 700;

    /* Spacing scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;
    --space-8: 4rem;
    --space-9: 6rem;

    /* Layout */
    --container-max: 1200px;
    --container-px: clamp(1rem, 4vw, 2rem);

    /* Shape */
    --radius-pill: 999px;
    --radius-md: 8px;

    /* Motion */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --dur: 180ms;
}

/* ---------- 2. Reset / base ---------- */

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    font-family: var(--font-body);
}

body {
    margin: 0;
    font-family: var(--font-body);
    font-weight: var(--font-weight-regular);
    font-size: 16px; /* 12pt body per Tom */
    line-height: 1.65;
    color: var(--text-on-dark);
    background: var(--bg-page);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Force Roboto on form controls site-wide (browsers default these to their own UI font). */
input, textarea, select, button, optgroup {
    font-family: var(--font-body);
}

img, svg {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--color-danube);
    text-decoration: none;
    transition: color var(--dur) var(--ease);
}
a:hover { color: var(--color-raw-umber-hover); }
a:focus-visible {
    outline: 2px solid var(--color-raw-umber);
    outline-offset: 3px;
    border-radius: 2px;
}

h1, h2, h3, h4 {
    font-weight: var(--font-weight-bold);
    line-height: 1.15;
    margin: 0 0 var(--space-4);
    letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.75rem, 3.5vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); }

p { margin: 0 0 var(--space-4); }

::selection {
    background: var(--color-raw-umber);
    color: #fff;
}

/* ---------- 3. Layout primitives ---------- */

.container {
    width: 100%;
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: var(--container-px);
}

main {
    flex: 1 0 auto;
}

.section {
    position: relative;
    padding-block: var(--space-9);
}

.section--dark {
    background: var(--color-woodsmoke);
    color: var(--text-on-dark);
}
.section--deepdark {
    background: var(--color-woodsmoke-soft);
    color: var(--text-on-dark);
}
.section--light {
    background: var(--color-gull-gray);
    color: var(--text-on-light);
}
.section--iron {
    background: var(--color-iron);
    color: var(--text-on-light);
}
.section--accent {
    background: var(--color-st-tropaz);
    color: #fff;
}

.grid-split {
    display: grid;
    gap: var(--space-7);
    align-items: center;
    grid-template-columns: 1fr;
}
@media (min-width: 860px) {
    .grid-split { grid-template-columns: 1fr 1fr; }
    .grid-split--reverse > :first-child { order: 2; }
}

.grid-3 {
    display: grid;
    gap: var(--space-6);
    grid-template-columns: 1fr;
}
@media (min-width: 720px) {
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- 4. Components ---------- */

/* Eyebrow */
.eyebrow {
    display: inline-block;
    font-size: 0.8125rem;
    font-weight: var(--font-weight-bold); /* Roboto 700 for kicker emphasis */
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--color-raw-umber);
    margin: 0 0 var(--space-3);
}
.section--accent .eyebrow,
.section--dark .eyebrow.on-dark-alt { color: var(--color-iron); }

/* Squiggle underline that sits under a heading */
.squiggle {
    display: block;
    width: 96px;
    height: 14px;
    margin: var(--space-4) 0 var(--space-5);
    color: var(--color-raw-umber);
}
.squiggle--center { margin-left: auto; margin-right: auto; }
.section--light .squiggle { color: var(--color-st-tropaz); }
.section--accent .squiggle { color: var(--color-iron); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 0.85rem 1.75rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: var(--font-weight-semibold);
    letter-spacing: 0.02em;
    border: 2px solid transparent;
    border-radius: var(--radius-pill);
    cursor: pointer;
    text-decoration: none;
    transition: background-color var(--dur) var(--ease),
                color var(--dur) var(--ease),
                border-color var(--dur) var(--ease),
                transform var(--dur) var(--ease);
    will-change: transform;
}
.btn:focus-visible {
    outline: 3px solid var(--color-iron);
    outline-offset: 3px;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--primary {
    background: var(--color-raw-umber);
    color: #fff;
    border-color: var(--color-raw-umber);
}
.btn--primary:hover {
    background: var(--color-raw-umber-hover);
    border-color: var(--color-raw-umber-hover);
    color: #fff;
}

.btn--ghost {
    background: transparent;
    color: var(--color-iron);
    border-color: var(--color-gull-gray);
}
.btn--ghost:hover {
    background: var(--color-gull-gray);
    color: var(--color-woodsmoke);
    border-color: var(--color-gull-gray);
}

.btn--ghost-dark {
    background: transparent;
    color: var(--color-woodsmoke);
    border-color: var(--color-raw-umber);
}
.btn--ghost-dark:hover {
    background: var(--color-raw-umber);
    color: #fff;
    border-color: var(--color-raw-umber);
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
}

/* Wavy section divider (rendered inline by renderWaveDivider())
   The SVG is placed as the last child of a section. The :has() rule
   below strips the section's bottom padding so the wave sits flush
   against the next section, instead of floating above a strip of
   the section's own background color. */
.wave-divider {
    display: block;
    width: 100%;
    height: 80px;
    line-height: 0;
    margin-top: var(--space-9); /* preserves the visual breathing room
                                   that the section's bottom padding
                                   used to provide before :has() zeroed it */
    position: relative;         /* stacks above .hero::before gradient overlay
                                   so the wave fill isn't tinted by the hero
                                   background glows */
    z-index: 1;
    transform: translateY(2px); /* closes the subpixel gap between the wave
                                   bottom and the next section on high-DPI
                                   (mobile) screens; transforms are more
                                   reliable than negative margins in Safari */
}

.section:has(> .wave-divider:last-child),
.hero:has(> .wave-divider:last-child) {
    padding-bottom: 0;
}

/* ---------- 5. Header / nav ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(19, 23, 27, 0.92);
    backdrop-filter: saturate(150%) blur(8px);
    -webkit-backdrop-filter: saturate(150%) blur(8px);
    border-bottom: 1px solid rgba(146, 160, 178, 0.18);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);
    padding-block: var(--space-4);
}

.nav__brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}
.nav__brand img {
    height: 54px;
    width: auto;
}

.nav__links {
    display: flex;
    gap: var(--space-6);
    list-style: none;
    margin: 0;
    padding: 0;
}
.nav__links a {
    color: var(--color-iron);
    font-weight: var(--font-weight-medium);
    padding: var(--space-2) 0;
    position: relative;
}
.nav__links a:hover { color: var(--color-raw-umber-hover); }
.nav__links a.is-active::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -2px;
    height: 2px;
    background: var(--color-raw-umber);
    border-radius: 2px;
}

@media (max-width: 720px) {
    .nav__links { display: none; }
}

.nav__cta { white-space: nowrap; }

/* ---------- 6. Hero ---------- */

.hero {
    position: relative;
    padding-block: var(--space-9) var(--space-8);
    overflow: hidden;
}
.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 80% 20%, rgba(93, 145, 198, 0.18), transparent 55%),
        radial-gradient(circle at 15% 85%, rgba(158, 100, 60, 0.15), transparent 50%);
    pointer-events: none;
}
.hero__inner {
    position: relative;
    max-width: 820px;
}
.hero h1 {
    color: var(--color-iron);
    margin-bottom: var(--space-5);
}
.hero h1 em {
    font-style: normal;
    color: var(--color-raw-umber);
}
.hero__lede {
    font-size: clamp(1.05rem, 1.5vw, 1.25rem);
    color: var(--text-muted-on-dark);
    max-width: 62ch;
    margin-bottom: var(--space-6);
}

/* ---------- 7. Feature cards (3-up) ---------- */

.feature {
    text-align: center;
    padding: var(--space-5);
}
.feature__icon {
    width: 60px;
    height: 60px;
    margin: 0 auto var(--space-4);
    color: var(--color-raw-umber);
}
.feature h3 {
    color: var(--color-raw-umber);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 1rem;
    font-weight: var(--font-weight-bold);
}
.section--dark .feature h3 { color: var(--color-raw-umber); }

/* ---------- 8. Accent (blue) CTA section ---------- */

.cta-band {
    text-align: center;
}
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255, 255, 255, 0.9); max-width: 62ch; margin-inline: auto; }
.cta-band .btn-row { justify-content: center; }

/* Ghost button variant for use on accent (blue) bg */
.section--accent .btn--ghost {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.7);
}
.section--accent .btn--ghost:hover {
    background: #fff;
    color: var(--color-st-tropaz);
    border-color: #fff;
}

/* ---------- 9. Footer ---------- */

.site-footer {
    background: #0d1013;
    color: var(--text-muted-on-dark);
    padding-block: var(--space-7);
    border-top: 1px solid rgba(146, 160, 178, 0.15);
}
.site-footer__inner {
    display: grid;
    gap: var(--space-6);
    grid-template-columns: 1fr;
    align-items: center;
}
@media (min-width: 720px) {
    .site-footer__inner { grid-template-columns: auto 1fr auto; }
}
.site-footer img { height: 42px; width: auto; }
.site-footer a {
    color: var(--color-gull-gray);
}
.site-footer a:hover { color: var(--color-raw-umber-hover); }
.site-footer__links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-5);
    list-style: none;
    padding: 0; margin: 0;
    justify-content: center;
}
.site-footer__copy {
    font-size: 0.875rem;
    color: var(--color-gull-gray);
    text-align: center;
    margin: 0;
}
@media (min-width: 720px) {
    .site-footer__copy { text-align: right; }
}

.site-footer__legal {
    margin-top: var(--space-6);
    padding-top: var(--space-5);
    border-top: 1px solid rgba(146, 160, 178, 0.12);
    font-size: 0.8125rem;
    color: var(--color-gull-gray);
    text-align: center;
}
.site-footer__legal p { margin: 0; max-width: 72ch; margin-inline: auto; }

/* ---------- 10. Utilities ---------- */

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0);
    white-space: nowrap; border: 0;
}

.center-text { text-align: center; }
.max-prose { max-width: 62ch; margin-inline: auto; }

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--color-raw-umber);
    color: #fff;
    padding: var(--space-3) var(--space-4);
    z-index: 100;
}
.skip-link:focus {
    left: var(--space-4);
    top: var(--space-3);
}

/* ---------- 11. Forms (contact + grant application) ---------- */

.form {
    display: grid;
    gap: var(--space-5);
    max-width: 640px;
    margin-inline: auto;
}
.form__row {
    display: grid;
    gap: var(--space-5);
    grid-template-columns: 1fr;
}
@media (min-width: 720px) {
    .form__row--2col { grid-template-columns: 1fr 1fr; }
}
.form__field {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.form__field label {
    font-weight: var(--font-weight-medium);
    font-size: 0.9375rem;
    color: var(--text-on-dark);
}
.section--light .form__field label,
.section--iron .form__field label { color: var(--text-on-light); }

.form__field input,
.form__field select,
.form__field textarea {
    font: inherit;
    padding: 0.75rem 1rem;
    background: rgba(255,255,255,0.06);
    border: 1.5px solid rgba(146, 160, 178, 0.35);
    border-radius: var(--radius-md);
    color: var(--text-on-dark);
    transition: border-color var(--dur) var(--ease),
                background-color var(--dur) var(--ease);
}
.section--light .form__field input,
.section--light .form__field select,
.section--light .form__field textarea,
.section--iron .form__field input,
.section--iron .form__field select,
.section--iron .form__field textarea {
    background: #fff;
    border-color: rgba(19, 23, 27, 0.18);
    color: var(--text-on-light);
}

.form__field textarea {
    min-height: 140px;
    resize: vertical;
}

.form__field input:focus,
.form__field select:focus,
.form__field textarea:focus {
    outline: none;
    border-color: var(--color-raw-umber);
    background: rgba(255,255,255,0.1);
}
.section--light .form__field input:focus,
.section--iron .form__field input:focus {
    background: #fff;
    box-shadow: 0 0 0 3px rgba(158, 100, 60, 0.15);
}

.form__hint {
    font-size: 0.8125rem;
    color: var(--color-gull-gray);
}

.form__submit { display: flex; justify-content: flex-start; }

.alert {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-5);
    border-left: 4px solid;
}
.alert--success {
    background: rgba(93, 145, 198, 0.12);
    border-color: var(--color-danube);
    color: var(--text-on-dark);
}
.section--light .alert--success { color: var(--text-on-light); }

/* Simple prose block used for long-form copy pages */
.prose {
    max-width: 72ch;
    margin-inline: auto;
}
.prose ul {
    padding-left: 1.25rem;
    margin: 0 0 var(--space-4);
}
.prose ul li { margin-bottom: var(--space-2); }
.prose h3 {
    margin-top: var(--space-6);
    color: var(--color-raw-umber);
    font-size: 1.125rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.section--light .prose h3,
.section--iron .prose h3 { color: var(--color-st-tropaz); }

/* Page-title block used at top of interior (non-home) pages */
.page-head {
    padding-block: var(--space-8) var(--space-7);
    text-align: center;
}
.page-head .eyebrow { margin-bottom: var(--space-3); }
.page-head h1 { margin-bottom: var(--space-4); }
