/* GK – Gedichten voor Gerrit Komrij
   Papier, Baskerville en de blauwe inkt van de bundel. */

:root {
    --ink: #3b5486;            /* blauwe drukinkt */
    --ink-soft: #6b7fa8;
    --ink-faint: rgba(59, 84, 134, .14);
    --text: #2a2d33;
    --paper: #f3f1eb;          /* Munken Pure Rough */
    --paper-edge: #e6e2d8;
    --wood: #1d1c1a;
    --on-wood: #ecebe6;
    --on-wood-soft: rgba(236, 235, 230, .7);

    --serif: "Libre Baskerville", Baskerville, "Baskerville Old Face", Georgia, serif;
    --toc-w: 22rem;
    --ease: cubic-bezier(.22, .61, .36, 1);
    --t: .45s;
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--wood);
    color: var(--text);
    font: 400 16px/1.6 var(--serif);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img, svg, video { display: block; max-width: 100%; }
[hidden] { display: none !important; }
a { color: inherit; }
button { font: inherit; color: inherit; }

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

.sr-only {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: fixed; z-index: 100; top: .75rem; left: .75rem;
    padding: .6rem 1rem; background: var(--paper); color: var(--ink);
    transform: translateY(-200%); transition: transform .2s;
}
.skip-link:focus { transform: none; }

.icon { width: 1.1em; height: 1.1em; flex: none; }

/* Kleine kapitalen zoals in de bundel */
.caps {
    font-size: .72rem; letter-spacing: .22em; text-transform: uppercase;
}

/* ───────────── Knoppen ───────────── */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .6em;
    min-height: 3rem; padding: .7rem 1.4rem;
    border: 1px solid rgba(236, 235, 230, .35); border-radius: 999px;
    background: rgba(29, 28, 26, .25);
    color: var(--on-wood);
    font-size: .74rem; letter-spacing: .2em; text-transform: uppercase; text-decoration: none;
    cursor: pointer;
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    transition: background-color .25s, border-color .25s, color .25s, transform .25s var(--ease);
}
.btn:hover { background: rgba(236, 235, 230, .12); border-color: rgba(236, 235, 230, .7); }
.btn:active { transform: scale(.98); }
.btn .icon { width: 1rem; height: 1rem; opacity: .75; transition: transform .25s var(--ease); }
.btn:hover .icon { transform: translateX(2px); }

.btn--primary { background: var(--paper); border-color: var(--paper); color: var(--ink); }
.btn--primary:hover { background: #fff; border-color: #fff; }

.btn--ink { background: transparent; border-color: var(--ink-faint); color: var(--ink); backdrop-filter: none; }
.btn--ink:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn--ink .icon { opacity: 1; }

.icon-btn {
    display: inline-grid; place-items: center;
    width: 2.75rem; height: 2.75rem; padding: 0;
    border: 0; border-radius: 50%; background: transparent; cursor: pointer;
    transition: background-color .2s;
}
.icon-btn svg { width: 1.35rem; height: 1.35rem; }
.icon-btn:hover { background: var(--ink-faint); }

/* ───────────── Intro ───────────── */

.intro {
    position: relative;
    min-height: 100vh; min-height: 100dvh;
    display: grid; place-items: center;
    padding: 3rem 1.25rem calc(3rem + env(safe-area-inset-bottom));
    color: var(--on-wood);
    background:
        radial-gradient(ellipse at 50% 45%, rgba(29, 28, 26, .62), rgba(29, 28, 26, .88) 75%),
        url("/media/background.jpg") center 40% / cover no-repeat var(--wood);
    text-align: center;
    overflow: hidden;
}

.intro__inner { width: 100%; max-width: 40rem; display: flex; flex-direction: column; align-items: center; }

.intro__inner > * { animation: rise 1s var(--ease) both; }
.intro__inner > :nth-child(2) { animation-delay: .1s; }
.intro__inner > :nth-child(3) { animation-delay: .25s; }
.intro__inner > :nth-child(4) { animation-delay: .45s; }
.intro__inner > :nth-child(5) { animation-delay: .6s; }

.intro__presented {
    margin: 0 0 .9rem;
    font-size: .66rem; letter-spacing: .32em; text-transform: uppercase; color: var(--on-wood-soft);
}

.intro__komrijk {
    display: flex; flex-direction: column; align-items: center; gap: .15rem;
    text-decoration: none; color: var(--on-wood-soft);
    font-size: .7rem; letter-spacing: .3em; text-transform: uppercase;
    opacity: .9; transition: opacity .25s;
}
.intro__komrijk:hover { opacity: 1; }
.intro__komrijk img { width: 7.5rem; height: auto; }

.intro__title { margin: clamp(2.5rem, 8vh, 4.5rem) 0 0; font-weight: 400; }

.intro__mark {
    width: clamp(9rem, 32vw, 15rem); height: auto; aspect-ratio: 261 / 152; margin: 0 auto;
    color: #c9d4ea;
    filter: drop-shadow(0 6px 30px rgba(0, 0, 0, .35));
}

.intro__subtitle {
    display: block; margin-top: 1.6rem;
    font-size: clamp(.7rem, 1.8vw, .82rem); letter-spacing: .3em; text-transform: uppercase;
}

.intro__actions {
    display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem;
    margin-top: clamp(2.5rem, 7vh, 3.75rem);
}

.intro__colophon {
    max-width: 30rem; margin: clamp(2.5rem, 7vh, 4rem) 0 0;
    font-size: .78rem; font-style: italic; line-height: 1.8; color: var(--on-wood-soft);
}

@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* ───────────── Reader: decor ───────────── */

.reader { position: relative; min-height: 100vh; min-height: 100dvh; }

.stage { position: fixed; inset: 0; overflow: hidden; background: var(--wood); }

.stage__img {
    position: absolute; inset: 0; width: 100%; height: 100%; max-width: none;
    object-fit: cover; object-position: 60% 40%;
    opacity: 0; transform: scale(1.03);
    transition: opacity .8s var(--ease), transform 6s var(--ease);
}
.stage__img.is-active { opacity: 1; transform: none; }

.stage::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(90deg, rgba(29, 28, 26, .55), rgba(29, 28, 26, .05) 55%);
    transition: background-color var(--t);
}
[data-view="poem"] .stage::after { background-color: rgba(29, 28, 26, .62); }

