/*
Theme Name: Hetkipalvelus
Description: A custom block theme scaffolded by Studio Code.
Requires at least: 6.7
Tested up to: 6.9
Requires PHP: 7.2
Version: 0.1.7
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: hetkipalvelus
Tags: full-site-editing, block-patterns, block-styles, wide-blocks, accessibility-ready, style-variations
*/

/* WordPress inserts margin-block-start: var(--wp--style--block-gap) between the
   template's top-level sections (header part, main, footer part) — a gap that
   exists even when no markup asks for it. Zero it so sections butt edge-to-edge
   and own their vertical rhythm via padding. */
.wp-site-blocks > * + * {
	margin-block-start: 0;
}

/* Main carries its own vertical padding so templates the theme does not author
   still clear the header and footer. Templates built from full-bleed sections
   opt out with is-flush. */
.wp-site-blocks main {
	padding-block: var(--wp--preset--spacing--60) var(--wp--preset--spacing--70);
}
.wp-site-blocks main.is-flush {
	padding-block: 0;
}

/* === header & footer surfaces === */
.site-header {
	border-bottom: 1px solid var(--wp--preset--color--line);
}
.site-header .wp-block-site-title {
	color: var(--wp--preset--color--primary);
	line-height: 1;
	margin: 0;
}
.site-header .wp-block-site-title a {
	color: var(--wp--preset--color--primary);
	text-decoration: none;
}
.site-header .site-logo {
	margin: 0;
	line-height: 0;
}

/* navigation links inside the header */
.site-header .wp-block-navigation a {
	color: var(--wp--preset--color--text);
	text-decoration: none;
}
.site-header .wp-block-navigation a:hover {
	color: var(--wp--preset--color--primary);
}

/* === hero === */
.hero-title {
	font-size: clamp(2rem, 4.6vw, 2.6rem);
	line-height: 1.14;
	margin-bottom: 1.1rem;
}
.hero-lede {
	font-size: 1.2rem;
	color: var(--wp--preset--color--muted);
	max-width: 58ch;
}

/* small rubric eyebrow labels */
.eyebrow {
	color: var(--wp--preset--color--rubric);
	font-size: var(--wp--preset--font-size--label);
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	margin-bottom: 0.5rem;
}

/* === cards === */
.is-style-card {
	background: var(--wp--preset--color--card);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: var(--wp--custom--rounded--lg, 14px);
	padding: 1.6rem;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}
.is-style-card:hover {
	background: var(--wp--preset--color--surface);
}
.is-style-card h2,
.is-style-card h3 {
	margin-top: 0;
}

/* extensible card grid on the homepage */
.card-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
	gap: 1.25rem;
}
.card-grid .is-style-card {
	margin: 0;
}

/* calm hairline link list (book-like) */
.link-list {
	margin: 1rem 0;
}
.link-list > * + * {
	margin-block-start: 0;
}
.link-item {
	padding: 0.65rem 0;
	border-bottom: 1px solid var(--wp--preset--color--line);
}
.link-item:first-child {
	padding-top: 0.15rem;
}
.link-item h2 {
	font-size: clamp(1.0625rem, 2vw, 1.125rem);
	margin: 0;
}
.link-item h2 a {
	text-decoration: none;
	color: var(--wp--preset--color--primary);
}
.link-item h2 a:hover {
	color: var(--wp--preset--color--rubric);
}
.link-item p {
	margin: 0;
	color: var(--wp--preset--color--muted);
}

/* === liturgical instruction block (book extracts) === */
.is-style-rule {
	border-left: 3px solid var(--wp--preset--color--line);
	padding: 0.25rem 0 0.25rem 1.25rem;
	margin-left: 0;
}
.is-style-rule .speaker {
	color: var(--wp--preset--color--rubric);
	font-weight: 600;
}

/* === table of contents on long pages === */
.toc {
	background: var(--wp--preset--color--surface);
	border-radius: var(--wp--custom--rounded--lg, 14px);
	padding: 1.25rem 1.5rem;
	margin: 1.5rem 0 2rem;
}
.toc h2 {
	font-size: var(--wp--preset--font-size--headline);
	margin-top: 0;
}
.toc a {
	color: var(--wp--preset--color--primary);
}

/* === primary button hover === */
.wp-block-button__link:hover {
	filter: brightness(1.08);
}

/* translucent wine-red secondary button */
.is-style-wine .wp-block-button__link {
	background: rgba(166, 25, 46, 0.08);
	color: var(--wp--preset--color--rubric);
	border: 1px solid rgba(166, 25, 46, 0.5);
}
.is-style-wine .wp-block-button__link:hover {
	background: var(--wp--preset--color--rubric);
	color: #ffffff;
}

