/* ==========================================================================
   Tantillo theme — base styles
   Every selector is wrapped in :where() => specificity 0,0,0, except the few
   theme UI elements (skip link, back-to-top, .tf-button) that must win over the
   Elementor kit "links/buttons" styles: those use 2 classes (0,2,0) and read
   their colours from CSS variables set in Site Settings > Tantillo Layout.
   Any Elementor setting (Site Settings, widget style, custom CSS) overrides
   these rules without !important.
   Layout values come from CSS variables printed by
   Elementor > Site Settings > Tantillo Layout (see inc/class-kit-tab-layout.php).
   ========================================================================== */

:where(:root) {
	--tf-sheet-width: 1140px;
	--tf-sheet-bg: #ffffff;
	--tf-sheet-offset: 0px;
	--tf-sheet-radius: 0px;
	--tf-progress-color: var(--e-global-color-accent, #a86b32);
	--tf-progress-height: 3px;
	--tf-btt-bg: var(--e-global-color-primary, #000000);
	--tf-btt-color: #ffffff;
	--tf-selection-bg: var(--e-global-color-accent, #a86b32);
	--tf-header-shadow: rgba(0, 0, 0, 0.18);
	--tf-admin-bar: 0px;
	--tf-collapse-h: 0px;
	--tf-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
	--tf-ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

/* ---------------------------------------------------------------- Reset */
:where(*, *::before, *::after) {
	box-sizing: border-box;
}

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

:where(body) {
	margin: 0;
	background-color: #000000;
	color: var(--e-global-color-text, #1a1a1a);
	font-family: var(--e-global-typography-text-font-family, "Open Sans"), system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	font-size: 16px;
	line-height: 1.7;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
	overflow-x: clip;
}

:where(img, svg, video, canvas, audio, iframe, embed, object) {
	max-width: 100%;
}

/* Images stay inline (Elementor aligns them with text-align). */
:where(video, canvas, audio, iframe, embed, object) {
	display: block;
}

:where(img, video) {
	height: auto;
}

:where(a) {
	color: inherit;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
	transition: color 0.25s ease, opacity 0.25s ease;
}

:where(h1, h2, h3, h4, h5, h6) {
	margin: 0 0 0.5em;
	font-family: var(--e-global-typography-primary-font-family, "Teko"), "Arial Narrow", sans-serif;
	font-weight: 600;
	line-height: 1.05;
	letter-spacing: 0.01em;
}

:where(p, ul, ol, dl, blockquote, figure, table) {
	margin: 0 0 1em;
}

:where(button, input, select, textarea) {
	font: inherit;
	color: inherit;
}

:where(:focus-visible) {
	outline: 2px solid var(--e-global-color-accent, #a86b32);
	outline-offset: 3px;
}

:where(::selection) {
	background: var(--tf-selection-bg);
	color: #ffffff;
}

/* ------------------------------------------------------------- Layout */
:where(.tf-site) {
	position: relative;
	padding-block: var(--tf-sheet-offset);
	min-height: 100vh;
	min-height: 100dvh;
}

:where(.tf-sheet) {
	position: relative;
	width: 100%;
	max-width: var(--tf-sheet-width);
	margin-inline: auto;
	background-color: var(--tf-sheet-bg);
	border-radius: var(--tf-sheet-radius);
	overflow-x: clip;
	display: flex;
	flex-direction: column;
	min-height: calc(100vh - 2 * var(--tf-sheet-offset));
	min-height: calc(100dvh - 2 * var(--tf-sheet-offset));
}

:where(.tf-main) {
	flex: 1 0 auto;
	outline: 0;
}

:where(.tf-footer) {
	margin-top: auto;
}

/* Skip link (accessibility) */
.tf-theme .tf-skip-link {
	position: absolute;
	left: 12px;
	top: -100px;
	z-index: 100000;
	padding: 10px 16px;
	background: #000000;
	color: #ffffff;
	font-weight: 600;
	text-decoration: none;
	border-radius: 4px;
	transition: top 0.2s ease;
}

.tf-theme .tf-skip-link:focus {
	top: 12px;
}

/* ------------------------------------------------------- Sticky header */
:where(.admin-bar) {
	--tf-admin-bar: 32px;
}

@media (max-width: 782px) {
	:where(.admin-bar) {
		--tf-admin-bar: 46px;
	}
}

@media (max-width: 600px) {
	:where(.admin-bar) {
		--tf-admin-bar: 0px;
	}
}

:where(.tf-sticky-header) :where(.tf-header) {
	position: sticky;
	top: calc(var(--tf-admin-bar) - var(--tf-collapse-h));
	z-index: 90;
	transition: box-shadow 0.35s ease;
}

:where(.tf-sticky-header) :where(.tf-header.is-stuck) {
	box-shadow: 0 14px 30px -18px var(--tf-header-shadow);
}

:where(.elementor-editor-active, .elementor-editor-preview) :where(.tf-header) {
	position: relative;
	top: auto;
}

/* Elementor quirk fixes ------------------------------------------------
   The kit option "Paragraph spacing" (.elementor-kit-N p) also hits headings
   rendered with the <p> tag and the last paragraph of text editors, adding
   big empty gaps. Spacing between widgets is given by the containers. */
.elementor-widget-heading p.elementor-heading-title {
	margin-block-end: 0;
}

.elementor-widget-text-editor p:last-child,
.elementor-widget-text-editor ul:last-child,
.elementor-widget-text-editor ol:last-child {
	margin-block-end: 0;
}

/* Elements visible only when the header is stuck (e.g. small name in the menu bar). */
.tf-theme .tf-show-when-stuck {
	transition: opacity 0.35s ease, transform 0.45s var(--tf-ease-out);
}

.tf-sticky-header:not(.tf-is-scrolled):not(.elementor-editor-active) .tf-show-when-stuck {
	opacity: 0;
	transform: translateY(8px);
	pointer-events: none;
}

/* ------------------------------------------------------ Page fade-in */
@keyframes tf-page-in {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

:where(.tf-page-fade) :where(.tf-main) {
	animation: tf-page-in 0.7s var(--tf-ease-out) both;
}

:where(.elementor-editor-active) :where(.tf-main) {
	animation: none;
}

/* ------------------------------------------------- Scroll progress bar */
:where(.tf-progress) {
	position: fixed;
	inset: 0 0 auto 0;
	height: var(--tf-progress-height);
	background: var(--tf-progress-color);
	transform-origin: 0 50%;
	transform: scaleX(var(--tf-progress, 0));
	z-index: 100001;
	pointer-events: none;
	will-change: transform;
}

:where(.admin-bar) :where(.tf-progress) {
	top: var(--tf-admin-bar);
}

/* ---------------------------------------------------------- Back to top */
.tf-theme .tf-to-top {
	position: fixed;
	right: clamp(14px, 3vw, 28px);
	bottom: clamp(14px, 3vw, 28px);
	z-index: 1000;
	width: 52px;
	height: 52px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--tf-btt-bg);
	color: var(--tf-btt-color);
	cursor: pointer;
	display: grid;
	place-items: center;
	opacity: 0;
	visibility: hidden;
	transform: translateY(16px) scale(0.85);
	transition: opacity 0.35s ease, transform 0.45s var(--tf-ease-out), visibility 0s linear 0.35s;
	box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.55);
}

.tf-theme .tf-to-top.is-visible {
	opacity: 1;
	visibility: visible;
	transform: none;
	transition-delay: 0s;
}

.tf-theme .tf-to-top:hover,
.tf-theme .tf-to-top:focus {
	background: var(--tf-btt-hover-bg, var(--e-global-color-accent, #a86b32));
	color: var(--tf-btt-color);
	transform: translateY(-3px);
}

:where(.tf-to-top__ring) {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	transform: rotate(-90deg);
}

:where(.tf-to-top__ring circle) {
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-dasharray: 138.2;
	stroke-dashoffset: calc(138.2 - 138.2 * var(--tf-progress, 0));
	opacity: 0.9;
}

:where(.tf-to-top__icon) {
	width: 20px;
	height: 20px;
	fill: currentColor;
	position: relative;
}

/* ------------------------------------------- Classic (non Elementor) content */
:where(.tf-entry) {
	width: min(100% - 32px, 860px);
	margin: clamp(32px, 6vw, 72px) auto;
}

:where(.tf-entry__title) {
	font-size: clamp(2.4rem, 5vw, 3.6rem);
	text-transform: uppercase;
}

:where(.tf-entry__media img) {
	width: 100%;
	border-radius: 4px;
}

:where(.tf-404) {
	text-align: center;
}

:where(.tf-404__code) {
	font-family: var(--e-global-typography-primary-font-family, "Teko"), sans-serif;
	font-size: clamp(6rem, 22vw, 14rem);
	line-height: 0.9;
	margin: 0;
	color: var(--e-global-color-secondary, #9897a5);
}

.tf-theme .tf-button {
	display: inline-block;
	padding: 12px 26px;
	background: #000000;
	color: #ffffff;
	text-decoration: none;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	font-size: 13px;
	font-weight: 600;
	transition: background-color 0.3s ease;
}

.tf-theme .tf-button:hover {
	background: var(--e-global-color-accent, #a86b32);
}

:where(.tf-archive__grid) {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 28px;
}

:where(.tf-card__link) {
	display: block;
	text-decoration: none;
}

:where(.tf-card__media) {
	display: block;
	aspect-ratio: 4 / 3;
	overflow: hidden;
}

:where(.tf-card__media img) {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.8s var(--tf-ease-out);
}

:where(.tf-card__link:hover .tf-card__media img) {
	transform: scale(1.06);
}

:where(.tf-card__title) {
	margin-top: 12px;
	font-size: 1.6rem;
}

/* ------------------------------------------------------ Fallback header */
:where(.tf-fallback-header) {
	background: #9897a5;
	color: #ffffff;
	padding: 24px clamp(16px, 4vw, 40px) 0;
}

:where(.tf-fallback-header__brand) {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 24px;
	padding-bottom: 20px;
}

:where(.tf-fallback-header__title) {
	font-family: "Teko", sans-serif;
	font-size: clamp(2.4rem, 6vw, 4.5rem);
	line-height: 1;
	text-transform: uppercase;
	text-decoration: none;
}

:where(.tf-fallback-nav) {
	background: #ffffff;
	margin-inline: calc(-1 * clamp(16px, 4vw, 40px));
	border-top: 1px solid #b5b5b5;
}

:where(.tf-fallback-nav ul) {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
}

:where(.tf-fallback-nav a) {
	display: block;
	padding: 6px 12px;
	color: #000000;
	text-decoration: none;
	text-transform: uppercase;
	font-size: 12px;
}

:where(.tf-fallback-nav .sub-menu) {
	display: none;
}

:where(.tf-fallback-footer) {
	background: #000000;
	color: #ffffff;
	text-align: center;
	padding: 20px;
}

/* ---------------------------------------------------------- WP helpers */
:where(.screen-reader-text) {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal;
}

:where(.alignleft) {
	float: left;
	margin: 0.4em 1.5em 1em 0;
}

:where(.alignright) {
	float: right;
	margin: 0.4em 0 1em 1.5em;
}

:where(.aligncenter) {
	display: block;
	margin-inline: auto;
}

:where(.wp-caption-text, figcaption) {
	font-size: 0.85em;
	opacity: 0.75;
}

/* ------------------------------------------------------- Reduced motion */
@media (prefers-reduced-motion: reduce) {
	:where(html) {
		scroll-behavior: auto;
	}

	:where(.tf-page-fade) :where(.tf-main) {
		animation: none;
	}

	:where(.tf-to-top) {
		transition: none;
	}
}
