/*
  Festival Framework details.

  Optional touches a style switches on by token (settings.custom.details and
  settings.custom.layout in theme.json), surfaced as body classes by
  inc/details.php. Nothing here names a colour or a typeface: it all reads
  the same tokens as the rest of the theme, so any style can use any detail.
*/

body {
	--ff-band: var(--wp--preset--color--band);
	--ff-band-ink: var(--wp--preset--color--band-ink);
	--ff-panel: var(--wp--preset--color--panel);
	--ff-feature: var(--wp--preset--color--feature);
	--ff-line: var(--wp--custom--btn-line);
	--fc-still-bg: var(--ff-panel);
	--fc-still-ink: var(--wp--preset--color--ink);
	--ff-scallop: 12px;
}
@media (max-width: 640px) { body { --ff-scallop: 8px; } }

/* Outline buttons and focus rings use a line colour that always reads on the page (a pale accent would not). */
.fc-btn:not(.fc-btn--solid):not(.fc-btn--off):not(:hover) { border-color: var(--ff-line); color: var(--ff-line); }
:focus-visible { outline-color: var(--ff-line); }

/* ── layout: solid Book buttons ───────────────────────────────────────── */

.ff-book-solid .fc-session__book .fc-btn:not(.fc-btn--off),
.ff-book-solid .fc-card .fc-btn:not(.fc-btn--off) {
	background: var(--wp--preset--color--accent);
	border-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--accent-ink);
}

/* ── bands ────────────────────────────────────────────────────────────── */

.ff-bands .ff-band,
.ff-bands .ff-footer {
	background: var(--ff-band);
	color: var(--ff-band-ink);
	--fc-ink: var(--ff-band-ink);
	--fc-ink-2: color-mix(in srgb, var(--ff-band-ink) 88%, var(--ff-band));
	--fc-ink-3: color-mix(in srgb, var(--ff-band-ink) 74%, var(--ff-band));
	--fc-rule: color-mix(in srgb, var(--ff-band-ink) 40%, var(--ff-band));
	--fc-rule-2: color-mix(in srgb, var(--ff-band-ink) 22%, var(--ff-band));
	--fc-paper: var(--ff-band);
	--fc-paper-2: color-mix(in srgb, var(--ff-band-ink) 10%, var(--ff-band));
	--ff-line: var(--ff-band-ink);
	border: 0;
}
.ff-bands .ff-band :focus-visible,
.ff-bands .ff-footer :focus-visible { outline-color: var(--wp--preset--color--accent); }
.ff-bands .ff-footer,
.ff-bands .ff-footer a,
.ff-bands .ff-footer .wp-block-site-title { color: var(--ff-band-ink); }
.ff-bands .ff-footer .wp-block-site-tagline,
.ff-bands .ff-footer p { color: color-mix(in srgb, var(--ff-band-ink) 82%, var(--ff-band)); }

/* The phone menu is a band too. */
.ff-bands .ff-masthead .wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open {
	background-color: var(--ff-band);
	color: var(--ff-band-ink);
}
.ff-bands .ff-masthead .wp-block-navigation .is-menu-open .current-menu-item > .wp-block-navigation-item__content {
	box-shadow: none;
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--accent);
	text-decoration-thickness: 2px;
	text-underline-offset: 0.18em;
}
.ff-bands .ff-masthead .is-menu-open :focus-visible { outline-color: var(--wp--preset--color--accent); }

.ff-bands .ff-panelband { background: var(--ff-panel); }
.ff-panelband { padding-block: var(--wp--preset--spacing--80); }
body:not(.ff-bands) .ff-panelband { padding-block: 0; }

/* ── scalloped edges ──────────────────────────────────────────────────── */

.ff-band--edge,
.ff-footer { position: relative; }
.ff-scallop.ff-bands .ff-band--edge::after,
.ff-scallop.ff-bands .ff-footer::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	height: var(--ff-scallop);
	pointer-events: none;
	z-index: 5;
	background-size: calc(var(--ff-scallop) * 2) var(--ff-scallop);
	background-repeat: repeat-x;
}
.ff-scallop.ff-bands .ff-band--edge::after {
	top: 100%;
	background-image: radial-gradient(circle at var(--ff-scallop) 0, var(--ff-band) var(--ff-scallop), transparent calc(var(--ff-scallop) + 0.5px));
	background-position: center top;
}
.ff-scallop.ff-bands .ff-footer::before {
	bottom: 100%;
	background-image: radial-gradient(circle at var(--ff-scallop) var(--ff-scallop), var(--ff-band) var(--ff-scallop), transparent calc(var(--ff-scallop) + 0.5px));
	background-position: center bottom;
}