.stage__caption {
    position: absolute; right: clamp(1.5rem, 4vw, 3.5rem); bottom: clamp(1.5rem, 5vh, 3rem);
    max-width: min(32rem, calc(100% - var(--toc-w) - 6rem));
    text-align: right; color: var(--on-wood);
    text-shadow: 0 1px 20px rgba(0, 0, 0, .45);
    opacity: 0; transform: translateY(8px);
    transition: opacity .4s, transform .4s var(--ease);
}
.stage__caption.is-visible { opacity: 1; transform: none; }
.stage__caption-title { display: block; font-size: clamp(1.4rem, 2.6vw, 2.2rem); line-height: 1.25; }
.stage__caption-poet { display: block; margin-top: .4rem; font-style: italic; color: var(--on-wood-soft); }
[data-view="poem"] .stage__caption { display: none; }

/* ───────────── Inhoud ───────────── */

.toc {
    position: fixed; z-index: 20; top: 0; bottom: 0; left: 0;
    width: var(--toc-w);
    padding: clamp(.75rem, 2vw, 1.25rem);
    display: flex;
}

.toc__paper {
    flex: 1; display: flex; flex-direction: column; min-height: 0;
    background: var(--paper);
    border-radius: 3px;
    box-shadow: 0 1px 0 var(--paper-edge) inset, 0 30px 60px -20px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .2);
    color: var(--ink);
}

.toc__head { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.25rem 0 1.75rem; }

.toc__home { display: block; width: 3.4rem; color: var(--ink); opacity: .9; transition: opacity .2s; }
.toc__home:hover { opacity: 1; }
.toc__home svg { width: 100%; height: auto; aspect-ratio: 261 / 152; }

.toc__close { display: none; color: var(--ink); }

.toc__title {
    margin: 1.75rem 1.75rem .5rem;
    font-size: .7rem; font-weight: 400; letter-spacing: .3em; text-transform: uppercase; color: var(--ink-soft);
}

.toc__list {
    flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    list-style: none; margin: 0; padding: .25rem .75rem 1rem;
    scrollbar-width: thin; scrollbar-color: var(--ink-faint) transparent;
}

.toc__link {
    position: relative; display: block;
    padding: .62rem 1rem .62rem 1rem;
    border-radius: 3px;
    text-decoration: none; line-height: 1.35;
    transition: background-color .2s, padding-left .3s var(--ease);
}
.toc__link::before {
    content: ""; position: absolute; left: 0; top: .8rem; bottom: .8rem; width: 2px;
    background: var(--ink); border-radius: 2px;
    transform: scaleY(0); transition: transform .3s var(--ease);
}
.toc__link:focus-visible { background: rgba(59, 84, 134, .06); padding-left: 1.25rem; }
@media (hover: hover) {
    .toc__link:hover { background: rgba(59, 84, 134, .06); padding-left: 1.25rem; }
}
.toc__link[aria-current="page"] { background: rgba(59, 84, 134, .08); padding-left: 1.25rem; }
.toc__link[aria-current="page"]::before { transform: none; }

