/* ============================================================
   photos.css — page styles for /photos
   Uses base.css variables: --primary-color, --secondary-color,
   --accent-color, --font-primary (Kreon), --font-heading (Kavoon),
   --font-brand (Permanent Marker), --font-accent (Delius).
   ============================================================ */

body {
    background-color: var(--secondary-color);
    color: var(--text-color);
    font-family: var(--font-primary);
    padding-bottom: 40px;
}

/* Footer (uses shared base.css #footer; just spacing tweak here). */
#footer {
    margin-top: 40px;
    padding: 16px 24px 0;
    text-align: center;
    color: var(--text-color);
    font-size: 0.92rem;
}

/* ── Page title (Mogra style, mirrors the minis header) ─────── */
.header-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 24px;
    padding: 20px 0 8px;
}

.page-title {
    font-family: "Mogra", system-ui, serif;
    color: var(--text-color);
    text-align: center;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    margin: 0;
}

.page-title .photos {
    font-size: clamp(43px, 6.3vw, 74px);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--text-light-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    padding: 0 4px;
    margin: 0;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
}

.page-title .photos:hover { text-decoration: none; }

.page-title .by {
    font-size: clamp(18px, 2.7vw, 32px);
    color: #0d1a33;
    font-weight: 700;
    font-style: italic;
    transform: rotate(-5deg);
    margin: 0 4px;
    position: relative;
    top: 0;
}

.page-title .brand {
    font-size: clamp(20px, 3.24vw, 40px);
    color: #0d1a33;
    font-weight: 600;
    font-style: italic;
    margin: 0 4px;
    position: relative;
    transform: rotate(1deg) skewX(-3deg);
    letter-spacing: -0.5px;
}

.page-title .brand a {
    text-decoration: none;
    color: inherit;
}

/* ── Main wrapper ───────────────────────────────────────────── */
.photos-main {
    width: 100%;
    margin: 0;
    padding: 8px 40px 24px;
}

.empty-msg {
    text-align: center;
    color: var(--text-light-color);
    padding: 60px 20px;
    font-size: 1.05rem;
    grid-column: 1 / -1;
}

/* ── Bento grid ─────────────────────────────────────────────── */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 200px;
    gap: 10px;
}

.bento-card {
    position: relative;
    overflow: hidden;
    border-radius: 14px;
    cursor: pointer;
    background: #1a1a1a;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    isolation: isolate;
    padding: 0;
    border: none;
}

.bento-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow-hover);
}

/* Blurred copy of the image acts as the backdrop so the
   letterbox area around a `contain`-fit image isn't dead space. */
.bento-card-bg {
    position: absolute;
    inset: -8%;
    background-size: cover;
    background-position: center;
    filter: blur(34px) brightness(0.55) saturate(1.1);
    z-index: 0;
    transform: scale(1.05);
}

.bento-card-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Anchor to the top so any letterbox sits at the bottom of the
       card, where the gradient + title overlay can absorb it. */
    object-position: center top;
    transition: transform 0.5s ease;
    z-index: 1;
}

.bento-card:hover .bento-card-img {
    transform: scale(1.03);
}

/* Bottom gradient only — keeps the top of the image fully visible. */
.bento-card-overlay {
    position: absolute;
    inset: auto 0 0 0;
    height: 55%;
    background: linear-gradient(180deg,
            rgba(0, 0, 0, 0) 0%,
            rgba(0, 0, 0, 0.55) 70%,
            rgba(0, 0, 0, 0.82) 100%);
    z-index: 2;
    pointer-events: none;
}

.bento-card-content {
    position: absolute;
    inset: 0;
    z-index: 3;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    color: #fff;
    pointer-events: none;
}

.bento-card-title {
    font-family: var(--font-heading);
    font-size: clamp(1.15rem, 1.8vw, 1.55rem);
    line-height: 1.2;
    margin: 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.bento-card-count {
    font-family: var(--font-accent);
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.82);
    margin-top: 4px;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

/* Hover CTA — pinned bottom-right. */
.bento-card-cta {
    position: absolute;
    right: 14px;
    bottom: 14px;
    z-index: 4;
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary-color);
    font-family: var(--font-accent);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 7px 16px;
    border-radius: 999px;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.bento-card:hover .bento-card-cta,
.bento-card:focus-visible .bento-card-cta {
    opacity: 1;
    transform: translateY(0);
}

/* ── Series view ────────────────────────────────────────────── */
.series-view {
    padding: 0;
}

.back-btn {
    background: var(--primary-color);
    border: 2px solid var(--primary-color);
    color: var(--secondary-color);
    font-family: var(--font-accent);
    font-weight: 600;
    font-size: 0.98rem;
    padding: 10px 20px;
    border-radius: 999px;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 28px;
    box-shadow: var(--card-shadow);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.back-btn:hover {
    background: var(--text-light-color);
    border-color: var(--text-light-color);
    color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
}

.series-header {
    text-align: center;
    max-width: 760px;
    margin: 0 auto 56px;
}

.series-header h1 {
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 3.5vw, 2.6rem);
    color: var(--primary-color);
    margin-bottom: 6px;
    line-height: 1.15;
}

.series-count {
    display: inline-block;
    font-family: var(--font-accent);
    font-size: 0.95rem;
    color: var(--text-light-color);
    letter-spacing: 0.5px;
    margin-bottom: 14px;
}

.series-header p {
    font-family: var(--font-primary);
    font-size: 1.05rem;
    color: var(--text-light-color);
    line-height: 1.6;
}

/* The `hidden` HTML attribute is intended to set display:none, but our
   own .series-raw-link / .series-count rules use explicit `display:`
   values that override the UA stylesheet. Restore the intended behavior. */
[hidden] { display: none !important; }

.series-raw-link {
    display: inline-block;
    margin-top: 18px;
    background: var(--primary-color);
    color: var(--secondary-color);
    font-family: var(--font-accent);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 10px 22px;
    border-radius: 999px;
    text-decoration: none;
    transition: var(--transition);
}

.series-raw-link:hover {
    background: var(--text-light-color);
    transform: translateY(-2px);
    box-shadow: var(--card-shadow);
}

/* Centered grid of fixed-aspect cards.
   Each card is 16:9 (landscape) by default; cards with
   data-orientation="portrait" flip to 9:16. The actual full-resolution
   image is shown in the lightbox — these cards are just consistent tiles. */
.series-image-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 14px;
    max-width: 1600px;
    margin: 0 auto;
}

