/* Guest photo albums: event chooser, justified photo grid, videos, lightbox. */

.album-events {
    display: grid;
    gap: 1.25rem;
    margin-top: 1.5rem;
}

@media (min-width: 760px) {
    .album-events {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.album-event {
    position: relative;
    display: block;
    aspect-ratio: 4 / 5;
    border-radius: 16px;
    overflow: hidden;
    background: var(--editorial-accent);
    color: #fff;
    text-decoration: none;
    box-shadow: var(--editorial-shadow);
}

.album-event img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.2s ease;
}

.album-event:hover img {
    opacity: 0.92;
}

.album-event::after {
    content: '';
    position: absolute;
    inset: 40% 0 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0));
}

.album-event-body {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    display: grid;
    gap: 0.35rem;
    padding: 1.5rem;
}

.album-event-title {
    font-family: 'Lora', serif;
    font-size: clamp(1.8rem, 6vw, 2.6rem);
    font-weight: 600;
    line-height: 1.1;
}

.album-event-date {
    font-size: 0.95rem;
    font-weight: 600;
}

.album-event-meta,
.album-head-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
    font-size: 0.95rem;
}

.album-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    margin-top: 0.5rem;
    color: var(--editorial-text);
    font-weight: 600;
    text-decoration: none;
}

.album-head {
    display: grid;
    justify-items: center;
    gap: 0.5rem;
    padding-top: 0.25rem;
}

.album-head .album-event-date,
.album-head-meta {
    color: var(--editorial-muted);
    justify-content: center;
}

.album-download-all {
    margin-top: 0.75rem;
}

.album-size {
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

.album-tabs {
    position: sticky;
    top: var(--album-topbar, 0px);
    z-index: 20;
    display: flex;
    gap: 0.25rem;
    margin: 1.5rem -1rem 0;
    padding: 0.5rem 1rem;
    overflow-x: auto;
    background: var(--editorial-bg);
    border-bottom: 1px solid var(--editorial-border);
    scrollbar-width: none;
}

.album-tabs a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex: none;
    min-height: 44px;
    padding: 0 0.85rem;
    border-radius: 8px;
    color: var(--editorial-text);
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
}

.album-tabs a:hover {
    background: rgba(212, 185, 150, 0.25);
}

.album-tabs a[aria-current="location"] {
    background: rgba(212, 185, 150, 0.45);
}