.toc__poem { display: block; font-size: .94rem; color: var(--ink); }
.toc__poet { display: flex; align-items: center; gap: .45rem; margin-top: .1rem; font-size: .82rem; font-style: italic; color: var(--ink-soft); }

.toc__video {
    display: inline-grid; place-items: center; width: 1.05rem; height: 1.05rem;
    border: 1px solid currentColor; border-radius: 50%; font-style: normal;
}
.toc__video svg { width: .55rem; height: .55rem; margin-left: 1px; }

.toc__foot {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    margin: 0 1.75rem; padding: 1rem 0 1.25rem;
    border-top: 1px solid var(--ink-faint);
    font-size: .7rem; color: var(--ink-soft);
}
.toc__back {
    display: inline-flex; align-items: center; gap: .3rem;
    letter-spacing: .2em; text-transform: uppercase; text-decoration: none; color: var(--ink);
}
.toc__back:hover { text-decoration: underline; text-underline-offset: 3px; }
.toc__hint { font-style: italic; text-align: right; }

.toc-backdrop { display: none; }

/* ───────────── Gedicht ───────────── */

.page {
    position: relative; z-index: 10;
    margin-left: var(--toc-w);
    padding: clamp(1.25rem, 4vh, 3rem) clamp(1rem, 4vw, 3rem) 4rem;
    outline: none;
}
[data-view="index"] .page { display: none; }

.page__bar { display: none; }

.poem { max-width: 40rem; margin: 0 auto; animation: page-in .6s var(--ease) both; }

@keyframes page-in { from { opacity: 0; transform: translateY(18px); } }

.sheet {
    position: relative;
    padding: clamp(2.5rem, 7vw, 5rem) clamp(1.5rem, 7vw, 5rem) clamp(2.5rem, 5vw, 3.5rem);
    background: var(--paper);
    background-image:
        radial-gradient(ellipse at 0 0, rgba(255, 255, 255, .55), transparent 55%),
        linear-gradient(90deg, rgba(0, 0, 0, .035), transparent 6%);
    border-radius: 3px;
    box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .6), 0 2px 10px rgba(0, 0, 0, .25);
}

.poem__title {
    margin: 0 0 2.25rem;
    font-size: .95rem; font-weight: 400; line-height: 1.6;
    letter-spacing: .2em; text-transform: uppercase;
    color: var(--ink);
    outline: none;
}

.poem__text { color: var(--ink); font-size: clamp(1rem, 2.3vw, 1.08rem); line-height: 1.75; }

.stanza { margin: 0 0 1.6em; }
.stanza:last-child { margin-bottom: 0; }

/* Lange regels inspringend laten doorlopen in plaats van gewoon af te breken */
.line { display: inline-block; padding-left: 1.5em; text-indent: -1.5em; }

.poem__sign {
    margin: 2.5rem 0 0;
    font-size: .78rem; letter-spacing: .22em; text-transform: uppercase; color: var(--ink-soft);
}

.poem__video { margin-top: 2rem; }

.poet {
    display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 1.25rem;
    margin-top: 3rem; padding-top: 2.25rem;
    border-top: 1px solid var(--ink-faint);
    position: relative;
}
.poet__ornament {
    position: absolute; top: 0; left: 50%; transform: translate(-50%, -55%);
    padding: 0 .9rem; background: var(--paper); color: var(--ink-soft); font-size: 1.2rem; line-height: 1;
}
.poet__face {
    width: 5rem; height: 5rem; border-radius: 50%; object-fit: cover;
    filter: grayscale(1) contrast(1.05);
    box-shadow: 0 0 0 4px var(--paper), 0 0 0 5px var(--ink-faint);
}
.poet__name { margin: 0 0 .35rem; font-size: 1.05rem; font-weight: 400; color: var(--ink); }
.poet__links { display: flex; flex-wrap: wrap; gap: .25rem 1.1rem; margin: 0; padding: 0; list-style: none; font-size: .8rem; }
.poet__links a {
    display: inline-flex; align-items: center; gap: .4rem; padding: .2rem 0;
    color: var(--ink-soft); text-decoration: none; transition: color .2s;
    word-break: break-word;
}
.poet__links a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.poet__links .icon { width: .95rem; height: .95rem; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.25rem; }
.pager__link {
    display: flex; align-items: center; gap: .75rem;
    padding: 1rem 1.1rem; border-radius: 3px;
    color: var(--on-wood); text-decoration: none; font-size: .9rem; line-height: 1.35;
    background: rgba(29, 28, 26, .35);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    border: 1px solid rgba(236, 235, 230, .12);
    transition: background-color .25s, border-color .25s;
}
.pager__link:hover { background: rgba(29, 28, 26, .55); border-color: rgba(236, 235, 230, .35); }
.pager__link small {
    display: block; margin-bottom: .2rem;
    font-size: .62rem; letter-spacing: .22em; text-transform: uppercase; color: var(--on-wood-soft);
}
.pager__link--next { justify-content: flex-end; text-align: right; }
.pager__link .icon { opacity: .7; transition: transform .25s var(--ease); }
.pager__link--prev:hover .icon { transform: translateX(-3px); }
.pager__link--next:hover .icon { transform: translateX(3px); }