/* === tabbed guide view === */
.tabs {
	padding-bottom: clamp(3rem, 8vw, 5rem);
}
.tab-list {
	gap: 0.5rem;
	flex-wrap: wrap;
	margin: 1.5rem 0 0;
}
.tab-list .wp-block-button {
	margin: 0;
}
.tab-list .wp-block-button__link {
	background: transparent;
	color: var(--wp--preset--color--primary);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 999px;
	padding: 0.45rem 1.15rem;
	font-size: 1rem;
	font-weight: 500;
}
.tab-list .wp-block-button.is-active .wp-block-button__link,
.tab-list .wp-block-button__link:hover {
	background: var(--wp--preset--color--primary);
	color: #ffffff;
	border-color: transparent;
}
.tab-panel {
	display: none;
	margin-top: 2rem;
}
.tab-panel.is-active {
	display: block;
}

/* link arrows on guide link list */
.link-item h2 a::after {
	content: " \2192";
	color: var(--wp--preset--color--muted);
	margin-left: 0.25em;
}

/* === light/dark theme toggle === */
.theme-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 999px;
	background: transparent;
	color: var(--wp--preset--color--text);
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}
.theme-toggle:hover {
	background: var(--wp--preset--color--surface);
}
.theme-toggle .icon-sun {
	display: none;
}
[data-theme="dark"] .theme-toggle .icon-sun {
	display: block;
}
[data-theme="dark"] .theme-toggle .icon-moon {
	display: none;
}

/* === dark theme === */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--wp--preset--color--background: #242321;
		--wp--preset--color--card: #2c2b29;
		--wp--preset--color--text: #eeeeee;
		--wp--preset--color--muted: #b7bac1;
		--wp--preset--color--line: #44464b;
		--wp--preset--color--surface: #2b2a28;
		--wp--preset--color--primary: #b7ccec;
		--wp--preset--color--rubric: #ec6a58;
		--wp--preset--color--gold: #d4b26a;
	}
	:root:not([data-theme="light"]) .theme-toggle .icon-sun {
		display: block;
	}
	:root:not([data-theme="light"]) .theme-toggle .icon-moon {
		display: none;
	}
}
[data-theme="dark"] {
	--wp--preset--color--background: #242321;
	--wp--preset--color--card: #2c2b29;
	--wp--preset--color--text: #eeeeee;
	--wp--preset--color--muted: #b7bac1;
	--wp--preset--color--line: #44464b;
	--wp--preset--color--surface: #2b2a28;
	--wp--preset--color--primary: #b7ccec;
	--wp--preset--color--rubric: #ec6a58;
	--wp--preset--color--gold: #d4b26a;
}

/* buttons need dark text on the light-blue dark-theme primary */
[data-theme="dark"] .wp-block-button__link {
	color: #242321;
}
/* inactive tab outline text in dark */
[data-theme="dark"] .tab-list .wp-block-button:not(.is-active) .wp-block-button__link {
	color: var(--wp--preset--color--primary);
}
/* active + hover tabs get a dark fill with light text in dark (never inverts away) */
[data-theme="dark"] .tab-list .wp-block-button.is-active .wp-block-button__link,
[data-theme="dark"] .tab-list .wp-block-button__link:hover {
	background: #3b5b8a;
	color: #ffffff;
	border-color: transparent;
}
[data-theme="dark"] .is-style-wine .wp-block-button__link {
	background: rgba(236, 106, 88, 0.12);
	color: #ec6a58;
	border-color: rgba(236, 106, 88, 0.55);
}
[data-theme="dark"] .is-style-wine .wp-block-button__link:hover {
	background: #ec6a58;
	color: #242321;
}
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .wp-block-button__link {
		color: #242321;
	}
	:root:not([data-theme="light"]) .tab-list .wp-block-button:not(.is-active) .wp-block-button__link {
		color: var(--wp--preset--color--primary);
	}
	:root:not([data-theme="light"]) .tab-list .wp-block-button.is-active .wp-block-button__link,
	:root:not([data-theme="light"]) .tab-list .wp-block-button__link:hover {
		background: #3b5b8a;
		color: #ffffff;
		border-color: transparent;
	}
	:root:not([data-theme="light"]) .is-style-wine .wp-block-button__link {
		background: rgba(236, 106, 88, 0.12);
		color: #ec6a58;
		border-color: rgba(236, 106, 88, 0.55);
	}
	:root:not([data-theme="light"]) .is-style-wine .wp-block-button__link:hover {
		background: #ec6a58;
		color: #242321;
	}
}

/* === footer === */
.site-footer {
	border-top: 1px solid var(--wp--preset--color--line);
}
.site-footer a {
	color: var(--wp--preset--color--primary);
}
.site-footer .footer-muted {
	color: var(--wp--preset--color--muted);
}

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