/*
Theme Name: LinguaLeaf
Theme URI: https://lingualeaf.local/
Author: Tom
Description: Block theme for LinguaLeaf, with English and Spanish teaching materials, filterable by level, grammar, topic and exam, and interactive classroom games.
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: lingualeaf
*/

/* ---------- Basics ---------- */
:root {
	--ll-slate: var(--wp--preset--color--slate);
	--ll-sage: var(--wp--preset--color--sage);
	--ll-leaf: var(--wp--preset--color--leaf);
	--ll-leaf-dark: var(--wp--preset--color--leaf-dark);
	--ll-line: var(--wp--preset--color--line);
	--ll-moss: var(--wp--preset--color--moss);
	--ll-muted: var(--wp--preset--color--muted);
	--ll-radius: 16px;
}

:where(.wp-site-blocks) > * { margin-block-start: 0; }
.wp-site-blocks > main { margin-block-start: 0; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
	outline: 3px solid var(--ll-leaf);
	outline-offset: 2px;
}

.ll-eyebrow {
	margin-bottom: 0.5rem !important;
	font-size: 0.875rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--ll-leaf-dark);
}
.has-slate-background-color .ll-eyebrow { color: var(--ll-leaf); }

.ll-section { padding-block: clamp(3.5rem, 7vw, 5.5rem); }
.ll-section > * + * { margin-block-start: 0; }
.ll-section h2 { margin-block: 0 2rem; }

