.love-story {
    --story-paper: #f7f5ef;
    --story-ink: #252622;
    --story-muted: #626c7d;
    --story-accent: #54022e;
    --story-gutter: clamp(18px, 3.4vw, 56px);
    --story-gap: clamp(8px, 1.25vw, 18px);
    --story-space: clamp(28px, 4vw, 60px);
    background: var(--story-paper);
    color: var(--story-ink);
    padding-bottom: var(--story-space);
}

.love-story-frame {
    width: min(1280px, calc(100% - 2 * var(--story-gutter)));
    margin-inline: auto;
}

.love-story a,
.love-story button {
    color: inherit;
}

.love-story__gallery-link:hover {
    color: var(--story-accent);
}

.love-story :focus-visible {
    outline: 2px solid var(--story-accent);
    outline-offset: 3px;
}

.love-story__opening {
    display: grid;
    grid-template-columns: minmax(0, 0.83fr) minmax(0, 1fr);
    grid-template-rows: 1fr auto;
    grid-template-areas:
        "cover names"
        "cover detail";
    column-gap: var(--story-gap);
}

.love-story__opening--solo {
    grid-template-rows: auto;
    grid-template-areas: "cover names";
    align-items: center;
}

.love-story__photo {
    display: block;
    min-width: 0;
    cursor: zoom-in;
}

.love-story__photo img {
    display: block;
    width: 100%;
    height: auto;
}

.love-story__cover {
    grid-area: cover;
    align-self: start;
}

.love-story__opening--solo .love-story__cover {
    align-self: center;
}

.love-story__opening-detail {
    grid-area: detail;
}

.love-story__opening-detail--portrait {
    max-width: min(55%, 360px);
}

.love-story__names {
    grid-area: names;
    align-self: start;
    padding: clamp(20px, 3.2vw, 46px);
}

.love-story__opening--solo .love-story__names {
    align-self: center;
}

.love-story__names time {
    display: block;
    margin-bottom: clamp(14px, 2.7vw, 35px);
    font-size: 16px;
    letter-spacing: 0.025em;
}

.love-story__names h1,
.love-story__intro h2 {
    margin: 0;
    color: var(--story-ink);
    font-family: ptserif-r, Georgia, serif;
    font-weight: 400;
    overflow-wrap: anywhere;
}

.love-story__names h1 {
    font-size: clamp(34px, 4vw, 50px);
    line-height: 1.06;
    letter-spacing: -0.04em;
}

.love-story__names h1 span {
    display: block;
}

.love-story__opening-controls {
    display: flex;
    justify-content: flex-end;
}

.love-story__gallery-link {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    gap: 14px;
}

