:root {
    --foto-green: #123f30;
    --foto-green-soft: #1d654b;
    --foto-cream: #f5f0e4;
    --foto-ink: #19251f;
    --foto-line: #d8dfda;
}

.foto-viewer-page .site-main > .page-hero {
    display: none;
}

.foto-viewer {
    width: min(1380px, calc(100% - 32px));
    margin: 34px auto 70px;
    color: var(--foto-ink);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.foto-viewer__hero {
    overflow: hidden;
    border-radius: 24px;
    background: linear-gradient(135deg, #0f3729, #247456);
    color: #fff;
    padding: clamp(30px, 6vw, 72px);
    box-shadow: 0 20px 50px rgba(18, 63, 48, .18);
}

.foto-viewer__hero p,
.foto-album-panel header p {
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 850;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.foto-viewer__hero h1 {
    margin: 0 0 12px;
    color: inherit;
    font-size: clamp(38px, 7vw, 76px);
    line-height: .98;
}

.foto-viewer__hero span {
    display: block;
    max-width: 650px;
    font-size: clamp(17px, 2vw, 22px);
    line-height: 1.45;
}

.foto-albums {
    display: grid;
    grid-template-columns: none;
    grid-template-rows: 110px;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - 28px) / 3);
    gap: 14px;
    max-height: 110px;
    align-content: start;
    overflow-x: auto;
    overflow-y: hidden;
    margin: 22px 0 8px;
    padding: 0;
    overscroll-behavior: contain;
    scrollbar-width: none;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.foto-albums::-webkit-scrollbar {
    display: none;
}

.foto-albums::-webkit-scrollbar-track {
    border-radius: 999px;
    background: #e5ece8;
}

.foto-albums::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: var(--foto-green-soft);
}

.foto-albums-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin: 0 0 22px;
    color: var(--foto-green);
    font-size: 13px;
    font-weight: 700;
}

.foto-albums-hint[hidden] { display: none !important; }

.foto-albums-hint > b { font-size: 20px; line-height: 1; }

.foto-albums-dots { display: inline-flex; gap: 5px; margin-left: 3px; }

.foto-albums-dots i {
    display: block;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #c8d5ce;
    transition: width .18s ease, background-color .18s ease;
}

.foto-albums-dots i.is-active { width: 20px; background: var(--foto-green-soft); }

.foto-album-card {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 14px;
    height: 110px;
    min-height: 110px;
    overflow: hidden;
    box-sizing: border-box;
    border: 2px solid transparent;
    border-radius: 16px;
    background: #fff;
    color: var(--foto-ink);
    padding: 8px;
    text-align: left;
    box-shadow: 0 7px 24px rgba(23, 48, 35, .09);
    cursor: pointer;
    scroll-snap-align: start;
}

.foto-album-card.is-active {
    border-color: var(--foto-green-soft);
    background: #f3fbf6;
}

.foto-album-card > img,
.foto-album-card__placeholder {
    width: 92px;
    height: 92px;
    border-radius: 11px;
    object-fit: cover;
    background: linear-gradient(145deg, #dbe8df, #a9c6b6);
}

.foto-album-card > span:last-child {
    display: flex;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
}

.foto-album-card strong,
.foto-album-card small,
.foto-album-card em {
    display: block;
}

.foto-album-card strong {
    display: -webkit-box;
    overflow: hidden;
    font-size: 17px;
    line-height: 1.2;
    overflow-wrap: anywhere;
    text-overflow: ellipsis;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.foto-album-card small,
.foto-album-card em {
    margin-top: 3px;
    color: #607067;
    font-size: 12px;
    font-style: normal;
}

.foto-album-panel {
    border: 1px solid var(--foto-line);
    border-radius: 20px;
    background: #fff;
    padding: clamp(18px, 3vw, 34px);
}

.foto-album-panel[hidden],
.foto-lightbox[hidden] {
    display: none !important;
}

.foto-album-panel > header {
    display: grid;
    grid-template-columns: minmax(220px, .8fr) minmax(300px, 1.2fr);
    gap: 28px;
    align-items: end;
    margin-bottom: 24px;
}

.foto-album-panel header p {
    color: var(--foto-green-soft);
}

.foto-album-panel h2 {
    margin: 0;
    color: var(--foto-green);
    font-size: clamp(28px, 4vw, 46px);
    line-height: 1.05;
}

.foto-album-panel__description,
.foto-album-panel__description p {
    margin: 0;
    color: #55645c;
    line-height: 1.55;
}

.foto-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.foto-grid__item {
    overflow: hidden;
    aspect-ratio: 4 / 3;
    border: 0;
    border-radius: 12px;
    background: #e7ece9;
    padding: 0;
    cursor: zoom-in;
}

.foto-grid__item:nth-child(7n + 1) {
    grid-column: span 2;
    grid-row: span 2;
}

.foto-grid__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .25s ease;
}

.foto-grid__item:hover img,
.foto-grid__item:focus-visible img {
    transform: scale(1.035);
}

.foto-viewer__empty,
.foto-album-panel__empty {
    margin-top: 22px;
    border: 1px solid var(--foto-line);
    border-radius: 16px;
    background: #fff;
    padding: 28px;
    text-align: center;
}

.foto-viewer__empty strong {
    color: var(--foto-green);
    font-size: 25px;
}

.foto-viewer__empty a {
    display: inline-block;
    border-radius: 9px;
    background: var(--foto-green);
    color: #fff;
    padding: 10px 16px;
    text-decoration: none;
    font-weight: 800;
}

body.foto-lightbox-open {
    overflow: hidden;
}

.foto-lightbox {
    position: fixed;
    z-index: 100000;
    inset: 0;
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr) 74px;
    place-items: center;
    background:
        radial-gradient(circle at 50% 30%, rgba(44, 85, 66, .28), transparent 55%),
        rgba(5, 11, 8, .96);
    padding: 72px 24px 24px;
}