/* ---------- Header ---------- */
.ll-header { padding-block: 0.75rem; border-bottom: 1px solid #2B3D44; }
.ll-header .wp-block-site-title a { color: var(--ll-sage); text-decoration: none; }
.ll-header .wp-block-navigation a { color: var(--ll-sage); text-decoration: none; }
.ll-header .wp-block-navigation a:hover { color: #fff; }
.ll-header .wp-block-navigation__container { gap: 1.75rem; }
.ll-header .wp-block-search__button {
	width: 44px; height: 44px; padding: 0; border-radius: 22px;
	background: transparent; color: var(--ll-sage); border: 1px solid #3A4F57;
}
.ll-header .wp-block-search__button:hover { color: #fff; background: transparent; }
.ll-header .wp-block-search__button svg { fill: currentColor; }
.ll-header .wp-block-search__input { border-radius: 22px; }

/* ---------- Hero ---------- */
.ll-hero { padding-block: 1.5rem 5rem; text-align: center; }
.ll-hero .ll-hero__logo { margin-block: 0 0.5rem; }
.ll-hero .ll-hero__logo img { width: 476px; max-width: 100%; height: auto; }
.ll-hero .ll-hero__tagline { max-width: 640px; margin-inline: auto; font-size: var(--wp--preset--font-size--large); line-height: 1.55; }
.ll-hero .wp-block-buttons { margin-top: 2rem; }
.ll-hero .is-style-outline .wp-block-button__link {
	background: transparent; color: var(--ll-sage); border: 1.5px solid var(--ll-sage);
}
.ll-hero .is-style-outline .wp-block-button__link:hover { background: var(--ll-sage); color: var(--ll-slate); }

/* ---------- Finder (search + filters) ---------- */
.ll-finder-wrap { position: relative; z-index: 2; }
.ll-finder-wrap.is-overlap { margin-top: -2.5rem !important; }
.ll-finder {
	background: #fff; border: 1px solid var(--ll-line); border-radius: var(--ll-radius);
	padding: 1.5rem; box-shadow: 0 12px 32px rgba(26, 39, 44, 0.10);
}
.ll-finder h2 { margin: 0 0 1rem; font-size: 1.375rem; }
.ll-finder form { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
.ll-finder .ll-field { display: flex; flex-direction: column; gap: 0.375rem; flex: 1 1 150px; min-width: 0; }
.ll-finder .ll-field--search { flex: 2 1 240px; }
.ll-finder label { font-size: 0.875rem; font-weight: 600; color: var(--ll-muted); }
.ll-finder input,
.ll-finder select {
	height: 48px; padding: 0 0.875rem; border: 1px solid #C3CDBF; border-radius: 10px;
	background: #F7F9F5; font: inherit; font-size: 1rem; color: var(--ll-slate); width: 100%; box-sizing: border-box;
}
.ll-finder .ll-actions { display: flex; gap: 0.5rem; align-items: center; }
.ll-finder button {
	height: 48px; padding: 0 1.75rem; border: 0; border-radius: 10px; cursor: pointer;
	background: var(--ll-slate); color: #fff; font: inherit; font-weight: 700;
}
.ll-finder button:hover { background: var(--ll-leaf-dark); }
.ll-finder .ll-reset { font-size: 0.9375rem; padding: 0 0.5rem; }

/* ---------- Pathway cards ---------- */
.ll-paths { gap: 1.5rem; }
.ll-path {
	position: relative; display: flex; flex-direction: column; gap: 0.875rem;
	padding: 2rem; background: #fff; border: 1px solid var(--ll-line); border-radius: var(--ll-radius);
	transition: border-color .15s, transform .15s;
}
.ll-path:hover { border-color: #9DB59A; transform: translateY(-2px); }
.ll-path > * { margin: 0 !important; }
.ll-path h3 a { color: var(--ll-slate); text-decoration: none; }
.ll-path h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--ll-radius); }
.ll-path p { color: var(--ll-muted); }
.ll-path .ll-icon svg { display: block; }
.ll-path .ll-more { margin-top: auto !important; font-weight: 700; color: var(--ll-leaf-dark); }

.ll-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; position: relative; z-index: 1; }
.ll-chips a {
	display: inline-flex; align-items: center; min-height: 36px; padding: 0 0.875rem;
	border-radius: 999px; background: var(--ll-moss); color: var(--ll-slate);
	font-size: 0.875rem; font-weight: 600; text-decoration: none;
}
.ll-chips a:hover { background: var(--ll-sage); }

/* ---------- Resource cards (query loops) ---------- */
.ll-cards { gap: 1.5rem; }
.ll-card {
	display: flex; flex-direction: column; height: 100%;
	background: #fff; border: 1px solid var(--ll-line); border-radius: 14px; overflow: hidden;
	transition: border-color .15s;
}
.ll-card:hover { border-color: #9DB59A; }
.ll-card > * { margin: 0 !important; }
.ll-card__top {
	display: flex; flex-direction: column; justify-content: space-between; gap: 1rem;
	min-height: 150px; padding: 1rem 1.25rem 1.25rem; box-sizing: border-box;
}
.ll-card__top > * { margin: 0 !important; }
.ll-card .wp-block-post-title { font-size: 1.375rem; line-height: 1.2; }
.ll-card .wp-block-post-title a { color: var(--ll-sage); text-decoration: none; }
.ll-card .wp-block-post-title a:hover { color: #fff; }
.ll-card__body { display: flex; flex-direction: column; gap: 0.625rem; flex: 1; padding: 1.25rem; }
.ll-card__body > * { margin: 0 !important; }
.ll-card .wp-block-post-excerpt { font-size: 0.9375rem; line-height: 1.55; color: var(--ll-muted); }
.ll-card .wp-block-post-excerpt__excerpt { margin: 0; }
.ll-card .ll-card__meta { margin-top: auto !important; font-size: 0.875rem; color: var(--ll-muted); }
.ll-card .ll-card__meta a { color: var(--ll-muted); }

.ll-pills { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.ll-pills .wp-block-post-terms__separator { display: none; }
.ll-pills a {
	display: inline-block; padding: 0.25rem 0.625rem; border-radius: 999px;
	background: var(--ll-leaf); color: var(--ll-slate); font-size: 0.8125rem; font-weight: 700; text-decoration: none;
}
.ll-pills--soft a { background: var(--ll-moss); }
.ll-pills a:hover { background: var(--ll-sage); color: var(--ll-slate); }

.ll-section-head { gap: 1rem; margin-bottom: 2rem; }
.ll-section-head h2 { margin: 0 !important; }
.ll-section-head > * { margin: 0 !important; }

.wp-block-query-pagination { margin-top: 3rem; gap: 0.5rem; }
.wp-block-query-pagination a,
.wp-block-query-pagination .current {
	display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px;
	padding: 0 0.75rem; border-radius: 22px; text-decoration: none;
}
.wp-block-query-pagination .current { background: var(--ll-slate); color: #fff; }

.ll-empty {
	padding: 2.5rem; border: 2px dashed #B9C6B5; border-radius: var(--ll-radius); background: var(--ll-moss); text-align: center;
}

/* ---------- Listing page with left filter bar ---------- */
.screen-reader-text {
	position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.ll-page-head h1 { margin-block: 0 0.75rem; }
.ll-page-head .ll-lede { margin: 0; max-width: 640px; }
.ll-browse { margin-top: 2.5rem !important; gap: 2.5rem; align-items: flex-start !important; }
.ll-browse__results > * + * { margin-block-start: 1.25rem; }

.ll-sidebar {
	position: sticky; top: 1.5rem;
	background: #fff; border: 1px solid var(--ll-line); border-radius: var(--ll-radius); padding: 1.25rem;
}
.admin-bar .ll-sidebar { top: calc(32px + 1.5rem); }
.ll-sidebar form { display: flex; flex-direction: column; gap: 1.5rem; }
.ll-sidebar__group { margin: 0; padding: 0; border: 0; min-width: 0; }
.ll-sidebar__group + .ll-sidebar__group { padding-top: 1.5rem; border-top: 1px solid var(--ll-line); }
.ll-sidebar__legend {
	display: block; float: left; width: 100%; padding: 0; margin-bottom: 0.75rem;
	font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ll-slate);
}
.ll-sidebar__search { display: flex; }
.ll-sidebar__search input {
	flex: 1; min-width: 0; height: 44px; padding: 0 0.75rem; border: 1px solid #C3CDBF; border-right: 0;
	border-radius: 10px 0 0 10px; background: #F7F9F5; font: inherit; font-size: 1rem;
}
.ll-sidebar__search button {
	width: 44px; height: 44px; border: 0; border-radius: 0 10px 10px 0; cursor: pointer;
	background: var(--ll-slate); color: #fff; display: flex; align-items: center; justify-content: center;
}
.ll-sidebar select {
	width: 100%; height: 44px; padding: 0 0.75rem; border: 1px solid #C3CDBF; border-radius: 10px;
	background: #F7F9F5; font: inherit; font-size: 1rem; color: var(--ll-slate);
}
.ll-sidebar__legend + * { clear: both; }
.ll-sidebar__options { display: flex; flex-direction: column; gap: 0.25rem; }
.ll-check {
	display: flex; align-items: center; gap: 0.625rem; min-height: 40px; padding: 0 0.5rem;
	border-radius: 8px; cursor: pointer; font-size: 0.9375rem;
}
.ll-check:hover { background: var(--ll-moss); }
.ll-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--ll-leaf-dark); }

/* Levels as a row of toggle tiles */
.ll-sidebar__options--levels { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.375rem; }
.ll-sidebar__options--levels .ll-check { position: relative; justify-content: center; padding: 0; min-height: 44px; border: 1px solid #C3CDBF; background: #F7F9F5; font-weight: 700; }
.ll-sidebar__options--levels .ll-check input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.ll-sidebar__options--levels .ll-check:has(input:checked) { background: var(--ll-slate); border-color: var(--ll-slate); color: #fff; }
.ll-sidebar__options--levels .ll-check:has(input:focus-visible) { outline: 3px solid var(--ll-leaf); outline-offset: 2px; }

.ll-sidebar__actions { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.ll-sidebar__apply {
	height: 44px; padding: 0 1.25rem; border: 0; border-radius: 999px; cursor: pointer;
	background: var(--ll-leaf); color: var(--ll-slate); font: inherit; font-weight: 700;
}
.ll-sidebar__apply:hover { background: var(--ll-slate); color: #fff; }
.ll-sidebar__actions a { font-size: 0.9375rem; font-weight: 600; }

.ll-results { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; }
.ll-results__count { margin: 0; font-weight: 700; }
.ll-results__chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.ll-results__chips a {
	display: inline-flex; align-items: center; gap: 0.375rem; min-height: 32px; padding: 0 0.75rem;
	border-radius: 999px; background: var(--ll-moss); color: var(--ll-slate); font-size: 0.875rem; font-weight: 600; text-decoration: none;
}
.ll-results__chips a:hover { background: var(--ll-sage); }
.ll-browse__results .wp-block-query { margin-top: 1.25rem; }

@media (max-width: 781px) {
	.ll-browse__filters { flex-basis: 100% !important; }
	.ll-sidebar { position: static; }
}

/* ---------- Interactive band ---------- */
.ll-interactive h2 { color: #fff; margin-bottom: 1rem !important; }
.ll-interactive .wp-block-columns { gap: 3rem; align-items: center; }
.ll-games { gap: 1rem; }
.ll-game {
	position: relative; display: flex; flex-direction: column; gap: 0.75rem; padding: 1.5rem;
	border-radius: 14px; background: var(--wp--preset--color--slate-2); border: 1px solid #2F454C;
	transition: border-color .15s;
}
.ll-game:hover { border-color: var(--ll-sage); }
.ll-game > * { margin: 0 !important; }
.ll-game h3 { font-size: 1.25rem; }
.ll-game h3 a { color: #fff; text-decoration: none; }
.ll-game h3 a::after { content: ""; position: absolute; inset: 0; }
.ll-game p { font-size: 0.875rem; }
.ll-interactive .is-style-outline .wp-block-button__link { background: transparent; color: var(--ll-sage); border: 1.5px solid var(--ll-sage); }
.ll-interactive .is-style-outline .wp-block-button__link:hover { background: var(--ll-sage); color: var(--ll-slate); }

/* ---------- About ---------- */
.ll-about .wp-block-columns { gap: 3rem; align-items: center; }
.ll-photo-placeholder {
	aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center;
	border: 2px dashed #B9C6B5; border-radius: var(--ll-radius); background: var(--ll-moss); color: var(--ll-muted);
}
.ll-about img { border-radius: var(--ll-radius); }
.ll-about p { font-size: 1.125rem; line-height: 1.65; color: #33433F; }

/* ---------- Single resource ---------- */
.ll-single { padding-block: 3rem 5rem; }
.ll-single .wp-block-post-title { margin-top: 0.75rem; }
.ll-lede { font-size: var(--wp--preset--font-size--large); color: var(--ll-muted); }
.ll-meta { font-size: 0.9375rem; color: var(--ll-muted); }
.ll-meta .wp-block-post-terms__prefix { font-weight: 700; color: var(--ll-slate); }
.ll-single .wp-block-file {
	display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem;
	padding: 1rem 1.25rem; background: #fff; border: 1px solid var(--ll-line); border-radius: 12px;
}
.ll-single .wp-block-file .wp-block-file__button {
	background: var(--ll-leaf); color: var(--ll-slate); border-radius: 999px; padding: 0.6rem 1.25rem; font-weight: 700;
}
.ll-single .wp-block-file .wp-block-file__button:hover { background: var(--ll-slate); color: #fff; }

/* ---------- Downloads box ---------- */
.ll-downloads {
	margin-block: 2rem 2.5rem !important; background: #fff; border: 1px solid var(--ll-line);
	border-radius: var(--ll-radius); overflow: hidden;
}
.ll-downloads__head {
	display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem;
	padding: 1.25rem 1.5rem; background: var(--ll-slate); color: var(--ll-sage);
}
.ll-downloads__head h2 { margin: 0; font-size: 1.5rem; color: #fff; }
.ll-downloads__head p { margin: 0.125rem 0 0; font-size: 0.9375rem; }
.ll-downloads__pack {
	display: inline-flex; align-items: center; gap: 0.5rem; min-height: 48px; padding: 0 1.4rem;
	border-radius: 999px; background: var(--ll-leaf); color: var(--ll-slate); font-weight: 700; text-decoration: none;
}
.ll-downloads__pack:hover { background: #fff; color: var(--ll-slate); }
.ll-downloads__pack small { font-weight: 500; font-size: 0.875rem; }
.ll-downloads__list { list-style: none; margin: 0; padding: 0; }
.ll-file {
	display: flex; align-items: center; gap: 1rem; padding: 1.125rem 1.5rem;
}
.ll-file + .ll-file { border-top: 1px solid var(--ll-line); }
.ll-file__badge {
	flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
	width: 52px; height: 60px; border-radius: 6px 14px 6px 6px; color: #fff;
	font-size: 0.75rem; font-weight: 800; letter-spacing: 0.04em;
}
.ll-file__text { flex: 1; min-width: 0; }
.ll-file__text h3 { margin: 0 0 0.25rem; font-family: var(--wp--preset--font-family--figtree); font-size: 1.0625rem; font-weight: 700; }
.ll-file__text p { margin: 0; font-size: 0.9375rem; line-height: 1.5; color: var(--ll-muted); }
.ll-file__text .ll-file__meta { margin-top: 0.25rem; font-size: 0.8125rem; font-weight: 600; }
.ll-file__button,
.ll-downloads__pack { box-sizing: border-box; }
.ll-file__button {
	flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 44px; padding: 0 1.1rem;
	border: 1.5px solid var(--ll-slate); border-radius: 999px; color: var(--ll-slate); font-weight: 700; text-decoration: none;
}
.ll-file__button:hover { background: var(--ll-slate); color: #fff; }
@media (max-width: 600px) {
	.ll-file { flex-wrap: wrap; padding: 1rem 1.125rem; }
	.ll-file__button { width: 100%; justify-content: center; }
	.ll-downloads__pack { width: 100%; justify-content: center; }
}

/* ---------- Embedded games ---------- */
.ll-game-embed { margin-block: 2rem; }
.ll-game-embed__frame {
	width: 100%; border: 1px solid var(--ll-line); border-radius: 14px; background: #fff; display: block;
}
.ll-game-embed__bar { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 0.5rem; font-size: 0.9375rem; }

/* Play box on a material's page (game in a frame that grows to fit it) */
.ll-play {
	margin-block: 2rem 2.5rem !important; background: #fff; border: 1px solid var(--ll-line);
	border-radius: var(--ll-radius); overflow: hidden;
}
.ll-play__head {
	display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem;
	padding: 1.25rem 1.5rem; background: var(--ll-slate); color: var(--ll-sage);
}
.ll-play__head h2 { margin: 0; font-size: 1.5rem; color: #fff; }
.ll-play__head p { margin: 0.125rem 0 0; font-size: 0.9375rem; }
.ll-play__full {
	display: inline-flex; align-items: center; gap: 0.5rem; min-height: 48px; padding: 0 1.4rem; box-sizing: border-box;
	border-radius: 999px; background: var(--ll-leaf); color: var(--ll-slate); font-weight: 700; text-decoration: none;
}
.ll-play__full:hover { background: #fff; color: var(--ll-slate); }
.ll-play .ll-game-embed__frame { border: 0; border-radius: 0; min-height: 320px; }
.ll-play__locked {
	display: flex; align-items: center; justify-content: center; gap: 0.5rem; margin: 0; padding: 3rem 1.5rem;
	color: var(--ll-muted); font-weight: 600; background: #F6F8F5;
}
@media (max-width: 600px) {
	.ll-play__full { width: 100%; justify-content: center; }
}

/* ---------- Footer ---------- */
.ll-footer { padding-block: 4rem 2rem; }
.ll-footer a { color: var(--ll-sage); text-decoration: none; }
.ll-footer a:hover { color: #fff; text-decoration: underline; }
.ll-footer .wp-block-site-title a { font-size: 1.75rem; }
.ll-footer h2 { font-family: var(--wp--preset--font-family--figtree); font-size: 1rem; font-weight: 700; color: #fff; margin-bottom: 0.75rem; }
.ll-footer .wp-block-list { list-style: none; padding: 0; margin: 0; }
.ll-footer .wp-block-list li { margin-bottom: 0.5rem; }
.ll-footer__bottom { margin-top: 3rem !important; padding-top: 1.5rem; border-top: 1px solid #2B3D44; font-size: 0.875rem; }

@media (max-width: 781px) {
	.ll-hero { padding-bottom: 4rem; }
	.ll-finder { padding: 1.25rem; }
	.ll-finder .ll-actions { width: 100%; }
	.ll-finder button { flex: 1; }
}

.ll-paths { margin-top: 2rem !important; }

/* ---------- Price labels and locked downloads ---------- */
.ll-card__tags { gap: 0.5rem; }
.ll-card__tags > * { margin: 0 !important; }
.ll-price {
	display: inline-block; padding: 0.25rem 0.625rem; border-radius: 999px;
	font-size: 0.8125rem; font-weight: 700; line-height: 1.4; white-space: nowrap;
}
.ll-price--free { background: var(--ll-moss); color: var(--ll-slate); }
.ll-price--paid { background: var(--wp--preset--color--gold); color: var(--ll-slate); }
.ll-downloads__soon { font-size: 0.9375rem; color: var(--ll-sage); }
.ll-downloads__soon strong { color: #fff; font-size: 1.125rem; }
.ll-downloads__note {
	margin: 0; padding: 0.75rem 1.5rem; background: #FBF5E4; border-bottom: 1px solid #EADDB5; font-size: 0.875rem; color: #5A4A1A;
}
.ll-file__locked {
	flex: 0 0 auto; display: inline-flex; align-items: center; gap: 0.375rem; min-height: 44px; padding: 0 0.5rem;
	color: var(--ll-muted); font-size: 0.875rem; font-weight: 600;
}
