/*
Theme Name: Folkpedia Faithful
Theme URI: https://folkpedia.example.com
Author: Telex
Description: A warm, antique parchment-inspired encyclopedia theme for mythology and folklore. Features Playfair Display headings, Lora body text, gold accent highlights, and deep dark-light contrast evoking ancient manuscripts.
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: folkpedia-faithful
Tags: blog, education, custom-colors, custom-menu, editor-style, block-styles, wide-blocks, full-site-editing
Requires at least: 6.4
Tested up to: 6.7
Requires PHP: 8.0
*/

/* ==========================================================================
   Base & Global Resets
   ========================================================================== */

html {
	scroll-behavior: smooth;
}

body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* Ensure sticky and scroll-driven features work */
:root,
body,
.wp-site-blocks {
	overflow: visible;
}

/* ==========================================================================
   Typography Polish
   ========================================================================== */

/* Headings — warm antique character */
h1, h2, h3, h4, h5, h6 {
	text-wrap: balance;
}

/* Paragraph prose rhythm */
p {
	text-wrap: pretty;
}

/* Drop cap for long-form content */
.has-drop-cap:not(:focus)::first-letter {
	font-family: var(--wp--preset--font-family--display);
	color: var(--wp--preset--color--gold-accent);
	font-weight: 600;
	margin-right: 0.05em;
}

/* Small text utility */
.has-small-font-size {
	line-height: 1.5;
}

/* ==========================================================================
   Link Styles
   ========================================================================== */

a {
	transition: color 0.2s ease;
}

