/* Verhalenpagina: een inhoudsopgave op perkament, daarna elk verhaal als
   spread met de illustratie als opgeprikte kaart naast de tekst.
   Opbouw komt uit inc/verhalen.php; alle tekst blijft uit de pagina-editor. */

.ss-verhalen {
    --verhalen-surface: var(--color-bg);
    --verhalen-callout: var(--color-bg-perkament);
}

/* Kop en inleiding ------------------------------------------------------ */
.ss-verhalen__header {
    padding-block: var(--space-3xl) var(--space-3xl);
    background: var(--color-bg-perkament);
}

.ss-verhalen__heading {
    max-width: 18ch;
    margin: 0;
    color: var(--color-primary);
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    line-height: 1.1;
    letter-spacing: var(--letter-spacing-tight);
    text-wrap: balance;
    overflow-wrap: break-word;
}

.ss-verhalen__intro {
    max-width: 52ch;
    margin-top: var(--space-lg);
    color: var(--color-primary);
    font-size: var(--font-size-xl);
    line-height: var(--line-height-relaxed);
    overflow-wrap: break-word;
}

.ss-verhalen__intro > * {
    margin: 0 0 var(--space-md);
}

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

/* Inhoudsopgave --------------------------------------------------------- */
.ss-verhalen__index {
    margin-top: var(--space-2xl);
}

.ss-verhalen__index-label {
    margin: 0 0 var(--space-md);
    color: var(--color-text);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
}

.ss-verhalen__index-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: var(--space-md);
    margin: 0;
    padding: 0;
    list-style: none;
}

.ss-verhalen__index-item {
    display: flex;
    margin: 0;
}

.ss-verhalen__index-link {
    display: flex;
    flex: 1;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm);
    padding-right: var(--space-lg);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    color: var(--color-primary);
    text-decoration: none;
    transition: transform 250ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

.ss-verhalen__index-media {
    flex: 0 0 auto;
    width: 88px;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: var(--radius-md);
    background: var(--color-bg-perkament-dark);
}

.ss-verhalen__index-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ss-verhalen__index-title {
    font-family: var(--font-heading);
    font-size: 1.1875rem;
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-snug);
    text-wrap: balance;
    overflow-wrap: break-word;
}

.ss-verhalen__index-link:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.ss-verhalen__index-link:hover .ss-verhalen__index-title {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}

.ss-verhalen__index-link:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring-color);
    outline-offset: 3px;
}

/* Verhalen -------------------------------------------------------------- */
.ss-verhalen__story {
    padding-block: var(--space-4xl);
    background: var(--verhalen-surface);
    scroll-margin-top: var(--header-h);
}

.ss-verhalen__story:nth-of-type(even) {
    --verhalen-surface: var(--color-bg-perkament);
    --verhalen-callout: var(--color-surface);
}

.ss-verhalen__story-inner {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    grid-template-areas:
        "figure head"
        "figure text";
    grid-template-rows: auto 1fr;
    column-gap: clamp(var(--space-2xl), 6vw, var(--space-4xl));
}

.ss-verhalen__story:nth-of-type(even) .ss-verhalen__story-inner {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    grid-template-areas:
        "head figure"
        "text figure";
}

.ss-verhalen__story--zonder-beeld .ss-verhalen__story-inner,
.ss-verhalen__story--zonder-beeld:nth-of-type(even) .ss-verhalen__story-inner {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "text";
    max-width: calc(var(--container-content) + 2 * var(--container-padding-desktop));
}

.ss-verhalen__story-head {
    grid-area: head;
}

.ss-verhalen__title {
    max-width: 22ch;
    margin: 0 0 var(--space-xl);
    color: var(--color-primary);
    font-size: clamp(1.875rem, 3.2vw, 2.75rem);
    line-height: var(--line-height-heading);
    letter-spacing: var(--letter-spacing-snug);
    text-wrap: balance;
    overflow-wrap: break-word;
}

