/* Three Square Books: minimal editorial styling on top of Twenty Twenty-Five.
 * Colours, fonts and sizes are theme.json presets (var(--wp--preset--…)). */

:root {
	--tsb-header-h: 88px;
	--tsb-radius: var(--wp--custom--radius, 14px);
	--tsb-shadow: var(--wp--custom--shadow);
	--tsb-rule: linear-gradient(90deg, var(--wp--preset--color--orange), var(--wp--preset--color--green) 50%, var(--wp--preset--color--blue));
	--tsb-ui: var(--wp--preset--font-family--nunito);
}

html {
	scroll-padding-top: calc(var(--tsb-header-h) + 12px);
}
@media (prefers-reduced-motion: no-preference) {
	html { scroll-behavior: smooth; }
}

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

::selection {
	background: color-mix(in srgb, var(--wp--preset--color--orange) 30%, transparent);
}

.tsb-visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

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

.wp-site-blocks > header.wp-block-template-part {
	position: sticky;
	top: 0;
	z-index: 50;
}
.admin-bar .wp-site-blocks > header.wp-block-template-part { top: 32px; }
@media (max-width: 782px) {
	.admin-bar .wp-site-blocks > header.wp-block-template-part { top: 46px; }
}
@media (max-width: 600px) {
	.admin-bar .wp-site-blocks > header.wp-block-template-part { position: static; }
}

.tsb-header {
	background: color-mix(in srgb, var(--wp--preset--color--base) 92%, transparent);
	-webkit-backdrop-filter: saturate(1.4) blur(10px);
	backdrop-filter: saturate(1.4) blur(10px);
	position: relative;
}
.tsb-header::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 3px;
	background: var(--tsb-rule);
	opacity: 0.85;
}

.tsb-header__inner { gap: 0.75rem 2rem; }

.tsb-logo,
.tsb-logo a { display: block; line-height: 0; }
.tsb-logo img {
	width: 300px;
	max-width: 62vw;
	height: auto;
}

.tsb-nav .wp-block-navigation__container { gap: 0.25rem 1.75rem; }
.tsb-nav .wp-block-navigation-item__content {
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
	padding: 0.35rem 0;
	background: linear-gradient(currentColor, currentColor) 0 100% / 0 2px no-repeat;
	transition: background-size 0.2s ease;
}
.tsb-nav .wp-block-navigation-item:nth-child(1) .wp-block-navigation-item__content { color: var(--wp--preset--color--orange-text); }
.tsb-nav .wp-block-navigation-item:nth-child(2) .wp-block-navigation-item__content { color: var(--wp--preset--color--blue-text); }
.tsb-nav .wp-block-navigation-item:nth-child(3) .wp-block-navigation-item__content { color: var(--wp--preset--color--green-text); }
.tsb-nav .wp-block-navigation-item__content:hover,
.tsb-nav .wp-block-navigation-item__content:focus-visible {
	background-size: 100% 2px;
}

@media (max-width: 640px) {
	:root { --tsb-header-h: 118px; }
	.tsb-header__inner { justify-content: center !important; }
	.tsb-logo img { width: 230px; }
	.tsb-nav { width: 100%; }
	.tsb-nav .wp-block-navigation__container { justify-content: center; gap: 0.25rem 2rem; }
}

/* ---------------------------------------------------------------- Shared */

.tsb-eyebrow {
	font-family: var(--tsb-ui);
	font-weight: 800;
	font-size: 0.8125rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--wp--preset--color--muted);
	display: flex;
	align-items: center;
	gap: 0.6em;
	margin-bottom: 0.5rem !important;
}
.tsb-eyebrow.has-text-align-center { justify-content: center; }
.tsb-eyebrow::before {
	content: "";
	width: 0.8em;
	height: 0.8em;
	border-radius: 3px;
	background: var(--tsb-eyebrow, var(--wp--preset--color--orange));
	flex: none;
}
.tsb-eyebrow--orange { --tsb-eyebrow: var(--wp--preset--color--orange); }
.tsb-eyebrow--blue { --tsb-eyebrow: var(--wp--preset--color--blue); }
.tsb-eyebrow--green { --tsb-eyebrow: var(--wp--preset--color--green); }

