/* Gallery pages of the new design */

/* — title row: heading left, tabs right — */
.gallery-head {
    display: flex; justify-content: space-between; align-items: end;
    gap: 24px; flex-wrap: wrap;
}
/* the tabs are links, so mark the current one like a checked option */
.seg-opt { color: inherit; text-decoration: none; }
.seg-opt[aria-current='page'],
.seg-opt[aria-current='page']:hover { background: var(--color-accent); color: var(--color-bg); }
.seg-opt:not([aria-current]):hover { color: inherit; }

/* — intro: the curator's note, with the collection totals beside it — */
.gallery-intro {
    margin-top: 32px; padding-top: 24px;
    border-top: 1px solid var(--color-divider);
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px 56px; align-items: start;
}
.gallery-intro__text {
    margin: 0; max-width: 84ch;
    font-size: 16px; line-height: 1.65; text-wrap: pretty;
    color: var(--color-neutral-800);
}
.gallery-intro__text::first-letter {
    float: left; margin: 6px 10px 0 0;
    font-family: var(--font-heading); font-weight: var(--font-heading-weight);
    font-size: 58px; line-height: 0.8; color: var(--color-accent-700);
}
.gallery-intro__stats {
    display: flex; gap: 32px;
    border-left: 3px solid var(--color-accent); padding-left: 18px;
}
.gallery-intro__value {
    font-family: var(--font-heading); font-weight: var(--font-heading-weight);
    font-size: 40px; line-height: 1; color: var(--color-accent-900);
}
.gallery-intro__label {
    margin-top: 4px; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--color-accent-700);
}
@media (max-width: 720px) {
    .gallery-intro { grid-template-columns: 1fr; }
}

/* — album grid — */
.gallery-albums {
    margin-top: 36px; padding: 6px;
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px 22px;
}
@media (max-width: 900px) { .gallery-albums { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .gallery-albums { grid-template-columns: 1fr; } }
.gallery-album { display: flex; flex-direction: column; gap: 10px; color: inherit; text-decoration: none; }
.gallery-album:hover { color: var(--color-accent-700); }
.gallery-album__cover { aspect-ratio: 4 / 3; margin: 0; }
.gallery-album__cover > img { transition: opacity 0.2s; }
.gallery-album:hover .gallery-album__cover > img { opacity: 0.85; }
.gallery-album__badge {
    position: absolute; top: 8px; left: 8px; z-index: 1;
    background: var(--color-accent-900); color: var(--color-bg);
}
.gallery-album__caption { display: flex; justify-content: space-between; gap: 8px; }
.gallery-album__title {
    font-family: var(--font-heading); font-weight: var(--font-heading-weight);
    font-size: 17px; line-height: 1.2;
}
.gallery-album__count { font-size: 13px; opacity: 0.6; white-space: nowrap; }

.gallery-empty { margin-top: 36px; }

/* ————————————————— album page ————————————————— */
.album-meta { margin: 12px 0 0; font-size: 15px; opacity: 0.75; display: flex; align-items: center; gap: 10px; }
.album-meta__new { background: var(--color-accent-900); color: var(--color-bg); }
/* title left, switcher right at any title length: a long title wraps rather than pushing the switcher down */
.album-head { flex-wrap: nowrap; }
.album-head > div:first-child { flex: 1; min-width: 0; }
.album-switch { display: flex; flex-direction: column; gap: 5px; flex: none; width: 280px; }
.album-switch__label {
    font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-accent-700);
}

/* — justified rows: album.js sets --r (width / height) on each tile once its photo loads;
     the tile grows in proportion to it, so every row fills the width at one height — */
