/* Round 33 (13 November 2026), comment 35f1dfa8: Services, FORMATS section (#formats).
 * The portrait frame becomes a viewfinder. Each format row carries a still from that format's own page; on
 * desktop the frame cuts to the active row's still (hover, keyboard focus, or the row level with the frame while
 * scrolling) with a short crossfade (r44, was a wipe and blur), and a soft highlight glides to the active row. Below 1024px the
 * frame is hidden and every row shows its still as a thumbnail. Script: assets/js/r33-formats.js.
 * Without the script the frame shows the studio still and the rows work as plain links.
 * Loaded on the Services page only (functions.php). Every selector starts at #formats so it outranks the
 * doubled class rules in residue.css without !important. */

/* ---------- list rhythm ---------- */
#formats .fmt-group { margin-bottom: clamp(2rem, 3.4vw, 2.75rem); }
#formats .fmt-group:last-of-type { margin-bottom: 0; }
#formats .fmt-group-label { margin-bottom: 0.65rem; color: var(--slate, #0D4C46); }
#formats .r33f-list { position: relative; }

/* ---------- rows ---------- */
#formats .r33f-row {
	position: relative; z-index: 1;
	grid-template-columns: auto 1fr auto; column-gap: 1rem;
	padding: 1rem 0;
	border-radius: 0;
	transition: color 320ms var(--ease-out, cubic-bezier(.22,1,.36,1));
	-webkit-tap-highlight-color: transparent;
}
#formats .r33f-row .fmt-row__h3 {
	font-size: clamp(1.2rem, 5.2vw, 1.5rem);
	line-height: 1.12;
	text-wrap: balance;
	transition: transform 520ms var(--ease-out, cubic-bezier(.22,1,.36,1)), color 320ms var(--ease-out, cubic-bezier(.22,1,.36,1));
}
#formats .r33f-row:focus-visible { outline: 2px solid var(--navy, #0B262D); outline-offset: 3px; border-radius: 12px; }
#formats .r33f-row .arrow { transition: transform 420ms var(--ease-out, cubic-bezier(.22,1,.36,1)), background-color 320ms var(--ease-out, cubic-bezier(.22,1,.36,1)), color 320ms var(--ease-out, cubic-bezier(.22,1,.36,1)); }

/* thumbnails (below 1024px) */
#formats .r33f-thumb {
	width: clamp(4.75rem, 22vw, 6.5rem); aspect-ratio: 3 / 2;
	border-radius: 10px; overflow: hidden;
	background: var(--navy-deep, #07191E);
	box-shadow: 0 10px 22px -14px rgba(11, 38, 45, 0.55), inset 0 0 0 1px rgba(11, 38, 45, 0.10);
}
#formats .r33f-thumb__img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 700ms var(--ease-out, cubic-bezier(.22,1,.36,1)); }
#formats .r33f-row:hover .r33f-thumb__img, #formats .r33f-row:focus-visible .r33f-thumb__img { transform: scale(1.06); }

/* below 1024px each group's thumbnails cut in, left to right, as the group reveals */
@media (max-width: 1023px) and (prefers-reduced-motion: no-preference) {
	html.mo-js #formats .fmt-group .r33f-thumb { clip-path: inset(0 100% 0 0 round 10px); transition: clip-path 900ms var(--ease-out, cubic-bezier(.22,1,.36,1)); }
	html.mo-js #formats .fmt-group.in .r33f-thumb { clip-path: inset(0 0 0 0 round 10px); }
	html.mo-js #formats .fmt-group.in .fmt-row:nth-child(2) .r33f-thumb { transition-delay: 90ms; }
	html.mo-js #formats .fmt-group.in .fmt-row:nth-child(3) .r33f-thumb { transition-delay: 180ms; }
	html.mo-js #formats .fmt-group .r33f-thumb__img { transform: scale(1.12); transition: transform 1100ms var(--ease-out, cubic-bezier(.22,1,.36,1)); }
	html.mo-js #formats .fmt-group.in .r33f-thumb__img { transform: none; }
}

/* per still framing (the stills are 16:9; frame and thumbs crop them) */
#formats [data-r33f-still="0"] img, #formats [data-r33f="0"] .r33f-thumb__img { object-position: 58% 50%; }
#formats [data-r33f-still="1"] img, #formats [data-r33f="1"] .r33f-thumb__img { object-position: 52% 50%; }
#formats [data-r33f-still="3"] img, #formats [data-r33f="3"] .r33f-thumb__img { object-position: 30% 50%; }
#formats [data-r33f-still="4"] img, #formats [data-r33f="4"] .r33f-thumb__img { object-position: 46% 50%; }
#formats [data-r33f-still="5"] img, #formats [data-r33f="5"] .r33f-thumb__img { object-position: 42% 50%; }
#formats [data-r33f-still="6"] img, #formats [data-r33f="6"] .r33f-thumb__img { object-position: 22% 50%; }
#formats [data-r33f-still="10"] img, #formats [data-r33f="10"] .r33f-thumb__img { object-position: 42% 50%; }

/* ---------- viewfinder (hidden below 1024px) ---------- */
#formats .r33f-vf { display: none; }

