/* Portfolio GL — darkroom / helix WebGL2 galleries with a still-image fallback */
.pgl {
    --pgl-bg: #0c0c0e;
    --pgl-fg: #ece7df;
    --pgl-mute: #8f8b85;
    --pgl-line: #2a292c;
    --pgl-accent: #ff6b3d;
    --pgl-serif: "Lora", Georgia, "Times New Roman", serif;
    --pgl-sans: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
    position: relative;
    background: var(--pgl-bg);
    color: var(--pgl-fg);
    font-family: var(--pgl-sans);
    font-size: 14px;
    line-height: 1.4;
    outline: none;
    -webkit-user-select: none;
    user-select: none;
}
/* Darkroom and the still fallback sit on white, with black type and controls */
.pgl-darkroom,
.pgl-fallback {
    --pgl-bg: #ffffff;
    --pgl-fg: #000000;
    --pgl-mute: #000000;
    --pgl-line: #000000;
    --pgl-accent: #000000;
}
.pgl-darkroom .pgl-bar { border-top-color: transparent; }
.pgl-darkroom .pgl-btn:hover { background: var(--pgl-fg); color: var(--pgl-bg); }
.pgl-darkroom .pgl-tick::after { height: 3px; }
.pgl-darkroom .pgl-tick:hover::after { height: 10px; background: var(--pgl-fg); }
.pgl-darkroom .pgl-tick.is-current::after { height: 18px; }
.pgl:focus-visible { box-shadow: 0 0 0 2px var(--pgl-accent); }
.pgl *, .pgl *::before, .pgl *::after { box-sizing: border-box; }

.pgl-stage {
    position: relative;
    height: clamp(340px, 72vh, 780px);
    overflow: hidden;
}
.pgl-stage canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: pan-y;
}
.pgl-darkroom .pgl-stage canvas { cursor: crosshair; }
.pgl-helix .pgl-stage canvas { cursor: grab; }
.pgl-helix .pgl-stage canvas.is-dragging { cursor: grabbing; }

.pgl-status {
    position: absolute;
    left: 16px;
    top: 14px;
    font-size: 11px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--pgl-accent);
    opacity: 0;
    transition: opacity .4s;
    pointer-events: none;
}
.pgl-status.is-on { opacity: .9; }
.pgl-status::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 8px;
    border-radius: 50%;
    background: currentColor;
    vertical-align: 1px;
    animation: pgl-pulse 1.2s ease-in-out infinite;
}
@keyframes pgl-pulse { 50% { opacity: .2; } }

.pgl-hint {
    position: absolute;
    right: 16px;
    top: 14px;
    font-size: 11px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--pgl-mute);
    transition: opacity .8s;
    pointer-events: none;
}
.pgl-hint.is-gone { opacity: 0; }

.pgl-close {
    position: absolute;
    right: 12px;
    bottom: 12px;
}

/* Control bar */
.pgl-bar {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 20px;
    padding: 18px 20px 14px;
    border-top: 1px solid var(--pgl-line);
}
.pgl-timer {
    position: absolute;
    left: 0;
    top: -1px;
    height: 1px;
    width: 100%;
    background: var(--pgl-accent);
    transform-origin: 0 50%;
    transform: scaleX(0);
}
.pgl-buttons { display: flex; gap: 6px; }
.pgl-btn {
    appearance: none;
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--pgl-line);
    border-radius: 50%;
    background: transparent;
    color: var(--pgl-fg);
    cursor: pointer;
    transition: border-color .2s, color .2s, background .2s;
}
.pgl-btn:hover { border-color: var(--pgl-fg); }
.pgl-btn:focus-visible { outline: 2px solid var(--pgl-accent); outline-offset: 2px; }
.pgl-btn svg { width: 14px; height: 14px; fill: currentColor; }
.pgl-btn[hidden] { display: none !important; }

.pgl-cap {
    margin: 0;
    min-width: 0;
    font-family: var(--pgl-serif);
    font-style: italic;
    font-size: 1.15rem;
    line-height: 1.35;
    text-wrap: balance;
    transition: opacity .5s;
}
.pgl-cap.is-swapping { opacity: 0; }
.pgl-count {
    font-size: 12px;
    letter-spacing: .12em;
    color: var(--pgl-mute);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.pgl-count b { color: var(--pgl-fg); font-weight: 600; }

/* Frame index: one tick per photograph */
.pgl-ticks {
    display: flex;
    gap: 2px;
    padding: 0 20px 18px;
}
.pgl-tick {
    appearance: none;
    flex: 1 1 0;
    min-width: 0;
    height: 18px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    position: relative;
}
.pgl-tick::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 6px;
    background: var(--pgl-line);
    transition: height .25s, background .25s;
}
.pgl-tick:hover::after { height: 12px; background: var(--pgl-mute); }
.pgl-tick.is-current::after { height: 18px; background: var(--pgl-accent); }
.pgl-tick:focus-visible { outline: 1px solid var(--pgl-accent); }

@media (max-width: 560px) {
    .pgl-bar { grid-template-columns: 1fr auto; gap: 12px 16px; padding: 14px 16px 12px; }
    .pgl-cap { grid-column: 1 / -1; order: -1; font-size: 1.05rem; }
    .pgl-ticks { padding: 0 16px 14px; gap: 1px; }
    .pgl-stage { height: clamp(300px, 62vh, 560px); }
}

/* Fallback: one random photograph, no WebGL */
.pgl-still { margin: 0; }
.pgl-still img { display: block; width: 100%; height: auto; }
.pgl-still figcaption {
    padding: 18px 20px 20px;
    font-family: var(--pgl-serif);
    font-style: italic;
    font-size: 1.15rem;
    text-align: center;
}

@media (prefers-reduced-motion: reduce) {
    .pgl-status::before { animation: none; }
    .pgl-cap, .pgl-hint { transition: none; }
}