.tsb-section h2 { margin-top: 0; }

.is-style-card {
	background: var(--wp--preset--color--white);
	border-radius: calc(var(--tsb-radius) + 6px);
	box-shadow: var(--tsb-shadow);
	padding: clamp(1.75rem, 5vw, 3.25rem) clamp(1.25rem, 5vw, 3.5rem);
}

/* ---------------------------------------------------------------- Hero */

.tsb-hero__art {
	margin-bottom: clamp(1.5rem, 4vw, 2.75rem) !important;
}
.tsb-hero__art img {
	width: 100%;
	height: auto;
	aspect-ratio: 3 / 1;
	object-fit: cover;
	border-radius: calc(var(--tsb-radius) + 10px);
	box-shadow: var(--tsb-shadow);
}
@media (max-width: 700px) {
	.tsb-hero__art img { aspect-ratio: 4 / 3; object-position: 50% 40%; }
}

.tsb-hero__sub {
	font-weight: 600;
	font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.75rem);
	line-height: 1.15;
	letter-spacing: -0.015em;
	max-width: 22ch;
	margin-inline: auto !important;
	text-wrap: balance;
}
.tsb-hero__lead {
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--large);
	max-width: 38ch;
	margin-inline: auto !important;
	text-wrap: pretty;
}
.tsb-hero .wp-block-buttons { margin-top: 1.75rem; }

/* ---------------------------------------------------------------- Featured book */

.tsb-book { border-top: 1px solid var(--wp--preset--color--accent-6); }

.is-style-book-cover img {
	width: 100%;
	max-width: 340px;
	height: auto;
	border-radius: 4px 10px 10px 4px;
	box-shadow:
		inset 6px 0 8px -6px rgba(0, 0, 0, 0.35),
		0 2px 4px rgba(15, 47, 74, 0.12),
		0 22px 44px -12px rgba(15, 47, 74, 0.35);
}
.tsb-book__cover .wp-block-image { margin-inline: auto; text-align: center; }

.tsb-facts {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
	gap: 0.85rem 1.5rem;
	margin: 1.75rem 0;
	padding: 1.25rem 0;
	border-top: 1px solid var(--wp--preset--color--accent-6);
	border-bottom: 1px solid var(--wp--preset--color--accent-6);
}
.tsb-facts dt {
	font-family: var(--tsb-ui);
	font-weight: 800;
	font-size: 0.75rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--wp--preset--color--muted);
}
.tsb-facts dd {
	margin: 0.15rem 0 0;
	font-size: 1rem;
	font-variant-numeric: lining-nums;
}

.tsb-unofficial {
	font-family: var(--tsb-ui);
	font-weight: 700;
	font-size: 0.75rem;
	letter-spacing: 0.04em;
	line-height: 1.5;
	color: var(--wp--preset--color--muted);
	margin-top: 1.5rem !important;
}

@media (max-width: 781px) {
	.tsb-book__cols { gap: 2.5rem !important; }
	.is-style-book-cover img { max-width: 260px; }
}

/* ---------------------------------------------------------------- About + three squares */

.tsb-about__lead {
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.6;
	text-wrap: pretty;
}

