/*
Theme Name:        IFAFA2026
Theme URI:         https://ifafa.org/
Description:       The block theme for the Irish Foreign Affairs Family Association. Keeps IFAFA's sky-blue and ink identity, with a fully editable header, footer and templates in the Site Editor, a Missions directory and members-only areas (with the IFAFA Members plugin).
Author:            Marco Neumann
Version:           2.0.1
Requires at least: 6.6
Tested up to:      7.1
Requires PHP:      7.4
License:           GNU General Public License v2 or later
License URI:       https://www.gnu.org/licenses/gpl-2.0.html
Text Domain:       ifafa2026
Tags:              block-patterns, full-site-editing, wide-blocks, style-variations, accessibility-ready, editor-style, custom-logo
*/

/* Most styling lives in theme.json. These are the few things it cannot express. */

:root {
	--ifafa-radius: var(--wp--custom--radius--medium, 14px);
}

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

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

body {
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
}

:where(h1, h2, h3) {
	text-wrap: balance;
	font-optical-sizing: auto;
}

:where(p, li) {
	text-wrap: pretty;
}

::selection {
	background: var(--wp--preset--color--sky);
	color: var(--wp--preset--color--contrast);
}

:where(a, button, input, select, textarea, summary):focus-visible {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 2px;
}

/* ---------- Header ---------- */

.ifafa-masthead {
	position: relative;
	overflow: hidden;
}

/* A soft "horizon" arc that echoes the original header band. */
.ifafa-masthead::after {
	content: "";
	position: absolute;
	right: -10%;
	bottom: -120%;
	width: 70%;
	aspect-ratio: 1;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 65%);
	pointer-events: none;
}

.ifafa-masthead > * {
	position: relative;
	z-index: 1;
}

.ifafa-masthead .wp-block-site-logo img {
	height: auto;
	filter: drop-shadow(0 4px 10px rgba(14, 26, 43, 0.12));
}

.ifafa-masthead .wp-block-site-tagline {
	max-width: 38ch;
}

.ifafa-navbar {
	position: sticky;
	top: 0;
	z-index: 50;
}

.admin-bar .ifafa-navbar {
	top: var(--wp-admin--admin-bar--height, 32px);
}

@media (max-width: 600px) {
	.admin-bar .ifafa-navbar { top: 0; }
}

.ifafa-navbar .wp-block-navigation-item__content {
	padding-block: 0.35rem;
	border-bottom: 2px solid transparent;
}

.ifafa-navbar .wp-block-navigation-item__content:hover,
.ifafa-navbar .current-menu-item > .wp-block-navigation-item__content {
	text-decoration: none;
	border-bottom-color: var(--wp--preset--color--sky);
}

.ifafa-navbar .wp-block-loginout a {
	display: inline-block;
	padding: 0.4rem 1rem;
	border-radius: 999px;
	background: var(--wp--preset--color--sky);
	color: var(--wp--preset--color--contrast);
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}

.ifafa-navbar .wp-block-loginout a:hover {
	background: var(--wp--preset--color--base);
}

.ifafa-navbar .wp-block-search__inside-wrapper {
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: var(--wp--preset--color--base);
	overflow: hidden;
}

.ifafa-navbar .wp-block-search__input {
	min-width: 0;
	width: 11rem;
	padding: 0.4rem 0.4rem 0.4rem 1rem;
	border: 0;
	background: transparent;
	color: var(--wp--preset--color--contrast);
	font-size: var(--wp--preset--font-size--x-small);
}

.ifafa-navbar .wp-block-search__input::placeholder {
	color: var(--wp--preset--color--muted);
	opacity: 1;
}

.ifafa-navbar .wp-block-search__button {
	margin: 0;
	padding: 0.35rem 0.7rem 0.35rem 0.3rem;
	border: 0;
	background: transparent;
	color: var(--wp--preset--color--contrast);
}

.ifafa-navbar .wp-block-search__button svg {
	fill: currentColor;
	width: 1.25rem;
	height: 1.25rem;
}

.ifafa-navbar .wp-block-navigation__responsive-container-open svg {
	fill: currentColor;
}

@media (max-width: 781px) {
	.ifafa-navbar .wp-block-search { display: none; }
}

/* ---------- Cards ---------- */