/* ── emblem ───────────────────────────────────────────────────────────── */

.ff-emblem { display: none; pointer-events: none; }
.ff-emblem span { display: block; width: 100%; aspect-ratio: 1; background: var(--ff-emblem) center / contain no-repeat; }

/* Footer: the emblem rises behind the top edge. */
.ff-has-emblem .ff-footer { margin-top: 136px !important; }
.ff-has-emblem .ff-emblem--footer {
	display: block;
	position: absolute;
	left: 50%;
	bottom: 100%;
	width: 168px;
	height: 110px;
	margin: 0 0 0 -84px;
	overflow: hidden;
	z-index: 1;
}
@media (max-width: 640px) {
	.ff-has-emblem .ff-footer { margin-top: 112px !important; }
	.ff-has-emblem .ff-emblem--footer { width: 132px; height: 86px; margin-left: -66px; }
}

/* ── home page header ─────────────────────────────────────────────────── */

.ff-hero { padding-block: var(--wp--preset--spacing--60) var(--wp--preset--spacing--80); }
.ff-hero__inner > * { margin-block: 0 !important; }
.ff-hero .fc-intro { padding-block: 0; }
.ff-hero__stage { position: relative; }
.ff-hero__stage:not(:has(.fc-slideshow)) { display: none; }
.ff-home-slideshow .ff-hero__inner:has(.fc-slideshow) {
	display: grid;
	grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
	gap: var(--wp--preset--spacing--80);
	align-items: center;
}
.ff-hero__stage > * { margin-block: 0 !important; }
.ff-hero__stage .fc-slideshow { position: relative; z-index: 1; }
.ff-has-emblem .ff-hero__stage:has(.fc-slideshow) { padding-top: 12.5rem; }
.ff-has-emblem .ff-hero__stage .ff-emblem--hero {
	display: block;
	position: absolute;
	left: 50%;
	top: 0;
	width: 23rem;
	margin-left: -11.5rem;
	z-index: 0;
}
@media (max-width: 1023px) {
	.ff-home-slideshow .ff-hero__inner:has(.fc-slideshow) { grid-template-columns: minmax(0, 1fr); gap: var(--wp--preset--spacing--60); }
	.ff-has-emblem .ff-hero__stage:has(.fc-slideshow) { padding-top: 9.25rem; }
	.ff-has-emblem .ff-hero__stage .ff-emblem--hero { width: 17rem; margin-left: -8.5rem; }
}

/* ── film page header ─────────────────────────────────────────────────── */

.ff-filmhead { padding-block: var(--wp--preset--spacing--70) var(--wp--preset--spacing--80); margin-top: 0 !important; }
.ff-filmhead__inner { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--wp--preset--spacing--80); align-items: center; }
.ff-filmhead__inner > *,
.ff-filmhead__text > * { margin-block: 0 !important; }
.ff-filmhead__text .fc-title { margin-bottom: var(--wp--preset--spacing--40) !important; }
.ff-filmhead .fc-poster { aspect-ratio: 16 / 9; border: 0; box-shadow: 0 0 0 1px color-mix(in srgb, var(--ff-band-ink) 25%, transparent); }
.ff-filmhead .fc-poster--blank { background: var(--ff-panel); align-items: center; justify-content: center; text-align: center; }
.ff-filmhead .fc-poster--blank .fc-poster__title { color: var(--wp--preset--color--ink); font-style: italic; }
.ff-filmhead .fc-poster--blank .fc-poster__type { display: none; }
@media (max-width: 899px) {
	.ff-filmhead__inner { grid-template-columns: minmax(0, 1fr); gap: var(--wp--preset--spacing--60); }
	.ff-filmhead__inner > .wp-block-festival-poster { order: -1; }
}
@media (min-width: 782px) { .ff-film__body .wp-block-column:last-child .wp-block-festival-film-facts { position: sticky; top: 7rem; } }

