/* The stream frame. Values from docs/design_handoff_numancia 3/docs/design.md → Shared stream frame. */
.stream{position:relative;min-height:100dvh}

/* Content area: top 88, bottom 156, edges 40. Photos use object-fit: contain, never cropped. */
.stage{position:absolute;top:88px;bottom:156px;left:var(--edge);right:var(--edge);container-type:size}
.layer{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;transition:opacity 225ms ease}
.layer.is-entering,.layer.is-leaving{opacity:0}
.photo-link{display:flex;align-items:center;justify-content:center;width:100%;height:100%;cursor:e-resize}
/* The photo's box is reserved from its stored aspect ratio and filled with its dominant colour. */
.photo{margin:0;width:min(100cqw,calc(100cqh*var(--ar)));aspect-ratio:var(--ar);background:var(--dom)}
.photo img{display:block;width:100%;height:100%;object-fit:contain;transition:opacity 200ms ease}
.js .photo img:not(.loaded){opacity:0;animation:num-show 0s 2.5s forwards} /* shows anyway if the script never runs */
@keyframes num-show{to{opacity:1}}
.photo.failed{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;background:var(--well);width:100%;height:100%;aspect-ratio:auto;text-align:center}
.photo.failed p{margin:0;font-weight:300;font-size:17px}
.photo.failed button{background:none;border:0;padding:0;font:400 12px var(--font-mono);text-decoration:underline;cursor:pointer}

/* End-of-year frame and text posts: one quiet column. */
.end,.textpost{width:100%;max-width:680px;display:flex;flex-direction:column;gap:18px}
.end-title,.textpost-title{margin:0;font-weight:500;font-size:40px;line-height:1.1;letter-spacing:-.02em}
.end-body{margin:0;font-weight:300;font-size:20px;line-height:1.5;color:var(--ink-2)}
.end-body a{color:var(--ink)}
.textpost{align-self:flex-start;margin:62px auto 0;gap:24px}
.layer:has(.textpost){align-items:flex-start}
.textpost-body{font-weight:300;font-size:24px;line-height:1.5}
.textpost-body p{margin:0 0 .8em}
.textpost-body p:last-child{margin:0}
.textpost-body p+p{color:var(--ink-2)}

/* Bottom bar: grid 1fr auto 1fr, edges 40, bottom 40. */
.bottom-bar{position:absolute;left:var(--edge);right:var(--edge);bottom:40px;display:grid;grid-template-columns:1fr auto 1fr;gap:40px;align-items:end}
.caption{display:flex;flex-direction:column;gap:6px;min-width:0;transition:opacity 225ms ease}
.caption.is-swapping{opacity:0}
.cap-title{margin:0;font-weight:500;font-size:22px;line-height:1.2}
.cap-desc{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;line-clamp:3;overflow:hidden;margin:0;font-weight:300;font-size:15px;line-height:1.45;color:var(--ink-2);max-width:380px}
.cap-date{margin:0;font:400 12px var(--font-mono);color:var(--muted)}

.center{display:flex;flex-direction:column;align-items:center;gap:12px;padding-bottom:16px}
.dash-wrap[hidden]{display:block;visibility:hidden}
.dashes{display:flex;gap:4px;justify-content:center}
.dashes i{display:block;width:14px;height:2px;background:var(--ink);opacity:.2;transition:opacity 300ms ease}
.dashes i.on{opacity:1}
.dashes--phone{display:none}
.year{font:400 13px var(--font-mono)}

.controls{display:flex;justify-content:flex-end;align-items:center;gap:22px}
.copy-link{background:none;border:0;padding:0;font:400 13px var(--font-mono);color:var(--muted);cursor:pointer}
.copy-link:hover{color:var(--ink)}
.copy-link[hidden]{display:none}
.next-label{font:400 13px var(--font-mono);text-decoration:none}
.btn{display:inline-grid;place-items:center;width:48px;height:48px;border-radius:50%;border:1px solid var(--soft-border);text-decoration:none;font:400 15px var(--font-mono);line-height:1;transition:background-color 150ms ease,color 150ms ease}
.btn-next{border-color:var(--ink)}
.btn-next:hover{background:var(--ink);color:var(--paper)}
.btn-prev:hover{border-color:var(--ink)}

/* The "link copied" toast: bottom-centre of the content area. */
.toast{position:absolute;left:50%;bottom:172px;transform:translateX(-50%);background:var(--ink);color:var(--paper);font:400 12px var(--font-mono);padding:10px 16px;border-radius:24px;opacity:0;pointer-events:none;transition:opacity 200ms ease;white-space:nowrap}
.toast.is-on{opacity:1;transition-duration:150ms}

