/* Rita's Refuge
   Hand-written, no build step. Every colour below was sampled from the organisation's
   own artwork in media/ and the contrast ratio against its background is noted where
   it matters. Keep those ratios above 4.5 for body text and 3.0 for large text and
   interface edges. */

/* Fonts: the @font-face rules live in default.hbs so they can use Ghost's {{asset}}
   helper and share one versioned URL with the preload tags. See the comment there. */

/* ------------------------------------------------------------------ tokens */

:root {
    --rr-cream:       #FFDF90;   /* logo ground */
    --rr-parchment:   #FFF4D9;   /* page ground, 14.85:1 with ink */
    --rr-sand:        #F6E7C8;   /* alternate light band */
    --rr-stone:       #CBAD83;   /* letterform fill, borders */
    --rr-ink:         #2C1D14;   /* body text */
    --rr-bark:        #3F2A1D;   /* headings, logo outlines */
    --rr-cocoa:       #5C3B22;   /* secondary text, 8.17:1 on sand */
    --rr-forest:      #3A614E;   /* dark band, 6.4:1 with parchment */
    --rr-moss:        #456945;   /* bio-card green */
    --rr-sage:        #518E65;
    --rr-poppy:       #E90D0F;   /* flower red. Decorative only: 4.24:1 fails AA text */
    --rr-poppy-text:  #B3210F;   /* red that passes: 6.11:1 on parchment */
    --rr-marigold:    #FF6C00;   /* orange flower, 5.72:1 with ink */

    /* --gh-font-* are set by Ghost when someone picks a font in Design settings.
       Unset, these fall back to the two families the brand collateral already uses. */
    --font-display: var(--gh-font-heading, 'Archivo Narrow'), 'Arial Narrow', system-ui, sans-serif;
    --font-body: var(--gh-font-body, 'Open Sans'), system-ui, -apple-system, 'Segoe UI', sans-serif;

    --wrap: 1120px;
    --wrap-narrow: 720px;
    --gutter: clamp(1rem, 4vw, 2rem);
    --band: clamp(3rem, 8vw, 6rem);
    --radius: 6px;
    --header-h: 4.25rem;

    --focus: var(--rr-poppy-text);
    --section-bg: var(--rr-parchment);
}

/* ------------------------------------------------------------------ base */

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

html {
    scroll-behavior: smooth;
    /* Anchored sections must clear the sticky header. */
    scroll-padding-top: calc(var(--header-h) + 1rem);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--rr-parchment);
    color: var(--rr-ink);
    font: 400 1.0625rem/1.7 var(--font-body);
    overflow-wrap: break-word;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.15;
    color: var(--rr-bark);
    margin: 0 0 0.5em;
    letter-spacing: 0.005em;
}

p, ul, ol, blockquote, figure { margin: 0 0 1.25em; }
img, svg { max-width: 100%; height: auto; }

a {
    color: var(--rr-poppy-text);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

a:hover { text-decoration-thickness: 2px; }

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
    border-radius: 2px;
}

.skip-link {
    position: absolute;
    left: 0.5rem;
    top: -4rem;
    z-index: 100;
    padding: 0.7rem 1.1rem;
    background: var(--rr-forest);
    color: var(--rr-parchment);
    font-weight: 700;
    border-radius: var(--radius);
    transition: top 120ms ease-out;
}

.skip-link:focus { top: 0.5rem; }

main:focus { outline: none; }

/* ------------------------------------------------------------------ layout */

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

.wrap--narrow { max-width: var(--wrap-narrow); }

.section {
    position: relative;
    padding-block: var(--band);
    background: var(--section-bg);
    color: var(--rr-ink);
}

.section--light { --section-bg: var(--rr-parchment); }
.section--stone { --section-bg: var(--rr-sand); }

.section--forest,
.section--moss {
    color: var(--rr-parchment);
    --focus: var(--rr-cream);
}

.section--forest { --section-bg: var(--rr-forest); }   /* 6.40:1 */
.section--moss   { --section-bg: var(--rr-moss); }     /* 5.71:1 */

.section--forest h1, .section--forest h2, .section--forest h3,
.section--moss h1, .section--moss h2, .section--moss h3 {
    color: var(--rr-cream);
}

/* Buttons are excluded: they carry their own background and their own text colour,
   and letting the section rule win here put cream text on the orange donate button. */
.section--forest a:not(.btn), .section--moss a:not(.btn) { color: var(--rr-cream); }

.section__heading {
    font-size: clamp(1.75rem, 4vw, 2.6rem);
    margin-bottom: 0.7em;
}