.tsb-squares {
	list-style: none;
	padding: 0;
	margin: clamp(2.5rem, 6vw, 4rem) auto 0 !important;
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: clamp(1rem, 3vw, 2rem);
	max-width: 960px;
}
.tsb-square {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 0.35rem;
	padding: 2rem 1.25rem 1.75rem;
	border-radius: calc(var(--tsb-radius) + 4px);
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--accent-6);
}
.tsb-square__icon {
	display: grid;
	place-items: center;
	width: 84px;
	height: 84px;
	border-radius: 16px;
	color: #FFF7E6;
	background: var(--tsb-sq);
	box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.14);
	margin-bottom: 0.65rem;
}
.tsb-square__icon svg { width: 60px; height: 60px; }
.tsb-square__word {
	font-size: var(--wp--preset--font-size--x-large);
	font-weight: 600;
	line-height: 1.1;
	color: var(--tsb-sq-text);
}
.tsb-square__line { color: var(--wp--preset--color--muted); font-style: italic; }
.tsb-square--orange { --tsb-sq: var(--wp--preset--color--orange); --tsb-sq-text: var(--wp--preset--color--orange-text); }
.tsb-square--blue { --tsb-sq: var(--wp--preset--color--blue); --tsb-sq-text: var(--wp--preset--color--blue-text); }
.tsb-square--green { --tsb-sq: var(--wp--preset--color--green); --tsb-sq-text: var(--wp--preset--color--green-text); }

@media (max-width: 700px) {
	.tsb-squares { grid-template-columns: 1fr; max-width: 420px; }
	.tsb-square { flex-direction: row; text-align: left; flex-wrap: wrap; column-gap: 1rem; padding: 1.25rem; }
	.tsb-square__icon { width: 60px; height: 60px; margin: 0; grid-row: span 2; border-radius: 12px; }
	.tsb-square__icon svg { width: 44px; height: 44px; }
	.tsb-square { display: grid; grid-template-columns: 60px 1fr; align-items: center; }
	.tsb-square__word { font-size: var(--wp--preset--font-size--large); align-self: end; }
	.tsb-square__line { align-self: start; }
}

/* ---------------------------------------------------------------- Contact */

.tsb-contact__aside {
	font-size: 0.95rem;
	color: var(--wp--preset--color--muted);
	margin-top: 1.75rem !important;
	padding-top: 1.5rem;
	border-top: 1px solid var(--wp--preset--color--accent-6);
}

/* ---------------------------------------------------------------- Footer */

.tsb-footer { position: relative; font-size: 0.95rem; }
.tsb-footer::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	height: 3px;
	background: var(--tsb-rule);
	opacity: 0.85;
}
.tsb-footer__top { gap: 1.5rem 2rem; }
.tsb-footer__brand {
	display: flex;
	align-items: center;
	gap: 0.9rem;
	color: inherit;
	text-decoration: none;
}
.tsb-footer__brand img { width: 84px; height: auto; }
.tsb-footer__brand strong {
	display: block;
	font-family: var(--tsb-ui);
	font-weight: 900;
	font-size: 1.15rem;
	letter-spacing: 0.01em;
}
.tsb-motto { display: block; font-style: italic; color: var(--wp--preset--color--muted); }

.tsb-footer__nav ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.5rem;
	list-style: none;
	margin: 0;
	padding: 0;
	font-family: var(--tsb-ui);
	font-weight: 700;
}
.tsb-footer__nav a { color: var(--wp--preset--color--contrast); text-decoration: none; }
.tsb-footer__nav a:hover,
.tsb-footer__nav a:focus-visible { text-decoration: underline; text-underline-offset: 0.2em; }

.tsb-footer__legal {
	margin-top: 2rem !important;
	padding-top: 1.5rem;
	border-top: 1px solid var(--wp--preset--color--accent-6);
	color: var(--wp--preset--color--muted);
	font-size: 0.875rem;
}
.tsb-footer__legal p { margin: 0 0 0.5rem; max-width: 80ch; }
.tsb-footer__legal a { color: inherit; }

/* ---------------------------------------------------------------- Inner pages */

.tsb-page-title { margin-bottom: 0.5rem; }
.tsb-page h2 { font-size: var(--wp--preset--font-size--x-large); margin-top: 2.5rem; }
.tsb-updated {
	font-family: var(--tsb-ui);
	font-weight: 700;
	font-size: 0.875rem;
	color: var(--wp--preset--color--muted);
}

/* ---------------------------------------------------------------- Focus */

:where(a, button, .wp-element-button):focus-visible {
	outline: 2px solid var(--wp--preset--color--blue);
	outline-offset: 3px;
	border-radius: 4px;
}