.series-image-card {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    cursor: zoom-in;
    background: var(--accent-color);
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    display: block;
    flex: 0 1 calc(25% - 11px);
    max-width: 520px;
    min-width: 220px;
    aspect-ratio: 16 / 9;
}

.series-image-card[data-orientation="portrait"] {
    aspect-ratio: 9 / 16;
    flex-basis: calc(22% - 11px);
    min-width: 280px;
    max-width: 460px;
}

.series-image-card[data-orientation="square"] {
    aspect-ratio: 1 / 1;
    flex-basis: calc(25% - 11px);
    min-width: 240px;
    max-width: 460px;
}

.series-image-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
}

.series-image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.series-image-card:hover img {
    transform: scale(1.04);
}

.series-image-hover {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-accent);
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.series-image-card:hover .series-image-hover,
.series-image-card:focus-visible .series-image-hover {
    opacity: 1;
}

/* ── Lightbox ───────────────────────────────────────────────── */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(15, 15, 18, 0.94);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 60px;
}

.lightbox[hidden] {
    display: none;
}

.lightbox-close {
    position: absolute;
    top: 14px;
    right: 18px;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease;
    z-index: 2;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease;
    z-index: 2;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.25);
}

.lightbox-prev { left: 14px; }
.lightbox-next { right: 14px; }

.lightbox-content {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 28px;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 1200px;
    max-height: 100%;
}

/* When there is no description, drop to a single centered column. */
.lightbox-content.no-desc {
    grid-template-columns: 1fr;
    max-width: none;
}

.lightbox-image-wrap {
    grid-column: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 0;
}

.lightbox-content.no-desc .lightbox-image-wrap {
    grid-column: 1;
}

.lightbox-image-wrap img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.lightbox-desc {
    grid-column: 1;
    grid-row: 1;
    color: #f0f0f0;
    font-family: var(--font-primary);
    font-size: 1rem;
    line-height: 1.65;
    max-height: 85vh;
    overflow-y: auto;
    padding-right: 8px;
}

.lightbox-content.no-desc .lightbox-desc {
    display: none;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .bento-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-auto-rows: 180px;
    }
    .bento-card[data-col-span="4"] { grid-column: span 3; }
    .bento-card[data-col-span="3"] { grid-column: span 3; }

    .series-image-card { flex-basis: calc(33.333% - 10px); }
    .series-image-card[data-orientation="portrait"] { flex-basis: calc(28% - 10px); min-width: 240px; }
    .series-image-card[data-orientation="square"] { flex-basis: calc(32% - 10px); }
}

@media (max-width: 720px) {
    .photos-wordmark { padding: 22px 12px 10px; }
    .photos-main { padding: 6px 8px 24px; }

    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 170px;
        gap: 8px;
    }
    .bento-card[data-col-span="3"],
    .bento-card[data-col-span="4"] { grid-column: span 2; }

    .bento-card-cta {
        opacity: 1;
        transform: none;
    }

    .photos-main { padding: 6px 16px 24px; }

    .series-image-grid {
        gap: 10px;
    }
    .series-image-card {
        flex-basis: calc(50% - 5px);
        min-width: 0;
    }
    .series-image-card[data-orientation="portrait"] {
        flex-basis: calc(48% - 5px);
        min-width: 0;
    }
    .series-image-card[data-orientation="square"] {
        flex-basis: calc(48% - 5px);
        min-width: 0;
    }

    .series-image-hover { opacity: 1; }

    /* Lightbox: stack vertically on small screens */
    .lightbox { padding: 20px 16px; }

    .lightbox-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        gap: 14px;
        align-items: start;
        overflow-y: auto;
    }

    .lightbox-image-wrap {
        grid-column: 1;
        grid-row: 1;
    }

    .lightbox-image-wrap img {
        max-height: 60vh;
    }

    .lightbox-desc {
        grid-column: 1;
        grid-row: 2;
        max-height: none;
        font-size: 0.95rem;
    }

    .lightbox-nav { width: 38px; height: 38px; font-size: 1.6rem; }
    .lightbox-prev { left: 6px; }
    .lightbox-next { right: 6px; }
}

@media (max-width: 480px) {
    .bento-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: 230px;
        gap: 8px;
    }
    .bento-card[data-col-span="2"],
    .bento-card[data-col-span="3"],
    .bento-card[data-col-span="4"] { grid-column: span 1; }
    .bento-card[data-row-span="2"],
    .bento-card[data-row-span="3"],
    .bento-card[data-row-span="4"] { grid-row: span 1; }

    .series-image-card,
    .series-image-card[data-orientation="portrait"],
    .series-image-card[data-orientation="square"] {
        flex-basis: 100%;
        max-width: none;
    }
}