.section__action {
    margin-top: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* The vine divider sits directly on the section colour. The artwork arrived on a
   transparent background in September 2026, which replaced a crop lifted out of a bio
   card with the olive watercolour baked into it. That version needed the band painted
   a matching green and a gradient over the bottom edge to dissolve the seam; none of
   that is necessary now, so it is gone. */

.section--vined { padding-top: 0; }

/* Aspect ratio matches the trimmed artwork so the vine is never stretched, and the
   art bleeds to both edges so it reads as a continuous band at any width. */
.vine {
    width: 100%;
    aspect-ratio: 1600 / 310;
    margin-bottom: var(--band);
    /* Versioned filename, not decoration. A url() inside a stylesheet gets no ?v=
       cache-busting query, so the name is the only cache key the CDN has. Reusing it
       after changing the artwork serves every visitor the old picture indefinitely.
       Bump this and VINE_VERSION in tools/extract-assets.py together. */
    background-image: url('../images/vine-divider-2.png');
    background-image: image-set(
        url('../images/vine-divider-2.webp') type('image/webp'),
        url('../images/vine-divider-2.png') type('image/png')
    );
    background-repeat: no-repeat;
    background-position: center bottom;
    background-size: 100% auto;
}

/* ------------------------------------------------------------------ header */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--rr-parchment) 94%, transparent);
    border-bottom: 2px solid var(--rr-stone);
    backdrop-filter: blur(8px);
}

.site-header__inner {
    min-height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--rr-bark);
    text-decoration: none;
    margin-right: auto;
    padding-block: 0.5rem;
}

.brand__mark { width: 3.25rem; height: auto; }

.brand__name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: 0.01em;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 2vw, 1.5rem);
}

.nav-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: clamp(0.75rem, 2vw, 1.5rem);
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-nav .nav-list a {
    color: var(--rr-bark);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.075rem;
    text-decoration: none;
    padding-block: 0.35rem;
    border-bottom: 2px solid transparent;
}

.site-nav .nav-list a:hover,
.nav-item--current > a {
    border-bottom-color: var(--rr-poppy);
}

.nav-toggle {
    display: none;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 2px solid var(--rr-bark);
    border-radius: var(--radius);
    color: var(--rr-bark);
    font: 600 1rem var(--font-display);
    padding: 0.45rem 0.8rem;
    cursor: pointer;
}

.nav-toggle__bars { display: grid; gap: 3px; }
.nav-toggle__bars span {
    display: block;
    width: 18px;
    height: 2px;
    background: currentColor;
}

@media (max-width: 820px) {
    .nav-toggle { display: flex; }

    .site-nav {
        display: none;
        flex-basis: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding-bottom: 1rem;
    }

    .site-nav.is-open { display: flex; }

    .nav-list {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .site-nav .nav-list a {
        display: block;
        padding: 0.7rem 0;
        border-bottom: 1px solid var(--rr-stone);
    }

    .site-nav .btn { margin-top: 0.9rem; text-align: center; }
}

/* ------------------------------------------------------------------ buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.15rem;
    border-radius: var(--radius);
    border: 2px solid transparent;
    font: 700 1rem/1.2 var(--font-display);
    text-decoration: none;
    cursor: pointer;
}

.btn--lg { padding: 0.8rem 1.6rem; font-size: 1.15rem; }

.btn--primary {
    background: var(--rr-forest);
    color: var(--rr-parchment);   /* 6.40:1 */
}

