/* Index Page Styles
 *
 * Page-specific layout only. Build on the tokens and shared classes in
 * global.css (.container, .section, .button, ...) and write mobile-first
 * min-width queries at 48rem / 64rem.
 */

/* ---------- Hero ---------- */

/* The overlay and text use palette colors directly so the hero looks the same
   in both themes. */
.hero {
    --hero-overlay-opacity: 0.82; /* keeps cream text above 4.5:1 over the sunlit sky */

    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding-block: clamp(4rem, 3rem + 6vw, 8rem) var(--space-lg); /* short bottom so the arrow sits near the edge */
    color: var(--palette-cream);
    background-color: var(--palette-navy-deep);
    text-align: center;
}

.hero__image {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 40%;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-color: var(--palette-navy-deep);
    opacity: var(--hero-overlay-opacity);
}

.hero__content {
    max-width: calc(var(--container-narrow) + 2 * var(--container-pad));
}

.hero__title {
    margin-bottom: var(--space-lg);
    color: var(--palette-cream);
}

.hero__text {
    font-size: clamp(var(--font-size-base), 0.95rem + 0.4vw, 1.25rem);
    line-height: 1.75;
}

/* Shrink-wrapped and pushed to the right edge of the text block, so the
   names line up with each other on the left */
.hero__signatures {
    width: fit-content;
    margin-top: var(--space-xl);
    margin-left: auto;
    text-align: left;
}

.hero__signature {
    margin: 0;
    font-size: var(--font-size-lg);
    font-style: italic;
    line-height: 1.5;
}

/* The global focus color is navy in light mode, which disappears on the overlay */
.hero :focus-visible {
    outline-color: var(--palette-cream);
}

/* Down arrow: jumps to the next section (smooth scrolling comes from global.css) */
.hero__scroll {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    margin: var(--space-2xl) auto 0;
    color: var(--palette-sun);
    animation: hero-scroll-nudge 2.4s var(--ease-out) infinite;
}

.hero__scroll:hover {
    color: var(--palette-sun);
}

.hero__scroll svg {
    width: 2.25rem;
    height: 2.25rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Disabled by the reduced-motion rule in global.css */
@keyframes hero-scroll-nudge {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(0.375rem); }
}

/* ---------- Gospel ---------- */

.gospel {
    text-align: center;
}

.gospel__title {
    margin-bottom: var(--space-lg);
}

.gospel__text {
    font-size: clamp(var(--font-size-base), 0.95rem + 0.4vw, 1.125rem);
    line-height: 1.75;
}

/* ---------- Scripture references ---------- */

.hero .bible-link {
    color: var(--palette-gold);
}

/* ---------- Five Solas ---------- */

.solas__header {
    max-width: var(--container-narrow);
    margin: 0 auto var(--space-2xl);
    text-align: center;
}

.solas__title {
    margin-bottom: var(--space-lg);
}

/* Flex rather than grid so the odd card in the two-column layout centers
   instead of hanging left; every card keeps the same basis (equal widths). */
.solas__list {
    --solas-gap: var(--space-lg);
    --solas-columns: 1;

    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--solas-gap);
    list-style: none;
}

@media (min-width: 48rem) {
    .solas__list {
        --solas-columns: 2;
    }
}

/* Five columns need ~1200px before the descriptions get too narrow to read */
@media (min-width: 75rem) {
    .solas__list {
        --solas-columns: 5;
        --solas-gap: var(--space-md);
    }
}

/* The parchment is light in both themes, so card text always uses dark
   palette colors instead of the theme tokens. */
.sola-card {
    flex: 0 0 calc((100% - (var(--solas-columns) - 1) * var(--solas-gap)) / var(--solas-columns));
    min-width: 0;
    padding: var(--space-xl) var(--space-lg);
    border-radius: var(--radius-md);
    background-color: #ebe0c9; /* parchment fallback while the image loads */
    background-image: url("assets/media/parchment_bg_2.png");
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    box-shadow: var(--shadow-md);
    color: var(--palette-ink);
}

.sola-card__title {
    margin-bottom: var(--space-md);
    font-size: var(--font-size-h4);
    color: var(--palette-navy-deep);
    text-align: center;
}

.sola-card__translation {
    display: block;
    margin-top: var(--space-2xs);
    font-size: var(--font-size-base);
    font-weight: 400;
}

.sola-card__text {
    text-align: left;
}

.solas__quote {
    max-width: var(--container-narrow);
    margin: var(--space-3xl) auto 0;
    text-align: center;
}

.solas__quote blockquote p {
    font-size: clamp(var(--font-size-lg), 1rem + 0.75vw, 1.5rem);
    font-style: italic;
    line-height: 1.6;
    color: var(--color-heading);
}

.solas__quote figcaption {
    margin-top: var(--space-md);
    color: var(--color-text-muted);
}

.solas__quote cite {
    font-style: normal;
}

/* ---------- Our Focus ---------- */

.focus {
    --focus-overlap: 0px;
}

/* Upper area: a light panel in both themes (see .surface-light in global.css).
   Bottom padding, not header margin, reserves the overlap so the panel color
   runs all the way down to the band. */
.focus__top {
    padding-block: var(--section-space) calc(var(--focus-overlap) + var(--space-2xl));
    background-color: var(--color-surface);
}

.focus__header {
    text-align: center;
}

/* Thin divider under the heading (decorative, so a pseudo-element, not <hr>) */
.focus__title::after {
    content: "";
    display: block;
    width: 4rem;
    height: 2px;
    margin: var(--space-md) auto 0;
    background-color: var(--color-accent);
}

/* Lower band: theme blue-gray with a faint woven texture drawn in CSS.
   flow-root stops the cards' negative margin from collapsing through the band
   (which would drag the whole band up instead of overlapping it). */
