/*
  Festival Framework: maps theme.json tokens onto Festival Core's --fc-*
  properties, plus the few base styles theme.json can't express.

  The agnosticism rule from the prototype holds: a style variation changes
  tokens only. Nothing in here names a colour, font or radius directly.
*/

body,
.editor-styles-wrapper {
	--fc-ink: var(--wp--preset--color--ink);
	--fc-ink-2: var(--wp--preset--color--ink-2);
	--fc-ink-3: var(--wp--preset--color--ink-3);
	--fc-rule: var(--wp--preset--color--rule);
	--fc-rule-2: var(--wp--preset--color--rule-2);
	--fc-paper: var(--wp--preset--color--paper);
	--fc-paper-2: var(--wp--preset--color--paper-2);
	--fc-accent: var(--wp--preset--color--accent);
	--fc-accent-ink: var(--wp--preset--color--accent-ink);
	--fc-warn: var(--wp--preset--color--warn);
	--fc-off: var(--wp--preset--color--off);

	--fc-display: var(--wp--preset--font-family--display);
	--fc-ui: var(--wp--preset--font-family--ui);
	--fc-display-weight: var(--wp--custom--display--weight);
	--fc-display-style: var(--wp--custom--display--style);
	--fc-display-case: var(--wp--custom--display--case);
	--fc-display-tracking: var(--wp--custom--display--tracking);
	--fc-display-leading: var(--wp--custom--display--leading);

	--fc-radius: var(--wp--custom--radius);
	--fc-pill-radius: var(--wp--custom--pill-radius);
	--fc-poster-ratio: var(--wp--custom--poster-ratio);
	--fc-dur: var(--wp--custom--motion--duration);
	--fc-ease: var(--wp--custom--motion--ease);
	--fc-lift: var(--wp--custom--motion--lift);
	--fc-toast-bg: var(--wp--preset--color--ink);
	--fc-toast-ink: var(--wp--preset--color--paper);

	--fc-t-xs: var(--wp--preset--font-size--xs);
	--fc-t-sm: var(--wp--preset--font-size--sm);
	--fc-t-md: var(--wp--preset--font-size--md);
	--fc-t-lg: var(--wp--preset--font-size--lg);
	--fc-t-xl: var(--wp--preset--font-size--xl);
	--fc-t-2xl: var(--wp--preset--font-size--xxl);

	--fc-s-1: var(--wp--preset--spacing--10);
	--fc-s-2: var(--wp--preset--spacing--20);
	--fc-s-3: var(--wp--preset--spacing--30);
	--fc-s-4: var(--wp--preset--spacing--40);
	--fc-s-5: var(--wp--preset--spacing--50);
	--fc-s-6: var(--wp--preset--spacing--60);
	--fc-s-7: var(--wp--preset--spacing--70);

	font-synthesis-weight: none;
	-webkit-font-smoothing: antialiased;
}

/* ── base ─────────────────────────────────────────────────────────────── */

a { text-underline-offset: 0.18em; text-decoration-thickness: 1px; }

:focus-visible {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 3px;
	border-radius: 2px;
}

::selection { background: var(--wp--preset--color--accent); color: var(--wp--preset--color--accent-ink); }

h1, h2, h3, h4 { text-wrap: balance; }

.wp-block-post-content p,
.fc-content p { max-width: 38rem; }

.fc-content > p:first-child { font-size: var(--wp--preset--font-size--md); color: var(--wp--preset--color--ink-2); }

.fc-lede { color: var(--wp--preset--color--ink-2); font-size: var(--wp--preset--font-size--md); }

/* ── masthead ─────────────────────────────────────────────────────────── */

.ff-masthead {
	position: sticky;
	top: 0;
	z-index: 20;
	background: var(--wp--preset--color--paper);
	border-bottom: 1px solid var(--wp--preset--color--rule);
}
.admin-bar .ff-masthead { top: var(--wp-admin--admin-bar--height, 32px); }
@media (max-width: 600px) { .admin-bar .ff-masthead { top: 0; } }

.ff-masthead .wp-block-site-title a { text-decoration: none; }
.ff-masthead .wp-block-navigation a { color: var(--wp--preset--color--ink-2); text-decoration: none; }
.ff-masthead .wp-block-navigation a:hover,
.ff-masthead .wp-block-navigation .current-menu-item a { color: var(--wp--preset--color--ink); }
.ff-masthead .wp-block-navigation .current-menu-item a { box-shadow: 0 1px 0 currentColor; }

/* Phone menu. WordPress opens it as a white sheet with black text; make it a
   page of this site instead: the site's background, its heading face, and
   links large enough to tap. */
