/*
Theme Name: FolkQuiz
Theme URI: https://folkquiz.com
Description: A simple, mobile-first theme for The Big Folk Quiz, in FolkCalendar's colours and type. The quiz itself comes from the Folk Quiz plugin's shortcodes; this theme supplies the page around it and hands the plugin its palette.
Version: 0.1.1
Requires at least: 6.4
Requires PHP: 8.1
Author: FolkQuiz
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: folkquiz-theme
*/

/* ==========================================================================
   1. Design tokens
   FolkCalendar's palette, so the two sites read as siblings. The quiz card's
   own tokens (--fq-*) live in assets/folkquiz.css, which the plugin prints.
   ========================================================================== */

:root {
	/* Surfaces and text */
	--site-bg: #f7f1e3;          /* page: warm cream */
	--site-surface: #fffdf8;     /* cards */
	--site-ink: #2a221b;         /* body text */
	--site-muted: #6b5f52;       /* secondary text */
	--site-line: #e3d8c2;        /* hairlines: decorative */
	--site-control-line: #8f7f66; /* the edge of a control: 3:1 against the page */

	/* Focus follows the mode: green on cream, amber on the dark palette. */
	--site-focus: #24513a;

	/* Brand */
	--site-primary: #24513a;     /* bottle green: header */
	--site-on-primary: #f7f1e3;
	--site-link: #24513a;
	--site-tint: #e2eee4;
	--site-on-tint: #1b3d2b;

	/* Accent: buttons */
	--site-accent: #e8a936;      /* harvest amber */
	--site-accent-hover: #d99a2b;
	--site-on-accent: #2a221b;

	--site-chip: #f0e8d4;

	/* Shape and type */
	--site-radius: 14px;
	--site-gap: 16px;
	--site-wrap: 44rem;
	--site-shadow: 0 1px 2px rgba(42, 34, 27, 0.06);
	--site-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
	--site-font-display: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
}

@media (prefers-color-scheme: dark) {
	:root {
		--site-bg: #16130f;
		--site-surface: #211d17;
		--site-ink: #f0e8d8;
		--site-muted: #b8ac96;
		--site-line: #3a3226;
		--site-control-line: #7f7463;
		--site-focus: #e8a936;
		--site-primary: #1c3f2c;
		--site-on-primary: #f0e8d8;
		--site-link: #93c9a4;
		--site-tint: #24392b;
		--site-on-tint: #d5ecdb;
		--site-chip: #2c261d;
		--site-shadow: none;
	}
}

/* ==========================================================================
   2. Base
   ========================================================================== */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--site-bg);
	color: var(--site-ink);
	font: 1rem/1.55 var(--site-font);
}

img,
svg,
video {
	max-width: 100%;
	height: auto;
}

a {
	color: var(--site-link);
}

a:focus-visible,
summary:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
	outline: 3px solid var(--site-focus);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}

h1,
h2,
h3 {
	margin: 0 0 0.5em;
	font-family: var(--site-font-display);
	line-height: 1.2;
}

h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }

p { margin: 0 0 1em; }

.wrap {
	width: 100%;
	max-width: var(--site-wrap);
	margin-inline: auto;
	padding-inline: var(--site-gap);
}

.site-main {
	padding-block: 24px 40px;
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.skip-link:focus {
	position: fixed;
	top: 8px;
	left: 8px;
	z-index: 100;
	width: auto;
	height: auto;
	margin: 0;
	padding: 12px 16px;
	clip-path: none;
	background: var(--site-accent);
	color: var(--site-on-accent);
	font-weight: 700;
}

/* ==========================================================================
   3. Header
   ========================================================================== */

.site-header {
	background: var(--site-primary);
	color: var(--site-on-primary);

	/* The green ring is invisible against the green bar it would sit on. */
	--site-focus: var(--site-on-primary);
}

.site-header__bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0 12px;
	width: 100%;
	max-width: 72rem;
	margin-inline: auto;
	padding: 8px var(--site-gap);
}

.site-brand {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	min-width: 0;
	color: inherit;
	font-family: var(--site-font-display);
	font-size: 1.4rem;
	font-weight: 700;
	text-decoration: none;
	white-space: nowrap;
}