/* ── ornament ─────────────────────────────────────────────────────────── */

.ff-has-ornament .fc-quote { position: relative; }
.ff-has-ornament .fc-quote:first-of-type::after {
	content: "";
	position: absolute;
	right: -30px;
	bottom: -34px;
	width: 84px;
	aspect-ratio: 5 / 6;
	background: var(--ff-ornament) center / contain no-repeat;
	rotate: 14deg;
	pointer-events: none;
}
@media (max-width: 1023px) { .ff-has-ornament .fc-quote:first-of-type::after { right: -8px; width: 64px; } }

/* ── paper grain ──────────────────────────────────────────────────────── */

body.ff-grain,
.ff-grain .ff-masthead {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.15' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.36  0 0 0 0 0.29  0 0 0 0 0.20  0.55 0 0 0 -0.19'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23g)'/%3E%3C/svg%3E");
	background-size: 180px 180px;
}

/* ── drop caps ────────────────────────────────────────────────────────── */

body.ff-dropcap.single-fc_film .fc-content > p:first-of-type::first-letter,
body.ff-dropcap.single-fc_person .fc-content > p:first-of-type::first-letter,
body.ff-dropcap.single-post .ff-article > p:first-of-type::first-letter {
	float: left;
	font-family: var(--wp--preset--font-family--display);
	font-style: italic;
	font-weight: var(--wp--custom--display--weight);
	font-size: 4.9em;
	line-height: 0.76;
	padding: 0.08em 0.1em 0 0;
	color: var(--ff-feature);
}

/* ── journal, articles, pages (every style) ───────────────────────────── */

.ff-eyebrow,
.ff-eyebrow a { font-size: var(--wp--preset--font-size--xs); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 500; color: var(--wp--preset--color--ink-3); text-decoration: none; }
.ff-meta { font-size: var(--wp--preset--font-size--sm); color: var(--wp--preset--color--ink-3); gap: 0.4em !important; }
.ff-meta > * { margin: 0 !important; }
.ff-meta > * + *::before { content: "·"; margin-right: 0.4em; }
.ff-lede { font-size: var(--wp--preset--font-size--lg); color: var(--wp--preset--color--ink-2); max-width: 40rem; }

.ff-journal .wp-block-post-template { gap: var(--wp--preset--spacing--70) var(--wp--preset--spacing--60); }
.ff-journal .wp-block-post { display: flex; flex-direction: column; gap: var(--wp--preset--spacing--20); }
.ff-journal .wp-block-post > * { margin: 0 !important; }
.ff-journal .wp-block-post-featured-image { margin-bottom: var(--wp--preset--spacing--30) !important; }
.ff-journal .wp-block-post-featured-image img,
.ff-article-image img { border-radius: var(--wp--custom--radius); aspect-ratio: 16 / 9; object-fit: cover; width: 100%; }
.ff-journal .wp-block-post-title { font-size: var(--wp--preset--font-size--lg); }
.ff-journal .wp-block-post-title a { text-decoration: none; }
.ff-journal .wp-block-post-title a:hover { text-decoration: underline; text-decoration-thickness: 1px; }
.ff-journal .wp-block-post-excerpt { font-size: var(--wp--preset--font-size--sm); color: var(--wp--preset--color--ink-2); }
.ff-journal .wp-block-post-excerpt__more-text { display: none; }
/* The newest article leads, across the full width. */
@media (min-width: 782px) {
	.ff-journal--lead .wp-block-post:first-child {
		grid-column: 1 / -1;
		display: grid;
		grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
		column-gap: var(--wp--preset--spacing--70);
		align-content: center;
		padding-bottom: var(--wp--preset--spacing--70);
		border-bottom: 1px solid var(--wp--preset--color--rule);
	}
	.ff-journal--lead .wp-block-post:first-child .wp-block-post-featured-image { grid-row: 1 / span 6; margin-bottom: 0 !important; }
	.ff-journal--lead .wp-block-post:first-child > :not(.wp-block-post-featured-image) { grid-column: 2; }
	.ff-journal--lead .wp-block-post:first-child:not(:has(.wp-block-post-featured-image)) { grid-template-columns: minmax(0, 1fr); }
	.ff-journal--lead .wp-block-post:first-child:not(:has(.wp-block-post-featured-image)) > * { grid-column: 1; }
	.ff-journal--lead .wp-block-post:first-child .wp-block-post-title { font-size: var(--wp--preset--font-size--xxl); }
	.ff-journal--lead .wp-block-post:first-child .wp-block-post-excerpt { font-size: var(--wp--preset--font-size--md); }
}

