/*
 * Hosted story page (templates/users/story.html, koncept 8.4). Decoration only: the
 * layouts and step states are the library's (storymap/storymap-v1.css), shared with
 * customers' own pages.
 *
 * Every colour goes through a --story-* variable that falls back on the instance theme
 * (--smartforms-* from custom-styles.css), so a story takes the municipality's colours
 * with nothing set for it. One story is restyled through its body class sm-story-<slug>
 * in the same custom-styles.css.
 */

:root {
    --story-paper: var(--smartforms-background-color, #f5f5f2);
    --story-ink: var(--smartforms-text-color, #1f2933);
    --story-header-bg: var(--smartforms-h1-background-color, #24402f);
    --story-header-text: var(--smartforms-h1-color, #fff);
    --story-accent: var(--smartforms-button-background-color, var(--story-header-bg));
    --story-accent-text: var(--smartforms-button-text-color, #fff);
    --story-card: #fff;
    --story-line: rgba(0, 0, 0, 0.12);
    --story-radius: var(--smartforms-radius, 12px);
    --story-shadow: var(--smartforms-card-shadow, 0 10px 15px -3px rgba(0, 0, 0, 0.1));
    --story-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --story-max-width: 1400px;
}

/* styles.css pads the body for the form pages; a story runs edge to edge. */
.story-page {
    margin: 0;
    padding: 0;
    background: var(--story-paper);
    color: var(--story-ink);
    line-height: 1.6;
    overflow-x: hidden;
}

.story-draft {
    margin: 0;
    padding: 10px 20px;
    background: #fff3cd;
    border-bottom: 1px solid #e6a817;
    color: #6b4a00;
    font-weight: 600;
    text-align: center;
}

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

.story-hero {
    display: grid;
    place-items: center;
    min-height: 70vh;
    min-height: 70svh;
    padding: 64px 24px;
    background: var(--story-header-bg);
    color: var(--story-header-text);
    text-align: center;
}

.story-hero-content {
    max-width: 760px;
}

.story-hero-title {
    margin: 0 0 18px;
    font-size: clamp(2.2rem, 7vw, 4.5rem);
    line-height: 1.1;
}

.story-hero-subtitle {
    margin: 0 0 18px;
    font-size: clamp(1.1rem, 2.4vw, 1.4rem);
    font-weight: 600;
}

.story-hero-intro {
    margin: 0 auto 14px;
    max-width: 620px;
    font-size: 1.05rem;
    opacity: 0.9;
}

.story-hero-start {
    display: inline-block;
    margin-top: 18px;
    padding: 12px 26px;
    border: 2px solid currentColor;
    border-radius: 100px;
    color: inherit;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s var(--story-ease), color 0.2s var(--story-ease);
}

.story-hero-start:hover,
.story-hero-start:focus-visible {
    background: var(--story-header-text);
    color: var(--story-header-bg);
}

/* ---------- the story ---------- */

.story-map {
    background: var(--story-line);
}

.sm-scrolly.story-main {
    max-width: var(--story-max-width);
    margin: 0 auto;
    padding: clamp(32px, 7vh, 80px) clamp(16px, 4vw, 40px);
}

.sm-scrolly .story-map {
    border-radius: var(--story-radius);
    box-shadow: var(--story-shadow);
}

.sm-scrolly .sm-step {
    margin: 0 0 4rem;
}

/* The library dims an inactive step to 0.55, which leaves body text below the 4.5:1
   contrast WCAG AA asks for. Still a hint, but one that keeps the text readable. */
.sm-scrolly .sm-step:not(.is-active) {
    opacity: 0.8;
}

/* In sidecar the step content is a card floating over the map. It fades in with its
   step, never the section itself: the library measures the section's box. */
.sm-sidecar .story-step {
    max-width: 440px;
    padding: clamp(20px, 3vw, 32px);
    background: var(--story-card);
    border: 1px solid var(--story-line);
    border-radius: var(--story-radius);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s var(--story-ease), transform 0.6s var(--story-ease);
}

.sm-sidecar .sm-step.is-active .story-step {
    opacity: 1;
    transform: none;
}

.story-step-kicker {
    margin: 0 0 10px;
    color: var(--story-header-bg);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.story-step-title {
    margin: 0 0 14px;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    line-height: 1.2;
}

.sm-sidecar .story-step-title {
    font-size: clamp(1.3rem, 2.4vw, 1.8rem);
}

.story-step-text {
    max-width: 60ch;
}

.story-step-text img {
    max-width: 100%;
    height: auto;
    border-radius: calc(var(--story-radius) - 4px);
}

.story-step-text a {
    color: inherit;
    text-underline-offset: 2px;
}

.story-step-features {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

.story-step-feature {
    padding: 6px 14px;
    border: 1px solid var(--story-line);
    border-radius: 100px;
    background: var(--story-card);
    color: inherit;
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.story-step-feature:hover,
.story-step-feature:focus-visible {
    border-color: var(--story-accent);
}

/* The photo is optional: a step without one starts at the kicker. */
.story-step-photo {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    margin-bottom: 16px;
    object-fit: cover;
    border-radius: calc(var(--story-radius) - 4px);
    background: var(--story-line);
}

.sm-sidecar .story-step-photo {
    aspect-ratio: auto;
    height: clamp(120px, 22vh, 190px);
}

.sm-scrolly .story-step-photo {
    max-width: 60ch;
}

.story-step-more {
    display: inline-block;
    margin-top: 16px;
    padding: 8px 18px;
    border: 1px solid var(--story-line);
    border-radius: 100px;
    background: var(--story-card);
    color: inherit;
    font-size: 0.9rem;
    text-decoration: none;
}

.story-step-more:hover,
.story-step-more:focus-visible {
    border-color: var(--story-accent);
}

.story-step-caption {
    margin: 14px 0 0;
    font-size: 0.85rem;
    opacity: 0.75;
}

@media (max-width: 768px) {
    .story-hero {
        min-height: 60vh;
        min-height: 60svh;
    }

    .sm-scrolly .sm-step {
        margin: 2rem 0;
    }

    /* Cards scroll below the map on a narrow screen, so every one stays visible. */
    .sm-sidecar .story-step {
        max-width: none;
        opacity: 1;
        transform: none;
        box-shadow: var(--story-shadow);
    }
}

@media (prefers-reduced-motion: reduce) {
    .story-hero-start,
    .sm-sidecar .story-step {
        transition: none;
    }

    .sm-sidecar .story-step {
        opacity: 1;
        transform: none;
    }
}