.custom-logo {
	max-height: 40px;
	width: auto;
}

/* "Your account", or "Sign in". Stays on the brand's row at every width. */
.site-account {
	display: inline-flex;
	align-items: center;
	flex: none;
	min-height: 44px;
	padding: 0 14px;
	border: 2px solid currentcolor;
	border-radius: 999px;
	color: inherit;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}

.site-account:hover {
	background: rgba(255, 255, 255, 0.16);
}

@media (max-width: 26rem) {
	.site-brand {
		font-size: 1.15rem;
	}

	.site-account {
		padding: 0 12px;
		font-size: 0.9375rem;
	}

	/* The three bars say "menu" on their own; still read out. */
	.site-nav__toggle-label {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}
}

/* --------------------------------------------------------------------------
   Main menu. assets/nav.js adds the Menu button's behaviour and a button
   beside each item with a second level; without it the menu shows, open.
   -------------------------------------------------------------------------- */

.site-brand,
.custom-logo-link {
	order: 1;
	margin-right: auto;
}

.site-account {
	order: 2;
}

.site-nav__toggle {
	display: none;
	order: 3;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 0 12px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: inherit;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.site-nav__toggle:hover {
	background: rgba(255, 255, 255, 0.12);
}

.site-nav__bars,
.site-nav__bars::before,
.site-nav__bars::after {
	display: block;
	width: 20px;
	height: 2px;
	border-radius: 2px;
	background: currentcolor;
}

.site-nav__bars {
	position: relative;
}

.site-nav__bars::before,
.site-nav__bars::after {
	content: "";
	position: absolute;
	left: 0;
}

.site-nav__bars::before {
	top: -6px;
}

.site-nav__bars::after {
	top: 6px;
}

.site-nav__toggle[aria-expanded="true"] .site-nav__bars {
	background: transparent;
}

.site-nav__toggle[aria-expanded="true"] .site-nav__bars::before {
	top: 0;
	transform: rotate(45deg);
}

.site-nav__toggle[aria-expanded="true"] .site-nav__bars::after {
	top: 0;
	transform: rotate(-45deg);
}

.site-nav {
	order: 4;
	flex-basis: 100%;
}

.site-nav__menu,
.site-nav .sub-menu,
.site-nav .children {
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-nav__menu {
	display: flex;
	flex-wrap: wrap;
	gap: 0 2px;
}

.site-nav li {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
}

.site-nav a {
	display: flex;
	align-items: center;
	min-height: 44px;
	padding: 0 12px;
	border-radius: 8px;
	color: inherit;
	font-weight: 600;
	text-decoration: none;
}

.site-nav a:hover {
	background: rgba(255, 255, 255, 0.12);
}

.site-nav .current-menu-item > a,
.site-nav .current-menu-ancestor > a,
.site-nav .current_page_item > a {
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 6px;
}

.site-nav__sub-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	min-height: 44px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: inherit;
	cursor: pointer;
}

.site-nav__sub-toggle:hover {
	background: rgba(255, 255, 255, 0.12);
}

.site-nav__chevron {
	width: 8px;
	height: 8px;
	margin-top: -4px;
	border-right: 2px solid currentcolor;
	border-bottom: 2px solid currentcolor;
	transform: rotate(45deg);
}

.site-nav__sub-toggle[aria-expanded="true"] .site-nav__chevron {
	margin-top: 4px;
	transform: rotate(-135deg);
}

/* Narrow screens: the menu is a panel under the bar, one item per row. */
@media (max-width: 47.99rem) {
	.js .site-nav__toggle {
		display: inline-flex;
	}

	.js .site-nav {
		display: none;
	}

	.js .site-nav.is-open {
		display: block;
	}

	.site-nav__menu {
		flex-direction: column;
		margin-top: 8px;
		padding-block: 8px;
		border-top: 1px solid rgba(255, 255, 255, 0.2);
	}

	.site-nav li {
		width: 100%;
	}

	.site-nav a {
		flex: 1;
	}

	.site-nav .sub-menu,
	.site-nav .children {
		width: 100%;
		padding-left: 16px;
	}

	.js .site-nav .sub-menu,
	.js .site-nav .children {
		display: none;
	}

	.js .site-nav .is-open > .sub-menu,
	.js .site-nav .is-open > .children {
		display: block;
	}
}

/* Wide screens: brand, menu, account in a row; a second level drops down. */
@media (min-width: 48rem) {
	.site-header__bar {
		flex-wrap: nowrap;
	}

	.site-brand,
	.custom-logo-link {
		margin-right: 12px;
	}

	.site-nav {
		order: 2;
		flex: 1 1 auto;
	}

	.site-account {
		order: 3;
	}

	.site-nav__sub-toggle {
		width: 28px;
		margin-left: -8px;
	}

	.site-nav .sub-menu,
	.site-nav .children {
		display: none;
		position: absolute;
		top: 100%;
		left: 0;
		z-index: 20;
		min-width: 14rem;
		padding: 6px;
		border: 1px solid var(--site-line);
		border-radius: 10px;
		background: var(--site-surface);
		box-shadow: 0 8px 24px rgba(42, 34, 27, 0.16);
		color: var(--site-ink);

		/* The header's pale ring would vanish on the pale panel. */
		--site-focus: var(--site-link);
	}

	.site-nav li:hover > .sub-menu,
	.site-nav li:focus-within > .sub-menu,
	.site-nav li.is-open > .sub-menu,
	.site-nav li:hover > .children,
	.site-nav li:focus-within > .children,
	.site-nav li.is-open > .children {
		display: block;
	}

	.site-nav .sub-menu li,
	.site-nav .children li {
		width: 100%;
	}

	.site-nav .sub-menu a,
	.site-nav .children a {
		flex: 1;
		font-weight: 500;
		white-space: nowrap;
	}

	.site-nav .sub-menu a:hover,
	.site-nav .children a:hover {
		background: var(--site-tint);
		color: var(--site-on-tint);
	}
}

@media (prefers-reduced-motion: no-preference) {
	.site-nav__bars::before,
	.site-nav__bars::after,
	.site-nav__chevron {
		transition: transform 0.15s ease, top 0.15s ease, margin 0.15s ease;
	}
}

/* ==========================================================================
   4. Footer
   ========================================================================== */

.site-footer {
	padding-block: 24px 40px;
	border-top: 1px solid var(--site-line);
	color: var(--site-muted);
	font-size: 0.9rem;
}

.site-footer ul {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 16px;
	margin: 0 0 12px;
	padding: 0;
	list-style: none;
}

.site-footer a {
	color: inherit;
}

.site-footer p {
	margin: 0;
}

/* Facebook, X and Instagram: icons only, each a 44px tap target. */
.site-footer .site-footer__social {
	gap: 4px;
	margin: 0 0 8px -12px;
}

.site-footer__social a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
}