.btn--primary:hover { background: #2F5140; }

.btn--donate {
    background: var(--rr-marigold);
    color: var(--rr-ink);         /* 5.72:1 */
    border-color: var(--rr-bark);
}

.btn--donate:hover { background: #E45F00; }

.btn--outline {
    background: transparent;
    color: var(--rr-bark);
    border-color: var(--rr-bark);
}

.btn--outline:hover { background: var(--rr-stone); }

.section--forest .btn--outline,
.section--moss .btn--outline {
    color: var(--rr-cream);
    border-color: var(--rr-cream);
}

.section--forest .btn--outline:hover,
.section--moss .btn--outline:hover {
    background: rgba(255, 244, 217, 0.14);
}

/* Marked with a dashed edge rather than reduced opacity: opacity blends the label
   into whatever is behind it and drops the contrast below AA. */
.is-placeholder {
    cursor: not-allowed;
    border-style: dashed;
}

.todo {
    display: inline-block;
    background: var(--rr-poppy-text);
    color: #fff;
    font: 700 0.7rem/1 var(--font-body);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.25rem 0.4rem;
    border-radius: 3px;
}

/* ------------------------------------------------------------------ hero */

.hero {
    background: var(--rr-cream);
    padding-block: clamp(2.5rem, 7vw, 4.5rem);
    border-bottom: 2px solid var(--rr-stone);
    text-align: center;
}

.hero__logo {
    width: min(88vw, 620px);
    height: auto;
    margin-inline: auto;
    display: block;
}

.hero__title {
    /* The logo already reads "Rita's Refuge". This heading is the accessible name of
       the page and is visually redundant, so it is small and quiet rather than absent. */
    font-size: clamp(1.35rem, 3vw, 1.75rem);
    margin: 0.75rem 0 0.35rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.hero__line {
    font-family: var(--font-display);
    font-style: italic;
    font-size: clamp(1.15rem, 3vw, 1.6rem);
    color: var(--rr-cocoa);
    max-width: 34ch;
    margin: 0 auto 1.75rem;
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin: 0;
}

/* ------------------------------------------------------------------ prose */

.prose { max-width: 68ch; }

.prose > :last-child { margin-bottom: 0; }

.prose h3 { font-size: 1.35rem; margin-top: 1.8em; }

.prose ul, .prose ol { padding-left: 1.3em; }

.prose li { margin-bottom: 0.4em; }

.prose blockquote {
    margin-inline: 0;
    padding: 0.2em 0 0.2em 1.1em;
    border-left: 4px solid var(--rr-poppy);
    font-style: italic;
    color: var(--rr-cocoa);
}

.section--forest .prose blockquote,
.section--moss .prose blockquote { color: var(--rr-parchment); }

.prose--compact { font-size: 0.975rem; }

.prose--statement {
    font-size: clamp(1.1rem, 2.4vw, 1.3rem);
    line-height: 1.65;
}

/* The poem is verse. Ghost's editor emits one paragraph per stanza with <br> between
   lines, so the stanza spacing and the hanging indent both come from here. */
.prose--verse {
    font-family: var(--font-display);
    font-style: italic;
    font-size: clamp(1.15rem, 2.6vw, 1.45rem);
    line-height: 1.55;
}

.prose--verse p { margin-bottom: 1.6em; }

/* ------------------------------------------------------------------ board */

.board-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: clamp(1.5rem, 3vw, 2.25rem);
    /* Two across on a desktop, not four. These bios run to a couple of hundred words
       and a 260px column turns them into a newspaper gutter. */
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
}

/* Photo beside the name, bio underneath, which is how the printed board cards in
   media/ are laid out. */
.board-card {
    background: rgba(255, 244, 217, 0.05);
    border: 2px solid rgba(255, 244, 217, 0.22);
    border-radius: var(--radius);
    padding: clamp(1.1rem, 2.5vw, 1.6rem);
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
        "photo name"
        "bio bio";
    column-gap: 1.15rem;
    align-content: start;
}

.board-card__photo {
    grid-area: photo;
    display: block;
    width: 6.5rem;
    height: 6.5rem;
    border-radius: 50%;
    margin: 0;
    border: 3px solid var(--rr-cream);
    background: var(--rr-cream);
    align-self: center;
}

.board-card__name {
    grid-area: name;
    align-self: end;
    font-size: 1.3rem;
    margin-bottom: 0.1em;
}

.board-card__role {
    grid-area: role;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.05rem;
    /* Parchment rather than cream: at this size the role line is normal text and
       needs 4.5:1 against the lightened card, which cream does not clear. */
    color: var(--rr-parchment);
    margin: 0;
}

.board-card__bio {
    grid-area: bio;
    max-width: none;
    margin-top: 1.1rem;
}

/* The name and role share one grid cell so they stay together next to the photo. */
.board-card__name, .board-card__role { grid-column: 2; }
.board-card__name { grid-row: 1; align-self: end; }
.board-card__role { grid-row: 2; align-self: start; }
.board-card__photo { grid-row: 1 / span 2; grid-column: 1; }
.board-card__bio { grid-row: 3; grid-column: 1 / -1; }

@media (max-width: 420px) {
    .board-card { grid-template-columns: 1fr; }
    .board-card__photo { grid-row: auto; grid-column: 1; margin-bottom: 0.9rem; }
    .board-card__name, .board-card__role { grid-column: 1; grid-row: auto; }
    .board-card__bio { grid-row: auto; }
}

/* ------------------------------------------------------------------ posts */

.post-grid {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    display: grid;
    gap: clamp(1.5rem, 3vw, 2.25rem);
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 17.5rem), 1fr));
}

.post-card {
    display: flex;
    flex-direction: column;
    background: var(--rr-parchment);
    border: 2px solid var(--rr-stone);
    border-radius: var(--radius);
    overflow: hidden;
    padding-bottom: 1.1rem;
}