/* Content area link underlines — subtle, gold-tinted */
.entry-content a:not(.wp-block-button__link):not(.wp-block-navigation-item__content),
.wp-block-post-content a:not(.wp-block-button__link):not(.wp-block-navigation-item__content) {
	text-decoration-color: var(--wp--preset--color--border);
	text-underline-offset: 0.2em;
	text-decoration-thickness: 1px;
	transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.entry-content a:not(.wp-block-button__link):not(.wp-block-navigation-item__content):hover,
.wp-block-post-content a:not(.wp-block-button__link):not(.wp-block-navigation-item__content):hover {
	text-decoration-color: var(--wp--preset--color--gold-accent);
}

/* ==========================================================================
   Button Variants
   ========================================================================== */

/* Base button transitions */
.wp-block-button__link {
	transition: background-color 0.25s ease, color 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
	letter-spacing: 0.01em;
}

.wp-block-button__link:hover {
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(28, 24, 20, 0.15);
}

.wp-block-button__link:active {
	transform: translateY(0);
	box-shadow: none;
}

/* Outline button style */
.wp-block-button.is-style-outline .wp-block-button__link {
	border-width: 2px;
	border-style: solid;
	border-color: var(--wp--preset--color--gold-accent);
	color: var(--wp--preset--color--gold-accent);
	background: transparent;
}

.wp-block-button.is-style-outline .wp-block-button__link:hover {
	background: var(--wp--preset--color--gold-accent);
	color: var(--wp--preset--color--dark);
	border-color: var(--wp--preset--color--gold-accent);
}

/* ==========================================================================
   Header — Sticky, Hide on Scroll Down / Show on Scroll Up
   ========================================================================== */

.wp-site-blocks > header.wp-block-template-part {
	position: sticky;
	top: 0;
	z-index: 100;
	will-change: transform;
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
}

/* Header inner group styling */
.site-header {
	border-bottom: 1px solid rgba(212, 201, 176, 0.4);
}

/* Mobile header fixes */
@media (max-width: 782px) {
	.wp-site-blocks > header.wp-block-template-part {
		/* Ensure full-width coverage on mobile */
		left: 0;
		right: 0;
		width: 100%;
	}

	.site-header .wp-block-group {
		min-height: 60px;
	}

	/* Ensure header background is opaque on scroll */
	body.is-scrolled .site-header {
		background-color: var(--wp--preset--color--parchment);
	}
}

/* Site title link — no underline */
.wp-block-site-title a {
	text-decoration: none;
}

/* Header logo sizing */
.header-logo {
	margin: 0;
	flex-shrink: 0;
}

.header-logo img {
	display: block;
	height: auto;
	max-height: 48px;
	width: auto !important;
	object-fit: contain;
	mix-blend-mode: multiply;
}

@media (max-width: 782px) {
	.header-logo img {
		max-height: 36px;
	}
}

/* Navigation link transitions */
.wp-block-navigation a {
	text-decoration: none;
	transition: color 0.2s ease;
}

/* ==========================================================================
   Mobile Hamburger Overlay — Full-screen
   ========================================================================== */

.wp-block-navigation__responsive-container.is-menu-open {
	position: fixed !important;
	top: 0 !important;
	left: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
	width: 100% !important;
	height: 100vh !important;
	height: 100dvh !important;
	z-index: 9999 !important;
	background-color: var(--wp--preset--color--dark) !important;
	display: flex !important;
	flex-direction: column !important;
	align-items: center !important;
	justify-content: center !important;
	padding: var(--wp--preset--spacing--60) var(--wp--preset--spacing--50) !important;
	overflow-y: auto;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0;
	width: 100%;
	max-width: 400px;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
	display: flex !important;
	flex-direction: column !important;
	align-items: center !important;
	gap: var(--wp--preset--spacing--50) !important;
	width: 100%;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
	width: 100%;
	text-align: center;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
	font-size: clamp(1.5rem, 5vw, 2.25rem) !important;
	font-family: var(--wp--preset--font-family--display) !important;
	font-weight: 500 !important;
	letter-spacing: -0.01em;
	color: var(--wp--preset--color--text-cream) !important;
	text-decoration: none !important;
	display: inline-block;
	padding: 0.3em 0;
	transition: color 0.2s ease;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content:hover,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content:focus {
	color: var(--wp--preset--color--gold-accent) !important;
}

/* Close button styling in full-screen overlay */
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close {
	position: fixed !important;
	top: 1.5rem;
	right: 1.5rem;
	z-index: 10000;
	color: var(--wp--preset--color--text-cream) !important;
	background: transparent !important;
	border: none !important;
	width: 48px;
	height: 48px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: color 0.2s ease;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close:hover {
	color: var(--wp--preset--color--gold-accent) !important;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close svg {
	width: 28px;
	height: 28px;
}

/* When mobile menu is open, always show the header */
body.has-modal-open .wp-site-blocks > header.wp-block-template-part,
body.admin-bar .wp-site-blocks > header.wp-block-template-part {
	transform: none !important;
	pointer-events: auto !important;
}

/* ==========================================================================
   Hero / Cover Treatments
   ========================================================================== */

/* Hero cover overlay refinement */
.wp-block-cover {
	overflow: hidden;
}

.wp-block-cover .wp-block-cover__inner-container {
	z-index: 2;
}

/* Hero heading gold accent style */
.wp-block-cover h1,
.wp-block-cover .has-gold-accent-color {
	text-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Hero subtitle cream text */
.wp-block-cover .has-text-cream-color {
	text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   Search Block — Mockup-faithful Pill Shape
   ========================================================================== */

.wp-block-search {
	max-width: 680px;
}

.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper {
	background: var(--wp--preset--color--white);
	border-radius: 60px;
	padding: 0.6rem;
	box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
	border: none;
	transition: box-shadow 0.3s ease;
}

.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper:focus-within {
	box-shadow: 0 15px 40px rgba(201, 168, 76, 0.2);
}

.wp-block-search .wp-block-search__input {
	font-family: var(--wp--preset--font-family--body);
	font-size: 1.1rem;
	color: var(--wp--preset--color--text-primary);
	border: none;
	background: transparent;
	padding: 0.5rem 1.5rem;
}

.wp-block-search .wp-block-search__input::placeholder {
	color: #9A8F82;
	font-style: italic;
}

.wp-block-search .wp-block-search__button {
	background-color: var(--wp--preset--color--parchment);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 50%;
	width: 52px;
	height: 52px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: var(--wp--preset--color--text-primary);
	transition: all 0.2s ease;
	padding: 0;
	min-width: 52px;
}

.wp-block-search .wp-block-search__button:hover {
	background-color: var(--wp--preset--color--gold-accent);
	border-color: var(--wp--preset--color--gold-accent);
	color: var(--wp--preset--color--white);
	transform: scale(1.05);
}

.wp-block-search .wp-block-search__button svg {
	width: 20px;
	height: 20px;
}

/* Hero logo — remove any generated background */
.hero-logo-img img {
	mix-blend-mode: multiply;
}

/* ==========================================================================
   Image Treatments
   ========================================================================== */

.wp-block-image img {
	transition: transform 0.4s ease, filter 0.4s ease;
}

/* Subtle warm sepia filter for folklore aesthetic */
.wp-block-image.is-style-rounded img {
	border-radius: 50%;
}

/* Gallery items */
.wp-block-gallery .wp-block-image img {
	border-radius: 4px;
}

.wp-block-gallery .wp-block-image img:hover {
	transform: scale(1.02);
}

/* Featured image in post template */
.wp-block-post-featured-image img {
	border-radius: 4px;
	transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.wp-block-post-featured-image img:hover {
	transform: scale(1.02);
	box-shadow: 0 8px 24px rgba(44, 32, 22, 0.12);
}

/* ==========================================================================
   Card Surface Patterns
   ========================================================================== */

/* Groups on card-surface background */
.has-card-surface-background-color {
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 6px;
}

/* Post template card styling */
.wp-block-post-template .wp-block-post {
	transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.wp-block-post-template .wp-block-post:hover {
	box-shadow: 0 6px 20px rgba(44, 32, 22, 0.08);
	transform: translateY(-2px);
}

/* ==========================================================================
   Separator — Ornamental Folkpedia Style
   ========================================================================== */

.wp-block-separator {
	opacity: 1;
}

.wp-block-separator:not(.is-style-wide):not(.is-style-dots) {
	max-width: 120px;
	border-color: var(--wp--preset--color--border);
}

.wp-block-separator.is-style-dots::before {
	color: var(--wp--preset--color--gold-accent);
}

/* ==========================================================================
   Quote & Pullquote — Antiquarian Feel
   ========================================================================== */

.wp-block-quote {
	position: relative;
}

.wp-block-quote cite,
.wp-block-pullquote cite {
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--small);
	font-style: normal;
	color: var(--wp--preset--color--text-secondary);
	letter-spacing: 0.03em;
	text-transform: uppercase;
}

.wp-block-pullquote {
	padding-top: var(--wp--preset--spacing--40);
	padding-bottom: var(--wp--preset--spacing--40);
}

/* ==========================================================================
   Table — Parchment Rows
   ========================================================================== */

.wp-block-table table {
	border-collapse: collapse;
}

.wp-block-table td,
.wp-block-table th {
	border-color: var(--wp--preset--color--border);
	padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--30);
}

.wp-block-table thead {
	border-bottom: 2px solid var(--wp--preset--color--gold-accent);
}

.wp-block-table thead th {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 600;
	text-transform: uppercase;
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: 0.05em;
}

.wp-block-table.is-style-stripes tbody tr:nth-child(odd) {
	background-color: var(--wp--preset--color--card-surface);
}

/* ==========================================================================
   Code Block — Manuscript Style
   ========================================================================== */

.wp-block-code code {
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.6;
	white-space: pre-wrap;
	word-break: break-all;
}

/* ==========================================================================
   Post Meta Elements
   ========================================================================== */

.wp-block-post-date,
.wp-block-post-author,
.wp-block-post-terms {
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--text-secondary);
}

.wp-block-post-terms a {
	text-decoration: none;
	color: var(--wp--preset--color--gold-accent);
	transition: color 0.2s ease;
}

.wp-block-post-terms a:hover {
	color: var(--wp--preset--color--text-primary);
}

/* Post title links */
.wp-block-post-title a {
	text-decoration: none;
	color: inherit;
	transition: color 0.2s ease;
}

.wp-block-post-title a:hover {
	color: var(--wp--preset--color--gold-accent);
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.wp-block-query-pagination {
	gap: var(--wp--preset--spacing--20);
}

.wp-block-query-pagination-numbers .page-numbers {
	font-family: var(--wp--preset--font-family--body);
	padding: 0.4em 0.8em;
	text-decoration: none;
	color: var(--wp--preset--color--text-secondary);
	border-radius: 4px;
	transition: all 0.2s ease;
}

.wp-block-query-pagination-numbers .page-numbers:hover {
	color: var(--wp--preset--color--gold-accent);
	background-color: var(--wp--preset--color--card-surface);
}

.wp-block-query-pagination-numbers .page-numbers.current {
	background-color: var(--wp--preset--color--gold-accent);
	color: var(--wp--preset--color--dark);
	font-weight: 600;
}

/* ==========================================================================
   Categories / Tag Cloud
   ========================================================================== */

.wp-block-categories-list a,
.wp-block-tag-cloud a {
	text-decoration: none;
	color: var(--wp--preset--color--text-secondary);
	transition: color 0.2s ease;
}

.wp-block-categories-list a:hover,
.wp-block-tag-cloud a:hover {
	color: var(--wp--preset--color--gold-accent);
}

.wp-block-tag-cloud a {
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 60px;
	padding: 0.3em 0.8em;
	display: inline-block;
	margin-bottom: 0.4em;
	font-size: var(--wp--preset--font-size--small) !important;
	transition: all 0.2s ease;
}

.wp-block-tag-cloud a:hover {
	background-color: var(--wp--preset--color--gold-accent);
	border-color: var(--wp--preset--color--gold-accent);
	color: var(--wp--preset--color--dark);
}

/* ==========================================================================
   Dark Section Treatments (hero, footer, feature bands)
   ========================================================================== */

.has-dark-background-color a:not(.wp-block-button__link) {
	color: var(--wp--preset--color--gold-accent);
}

.has-dark-background-color a:not(.wp-block-button__link):hover {
	color: var(--wp--preset--color--text-cream);
}

/* ==========================================================================
   Footer Styling
   ========================================================================== */

footer.wp-block-template-part a {
	text-decoration: none;
	transition: color 0.2s ease;
}

/* ==========================================================================
   Details / Accordion Block
   ========================================================================== */

.wp-block-details {
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 4px;
	padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--40);
	transition: border-color 0.2s ease;
}

.wp-block-details[open] {
	border-color: var(--wp--preset--color--gold-accent);
}

.wp-block-details summary {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 500;
	cursor: pointer;
	color: var(--wp--preset--color--text-primary);
	transition: color 0.2s ease;
	list-style: none;
}

.wp-block-details summary::-webkit-details-marker {
	display: none;
}

.wp-block-details summary::before {
	content: "+";
	display: inline-block;
	margin-right: 0.75em;
	font-weight: 400;
	color: var(--wp--preset--color--gold-accent);
	transition: transform 0.2s ease;
}

.wp-block-details[open] summary::before {
	content: "\2212";
}

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

/* ==========================================================================
   Selection Color
   ========================================================================== */

::selection {
	background-color: rgba(201, 168, 76, 0.25);
	color: var(--wp--preset--color--text-primary);
}

/* ==========================================================================
   Scrollbar Styling (thin, themed)
   ========================================================================== */

::-webkit-scrollbar {
	width: 8px;
}

::-webkit-scrollbar-track {
	background: var(--wp--preset--color--parchment);
}

::-webkit-scrollbar-thumb {
	background: var(--wp--preset--color--border);
	border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
	background: var(--wp--preset--color--gold-accent);
}

/* ==========================================================================
   Focus Styles — Accessibility
   ========================================================================== */

:focus-visible {
	outline: 2px solid var(--wp--preset--color--gold-accent);
	outline-offset: 2px;
}

.wp-block-button__link:focus-visible {
	outline-offset: 3px;
}

/* ==========================================================================
   Loop Layout Utilities
   ========================================================================== */
/* These classes are wired to the wp:query blocks emitted by content/pages and
   templates. Do not rename. Tune colours and spacing to theme.json tokens. */

/* Horizontal scrollable rail */
.wp-block-query.is-style-loop-rail .wp-block-post-template {
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: thin;
	padding-bottom: var(--wp--preset--spacing--20);
}
.wp-block-query.is-style-loop-rail .wp-block-post-template > * {
	flex: 0 0 320px;
	scroll-snap-align: start;
}

/* Compact list with hairline row dividers */
.wp-block-query.is-style-loop-list .wp-block-post-template > * {
	border-bottom: 1px solid var(--wp--preset--color--border);
	padding-block: var(--wp--preset--spacing--30);
}
.wp-block-query.is-style-loop-list .wp-block-post-template > *:last-child {
	border-bottom: 0;
}

/* Zigzag — flip the columns inside every even entry */
.wp-block-query.is-style-loop-zigzag .wp-block-post-template > *:nth-child(even) .wp-block-columns {
	flex-direction: row-reverse;
}

/* Timeline — vertical line with node markers per entry */
.wp-block-query.is-style-loop-timeline .wp-block-post-template {
	position: relative;
	padding-inline-start: 2.5rem;
}
.wp-block-query.is-style-loop-timeline .wp-block-post-template::before {
	content: '';
	position: absolute;
	inset-block: 0;
	inset-inline-start: 0.5rem;
	width: 2px;
	background: var(--wp--preset--color--border);
	opacity: 0.4;
}
.wp-block-query.is-style-loop-timeline .wp-block-post-template > * {
	position: relative;
}
.wp-block-query.is-style-loop-timeline .wp-block-post-template > *::before {
	content: '';
	position: absolute;
	inset-inline-start: -2.25rem;
	inset-block-start: 0.6rem;
	width: 1rem;
	height: 1rem;
	border: 2px solid var(--wp--preset--color--gold-accent);
	border-radius: 50%;
	background: var(--wp--preset--color--parchment);
}

/* Magazine — first child spans 2 columns of the grid */
.wp-block-query.is-style-loop-magazine .wp-block-post-template > *:first-child {
	grid-column: span 2;
}
@media (max-width: 600px) {
	.wp-block-query.is-style-loop-magazine .wp-block-post-template > *:first-child {
		grid-column: auto;
	}
}

/* ==========================================================================
   Civilization Stats Band — Mobile Responsive
   ========================================================================== */

@media (max-width: 600px) {
	/* Switch the stats row to a 2x2 grid */
	.civ-stats-row.is-layout-flex {
		display: grid !important;
		grid-template-columns: 1fr 1fr;
		gap: var(--wp--preset--spacing--40);
		justify-items: center;
	}

	/* Hide pipe separators on mobile */
	.civ-stat-pipe {
		display: none !important;
	}

	/* Each stat item stays centered */
	.civ-stat-item {
		text-align: center;
	}
}