.site-footer__social a:hover,
.site-footer__social a:focus-visible {
	color: var(--site-ink);
	background: var(--site-chip);
}

/* Folk Calendar, the sister site: its mark and name, as in its own header. */
.site-footer .site-footer__sister {
	margin: 0 0 16px;
}

.site-footer__sister a {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	color: var(--site-link);
	text-decoration: none;
}

.site-footer__sister-name {
	display: block;
	font-family: var(--site-font-display);
	font-size: 1.15rem;
	font-weight: 700;
	line-height: 1.2;
}

.site-footer__sister-line {
	display: block;
	color: var(--site-muted);
	font-size: 0.85rem;
}

.site-footer__sister a:hover .site-footer__sister-name {
	text-decoration: underline;
}

/* A stencil painted in the link's colour; hidden where masks are not
   supported rather than showing as a solid square. */
.site-footer__sister-mark {
	display: none;
}

@supports (mask-image: url("x.png")) or (-webkit-mask-image: url("x.png")) {
	.site-footer__sister-mark {
		display: block;
		flex: none;
		width: 38px;
		height: 38px;
		background: currentcolor;
		-webkit-mask: url("assets/img/folkcalendar-mark.png") center / contain no-repeat;
		mask: url("assets/img/folkcalendar-mark.png") center / contain no-repeat;
	}
}