.ff-article > h2 { margin-top: var(--wp--preset--spacing--70); }
.ff-article > p,
.ff-article > ul,
.ff-article > ol { font-size: var(--wp--preset--font-size--md); }
.ff-article .wp-block-pullquote,
.ff-article .wp-block-quote { border: 0; margin: var(--wp--preset--spacing--70) 0; padding: 0; text-align: left; }
.ff-article .wp-block-pullquote p,
.ff-article .wp-block-quote p {
	font-family: var(--wp--preset--font-family--display);
	font-weight: var(--wp--custom--display--weight);
	font-style: italic;
	font-size: var(--wp--preset--font-size--xl);
	line-height: 1.2;
	max-width: none;
	text-wrap: balance;
}
.ff-article .wp-block-image img { border-radius: var(--wp--custom--radius); }
.ff-article figcaption { font-size: var(--wp--preset--font-size--sm); color: var(--wp--preset--color--ink-3); }
.ff-tags a {
	display: inline-block;
	font-size: var(--wp--preset--font-size--xs);
	border: 1px solid var(--wp--preset--color--rule);
	border-radius: var(--wp--custom--pill-radius);
	padding: 0.2em 0.75em;
	margin: 0 0.3em 0.4em 0;
	text-decoration: none;
	color: var(--wp--preset--color--ink-2);
}
.ff-tags .wp-block-post-terms__separator { display: none; }

/* Page with a contents list: the list stays in view while the page scrolls. */
.ff-contents { position: sticky; top: 7rem; font-size: var(--wp--preset--font-size--sm); }
.admin-bar .ff-contents { top: calc(7rem + var(--wp-admin--admin-bar--height, 32px)); }
.ff-contents__label { font-size: var(--wp--preset--font-size--xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--wp--preset--color--ink-3); margin: 0 0 var(--wp--preset--spacing--30); }
.ff-contents ol { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--wp--preset--color--rule); }
.ff-contents li { border-bottom: 1px solid var(--wp--preset--color--rule-2); }
.ff-contents a { display: flex; gap: var(--wp--preset--spacing--30); padding-block: var(--wp--preset--spacing--30); text-decoration: none; color: var(--wp--preset--color--ink-2); }
.ff-contents a:hover { color: var(--wp--preset--color--ink); }
.ff-contents a span { color: var(--wp--preset--color--ink-3); font-variant-numeric: tabular-nums; }
.ff-with-contents { align-items: stretch !important; }
.ff-with-contents h2 { scroll-margin-top: 7rem; margin-top: var(--wp--preset--spacing--70); padding-top: var(--wp--preset--spacing--50); border-top: 1px solid var(--wp--preset--color--rule); }
.ff-with-contents .wp-block-post-content > h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
@media (max-width: 781px) { .ff-contents { position: static; margin-bottom: var(--wp--preset--spacing--60); } }