.album-photos {
    --row: 210px;
    margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--color-divider);
    display: flex; flex-wrap: wrap; gap: 10px;
}
/* a greedy filler keeps the last row from stretching */
.album-photos::after { content: ""; flex: 1000 1 0; }
/* each thumb is a small print: white mat and a hairline edge */
.album-photo {
    --r: 1.5; --mat: 4px;
    position: relative; overflow: hidden; display: block;
    flex: var(--r) 1 calc(var(--r) * var(--row)); height: var(--row);
    padding: var(--mat); background: #fff; color: var(--color-bg);
    border: 1px solid var(--color-divider); box-shadow: var(--shadow-sm);
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}
/* the tile is a link: keep its overlay text light over the site's a:hover colour */
.album-photo:hover { color: var(--color-bg); }
.album-photo > img {
    display: block; width: 100%; height: 100%; object-fit: cover;
    background: var(--color-neutral-200);
}
.album-photo__num {
    position: absolute; top: calc(var(--mat) + 12px); left: calc(var(--mat) + 12px); z-index: 2;
    font-family: ui-monospace, monospace; font-size: 10px; letter-spacing: 0.05em;
    padding: 2px 6px; background: color-mix(in srgb, var(--color-accent-900) 70%, transparent);
    opacity: 0; transition: opacity 0.25s;
}
.album-photo__new {
    position: absolute; top: calc(var(--mat) + 12px); right: calc(var(--mat) + 12px); z-index: 2;
    background: var(--color-accent-900); color: var(--color-bg);
}
/* the description rises from the bottom edge on hover */
.album-photo__desc {
    position: absolute; inset: auto var(--mat) var(--mat) var(--mat); z-index: 2;
    padding: 36px 14px 12px;
    background: linear-gradient(to top, color-mix(in srgb, var(--color-accent-900) 92%, transparent) 55%, transparent);
    font-size: 13px; line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
    transform: translateY(calc(100% + var(--mat))); transition: transform 0.3s ease;
}
/* photos that have a description carry a small marker until hovered */
.album-photo:has(.album-photo__desc)::after {
    content: "i"; position: absolute; right: calc(var(--mat) + 12px); bottom: calc(var(--mat) + 12px); z-index: 2;
    width: 18px; height: 18px; display: grid; place-items: center;
    font: italic 700 11px/1 Georgia, serif;
    background: color-mix(in srgb, var(--color-accent-900) 70%, transparent);
    transition: opacity 0.25s;
}
@media (hover: hover) {
    .album-photo:hover {
        box-shadow: var(--shadow-md);
        border-color: var(--color-accent-400);
    }
    .album-photo:hover .album-photo__num { opacity: 1; }
    .album-photo:hover .album-photo__desc { transform: none; }
    .album-photo:hover::after { opacity: 0; }
}
.album-photo:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
@media (max-width: 720px) {
    .album-photos { --row: 130px; gap: 6px; }
    .album-photo { --mat: 3px; }
    .album-head { flex-wrap: wrap; }
    .album-switch { width: 100%; }
}

/* — previous / next album — */
.album-pager {
    margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--color-divider);
    display: flex; justify-content: space-between; gap: 24px;
}
.album-pager__link { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; }
.album-pager__link--next { text-align: right; margin-left: auto; }
.album-pager__link:hover { color: var(--color-accent-700); }
.album-pager__dir {
    font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-accent-700);
}
.album-pager__name {
    font-family: var(--font-heading); font-weight: var(--font-heading-weight); font-size: 22px; line-height: 1.1;
}
/* the copy above the photos is a compact strip; the photos' own rule separates it from them */
.album-pager--top { margin-top: 24px; padding-top: 0; border-top: 0; }
.album-pager--top .album-pager__name { font-size: 17px; }
.album-pager--top + .album-photos, .album-pager--top + .gallery-empty { margin-top: 4px; }
.album-pager--top + .album-photos { padding-top: 16px; }