.foto-lightbox figure {
    display: grid;
    width: min(1250px, 100%);
    max-width: min(1200px, 100%);
    max-height: calc(100dvh - 100px);
    margin: 0;
    place-items: center;
}

.foto-lightbox__frame {
    position: relative;
    isolation: isolate;
    display: flex;
    box-sizing: border-box;
    max-width: 100%;
    max-height: calc(100dvh - 178px);
    align-items: center;
    justify-content: center;
    border: 3px solid #174b39;
    border-radius: 4px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .72), transparent 42%),
        linear-gradient(145deg, #fffaf0, #e6d8bd);
    padding: clamp(14px, 1.7vw, 24px);
    box-shadow:
        0 0 0 2px #c8a96b,
        0 0 0 7px #f3e8d3,
        0 0 0 10px #174b39,
        0 0 0 12px rgba(200, 169, 107, .78),
        0 30px 78px rgba(0, 0, 0, .62);
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    transition: transform .14s ease;
}

.foto-lightbox__frame.is-swiping {
    transform: scale(.992);
}

.foto-lightbox__frame::before,
.foto-lightbox__frame::after {
    position: absolute;
    content: "";
    pointer-events: none;
}

.foto-lightbox__frame::before {
    z-index: 2;
    inset: 7px;
    border: 1px solid rgba(154, 118, 55, .75);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .38);
}