.ff-masthead .wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open {
	background-color: var(--wp--preset--color--paper);
	color: var(--wp--preset--color--ink);
	padding: var(--wp--preset--spacing--40) var(--wp--style--root--padding-right, 1.25rem) var(--wp--preset--spacing--60) var(--wp--style--root--padding-left, 1.25rem);
}
.ff-masthead .is-menu-open .wp-block-navigation__responsive-container-content {
	align-items: stretch;
	padding-top: var(--wp--preset--spacing--70);
}
.ff-masthead .is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container {
	align-items: stretch;
	gap: 0;
	width: 100%;
}
.ff-masthead .is-menu-open .wp-block-navigation__container > .wp-block-navigation-item {
	align-items: stretch;
	border-bottom: 1px solid color-mix(in srgb, currentColor 22%, transparent);
}
.ff-masthead .is-menu-open .wp-block-navigation__container > .wp-block-navigation-item:first-child {
	border-top: 1px solid color-mix(in srgb, currentColor 22%, transparent);
}
.ff-masthead .wp-block-navigation .is-menu-open .wp-block-navigation-item__content {
	display: block;
	width: 100%;
	padding: 0.5em 0;
	color: inherit;
	font-family: var(--wp--preset--font-family--display);
	font-size: clamp(1.875rem, 9vw, 2.5rem);
	line-height: 1.1;
	box-shadow: none;
}
.ff-masthead .wp-block-navigation .is-menu-open .current-menu-item > .wp-block-navigation-item__content {
	font-style: italic;
}
.ff-masthead .wp-block-navigation__responsive-container-open,
.ff-masthead .wp-block-navigation__responsive-container-close {
	color: inherit;
	min-width: 44px;
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
@media (min-width: 600px) {
	.ff-masthead .wp-block-navigation__responsive-container-open:not(.always-shown) { display: none; }
}

/* ── footer ───────────────────────────────────────────────────────────── */

.ff-footer {
	border-top: 1px solid var(--wp--preset--color--rule);
	color: var(--wp--preset--color--ink-3);
	font-size: var(--wp--preset--font-size--sm);
}
.ff-footer a { color: var(--wp--preset--color--ink-2); }
.ff-footer .wp-block-site-title { font-size: var(--wp--preset--font-size--lg); color: var(--wp--preset--color--ink); }
.ff-browse { gap: var(--wp--preset--spacing--50) !important; }
.ff-browse a { text-decoration: none; }
.ff-browse a:hover { text-decoration: underline; }
.ff-pages { list-style: none; padding: 0; margin: var(--wp--preset--spacing--40) 0 0; display: flex; flex-wrap: wrap; gap: var(--wp--preset--spacing--20) var(--wp--preset--spacing--50); }
.ff-pages a { text-decoration: none; }
.ff-pages a:hover { text-decoration: underline; }
/* The page that only exists to be the front page has nothing to link to. */
.ff-pages .menu-item-home { display: none; }

/* ── festival pages ───────────────────────────────────────────────────── */

.fc-title { margin-top: 0; }

/* Film page: poster sticks beside the details on wide screens. */
@media (min-width: 782px) {
	.single-fc_film .wp-block-column:first-child .wp-block-festival-poster,
	.single-fc_person .wp-block-column:first-child .wp-block-festival-poster {
		position: sticky;
		top: 6rem;
	}
}

/* Section rhythm on the long pages. */
.fc-main > .wp-block-festival-film-sessions,
.fc-main > .wp-block-festival-film-package,
.fc-main > .wp-block-festival-film-credits,
.fc-main > .wp-block-festival-person-films {
	margin-top: var(--wp--preset--spacing--80);
}

/* The festival's own name on the home page carries the display face at full size. */
.fc-intro__name { font-size: var(--wp--preset--font-size--hero); }

/* Undertow and other dark styles: posters need a lighter edge. */
.fc-poster { border-color: var(--wp--preset--color--rule); }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; animation: none !important; }
}

/* My festival link sits with the navigation. */
.ff-masthead .fc-my-link { font-size: var(--wp--preset--font-size--sm); color: var(--wp--preset--color--ink); font-weight: 500; }

/* ── Logo (Appearance → Brand) ─────────────────────────────────────────── */
.ff-brandmark { gap: 12px; }
.ff-brandmark .wp-block-site-logo { line-height: 0; }
.ff-brandmark .wp-block-site-logo img,
.ff-brandmark .ff-preview-logo {
	height: var(--wp--custom--logo-height, 40px) !important;
	max-height: none;
	width: auto !important;
	display: block;
}
.ff-footer .ff-brandmark .wp-block-site-logo img,
.ff-footer .ff-brandmark .ff-preview-logo { height: calc(var(--wp--custom--logo-height, 40px) * 1.2) !important; }
/* With a logo, the name stays for screen readers and search engines only. */
.ff-brandmark .wp-block-site-logo:not(:empty) + .wp-block-site-title:not(.ff-no-logo),
.ff-brandmark .wp-block-site-title.ff-has-logo {
	position: absolute !important;
	width: 1px; height: 1px; margin: -1px; padding: 0;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