.site-footer .site-footer__legal {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 16px;
	margin-bottom: 8px;
}

/* ==========================================================================
   5. Shared components
   ========================================================================== */

.eyebrow {
	margin: 0 0 4px;
	color: var(--site-muted);
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.lede {
	color: var(--site-muted);
	font-size: 1.05rem;
}

.panel {
	margin: 0 0 var(--site-gap);
	padding: var(--site-gap);
	background: var(--site-surface);
	border: 1px solid var(--site-line);
	border-radius: var(--site-radius);
	box-shadow: var(--site-shadow);
}

.panel > :last-child {
	margin-bottom: 0;
}

.panel h2 {
	font-size: 1.15rem;
}

.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 0 22px;
	border: 2px solid var(--site-accent);
	border-radius: 999px;
	background: var(--site-accent);
	color: var(--site-on-accent);
	font: inherit;
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
}

.button:hover {
	border-color: var(--site-accent-hover);
	background: var(--site-accent-hover);
}

.button--ghost,
.button--ghost:hover {
	background: transparent;
	color: var(--site-link);
	border-color: currentcolor;
}

.button-row {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: var(--site-gap) 0;
}

.button-row .button {
	flex: 1 1 9rem;
}

.empty {
	padding: 24px 0;
	color: var(--site-muted);
	text-align: center;
}

/* ==========================================================================
   6. Page content
   ========================================================================== */

.entry-content > :last-child {
	margin-bottom: 0;
}

/* wpautop leaves an empty paragraph where a Divi wrapper or a shortcode's
   own paragraph used to be (inc/divi-legacy.php). */
.entry-content p:empty {
	display: none;
}

.entry-image {
	display: block;
	margin: 0 0 var(--site-gap);
	border-radius: var(--site-radius);
}

.nav-links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: var(--site-gap) 0;
}

/* ==========================================================================
   7. The quiz on the site's pages
   The card's palette and components are in assets/folkquiz.css, which the
   plugin prints wherever the quiz appears. These are only about how the quiz
   sits in this theme's page: the column is the ground, so the wrapper stays
   out of the way. `.site-main` because the plugin's own rules print later
   and would win a tie.
   ========================================================================== */

.site-main .folkquiz-app {
	padding: 0;
	background: transparent;
	color: inherit;
}

.site-main .fq-card {
	max-width: none;
}

/* ==========================================================================
   8. The consent banner (folk-quiz-consent)
   The plugin ships its own palette so it stands on its own; here it is
   handed the site's, as FolkCalendar's banner is. `body` because the
   plugin's <style> prints in the footer, after this sheet.
   ========================================================================== */

body #folkquiz-consent-banner {
	background: var(--site-surface);
	color: var(--site-ink);
	border: 1px solid var(--site-line);
	border-radius: var(--site-radius);
	box-shadow: 0 8px 24px rgba(42, 34, 27, 0.18);
	font-family: var(--site-font);
}

body #folkquiz-consent-banner .folkquiz-consent-actions {
	gap: 10px;
}

body #folkquiz-consent-banner button {
	flex: 1 1 9rem;
	min-height: 44px;
	border: 2px solid var(--site-accent);
	border-radius: 999px;
	font-weight: 700;
}

body #folkquiz-consent-accept {
	background: var(--site-accent);
	color: var(--site-on-accent);
}

body #folkquiz-consent-accept:hover {
	border-color: var(--site-accent-hover);
	background: var(--site-accent-hover);
}

body #folkquiz-consent-decline,
body #folkquiz-consent-decline:hover {
	border-color: currentcolor;
	background: transparent;
	color: var(--site-link);
}

body #folkquiz-consent-settings-link {
	background: var(--site-primary);
	color: var(--site-on-primary);
	font-family: var(--site-font);
	border-radius: 999px;
	padding: 0.25rem 0.7rem;
}

/* ==========================================================================
   9. Larger screens
   ========================================================================== */

@media (min-width: 40rem) {
	h1 { font-size: 2.3rem; }

	.site-main {
		padding-block: 32px 48px;
	}

	.button-row .button {
		flex: 0 1 auto;
	}
}