.love-story__gallery-link,
.love-story__counter {
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.love-story__gallery-link i,
.love-story__back i {
    font-size: 17px;
}

.love-story__intro {
    margin: clamp(14px, 2vw, 28px) auto var(--story-space);
    max-width: 42rem;
    padding-inline: 10px;
    text-align: center;
}

.love-story__intro h2 {
    font-size: clamp(28px, 3vw, 38px);
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.love-story__intro p {
    margin: 8px 0 0;
    color: var(--story-muted);
    font-size: clamp(16px, 1.7vw, 18px);
    line-height: 1.45;
}

.love-story__pause {
    max-width: 980px;
    margin: var(--story-space) auto 0;
}

.love-story__short-sequence {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--story-gap);
}

.love-story__short-sequence > .love-story__photo {
    flex: var(--story-photo-ratio) 1 0px;
}

.love-story__short-sequence > .love-story__short-portrait:only-child {
    max-width: 480px;
}

.love-story__wide--portrait {
    max-width: 620px;
    margin-inline: auto;
}

.love-story__spread {
    display: grid;
    grid-template-columns: minmax(0, 0.94fr) minmax(0, 1fr);
    gap: clamp(18px, 3vw, 44px);
    align-items: center;
    margin-top: var(--story-space);
}

.love-story__spread--solo {
    grid-template-columns: minmax(0, 1fr);
    max-width: 680px;
    margin-inline: auto;
}

.love-story__details {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    align-items: end;
    gap: var(--story-gap);
    padding-inline: clamp(0px, 2vw, 20px);
}

.love-story__details > :nth-child(3) {
    grid-column: 1 / -1;
    justify-self: center;
    width: 72%;
}

.love-story__sequence {
    --story-strip-height: clamp(144px, 17vw, 256px);
    margin-top: var(--story-space);
}

.love-story__track {
    position: relative;
    display: flex;
    gap: var(--story-gap);
    overflow-x: auto;
    padding: 4px 4px 8px;
    margin-inline: -4px;
    scroll-padding-inline: 4px;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: #b7aea4 transparent;
}

.love-story__track .love-story__photo {
    flex: 0 0 auto;
    scroll-snap-align: start;
}

.love-story__track img {
    width: auto;
    height: var(--story-strip-height);
    max-width: none;
}

.love-story__sequence-controls:not([hidden]),
.love-story__viewer-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.love-story__icon-button {
    display: inline-grid;
    flex: 0 0 44px;
    min-width: 44px;
    min-height: 44px;
    place-items: center;
    padding: 0;
    background: transparent;
    border: 0;
    font-size: 18px;
}

.love-story__icon-button:enabled {
    cursor: pointer;
}

.love-story__icon-button:disabled {
    opacity: 0.35;
}

.love-story .love-story__back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 48px;
    max-width: 100%;
    margin-top: var(--story-space);
    padding: 12px 20px;
    border: 1px solid var(--story-accent);
    background-color: var(--color-bonus-light);
    color: var(--story-accent);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    transition: background-color 0.2s ease-out, color 0.2s ease-out;
}

.love-story .love-story__back:hover,
.love-story .love-story__back:focus-visible {
    background-color: var(--story-accent);
    color: var(--color-text-white);
}

.love-story__viewer {
    width: min(96vw, 1280px);
    margin: auto;
    padding: 0;
    max-width: none;
    max-height: none;
    color: #fff;
    background: transparent;
    border: 0;
}

.love-story__viewer::backdrop {
    background: rgb(24 23 22 / 96%);
}

.love-story__viewer-inner {
    box-sizing: border-box;
    height: min(calc(100dvh - 20px), 1080px);
    padding-inline: 6px;
    display: grid;
    grid-template-rows: 44px minmax(0, 1fr) 44px;
    gap: 7px;
}

.love-story__viewer-close {
    justify-self: end;
}

.love-story__viewer-photo {
    min-width: 0;
    min-height: 0;
}

.love-story__viewer-photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: scale-down;
}

.love-story__viewer-controls {
    justify-content: center;
}

.love-story__viewer :focus-visible {
    outline-color: #fff;
    outline-offset: -3px;
}

body:has(.love-story__viewer[open]) {
    overflow: hidden;
}

@media (max-width: 767px) {
    .love-story__opening,
    .love-story__spread {
        display: block;
    }

    .love-story__names {
        padding: 18px 4px 22px;
    }

    .love-story__names time {
        margin-bottom: 10px;
        font-size: 14px;
    }

    .love-story__names h1 {
        font-size: clamp(32px, 9vw, 38px);
    }

    .love-story__opening-detail--portrait {
        max-width: 100%;
    }

    .love-story__details {
        padding: 0;
    }

    .love-story__details + .love-story__portrait {
        margin-top: var(--story-gap);
    }

    .love-story__short-sequence {
        flex-direction: column;
    }

    .love-story__short-sequence > .love-story__photo {
        flex: none;
        width: 100%;
    }

    .love-story__short-sequence > .love-story__short-portrait {
        width: min(80%, 400px);
    }

    .love-story__sequence {
        --story-strip-height: clamp(144px, 42vw, 192px);
    }

    .love-story__sequence-controls:not([hidden]) {
        justify-content: space-between;
    }
}

@media (prefers-reduced-motion: reduce) {
    .love-story__track {
        scroll-behavior: auto;
    }

    .love-story .love-story__back {
        transition: none;
    }
}