.section--light .post-card { background: var(--rr-sand); }

.post-card__link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.post-card__image {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    background: var(--rr-stone);
}

.post-card__title {
    font-size: 1.25rem;
    margin: 1rem 1.1rem 0.4rem;
    color: var(--rr-bark);
}

.post-card__link:hover .post-card__title { text-decoration: underline; }

.post-card__meta {
    margin: 0 1.1rem 0.6rem;
    font-size: 0.85rem;
    color: var(--rr-cocoa);
}

.post-card__dot { margin-inline: 0.4em; }

.post-card__excerpt {
    margin: 0 1.1rem;
    font-size: 0.95rem;
    color: var(--rr-ink);
}

/* ------------------------------------------------------------------ single */

.page-head { margin-bottom: 2.5rem; }
.page-head__title { font-size: clamp(2rem, 5vw, 3rem); }
.page-head__intro { max-width: 60ch; color: var(--rr-cocoa); }

.post__head { margin-bottom: 2rem; }
.post__title { font-size: clamp(2rem, 5vw, 3rem); }

.post__tag a {
    font-family: var(--font-display);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.85rem;
}

.post__meta { color: var(--rr-cocoa); font-size: 0.9rem; margin-bottom: 0; }

.post__figure { margin: 0 0 2rem; }
.post__figure img { width: 100%; border-radius: var(--radius); }
.post__figure figcaption {
    font-size: 0.85rem;
    color: var(--rr-cocoa);
    text-align: center;
    margin-top: 0.6rem;
}

.post__content { margin-bottom: 2rem; }
.post__tags { font-size: 0.9rem; color: var(--rr-cocoa); }

.author-head { text-align: center; }
.author-head__photo { border-radius: 50%; width: 8rem; height: 8rem; object-fit: cover; }

.error { text-align: center; }
.error__code {
    font: 700 clamp(3.5rem, 12vw, 7rem)/1 var(--font-display);
    color: #A07C3E;   /* 3.52:1 on parchment, which clears AA for text this size */
    margin: 0;
}
.error__title { font-size: clamp(1.5rem, 4vw, 2.25rem); }
.error .prose { margin-inline: auto; }
.error .section__action { justify-content: center; }

/* Ghost's own card and gallery styles land inside .prose. Give the common ones a home.
   Wide and full cards have to escape the reading measure, which is what the negative
   margins do: the content column is centred, so pushing out by half the difference on
   each side widens the card symmetrically. */

.kg-image { border-radius: var(--radius); }

figure.kg-card { margin-bottom: 1.5em; }

.kg-width-wide {
    width: min(92vw, 60rem);
    max-width: none;
    margin-inline: calc(50% - min(46vw, 30rem));
}

.kg-width-full {
    width: 100vw;
    max-width: none;
    margin-inline: calc(50% - 50vw);
}

.kg-width-wide img, .kg-width-full img { width: 100%; }
.kg-width-full .kg-image { border-radius: 0; }

.kg-card figcaption {
    font-size: 0.85rem;
    color: var(--rr-cocoa);
    text-align: center;
    margin-top: 0.5rem;
}

/* ------------------------------------------------------------------ pagination */

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2.5rem;
    font-family: var(--font-display);
    font-weight: 600;
}

.pagination a {
    color: var(--rr-bark);
    text-decoration: none;
    border: 2px solid var(--rr-bark);
    border-radius: var(--radius);
    padding: 0.45rem 0.9rem;
}

.pagination a:hover { background: var(--rr-stone); }

/* ------------------------------------------------------------------ footer */

.site-footer {
    background: var(--rr-bark);
    color: var(--rr-parchment);
    padding-top: clamp(2.5rem, 6vw, 4rem);
    --focus: var(--rr-cream);
}

.site-footer__inner {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
    padding-bottom: 2.5rem;
}

.site-footer__mark { width: 6rem; }

.site-footer__name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.3rem;
    margin: 0.6rem 0 0.2rem;
}

.site-footer__tag { color: var(--rr-stone); margin: 0; font-size: 0.95rem; }

.site-footer__heading {
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--rr-stone);
}

.site-footer .nav-list {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.site-footer a { color: var(--rr-parchment); }

.site-footer__legal {
    border-top: 1px solid rgba(255, 244, 217, 0.2);
    padding-block: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--rr-stone);
}

.site-footer__legal p { margin: 0; }

/* ------------------------------------------------------------------ motion */

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media print {
    .site-header, .nav-toggle, .vine, .section__action { display: none; }
    body { background: #fff; color: #000; }
    .section { background: #fff; color: #000; padding-block: 1rem; }
}