/* — lightbox: photo on the left, its description in a side panel — */
.lightbox {
    width: 100vw; height: 100dvh; max-width: none; max-height: none;
    margin: 0; padding: 0; border: 0;
    background: #0e161f; color: var(--color-accent-100);
}
.lightbox[open] { display: grid; grid-template-columns: minmax(0, 1fr) 340px; }
.lightbox::backdrop { background: #0e161f; }
html.lightbox-open { overflow: hidden; }

.lightbox__stage { position: relative; display: grid; place-items: center; padding: 32px 72px; min-height: 0; }
.lightbox__img {
    max-width: 100%; max-height: calc(100dvh - 64px); object-fit: contain;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transition: opacity 0.25s ease;
}
.lightbox.is-loading .lightbox__img { opacity: 0.25; }
.lightbox__nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 48px; height: 72px; border: 0; cursor: pointer;
    background: transparent; color: var(--color-accent-300);
    font-size: 48px; line-height: 1; transition: color 0.2s, background 0.2s;
}
.lightbox__nav:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.lightbox__nav--prev { left: 12px; }
.lightbox__nav--next { right: 12px; }

.lightbox__panel {
    display: flex; flex-direction: column; gap: 16px; min-height: 0;
    padding: 24px 26px; overflow-y: auto;
    background: var(--color-accent-900); border-left: 1px solid var(--color-accent-800);
}
.lightbox__top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.lightbox__count {
    font-family: var(--font-heading); font-weight: var(--font-heading-weight);
    font-size: 30px; line-height: 1; color: #fff;
}
.lightbox__count small { font-size: 15px; color: var(--color-accent-300); }
.lightbox__tools { display: flex; gap: 6px; }
.lightbox__tool {
    width: 34px; height: 34px; cursor: pointer;
    background: transparent; color: var(--color-accent-300);
    border: 1px solid var(--color-accent-700); font-size: 13px;
}
.lightbox__tool:hover, .lightbox__tool[aria-pressed='true'] { color: #fff; border-color: var(--color-accent-300); }
.lightbox__album {
    font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-accent-300);
    padding-bottom: 14px; border-bottom: 1px solid var(--color-accent-800);
}
.lightbox__desc { font-size: 16px; line-height: 1.65; text-wrap: pretty; }
.lightbox__desc:empty::before { content: "Χωρίς περιγραφή"; font-style: italic; opacity: 0.45; }
.lightbox button:focus-visible { outline: 2px solid var(--color-accent-300); outline-offset: 2px; }

/* narrow screens: the description sits under the photo */
@media (max-width: 800px) {
    .lightbox[open] { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
    .lightbox__stage { padding: 12px; }
    .lightbox__img { max-height: calc(65dvh - 24px); }
    .lightbox__nav { display: none; }
    .lightbox__panel { max-height: 35dvh; border-left: 0; border-top: 1px solid var(--color-accent-800); padding: 16px 18px; gap: 10px; }
    .lightbox__count { font-size: 22px; }
    .lightbox__desc { font-size: 15px; }
}

/* ————————————————— video & audio pages ————————————————— */
.gallery-media { margin-top: 36px; padding: 6px; display: grid; gap: 28px 22px; }
.gallery-media--video { grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); }
.gallery-media--sound { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }

.media-card { padding: 0; gap: 0; }
.media-card__player { position: relative; aspect-ratio: 16 / 9; background: var(--color-accent-900); }
.media-card__player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.media-card__foot {
    padding: 12px 16px; border-top: 1px solid var(--color-divider);
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
}
.media-card__foot .card-meta { text-decoration: none; }
.media-card__num {
    font-family: var(--font-heading); font-weight: var(--font-heading-weight);
    font-size: 22px; line-height: 1; font-variant-numeric: tabular-nums; color: var(--color-accent-900);
}

.media-card--sound { padding: 16px; gap: 12px; }
.media-card__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.media-card--sound audio { width: 100%; display: block; }

/* — audio intro: the photo beside the text — */
.sound-intro {
    margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--color-divider);
    display: grid; grid-template-columns: minmax(200px, 1fr) minmax(0, 2fr);
    gap: 24px 40px; align-items: start;
}
.sound-intro__figure { aspect-ratio: 4 / 3; margin: 6px; }
@media (max-width: 720px) {
    .sound-intro { grid-template-columns: 1fr; }
}
