/* =============================================================
   Hero pages — a fixed, full-bleed picture that the page content
   scrolls up over. Used by the site home page, the resource guide
   home page, and the stake conference pages.

   The picture comes from --hero-image so a page can swap it by
   setting that variable (see .hero-conference at the bottom).
   ============================================================= */

/* ---------- the fixed image ----------

   The hero is sized from the viewport, not from the photo, and the photo is
   fitted inside it with `contain` so the whole frame is always visible. A
   blurred, over-scaled copy of the same photo fills whatever the photo does
   not cover. Because nothing is ever cropped, the picture can be swapped by
   changing --hero-image alone - no aspect ratio to keep in step.

   Portrait: the hero IS the photo - full width, its own height, nothing else.
   No backdrop shows, and the page stays short.
   Landscape: the hero is shortened so some content shows below it, which
   leaves gutters either side of the photo for the blur to fill.
   ------------------------------------------------------------------------ */

.hero {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    /* portrait: exactly as tall as the photo is at full width */
    aspect-ratio: var(--hero-ratio);
    height: auto;
    z-index: 0;
    overflow: hidden;

    background-color: var(--hero-backdrop);

    display: flex;
    align-items: flex-end;
    justify-content: center;
}

/* blurred fill. Over-scaled because blur samples past the edges as
   transparent, which would otherwise leave a soft rim. */
.hero::before {
    content: '';
    position: absolute;
    inset: 0;

    background-image: var(--hero-image);
    background-size: cover;
    background-position: center;

    filter: blur(var(--hero-blur)) saturate(1.1);
    transform: scale(1.15);
}

/* the photo itself, whole frame, plus the scrim that keeps the title legible.
   First background layer paints on top, so the gradient sits over the photo. */
.hero::after {
    content: '';
    position: absolute;
    inset: 0;

    background-image:
        linear-gradient(to bottom,
            rgba(0, 0, 0, 0) 58%,
            var(--hero-scrim-bottom) 100%),
        var(--hero-image);
    background-size: 100% 100%, contain;
    background-position: center, center var(--hero-photo-y);
    background-repeat: no-repeat, no-repeat;
}

.hero-title {
    position: relative;
    z-index: 1;
    width: 100% !important;
    margin: 0;
    padding: 0 20px 4vh;
    border: 0;

    text-align: center;
    color: #fff;
    font-weight: 700;
    font-size: clamp(1.6rem, 4.6vw, 3.25rem);
    line-height: 1.15;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7);
}

/* holds the space the fixed hero occupies, so content starts below it */
.hero-spacer {
    width: 100%;
    aspect-ratio: var(--hero-ratio);
    height: auto;
    flex-shrink: 0;
}

/* Wide or horizontal: shorten the hero so the top of the content shows. */
@media screen and (orientation: landscape) {

    .hero,
    .hero-spacer {
        aspect-ratio: auto;
        height: var(--hero-height-landscape);
    }

    /* the hero is short here, so the photo sits centred in it */
    .hero {
        --hero-photo-y: 50%;
    }
}

/* ---------- the content that scrolls over it ---------- */

.page-content {
    position: relative;
    z-index: 1;
    width: 100%;
    /* tall enough that scrolling fully covers the hero */
    min-height: 100vh;
    background-color: var(--background-page);
    box-shadow: 0 -18px 40px rgba(0, 0, 0, 0.3);
}

.section {
    width: 100%;
}

.section+.section {
    border-top: solid 1px var(--border-color);
}

.section-body {
    width: 100%;
    padding: 24px;
}

/* ---------- full width link lists (home links, guide sections) ---------- */

.link-list {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 8px;
}

.link-list a {
    display: block;
    width: 100%;
    padding: 16px;
    font-size: 1.15rem;
    text-decoration: none;
    background-color: var(--background-sub-header);
    border-radius: var(--border-radius);
}

.link-list a:hover,
.link-list a:focus-visible {
    background-color: var(--background-sub-header-hover);
    text-decoration: underline;
}

@media screen and (max-width: 800px) {
    .section-body {
        padding: 16px;
    }
}


/* ---------- per page pictures ----------
   Set on <main> by the layout, so both .hero and .hero-spacer inherit it.
   Swap the stake conference picture by pointing this at another file.
   ------------------------------------------------------------------- */

.hero-conference {
    --hero-image: url('/assets/images/dp-west-sunset-photo-enhanced.webp');
}
