/*
 * Single photo page (/photos/<id>-<slug>/, photo.php). Linked in <head> via
 * $GLOBALS['page_stylesheets'] so the layout is known before content paints (CLS, #1783).
 *
 * 2026-11-09: a full-screen viewer, as pro galleries do it. The photo fills a
 * dark stage the height of the screen below the header (109px on desktop),
 * uncropped; arrows step through the photographer's photos; the details sit
 * in a panel to the right on wide screens and under the photo on narrow ones.
 * The stage is dark in both themes: a photo reads best on black.
 */

@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.18s; }

.photo-page { padding: 0 0 48px; }
.photo-page .container { max-width: 1440px; margin: 0 auto; padding: 0 20px; }

/* ── Viewer: stage + info panel ─────────────────────────────────────────── */
/* The fixed 56px radio bar (style.css .radio-player-bar) covers the bottom of
   the screen wherever it is on the page. */
body:has(#radioPlayerBar) .pv { --pv-bottom: 56px; }
.pv {
    --pv-h: calc(100svh - 109px - var(--pv-bottom, 0px));
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    background: #0b0b0f;
}
.pv-stage {
    position: relative;
    height: var(--pv-h);
    min-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 56px 72px 40px;   /* room for the top bar, the arrows and the credit */
    background: #0b0b0f;
    overflow: hidden;
}
.pv-img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;              /* width/height attrs reserve the aspect ratio */
    object-fit: contain;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.pv-bar {
    position: absolute;
    top: 0; left: 0; right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.88rem;
    pointer-events: none;
}
.pv-bar a { pointer-events: auto; }
.pv-back { color: rgba(255, 255, 255, 0.85); text-decoration: none; font-weight: 600; }
.pv-back:hover { color: #fff; }
.pv-count { font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }

.pv-nav {
    position: absolute;
    top: 50%;
    width: 52px; height: 52px;
    margin-top: -26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #fff;
    transition: background 0.2s, transform 0.2s;
    z-index: 2;
}
.pv-nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.pv-nav:hover, .pv-nav:focus-visible { background: rgba(255, 255, 255, 0.2); transform: scale(1.06); }
.pv-prev { left: 12px; }
.pv-next { right: 12px; }

.pv-credit {
    position: absolute;
    left: 0; right: 0; bottom: 10px;
    margin: 0;
    text-align: center;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.5);
}

/* ── Info panel ─────────────────────────────────────────────────────────── */
.pv-info {
    height: var(--pv-h);
    min-height: 420px;
    overflow-y: auto;
    padding: 22px 24px 28px;
    background: var(--bg-card, #15151d);
    border-left: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
}
.pv-info .breadcrumb { font-size: 0.8rem; color: var(--text-muted); margin: 0 0 14px; }
.pv-info .breadcrumb a { color: var(--text-muted); text-decoration: none; }
.pv-info .breadcrumb a:hover { color: var(--pink, #FF69B4); }

.photo-h1 { font-size: 1.55rem; line-height: 1.2; margin: 0 0 8px; }
.photo-title-line { font-style: italic; color: var(--text-secondary); margin: 0 0 8px; }
.photo-description { color: var(--text-secondary); line-height: 1.6; margin: 0 0 12px; font-size: 0.95rem; }

.photo-facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 16px 0 20px; font-size: 0.92rem; }
.photo-facts dt { color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; padding-top: 3px; }
.photo-facts dd { margin: 0; overflow-wrap: anywhere; }
.photo-facts a, .pv-pg-contact a { color: var(--pink, #FF69B4); text-decoration: none; }
.photo-facts a:hover, .pv-pg-contact a:hover { text-decoration: underline; }

.pv-pg { padding: 16px 0; border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.08)); border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08)); }
.pv-pg-head { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.pv-pg-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.pv-pg-initial { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #8338EC, #FF006E); color: #fff; font-weight: 700; font-size: 1.2rem; }
.pv-pg-label { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.pv-pg-name { display: block; font-weight: 700; font-size: 1.05rem; }
.pv-pg-head:hover .pv-pg-name { color: var(--pink, #FF69B4); }
.pv-pg-loc { display: block; font-size: 0.82rem; color: var(--text-muted); }
.pv-pg-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pv-btn {
    display: inline-flex;
    align-items: center;
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.14));
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.pv-btn:hover { border-color: var(--pink, #FF69B4); color: var(--pink, #FF69B4); }
.pv-btn-primary { background: #7c3aed; border-color: #7c3aed; color: #fff; }
.pv-btn-primary:hover { background: #6d28d9; color: #fff; }
.pv-pg-contact { margin: 12px 0 0; font-size: 0.88rem; }

.photo-use { margin-top: 16px; font-size: 0.88rem; }
.photo-use summary { cursor: pointer; font-weight: 600; color: var(--text-secondary); }
.photo-use p { line-height: 1.55; margin: 8px 0 0; color: var(--text-secondary); }
.photo-use-credit code { display: inline-block; padding: 2px 6px; border-radius: 4px; background: var(--hover-bg); font-size: 0.82rem; overflow-wrap: anywhere; }

/* ── Filmstrip ──────────────────────────────────────────────────────────── */
.pv-strip {
    display: flex;
    gap: 4px;
    padding: 8px 12px 10px;
    overflow-x: auto;
    background: #0b0b0f;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    scrollbar-width: thin;
}
.pv-strip-item {
    --ar: 1.5;
    flex: 0 0 auto;
    height: 64px;
    aspect-ratio: var(--ar);
    border-radius: 3px;
    overflow: hidden;
    opacity: 0.5;
    outline: 2px solid transparent;
    outline-offset: -2px;
    transition: opacity 0.2s;
}
.pv-strip-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pv-strip-item:hover { opacity: 0.85; }
.pv-strip-item.is-current { opacity: 1; outline-color: #fff; }

/* ── Below the viewer ───────────────────────────────────────────────────── */
.pv-more-wrap { padding-top: 8px; }
.photo-more { margin-top: 32px; }
.photo-more h2 { font-size: 1.2rem; margin: 0 0 12px; }
.photo-more h2 a { color: inherit; text-decoration: none; }
.photo-more h2 a:hover { color: var(--pink, #FF69B4); }
.photo-more .jgrid { --row: 200px; }
.photo-join { margin-top: 36px; font-size: 0.9rem; color: var(--text-muted); }
.photo-join a { color: var(--pink, #FF69B4); }

/* ── Narrower screens: details go under the photo ──────────────────────── */
@media (max-width: 1100px) {
    .pv { grid-template-columns: 1fr; }
    .pv-stage { height: auto; min-height: 0; max-height: var(--pv-h); padding: 48px 64px 36px; }
    .pv-img { max-height: calc(var(--pv-h) - 84px); }
    .pv-info { height: auto; min-height: 0; overflow: visible; border-left: 0; padding: 20px; }
}
@media (max-width: 600px) {
    .pv-stage { padding: 40px 0 30px; max-height: none; }
    .pv-img { max-width: 100%; max-height: 70svh; box-shadow: none; }
    .pv-bar { padding: 10px 12px; font-size: 0.82rem; }
    .pv-nav { width: 40px; height: 40px; margin-top: -20px; background: rgba(0, 0, 0, 0.45); border-color: rgba(255, 255, 255, 0.18); }
    .pv-nav svg { width: 20px; height: 20px; }
    .pv-prev { left: 6px; }
    .pv-next { right: 6px; }
    .photo-h1 { font-size: 1.35rem; }
    .pv-strip-item { height: 52px; }
    .photo-page .container { padding: 0 16px; }
}

/* Light theme: the stage stays dark; the panel follows the theme. */
[data-theme="light"] .pv-info { background: #fff; border-color: rgba(0, 0, 0, 0.08); }
[data-theme="light"] .pv-pg { border-color: rgba(0, 0, 0, 0.08); }
@media (prefers-reduced-motion: reduce) {
    @view-transition { navigation: none; }
    .pv-nav { transition: none; }
}