/* "Get this print": a quiet link in the bar and a small sheet (docs design.md → Small components). Hidden unless the shop is on. */
.get-print{background:none;border:0;padding:0;font:400 13px var(--font-mono);color:var(--muted);cursor:pointer}
.get-print:hover{color:var(--ink)}
.get-print[hidden]{display:none}
.print-sheet{position:fixed;inset:0;z-index:30;display:flex;align-items:center;justify-content:center;background:rgba(230,229,225,.94)}
.print-sheet[hidden]{display:none}
.ps-panel{width:min(420px,calc(100vw - 32px));padding:32px;border:1px solid var(--rule);background:var(--paper)}
.ps-title{margin:0 0 20px;font-weight:500;font-size:24px}
.ps-sizes{list-style:none;margin:0;padding:0;font:400 13px var(--font-mono)}
.ps-sizes li{display:flex;justify-content:space-between;padding:12px 0;border-top:1px solid var(--rule)}
.ps-sizes li:last-child{border-bottom:1px solid var(--rule)}
.ps-note{margin:18px 0 0;font-weight:300;font-size:15px;line-height:1.5;color:var(--ink-2)}
.ps-request{display:block;margin-top:24px;padding:14px;background:var(--ink);color:var(--paper);text-align:center;font:400 13px var(--font-mono);text-decoration:none}
.ps-request:hover{background:var(--ink-2)}

/* ---- Post layouts (docs design.md → Post layouts) ---- */
.cap-meta{margin:0;font:400 12px var(--font-mono);color:var(--muted)}

/* photo + text: the photograph keeps the larger share; the text is as tall as the photograph and centred against it */
.phototext{position:absolute;inset:8px 0 0 0;display:grid;grid-template-columns:minmax(0,1.7fr) minmax(0,1fr);column-gap:72px;align-items:center}
.phototext.pt-left{grid-template-columns:minmax(0,1fr) minmax(0,1.7fr)}
.pt-photo{container-type:size;height:100%;display:flex;align-items:center;justify-content:center;min-height:0}
.pt-left .pt-photo{order:2}
.pt-text{display:flex;align-items:center;min-width:0}
.pt-inner{display:flex;flex-direction:column;gap:22px;width:100%}
.pt-words{font-weight:500;font-size:var(--fs);line-height:1.12;letter-spacing:-.02em;overflow-wrap:anywhere;text-wrap:pretty}
.pt-words p{margin:0 0 .5em}
.pt-words p:last-child{margin:0}
.pt-words em{font-weight:300}
.pt-text.is-tight .pt-words{line-height:1.2}

/* split 2-4: a mosaic. The block has the shape the page computed (--da computer, --ma phone) and each photograph is placed in percent of it, never cropped */
.split{position:relative;width:min(100cqw,calc(100cqh*var(--da)));aspect-ratio:var(--da)}
.split-item{position:absolute;left:var(--dx);top:var(--dy);width:var(--dw);height:var(--dh)}
.zoom{display:block;width:100%;height:100%;cursor:zoom-in}
.split-item .photo{width:100%;height:100%;aspect-ratio:auto}

/* carousel: one photograph at a time; works as a scrolling strip without JavaScript */
.carousel{position:absolute;inset:0}
.slides{position:absolute;top:8px;bottom:80px;left:80px;right:80px;container-type:size;display:flex;overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:none}
.slides::-webkit-scrollbar{display:none}
.slide{flex:0 0 100%;scroll-snap-align:center;display:flex;align-items:center;justify-content:center}
.js .slides{display:block;overflow:hidden}
.js .slide{position:absolute;inset:0;opacity:0;transition:opacity 300ms ease;pointer-events:none}
.js .slide.is-on{opacity:1;pointer-events:auto}
.arrow{position:absolute;top:calc(50% - 58px);display:grid;place-items:center;width:44px;height:44px;border-radius:50%;border:1px solid var(--soft-border);text-decoration:none;font-size:22px;line-height:1;transition:border-color 150ms ease}
.arrow:hover{border-color:var(--ink)}
.arrow-prev{left:0}
.arrow-next{right:0}
.thumbs{position:absolute;left:0;right:0;bottom:8px;display:flex;justify-content:safe center;gap:8px;overflow-x:auto;padding-bottom:6px;scrollbar-width:none}
.thumbs a{position:relative;flex:none;display:block;opacity:.4;transition:opacity 150ms ease}
.thumbs a:hover,.thumbs a.is-on{opacity:1}
.thumbs a.is-on::after{content:"";position:absolute;left:0;right:0;bottom:-6px;height:2px;background:var(--ink)}
.thumbs img{display:block;height:46px;width:auto}
.bars{display:none}