/* ── motion ───────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
	/* Moving between pages: a soft cross-fade, with the header staying put. */
	@view-transition { navigation: auto; }
	::view-transition-old(root),
	::view-transition-new(root) { animation-duration: 0.4s; animation-timing-function: ease; }
	.ff-reveal .ff-masthead { view-transition-name: ff-masthead; }

	/* Things arrive as you reach them. */
	.ff-js .ff-reveal .ff-arrive { opacity: 0; translate: 0 18px; transition: opacity 0.7s ease, translate 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); transition-delay: var(--ff-delay, 0ms); }
	.ff-js .ff-reveal .ff-arrive.is-in { opacity: 1; translate: 0 0; }

	/* Page headings and the home page header arrive on load, one after another. */
	@keyframes ff-rise { from { opacity: 0; translate: 0 22px; } to { opacity: 1; translate: 0 0; } }
	.ff-reveal main h1 { animation: ff-rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
	.ff-reveal .ff-hero .fc-eyebrow { animation: ff-rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
	.ff-reveal .ff-hero .fc-intro__name { animation-delay: 0.08s; }
	.ff-reveal .ff-hero .fc-intro__tagline { animation: ff-rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.22s both; }
	.ff-reveal .ff-hero .fc-intro__actions { animation: ff-rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.34s both; }
	.ff-reveal .ff-hero .fc-slideshow,
	.ff-reveal .ff-filmhead .wp-block-festival-poster { animation: ff-rise 1s cubic-bezier(0.2, 0.7, 0.2, 1) 0.15s both; }

	/* The emblem: rises once, then turns very slowly. */
	@keyframes ff-turn { to { rotate: 360deg; } }
	@keyframes ff-sunrise { from { translate: 0 38%; opacity: 0; } to { translate: 0 0; opacity: 1; } }
	.ff-reveal .ff-emblem--hero { animation: ff-sunrise 1.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.3s both; }
	.ff-reveal .ff-emblem span { animation: ff-turn 160s linear infinite; }
	/* Footer: the frame stays still and the emblem rises inside it, from behind the edge. */
	.ff-js .ff-reveal .ff-emblem--footer span { translate: 0 66%; transition: translate 2.8s cubic-bezier(0.25, 0.6, 0.25, 1); }
	.ff-js .ff-reveal .ff-emblem--footer.is-in span { translate: 0 0; }

	/* The slideshow: each still drifts in slowly, and its caption fades with it. */
	@keyframes ff-drift { from { scale: 1; } to { scale: 1.07; } }
	.ff-reveal .fc-slideshow__slide.is-active img { animation: ff-drift 7.5s ease-out both; }
	@keyframes ff-caption { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }
	.ff-reveal .fc-slideshow__caption.is-active { animation: ff-caption 0.6s ease both; }

	/* The ornament lands on the press quote. */
	.ff-js .ff-reveal.ff-has-ornament .fc-quote:first-of-type::after { opacity: 0; translate: 22px -34px; rotate: 34deg; transition: opacity 0.3s ease, translate 0.7s cubic-bezier(0.3, 1.4, 0.5, 1), rotate 0.7s ease; transition-delay: 0.5s; }
	.ff-js .ff-reveal.ff-has-ornament .fc-quote.is-in:first-of-type::after { opacity: 1; translate: 0 0; rotate: 14deg; }

	/* Hover: stills ease forward, buttons lift. */
	.ff-reveal .fc-card__poster .fc-poster img,
	.ff-reveal .ff-journal .wp-block-post-featured-image img { transition: scale 0.8s cubic-bezier(0.2, 0.7, 0.2, 1); }
	.ff-reveal .fc-card:hover .fc-card__poster .fc-poster img,
	.ff-reveal .ff-journal .wp-block-post:hover .wp-block-post-featured-image img { scale: 1.04; }
	.ff-reveal .ff-journal .wp-block-post-featured-image { overflow: hidden; border-radius: var(--wp--custom--radius); }
	.ff-reveal .fc-btn,
	.ff-reveal .fc-save { transition: translate 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease; }
	.ff-reveal .fc-btn:hover,
	.ff-reveal .fc-save:hover { translate: 0 -1px; }
	.ff-reveal .fc-btn:active,
	.ff-reveal .fc-save:active { translate: 0 0; }
}

/* Styles without bands keep the plain home page rhythm. */
body:not(.ff-bands) .ff-hero { padding-block: var(--wp--preset--spacing--70) var(--wp--preset--spacing--60); }
.ff-bands .ff-hero + * { margin-top: var(--wp--preset--spacing--80) !important; }

/* A band that opens the page sits flush under the header. */
.wp-site-blocks > main:has(> .ff-band:first-child) { margin-block-start: 0; }
.ff-bands .wp-site-blocks > main > .ff-band:first-child { margin-block-start: 0; }

/* Articles keep one left edge: text, headings and quotes share the reading column. */
.ff-article > p,
.ff-article > ul,
.ff-article > ol { max-width: var(--wp--style--global--content-size); }
main > .ff-lede { max-width: var(--wp--style--global--content-size); }