.album-tab-count,
.album-count {
    color: var(--editorial-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.album-section {
    margin-top: 2rem;
    scroll-margin-top: calc(var(--album-topbar, 0px) + 4.5rem);
}

.album-section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
}

.album-section-head h2 {
    font-size: clamp(1.4rem, 5vw, 1.9rem);
}

.album-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 44px;
    margin-left: auto;
    color: var(--editorial-text);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Justified rows: each tile grows in proportion to its aspect ratio, so a row shares one height. */
.album-grid {
    --row: 90px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.album-grid::after {
    content: '';
    flex-grow: 1000000;
}

@media (min-width: 680px) {
    .album-grid {
        --row: 200px;
        gap: 6px;
    }
}

@media (min-width: 1100px) {
    .album-grid {
        --row: 240px;
    }
}

.album-item {
    flex: calc(var(--r) * 100) 1 calc(var(--r) * var(--row));
    aspect-ratio: var(--r);
    max-height: calc(var(--row) * 1.6);
    overflow: hidden;
    border-radius: 4px;
    background: rgba(212, 185, 150, 0.3);
}

.album-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.2s ease;
}

.album-item:hover img {
    opacity: 0.88;
}

.album-videos {
    display: grid;
    gap: 1.25rem;
    align-items: start;
}

@media (min-width: 760px) {
    .album-videos {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

.album-video {
    margin: 0;
}

/* Phone-format clips keep a phone-like size instead of sitting between wide black bars. */
.album-video.is-portrait {
    width: 100%;
    max-width: 360px;
}

/* The main film: full width of the page, as large as the screen allows. */
.album-featured {
    margin-top: 1.5rem;
}

.album-video-featured video {
    max-height: 78vh;
    border-radius: 16px;
    box-shadow: var(--editorial-shadow);
}

.album-video-featured figcaption {
    margin-top: 0.75rem;
}

.album-video-featured figcaption strong {
    font-family: 'Lora', serif;
    font-size: clamp(1.4rem, 5vw, 1.9rem);
    font-weight: 600;
    margin-right: 0.5rem;
}

.album-video video {
    display: block;
    width: 100%;
    height: auto;
    max-height: 80vh;
    aspect-ratio: var(--r);
    border-radius: 12px;
    background: #000;
}

.album-video figcaption {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.75rem;
    margin-top: 0.4rem;
}

.album-soon {
    margin-top: 0;
    text-align: center;
    padding: 2rem 1rem;
}

.album-soon i {
    font-size: 2rem;
    color: var(--editorial-accent-deep);
}

.album-soon h2 {
    margin: 0.5rem 0;
}

.album-lightbox {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: #111;
    color: #fff;
    overflow: hidden;
}

.album-lightbox:fullscreen,
.album-lightbox:fullscreen::backdrop {
    background: #000;
}

.album-lightbox::backdrop {
    background: #111;
}

.album-lightbox[open] {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    grid-template-columns: minmax(0, 1fr);
}

/* Slideshow and fullscreen: the photo takes the whole screen, controls float over it and fade when idle. */
.album-lightbox.is-playing,
.album-lightbox.is-fullscreen {
    grid-template-rows: minmax(0, 1fr);
}

.album-lightbox.is-playing .album-lightbox-footer,
.album-lightbox.is-fullscreen .album-lightbox-footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding-top: 32px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
}

.album-lightbox-footer,
.album-lightbox-button {
    transition: opacity 0.3s ease;
}

.album-lightbox.is-idle {
    cursor: none;
}

.album-lightbox.is-idle .album-lightbox-footer,
.album-lightbox.is-idle .album-lightbox-button {
    opacity: 0;
    pointer-events: none;
}

.album-lightbox-strip {
    position: relative;
    display: flex;
    gap: 4px;
    height: 64px;
    padding: 4px 1rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
}

.album-lightbox-strip::-webkit-scrollbar {
    display: none;
}

.album-strip-thumb {
    flex: none;
    height: 100%;
    aspect-ratio: var(--r, 1.5);
    padding: 0;
    border: 0;
    border-radius: 4px;
    overflow: hidden;
    opacity: 0.45;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.album-strip-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.album-strip-thumb:hover {
    opacity: 0.8;
}

.album-strip-thumb[aria-current] {
    opacity: 1;
    outline: 2px solid #fff;
    outline-offset: -2px;
}

.album-strip-thumb:focus-visible {
    opacity: 1;
    outline: 3px solid var(--editorial-accent);
    outline-offset: -3px;
}

@media (max-height: 520px) {
    .album-lightbox-strip {
        display: none;
    }
}

.album-lightbox-image {
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: contain;
    background: center / contain no-repeat;
    touch-action: pinch-zoom;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    cursor: grab;
}

/* While the page is pinch-zoomed, one-finger drags pan the zoom instead of changing photo. */
.album-lightbox.is-zoomed .album-lightbox-image {
    touch-action: auto;
}

.album-lightbox-image.is-drifting {
    animation: album-drift 6s ease-out forwards;
}

@keyframes album-drift {
    from { scale: 1; }
    to { scale: 1.06; }
}

.album-lightbox-button {
    position: absolute;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
}

.album-lightbox-button:hover {
    background: rgba(0, 0, 0, 0.7);
}

.album-lightbox-tools {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1;
    display: flex;
    gap: 8px;
}

.album-lightbox-tools .album-lightbox-button {
    position: static;
}

.album-lightbox-button[aria-pressed="true"] {
    background: rgba(255, 255, 255, 0.25);
}

.album-lightbox-prev,
.album-lightbox-next {
    top: calc(50% - 24px);
    z-index: 1;
}

.album-lightbox-prev {
    left: 12px;
}

.album-lightbox-next {
    right: 12px;
}

.album-lightbox-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.album-lightbox-bar [data-lightbox-counter] {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    color: rgba(255, 255, 255, 0.85);
}

.album-lightbox-download {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease;
}

.album-lightbox-download:hover {
    background: rgba(255, 255, 255, 0.22);
}

.album-lightbox-download:focus-visible {
    outline: 3px solid var(--editorial-accent);
    outline-offset: 2px;
}

.album-greeting {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: var(--editorial-bg);
    color: var(--editorial-text);
    overflow-y: auto;
}

.album-greeting::backdrop {
    background: var(--editorial-bg);
}

html:has(.album-greeting[open]) {
    overflow: hidden;
}

.album-greeting-inner {
    display: grid;
    min-height: 100%;
}

.album-greeting-photo {
    width: 100%;
    height: 38dvh;
    object-fit: cover;
    object-position: center 30%;
}

.album-greeting-text {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 16px;
    max-width: 560px;
    margin: 0 auto;
    padding: 32px 24px calc(32px + env(safe-area-inset-bottom));
    text-align: center;
}

.album-greeting-text > * {
    animation: album-greeting-in 0.7s ease both;
}

.album-greeting-text > :nth-child(2) { animation-delay: 0.15s; }
.album-greeting-text > :nth-child(3) { animation-delay: 0.3s; }
.album-greeting-text > :nth-child(4) { animation-delay: 0.45s; }
.album-greeting-text > :nth-child(n + 5) { animation-delay: 0.6s; }

.album-greeting-heart {
    color: var(--editorial-accent-deep);
    font-size: 1.25rem;
}

.album-greeting-text h1,
.album-greeting-text h2 {
    font-size: clamp(2rem, 7vw, 3rem);
    line-height: 1.15;
}

.album-greeting-text p {
    font-size: 1.05rem;
    line-height: 1.65;
    color: var(--editorial-muted);
}

.album-head .album-greeting-sign {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.6rem;
    white-space: nowrap;
}

.album-greeting-text .album-greeting-sign {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.9rem;
    color: var(--editorial-text);
    white-space: nowrap;
}

/* Album login: the greeting layout as a page, with the password form in the text column. */
.album-login {
    display: block;
    min-height: 100dvh;
    height: auto;
}

@media (max-width: 859px) {
    .album-login .album-greeting-photo {
        height: 24dvh;
    }

    .album-login .album-greeting-text {
        gap: 12px;
        padding-top: 20px;
    }
}

/* Same switch as the site header, pinned to the top-right corner (over the photo on phones). */
.album-login {
    position: relative;
}

.album-login-lang {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.album-login-lang .lang-btn {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    text-decoration: none;
}

.album-login-form {
    display: grid;
    gap: 8px;
    width: 100%;
    max-width: 360px;
    margin-top: 8px;
    text-align: left;
}

.album-login-form label {
    font-size: 0.9rem;
    font-weight: 600;
}

.album-login-field {
    position: relative;
}

.album-login-field input {
    width: 100%;
    height: 48px;
    padding: 0 52px 0 14px;
    border: 1px solid var(--editorial-border);
    border-radius: 10px;
    background: #fff;
    color: var(--editorial-text);
    font-size: 1rem;
}

.album-login-field input:focus-visible {
    outline: 3px solid var(--editorial-accent-deep);
    outline-offset: 1px;
}

.album-login-field input[aria-invalid="true"] {
    border-color: var(--editorial-alert);
}

.album-login-toggle {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--editorial-muted);
    cursor: pointer;
}

.album-login-form .editorial-button {
    width: 100%;
    margin-top: 8px;
}

.album-greeting-text .album-login-error {
    display: flex;
    gap: 8px;
    align-items: baseline;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(178, 103, 94, 0.12);
    color: #8a3f37;
    font-size: 0.95rem;
}

.album-greeting-text .album-login-hint {
    font-size: 0.9rem;
}

.album-login-lang a:focus-visible,
.album-login-toggle:focus-visible {
    outline: 3px solid var(--editorial-accent-deep);
    outline-offset: 2px;
}

.album-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.album-greeting-progress {
    width: 160px;
    height: 2px;
    overflow: hidden;
    background: rgba(26, 26, 26, 0.12);
}

.album-greeting-progress span {
    display: block;
    width: 40%;
    height: 100%;
    background: var(--editorial-accent-deep);
    animation: album-greeting-loading 1.2s ease-in-out infinite;
}

.album-greeting.is-loaded .album-greeting-progress span {
    width: 100%;
    animation: none;
    transform: none;
}

@keyframes album-greeting-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

@keyframes album-greeting-loading {
    from { transform: translateX(-100%); }
    to { transform: translateX(250%); }
}

@media (min-width: 860px) {
    .album-greeting-inner {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .album-greeting-photo {
        height: 100dvh;
    }

    .album-greeting-text {
        padding: 48px;
    }
}

.album-greeting .editorial-button:focus-visible {
    outline: 3px solid var(--editorial-accent-deep);
    outline-offset: 3px;
}

.album-event:focus-visible,
.album-item:focus-visible,
.album-tabs a:focus-visible,
.album-link:focus-visible,
.album-back:focus-visible {
    outline: 3px solid var(--editorial-accent-deep);
    outline-offset: 3px;
}

.album-lightbox :focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .album-strip-thumb,
    .album-event img,
    .album-item img {
        transition: none;
    }

    .album-greeting-text > *,
    .album-greeting-progress span,
    .album-lightbox-image.is-drifting {
        animation: none;
    }
}