/* full-screen view of a photograph from a split (Esc or a click closes it) */
.lightbox{position:fixed;inset:0;z-index:30;display:flex;align-items:center;justify-content:center;padding:60px var(--edge);background:var(--paper);cursor:zoom-out}
.lightbox img{max-width:100%;max-height:100%;object-fit:contain;transition:opacity 225ms ease;cursor:e-resize}
.lightbox img.is-out{opacity:0}
.lb-close{position:absolute;top:28px;right:var(--edge);background:none;border:0;padding:0;font:400 13px var(--font-mono);color:var(--muted);cursor:pointer}
.lb-close:hover{color:var(--ink)}
.lb-arrow{position:absolute;top:50%;width:44px;height:44px;margin-top:-22px;border-radius:50%;border:1px solid var(--soft-border);background:none;color:var(--ink);font:400 16px var(--font-mono);cursor:pointer}
.lb-arrow:hover{background:var(--ink);color:var(--paper)}
.lightbox.many{padding-left:84px;padding-right:84px}
.lb-prev{left:20px}.lb-next{right:20px}
.lb-dashes{position:absolute;bottom:24px;left:0;right:0;display:flex;gap:4px;justify-content:center}
.lb-dashes i{display:block;width:14px;height:2px;background:var(--ink);opacity:.2;transition:opacity 300ms ease}
.lb-dashes i.on{opacity:1}

/* Phone: content area top 76, bottom 200, edges 16; bottom bar bottom 36, edges 22. */
@media (max-width:767px){
	.lightbox.many{padding-left:var(--edge-phone);padding-right:var(--edge-phone)}
	.lb-arrow{display:none}
	.lb-close{right:var(--edge-phone)}
	.stage{top:76px;bottom:200px;left:16px;right:16px}
	.bottom-bar{left:var(--edge-phone);right:var(--edge-phone);bottom:36px;grid-template-columns:1fr auto;gap:16px}
	/* The caption sits above the bar at bottom 110; the description is hidden on the phone stream. */
	.caption{position:absolute;left:0;right:0;bottom:74px}
	.cap-title{font-size:18px}
	.cap-desc{display:none}
	.cap-date{font-size:11px}
	.center{grid-column:1;grid-row:1;align-items:flex-start;gap:8px;padding-bottom:0}
	.dashes--desk{display:none}
	.dashes--phone{display:flex;gap:3px}
	.dashes i{width:10px}
	.year{font-size:11px}
	.controls{grid-column:2;grid-row:1;gap:14px}
	.copy-link{font-size:12px}
	.btn-prev,.next-label{display:none}
	.btn{width:44px;height:44px}
	.end-title,.textpost-title{font-size:30px}
	.end-body{font-size:17px}
	.textpost-body{font-size:19px}
	.toast{bottom:230px}
}

@media (max-width:767px){
	.cap-meta{font-size:11px}
	/* photo + text: photograph 360 high, then the words below it (they may run into the empty caption area) */
	.phototext,.phototext.pt-left{display:block;inset:-4px 0 auto 0;overflow:visible}
	.pt-photo{height:360px;justify-content:center}
	.pt-text{margin-top:18px}
	.pt-inner{gap:12px}
	.pt-words{font-size:clamp(18px,calc(var(--fs)*.5),30px)}
	/* split: the mosaic computed for the phone */
	.split{width:min(100cqw,calc(100cqh*var(--ma)));aspect-ratio:var(--ma)}
	.split-item{left:var(--mx);top:var(--my);width:var(--mw);height:var(--mh)}
	/* carousel: main image to bottom 250, bars instead of thumbnails, no side arrows */
	.slides{left:0;right:0;top:0;bottom:50px}
	.arrow,.thumbs{display:none}
	.bars{display:flex;position:absolute;left:0;right:0;bottom:12px;justify-content:center;gap:4px}
	.bars i{display:block;width:18px;height:4px;background:var(--ink);opacity:.4}
	.bars i.on{opacity:1}
}

.preview-banner{position:fixed;top:10px;left:50%;transform:translateX(-50%);margin:0;padding:4px 12px;background:var(--accent);color:#fff;font:400 11px var(--font-mono);z-index:20}
.photo picture{display:contents}