/* ───────────── Video ───────────── */

.video {
    width: min(64rem, calc(100vw - 2rem)); max-width: none; max-height: calc(100vh - 2rem);
    padding: 0; border: 0; background: transparent; color: var(--on-wood); overflow: visible;
}
.video::backdrop { background: rgba(12, 12, 11, .88); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.video[open] { animation: page-in .4s var(--ease) both; }
.video__frame { background: #000; border-radius: 3px; overflow: hidden; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
.video video { width: 100%; max-height: calc(100vh - 8rem); background: #000; }
.video__label { margin: .9rem 0 0; font-size: .85rem; font-style: italic; color: var(--on-wood-soft); text-align: center; }
.video__close { position: absolute; top: -3.25rem; right: -.5rem; color: var(--on-wood); }
.video__close:hover { background: rgba(255, 255, 255, .1); }

/* ───────────── Mobiel / tablet ───────────── */

@media (max-width: 900px) {
    :root { --toc-w: min(22rem, 88vw); }

    .stage::after { background: rgba(29, 28, 26, .5); }
    [data-view="poem"] .stage::after { background-color: rgba(29, 28, 26, .7); }
    .stage__caption { display: none; }

    /* Inhoud-weergave: de lijst is de pagina */
    [data-view="index"] .toc {
        position: relative; width: auto; max-width: 30rem; min-height: 100vh; min-height: 100dvh;
        margin: 0 auto; padding: 1rem;
    }
    [data-view="index"] .toc__list { overflow: visible; }

    /* Gedicht-weergave: inhoud als schuiflade */
    [data-view="poem"] .toc {
        padding: 0; transform: translateX(-102%); visibility: hidden;
        transition: transform .4s var(--ease), visibility 0s .4s;
    }
    [data-view="poem"] .toc__paper { border-radius: 0; }
    .toc-open[data-view="poem"] .toc { transform: none; visibility: visible; transition: transform .4s var(--ease); }
    [data-view="poem"] .toc__close { display: inline-grid; }

    [data-view="poem"] .toc-backdrop {
        display: block; position: fixed; inset: 0; z-index: 15;
        background: rgba(12, 12, 11, .55);
        opacity: 0; pointer-events: none; transition: opacity .4s;
    }
    .toc-open[data-view="poem"] .toc-backdrop { opacity: 1; pointer-events: auto; }
    .toc-open { overflow: hidden; }

    .page { margin-left: 0; padding: 0 .75rem 2.5rem; }

    .page__bar {
        position: sticky; top: 0; z-index: 5;
        display: flex; align-items: center; justify-content: space-between; gap: 1rem;
        margin: 0 -.75rem 1rem; padding: .6rem .75rem; padding-top: max(.6rem, env(safe-area-inset-top));
        background: rgba(29, 28, 26, .72);
        -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
        color: var(--on-wood);
    }
    .page__menu {
        display: inline-flex; align-items: center; gap: .55rem; min-height: 2.75rem; padding: 0 .5rem;
        font-size: .7rem; letter-spacing: .22em; text-transform: uppercase; text-decoration: none;
    }
    .page__menu .icon { width: 1.3rem; height: 1.3rem; }
    .page__count { font-size: .75rem; font-style: italic; color: var(--on-wood-soft); }
    .page__home { display: block; width: 2.6rem; padding: .5rem 0; color: #c9d4ea; }
    .page__home svg { width: 100%; height: auto; aspect-ratio: 261 / 152; }

    .poem { max-width: 36rem; }
    .poet { grid-template-columns: 1fr; justify-items: center; text-align: center; }
    .poet__links { justify-content: center; }
    .pager__link { padding: .85rem .9rem; font-size: .82rem; }
}

@media (max-width: 420px) {
    .intro__actions { flex-direction: column; align-items: stretch; width: 100%; max-width: 18rem; }
    .poem__title { font-size: .85rem; letter-spacing: .16em; }
    .line { padding-left: 1em; text-indent: -1em; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important; animation-delay: 0s !important;
        transition-duration: .01ms !important; scroll-behavior: auto !important;
    }
}

@media print {
    body { background: #fff; }
    .stage, .toc, .toc-backdrop, .page__bar, .pager, .poem__video, .intro, .video { display: none !important; }
    .page { margin: 0; padding: 0; }
    .sheet { box-shadow: none; background: none; padding: 0; }
}