.focus__band {
    position: relative; /* paints above the positioned .focus__top so the overlapping cards aren't covered */
    display: flow-root;
    padding-block: var(--space-2xl) var(--section-space);
    background-color: var(--color-band);
    background-image:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 6px),
        repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.06) 0 1px, transparent 1px 6px);
    color: var(--color-on-band);
}

.focus__list {
    display: grid;
    gap: var(--space-lg);
    max-width: var(--container-narrow);
    margin-inline: auto;
    list-style: none;
}

.focus-card {
    min-width: 0;
    padding: var(--space-xl) var(--space-lg);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    /* The parchment is light in both themes; .surface-light on the card keeps
       its text on the dark palette colors to match. */
    background-color: #ebe0c9; /* parchment fallback while the image loads */
    background-image: url("assets/media/parchment_bg_2.png");
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    /* Layered: a tight contact shadow for a crisp edge plus a wide, soft one
       for lift. Stronger than --shadow-md so the cards stand off both the
       light panel and the blue-gray band. */
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.12),
        0 12px 32px rgba(0, 0, 0, 0.22);
    color: var(--color-text);
}

.focus-card__title {
    margin-bottom: var(--space-md);
    font-size: var(--font-size-h3);
    text-align: center;
}

.focus-card__text {
    line-height: 1.75;
    text-align: left;
}

.focus__closing {
    margin-top: var(--space-2xl);
    text-align: center;
}

.focus__motto {
    margin-bottom: var(--space-xs);
    font-size: clamp(1.75rem, 1.3rem + 2vw, 2.75rem);
    font-weight: 700;
    line-height: var(--line-height-heading);
    text-wrap: balance;
}

.focus__translation {
    font-size: var(--font-size-lg);
    font-style: italic;
}

/* Desktop: three cards in a row, pulled up with a controlled negative margin
   so they straddle the edge of the band. The header reserves the same space,
   so nothing overlaps the heading and the cards stay in normal flow. */
@media (min-width: 64rem) {
    .focus {
        --focus-overlap: 7rem;
    }

    .focus__band {
        padding-top: 0;
    }

    .focus__list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        max-width: none;
        margin-top: calc(-1 * var(--focus-overlap));
    }

    .focus__closing {
        margin-top: var(--space-3xl);
    }
}

/* ---------- Community (Chili Fest photo) ---------- */

/* Like the hero, the overlay and text use palette colors directly so the
   section looks the same in both themes. Small screens stack the text under
   the photo (a 16:9 photo's bottom third is too short to hold it); from 75rem
   the section takes the photo's aspect ratio and the text sits in its bottom
   third. */
.community {
    --community-shade: 22, 47, 63; /* --palette-navy-deep as RGB, for the gradient */

    position: relative;
    isolation: isolate;
    overflow: hidden;
    background-color: var(--palette-navy-deep);
    color: var(--palette-cream);
    text-align: center;
}

.community__image {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 5940 / 3334;
    object-fit: cover;
}

.community__content {
    padding: var(--space-xl) var(--container-pad) var(--space-2xl);
}

.community__title {
    margin-bottom: var(--space-sm);
    color: var(--palette-cream);
}

.community__text {
    max-width: 40rem;
    margin: 0 auto var(--space-lg);
    font-size: clamp(var(--font-size-base), 0.95rem + 0.3vw, 1.125rem);
    line-height: 1.6;
}

/* Gold button with navy text: the theme accent (navy in light mode) would
   vanish against the dark backdrop. */
.community__button {
    --color-accent: var(--palette-gold);
    --color-accent-hover: var(--palette-gold-light);
    --color-on-accent: var(--palette-navy-deep);
}

.community :focus-visible {
    outline-color: var(--palette-cream);
}

@media (min-width: 75rem) {
    /* Three equal rows; the text block is confined to the last one */
    .community {
        display: grid;
        grid-template-rows: repeat(3, minmax(0, 1fr));
        aspect-ratio: 5940 / 3334;
        max-height: 56rem; /* stops very wide screens from getting a giant photo */
        width: 100%;
    }

    .community__image {
        position: absolute;
        inset: 0;
        z-index: -1;
        height: 100%;
        aspect-ratio: auto;
        object-position: center 60%;
    }

    /* Opacity gradient: light at the top so the photo shows through, dense at
       the bottom where the body text and button sit. */
    .community__content {
        grid-row: 3;
        align-self: center;
        justify-self: center;
        width: min(44rem, 100% - 2 * var(--container-pad));
        padding: var(--space-md) var(--space-xl);
        border-radius: var(--radius-md);
        background-image: linear-gradient(
            to bottom,
            rgba(var(--community-shade), 0.55),
            rgba(var(--community-shade), 0.9)
        );
        backdrop-filter: blur(2px);
        box-shadow: var(--shadow-md);
    }

    .community__text {
        margin-bottom: var(--space-md);
    }
}

/* ---------- Sermons ---------- */

.sermons {
    text-align: center;
}

.sermons__icon {
    display: block;
    width: 3rem;
    height: 3rem;
    margin: 0 auto var(--space-md);
    fill: none;
    stroke: var(--color-accent);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sermons__title {
    margin-bottom: var(--space-lg);
}

.sermons__text {
    font-size: clamp(var(--font-size-base), 0.95rem + 0.4vw, 1.125rem);
    line-height: 1.75;
}

/* Buttons stack full-width on narrow screens and sit side by side once
   there's room */
.sermons__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-md);
    margin-top: var(--space-xl);
}

.sermons__actions .button {
    flex: 1 1 12rem;
    max-width: 16rem;
}