.ss-verhalen__title strong {
    font-weight: inherit;
}

.ss-verhalen__figure {
    grid-area: figure;
    align-self: start;
    position: sticky;
    top: calc(var(--header-h) + var(--space-xl));
    width: 100%;
    max-width: 440px;
    margin: 0;
    justify-self: center;
}

.ss-verhalen__figure img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    transform: rotate(-2deg);
}

.ss-verhalen__story:nth-of-type(even) .ss-verhalen__figure img {
    transform: rotate(2deg);
}

.ss-verhalen__text {
    grid-area: text;
    min-width: 0;
    font-size: var(--font-size-lg);
    line-height: var(--line-height-relaxed);
    overflow-wrap: break-word;
}

.ss-verhalen__block > *,
.ss-verhalen__footer > * {
    max-width: 64ch;
}

.ss-verhalen__block + .ss-verhalen__block {
    margin-top: var(--space-xl);
}

.ss-verhalen__block p {
    margin: 0 0 var(--space-md);
}

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

.ss-verhalen__subtitle {
    margin: 0 0 var(--space-sm);
    color: var(--color-verfstreep-dark);
    font-size: var(--font-size-xl);
    line-height: var(--line-height-snug);
    text-wrap: balance;
}

.ss-verhalen__block--betekenis {
    padding: var(--space-lg) var(--space-xl);
    border-radius: var(--radius-lg);
    background: var(--verhalen-callout);
}

.ss-verhalen__block--betekenis .ss-verhalen__subtitle {
    color: var(--color-primary);
}

.ss-verhalen__block + .ss-verhalen__block--betekenis,
.ss-verhalen__block--betekenis + .ss-verhalen__block {
    margin-top: var(--space-2xl);
}

.ss-verhalen__footer {
    margin-top: var(--space-2xl);
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-border);
    font-size: var(--font-size-base);
}

.ss-verhalen__sources {
    margin: 0;
}

.ss-verhalen__text :is(ul, ol) {
    margin: 0 0 var(--space-md);
    padding-inline-start: var(--space-lg);
}

.ss-verhalen__text img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
}

.ss-verhalen__text a,
.ss-verhalen__intro a {
    color: var(--color-primary-light);
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

.ss-verhalen__text a:hover,
.ss-verhalen__intro a:hover {
    color: var(--color-primary);
}

.ss-verhalen__text a:focus-visible,
.ss-verhalen__intro a:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring-color);
    outline-offset: var(--focus-ring-offset);
}

.ss-verhalen__pagination {
    padding-block: var(--space-2xl);
}

/* Smal: kop, kaart, tekst onder elkaar --------------------------------- */
@media (max-width: 899px) {
    .ss-verhalen__header {
        padding-block: var(--space-2xl);
    }

    .ss-verhalen__heading {
        font-size: clamp(2rem, 8.2vw, 2.5rem);
    }

    .ss-verhalen__intro {
        font-size: var(--font-size-lg);
    }

    .ss-verhalen__index {
        margin-top: var(--space-xl);
    }

    .ss-verhalen__index-media {
        width: 72px;
    }

    .ss-verhalen__index-title {
        font-size: var(--font-size-lg);
    }

    .ss-verhalen__story {
        padding-block: var(--space-3xl);
    }

    .ss-verhalen__story-inner,
    .ss-verhalen__story:nth-of-type(even) .ss-verhalen__story-inner {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto;
        grid-template-areas: "head" "figure" "text";
    }

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

    .ss-verhalen__figure {
        position: static;
        max-width: 320px;
        margin-bottom: var(--space-2xl);
    }

    .ss-verhalen__text {
        font-size: var(--font-size-base);
    }

    .ss-verhalen__subtitle {
        font-size: var(--font-size-lg);
    }

    .ss-verhalen__block--betekenis {
        padding: var(--space-lg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .ss-verhalen__index-link {
        transition: none;
    }

    .ss-verhalen__index-link:hover {
        transform: none;
    }
}
