/* The print page scrolls, unlike the home page. */
body {
    display: block;
    height: auto;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
}

body::before {
    position: fixed;
}

.nav {
    position: absolute;
    animation: none;
    opacity: 1;
}

.nav-link.current {
    text-decoration: underline;
}

.home {
    position: absolute;
    top: 22px;
    left: 32px;
    z-index: 2;
}

.home img {
    height: 18px;
    display: block;
    filter: drop-shadow(0 0 10px rgba(233, 166, 166, 0.4));
}

main {
    position: relative;
    z-index: 1;
    padding: 120px 24px 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 120px;
}

.zine {
    /* One A6 page; the open spread is two of these. */
    --pw: min(320px, calc((100vw - 48px) / 2), calc(64vh * 297 / 420));
    --ph: calc(var(--pw) * 420 / 297);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 36px;
    outline: none;
}

.zine-meta {
    font-family: 'Courier New', monospace;
    color: #E9A6A6;
    text-align: center;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(233, 166, 166, 0.5);
}

.zine-meta h2 {
    font-size: 18px;
    font-weight: normal;
}

.zine-meta p {
    font-size: 13px;
    opacity: 0.6;
    margin-top: 6px;
}

.stage {
    perspective: 2400px;
    padding: 20px 0 40px;
}

.book {
    position: relative;
    width: calc(var(--pw) * 2);
    height: var(--ph);
    perspective: 1800px;
    transform: rotateX(14deg);
    transition: transform 0.9s cubic-bezier(0.645, 0.045, 0.355, 1);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Closed, the cover sits alone, so slide it to the middle. */
.book.closed-front {
    transform: rotateX(14deg) translateX(calc(var(--pw) * -0.5));
}

.book.closed-back {
    transform: rotateX(14deg) translateX(calc(var(--pw) * 0.5));
}

/* Shadow and glow under whichever pages are lying flat. */
.book::before {
    content: '';
    position: absolute;
    inset: 0;
    box-shadow:
        0 30px 50px rgba(0, 0, 0, 0.8),
        0 0 80px rgba(233, 166, 166, 0.12);
    transition: left 0.9s cubic-bezier(0.645, 0.045, 0.355, 1), right 0.9s cubic-bezier(0.645, 0.045, 0.355, 1);
}

.book.closed-front::before { left: 50%; }
.book.closed-back::before { right: 50%; }

/* Page edges peeking out from each stack. */
.book::after {
    content: '';
    position: absolute;
    inset: 2px calc(var(--right-stack) * -1.5px) 2px calc(var(--left-stack) * -1.5px);
    background:
        repeating-linear-gradient(90deg, #e9e4da 0 1px, #b9b3a8 1px 1.5px) left / calc(var(--left-stack) * 1.5px) 100% no-repeat,
        repeating-linear-gradient(90deg, #e9e4da 0 1px, #b9b3a8 1px 1.5px) right / calc(var(--right-stack) * 1.5px) 100% no-repeat;
    z-index: 0;
    transition: inset 0.9s cubic-bezier(0.645, 0.045, 0.355, 1);
}

.book.closed-front::after { left: 50%; }
.book.closed-back::after { right: 50%; }

.leaf {
    position: absolute;
    top: 0;
    left: 50%;
    width: var(--pw);
    height: 100%;
    transform-origin: left center;
    transform-style: preserve-3d;
    transition: transform 0.9s cubic-bezier(0.645, 0.045, 0.355, 1);
}

.leaf.turned {
    transform: rotateY(-180deg);
}

.face {
    position: absolute;
    inset: 0;
    background: #f4f1ea;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    overflow: hidden;
}

.face.back {
    transform: rotateY(180deg);
}

.face img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* The curve of the paper into the spine. */
.face::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.face.front::after {
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0.06) 7%, transparent 16%);
}

.face.back::after {
    background: linear-gradient(270deg, rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0.06) 7%, transparent 16%);
}

.controls {
    display: flex;
    align-items: center;
    gap: 20px;
    font-family: 'Courier New', monospace;
    color: #E9A6A6;
    font-size: 14px;
    letter-spacing: 1px;
}

.controls button {
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.7;
    transition: opacity 0.2s ease, text-shadow 0.2s ease;
}

.controls button:hover,
.controls button:focus-visible {
    opacity: 1;
    text-shadow: 0 0 12px rgba(233, 166, 166, 0.9);
}

.page-label {
    min-width: 90px;
    text-align: center;
    text-shadow: 0 0 10px rgba(233, 166, 166, 0.5);
}

.hint {
    font-family: 'Courier New', monospace;
    color: #E9A6A6;
    font-size: 12px;
    opacity: 0.45;
    letter-spacing: 1px;
    transition: opacity 0.6s ease;
}

.zine.touched .hint {
    opacity: 0;
}

@media (max-width: 480px) {
    .home { left: 20px; }
    .nav { right: 20px; }
    main { gap: 90px; }
}