.foto-lightbox__frame::after {
    z-index: 3;
    inset: 8px;
    background:
        linear-gradient(135deg, #174b39 0 8px, transparent 8px) top left / 25px 25px no-repeat,
        linear-gradient(225deg, #174b39 0 8px, transparent 8px) top right / 25px 25px no-repeat,
        linear-gradient(45deg, #174b39 0 8px, transparent 8px) bottom left / 25px 25px no-repeat,
        linear-gradient(315deg, #174b39 0 8px, transparent 8px) bottom right / 25px 25px no-repeat;
}

.foto-lightbox__frame.is-portrait {
    max-width: min(760px, 100%);
}

.foto-lightbox__frame img {
    position: relative;
    z-index: 1;
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(100dvh - 214px);
    border-radius: 2px;
    object-fit: contain;
    pointer-events: none;
    -webkit-user-drag: none;
}

.foto-lightbox figcaption {
    display: flex;
    width: 100%;
    box-sizing: border-box;
    justify-content: space-between;
    gap: 20px;
    max-width: min(100%, 900px);
    color: #fff;
    padding: 18px 3px 0;
    font-size: 14px;
}

.foto-lightbox__details {
    display: grid;
    gap: 4px;
}

.foto-lightbox__details strong {
    font-size: 14px;
    font-weight: 750;
}

.foto-lightbox__details small {
    color: rgba(255, 255, 255, .78);
    font-size: 12px;
}

.foto-lightbox button {
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    cursor: pointer;
}

.foto-lightbox__toolbar {
    position: absolute;
    z-index: 3;
    top: 16px;
    right: 18px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.foto-lightbox__action,
.foto-lightbox__close {
    display: inline-flex;
    box-sizing: border-box;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    padding: 8px 15px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 750;
    line-height: 1;
    backdrop-filter: blur(12px);
    transition: background .18s ease, transform .18s ease;
}

.foto-lightbox .foto-lightbox__action,
.foto-lightbox .foto-lightbox__action:visited {
    border-color: rgba(224, 199, 146, .72);
    background: linear-gradient(135deg, rgba(29, 101, 75, .96), rgba(13, 56, 41, .98));
    color: #fff !important;
    -webkit-text-fill-color: #fff;
    box-shadow: 0 5px 18px rgba(0, 0, 0, .25);
    font-weight: 800;
}

.foto-lightbox__action:hover,
.foto-lightbox__action:focus-visible,
.foto-lightbox__close:hover,
.foto-lightbox__close:focus-visible {
    background: rgba(255, 255, 255, .24);
    color: #fff;
    transform: translateY(-1px);
}

.foto-lightbox .foto-lightbox__action:hover,
.foto-lightbox .foto-lightbox__action:focus-visible {
    border-color: #ead7ac;
    background: linear-gradient(135deg, #287b5d, #164b39);
    color: #fff !important;
    -webkit-text-fill-color: #fff;
}

.foto-lightbox__action span {
    font-size: 18px;
}

.foto-lightbox__prev,
.foto-lightbox__next {
    width: 54px;
    height: 54px;
    font-size: 44px;
    line-height: 1;
    transition: background .18s ease, transform .18s ease;
}

.foto-lightbox__prev:hover,
.foto-lightbox__next:hover,
.foto-lightbox__prev:focus-visible,
.foto-lightbox__next:focus-visible {
    background: rgba(255, 255, 255, .26);
    transform: scale(1.06);
}

.foto-lightbox__close {
    position: static;
    cursor: pointer;
}

.foto-lightbox__close span {
    font-size: 25px;
    font-weight: 400;
}

.foto-lightbox__close em {
    font-style: normal;
}

@media (max-width: 900px) {
    .foto-albums { grid-auto-columns: calc((100% - 14px) / 2); }
    .foto-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .foto-album-panel > header { grid-template-columns: 1fr; gap: 12px; }
}

@media (max-width: 640px) {
    .foto-viewer { width: min(100% - 20px, 1380px); margin-top: 18px; }
    .foto-albums {
        grid-template-columns: none;
        grid-template-rows: repeat(2, 96px);
        grid-auto-flow: column;
        grid-auto-columns: 100%;
        gap: 10px 12px;
        max-height: 202px;
        overflow-x: auto;
        overflow-y: hidden;
        margin-bottom: 8px;
        padding: 0;
        scroll-behavior: smooth;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .foto-albums::-webkit-scrollbar { display: none; }
    .foto-album-card { width: 100%; min-width: 0; height: 96px; min-height: 96px; grid-template-columns: 78px minmax(0, 1fr); gap: 12px; scroll-snap-align: start; scroll-snap-stop: always; }
    .foto-album-card > img, .foto-album-card__placeholder { width: 78px; height: 78px; }
    .foto-album-card strong { font-size: 16px; line-height: 1.25; }
    .foto-albums-hint { margin-bottom: 20px; }
    .foto-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .foto-grid__item:nth-child(7n + 1) { grid-column: span 2; grid-row: span 1; }
    .foto-lightbox { grid-template-columns: 42px minmax(0, 1fr) 42px; padding: 66px 6px 16px; }
    .foto-lightbox__toolbar { top: 10px; right: 10px; left: 10px; justify-content: flex-end; }
    .foto-lightbox__action, .foto-lightbox__close { min-height: 40px; padding: 7px 11px; font-size: 12px; }
    .foto-lightbox__close em { display: none; }
    .foto-lightbox__prev, .foto-lightbox__next { width: 38px; height: 38px; font-size: 32px; }
    .foto-lightbox__frame { max-height: calc(100dvh - 165px); padding: 12px; box-shadow: 0 0 0 2px #c8a96b, 0 0 0 5px #f3e8d3, 0 0 0 8px #174b39, 0 18px 48px rgba(0, 0, 0, .58); }
    .foto-lightbox__frame::before { inset: 5px; }
    .foto-lightbox__frame::after { inset: 6px; }
    .foto-lightbox__frame img { max-height: calc(100dvh - 189px); }
    .foto-lightbox figcaption { padding-top: 14px; font-size: 12px; }
}