.ifafa-card {
	box-sizing: border-box;
	height: 100%;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ifafa-card:hover {
	transform: translateY(-3px);
	box-shadow: var(--wp--preset--shadow--lifted);
}

.ifafa-card .wp-block-post-featured-image {
	margin: 0;
}

.ifafa-card .wp-block-post-featured-image img {
	aspect-ratio: 16 / 10;
	object-fit: cover;
	border-radius: var(--ifafa-radius) var(--ifafa-radius) 0 0;
}

.ifafa-card .wp-block-post-title a::after {
	/* Make the whole card clickable via the title link. */
	content: "";
	position: absolute;
	inset: 0;
}

.ifafa-card {
	position: relative;
}

.ifafa-card .wp-block-post-terms a,
.ifafa-card .wp-block-post-terms {
	position: relative;
	z-index: 1;
}

.ifafa-card:focus-within {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 3px;
}

/* ---------- Topic chips (Terms Query) ---------- */

.ifafa-chips .wp-block-term-template {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ifafa-chips .wp-block-term-name a,
.ifafa-chips .wp-block-term-name {
	text-decoration: none;
}

.ifafa-chips .wp-block-term-template > li,
.ifafa-chips .wp-block-term-template > li > * {
	margin: 0;
}

.ifafa-chips .wp-block-term-template a {
	display: inline-block;
	padding: 0.35rem 0.85rem;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 999px;
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 600;
}

.ifafa-chips .wp-block-term-template a:hover {
	border-color: var(--wp--preset--color--sky);
	background: var(--wp--preset--color--sky-soft);
}

/* ---------- Content ---------- */

.wp-block-post-content > :where(h2, h3) {
	margin-top: var(--wp--preset--spacing--50);
}

.wp-block-details summary {
	cursor: pointer;
	font-weight: 600;
	list-style-position: outside;
}

.wp-block-details summary::marker {
	color: var(--wp--preset--color--accent);
}

.is-style-ifafa-checks {
	list-style: none;
	padding-left: 0;
}

.is-style-ifafa-checks li {
	position: relative;
	padding-left: 1.9rem;
}

.is-style-ifafa-checks li + li {
	margin-top: 0.5rem;
}

.is-style-ifafa-checks li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.3em;
	width: 1.15rem;
	height: 1.15rem;
	border-radius: 50%;
	background: var(--wp--preset--color--sky) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m5 10.5 3 3 7-7' fill='none' stroke='%230e1a2b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 75% no-repeat;
}

.is-style-ifafa-card {
	padding: var(--wp--preset--spacing--40);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: var(--ifafa-radius);
	background: var(--wp--preset--color--base);
	box-shadow: var(--wp--preset--shadow--soft);
}

.ifafa-eyebrow {
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

/* ---------- Classic-editor content (older posts and pages) ---------- */

.wp-block-post-content::after {
	content: "";
	display: table;
	clear: both;
}

.wp-block-post-content :where(img, figure, .wp-caption, a:has(> img)).alignleft,
.wp-block-post-content :where(p, div, a) > img.alignleft {
	float: left;
	max-width: 50%;
	height: auto;
	margin: 0.35em 1.5em 1em 0;
}

.wp-block-post-content :where(img, figure, .wp-caption, a:has(> img)).alignright,
.wp-block-post-content :where(p, div, a) > img.alignright {
	float: right;
	max-width: 50%;
	height: auto;
	margin: 0.35em 0 1em 1.5em;
}

.wp-block-post-content :where(img, .wp-caption).aligncenter {
	display: block;
	height: auto;
	margin-inline: auto;
}

.wp-block-post-content img.alignnone,
.wp-block-post-content :where(p) > img {
	max-width: 100%;
	height: auto;
}

.wp-block-post-content :where(.alignleft, .alignright, .aligncenter, .alignnone) img {
	border-radius: var(--wp--custom--radius--small, 8px);
}

.wp-block-post-content img:where(.alignleft, .alignright, .aligncenter, .alignnone) {
	border-radius: var(--wp--custom--radius--small, 8px);
}

.wp-caption {
	max-width: 100%;
}

.wp-caption img {
	display: block;
	max-width: 100%;
	height: auto;
}

.wp-caption-text {
	margin-top: 0.4em;
	font-size: var(--wp--preset--font-size--x-small);
	color: var(--wp--preset--color--muted);
}

/* Headings and lists start below floated images instead of squeezing beside them. */
.wp-block-post-content > :where(h2, h3, hr, .wp-block-separator) {
	clear: both;
}

@media (max-width: 600px) {
	.wp-block-post-content :where(img, figure, .wp-caption).alignleft,
	.wp-block-post-content :where(img, figure, .wp-caption).alignright,
	.wp-block-post-content :where(p, div, a) > img.alignleft,
	.wp-block-post-content :where(p, div, a) > img.alignright {
		float: none;
		display: block;
		max-width: 100%;
		margin: 0 0 1em;
	}
}

/* Footer */
.ifafa-footer a {
	color: inherit;
}

.ifafa-footer a:hover {
	color: var(--wp--preset--color--sky);
}