@media (min-width: 1024px) {
	#formats .r33f-thumb { display: none; }
	#formats .r33f-row { grid-template-columns: 1fr auto; padding: 1.35rem 0; }
	#formats .r33f-row .fmt-row__h3 { font-size: clamp(1.6rem, 2.4vw, 2.2rem); }

	#formats .r33f-vf {
		display: block; aspect-ratio: 4 / 5;
		background: var(--navy-deep, #07191E);
		isolation: isolate; cursor: pointer;
	}
	#formats .r33f-vf .fmt-media__img { position: absolute; inset: 0; }
	#formats .r33f-still { position: absolute; inset: 0; z-index: 1; clip-path: inset(0 100% 0 0); overflow: hidden; }
	#formats .r33f-still.is-on { clip-path: inset(0 0 0 0); }
	#formats .r33f-still__img { display: block; width: 100%; height: 100%; object-fit: cover; }

	/* frame guides and caption: only once the script has taken over */
	#formats .r33f-vf__chrome, #formats .r33f-vf__edge { display: none; }
	#formats .r33f-vf.is-live .r33f-vf__chrome {
		display: flex; flex-direction: column; justify-content: space-between;
		position: absolute; inset: 0; z-index: 60; pointer-events: none;
		padding: clamp(1.25rem, 2vw, 1.75rem);
		color: #fff;
		background:
			linear-gradient(180deg, rgba(7, 25, 30, 0.55) 0%, rgba(7, 25, 30, 0) 26%),
			linear-gradient(0deg, rgba(7, 25, 30, 0.88) 0%, rgba(7, 25, 30, 0.35) 28%, rgba(7, 25, 30, 0) 48%);
	}
	/* r44 (comment 63922b4b): the four corner guides were removed at Dan's request */
	#formats .r33f-vf__col {
		display: inline-flex; align-items: center; gap: 0.6rem; align-self: flex-start;
		margin: 0.35rem 0 0 0.35rem;
		font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.66rem; font-weight: 500;
		letter-spacing: 0.16em; text-transform: uppercase; color: rgba(255, 255, 255, 0.9);
	}
	#formats .r33f-vf__col::before {
		content: ""; width: 7px; height: 7px; border-radius: 50%;
		background: var(--acid, #F2E70C); box-shadow: 0 0 0 3px rgba(242, 231, 12, 0.18);
	}
	#formats .r33f-vf__cap { display: flex; flex-direction: column; gap: 0.55rem; margin: 0 4.25rem 0.35rem 0.35rem; }
	/* the frame opens the format it shows */
	#formats .r33f-vf.is-live .r33f-vf__chrome::after {
		content: ""; position: absolute; right: clamp(1.5rem, 2.2vw, 2rem); bottom: clamp(1.5rem, 2.2vw, 2rem);
		width: 2.75rem; height: 2.75rem; border-radius: 50%;
		background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='16' height='16' fill='none' stroke='%230B262D' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12h14'/><path d='m13 5 7 7-7 7'/></svg>") center / 16px no-repeat;
		box-shadow: 0 10px 24px -12px rgba(7, 25, 30, 0.7);
		transition: transform 420ms var(--ease-out, cubic-bezier(.22,1,.36,1));
	}
	#formats .r33f-vf.is-live:hover .r33f-vf__chrome::after { transform: translateX(4px); }
	#formats .r33f-vf__name {
		font-family: Outfit, sans-serif; font-weight: 500; letter-spacing: -0.02em; line-height: 1.02;
		font-size: clamp(1.6rem, 2.3vw, 2.15rem); text-wrap: balance; color: #fff;
	}
	#formats .r33f-vf__credit {
		font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.66rem; font-weight: 500;
		letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255, 255, 255, 0.78);
		min-height: 1em;
	}
	#formats .r33f-vf__credit b { font-weight: 500; color: var(--cyan, #1DBED5); }

	/* the leading edge of the cut */
	#formats .r33f-vf.is-live .r33f-vf__edge {
		display: none; position: absolute; top: 0; bottom: 0; left: 0; width: 2px; z-index: 55;
		background: var(--acid, #F2E70C); opacity: 0; pointer-events: none; will-change: transform, opacity;
	}

	/* glide highlight behind the active row */
	#formats .r33f-glide {
		position: absolute; left: -1.1rem; right: -1.1rem; top: 0; z-index: 0;
		border-radius: 14px; pointer-events: none;
		background: rgba(11, 38, 45, 0.05);
		opacity: 0;
		transition: transform 560ms var(--ease-out, cubic-bezier(.22,1,.36,1)), height 560ms var(--ease-out, cubic-bezier(.22,1,.36,1)), opacity 320ms var(--ease-out, cubic-bezier(.22,1,.36,1));
	}
	#formats .r33f-list.is-live .r33f-glide { opacity: 1; }
	#formats .r33f-row.is-active .fmt-row__h3 { transform: translateX(0.9rem); }
	#formats .r33f-row.is-active .arrow { background-color: var(--navy, #0B262D); color: #fff; transform: translateX(-0.4rem); }
	/* scrubbing with the pointer pulls focus onto the row under it (large text stays above 3:1) */
	#formats .r33f-list.is-scrubbing .r33f-row:not(.is-active) .fmt-row__h3 { color: rgba(11, 38, 45, 0.6); }
}

@media (prefers-reduced-motion: reduce) {
	#formats .r33f-row .fmt-row__h3, #formats .r33f-row .arrow, #formats .r33f-thumb__img, #formats .r33f-glide { transition: none; }
	#formats .r33f-row:hover .r33f-thumb__img { transform: none; }
}
