/**
 * Themify — main front-end stylesheet.
 *
 * Single source of truth for the public site. Everything is driven by CSS
 * custom properties declared in :root so the admin color/typography
 * customizer can override the whole look by printing a handful of variables.
 *
 * Sections:
 *   1. Design tokens
 *   2. Reset & base
 *   3. Typography
 *   4. Layout primitives
 *   5. Header / navigation
 *   6. Buttons & pills
 *   7. Hero
 *   8. Cards & blog grid
 *   9. Single post & TOC
 *  10. Sidebar & widgets
 *  11. Comments & forms
 *  12. Footer
 *  13. Utilities, motion, responsive, print
 */

/* ============================================================ 1. TOKENS */
:root {
	--tf-body-bg: linear-gradient(145deg, #ecfaf1 0%, #d6efde 40%, #c8e8d2 70%, #ecfaf1 100%);
	--tf-bg-primary: rgba(236, 249, 241, 0.82);
	--tf-bg-secondary: rgba(228, 244, 235, 0.87);
	--tf-bg-card: #ffffff;
	--tf-bg-card-hover: #f6fbf8;
	--tf-bg-nav: rgba(236, 249, 241, 0.92);

	--tf-text: #081a0c;
	--tf-text-muted: rgba(8, 26, 12, 0.72);
	--tf-text-faint: rgba(8, 26, 12, 0.46);

	--tf-border: rgba(20, 100, 38, 0.13);
	--tf-border-hover: rgba(20, 100, 38, 0.30);

	--tf-accent: #156b28;
	--tf-accent-glow: #2a9142;
	--tf-accent-bg: rgba(20, 107, 40, 0.08);

	--tf-btn: #156b28;
	--tf-btn-hover: #1e8f38;
	--tf-btn-text: #ffffff;

	--tf-shadow-sm: 0 1px 3px rgba(8, 26, 12, 0.06), 0 1px 2px rgba(8, 26, 12, 0.08);
	--tf-shadow: 0 6px 24px rgba(8, 26, 12, 0.09);
	--tf-shadow-lg: 0 18px 48px rgba(8, 26, 12, 0.14);

	--tf-radius-sm: 10px;
	--tf-radius: 16px;
	--tf-radius-lg: 24px;
	--tf-radius-pill: 999px;

	--tf-maxw: 1200px;
	--tf-maxw-narrow: 760px;
	--tf-nav-h: 68px;
	--tf-gap: clamp(16px, 3vw, 28px);

	--tf-font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--tf-font-head: "Playfair Display", Georgia, "Times New Roman", serif;

	--tf-fs-base: 1.0625rem;   /* 17px */
	--tf-lh-base: 1.7;
	--tf-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================ 2. RESET */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: hidden; }
body {
	margin: 0;
	background: var(--tf-body-bg);
	background-attachment: fixed;
	color: var(--tf-text);
	font-family: var(--tf-font-body);
	font-size: var(--tf-fs-base);
	line-height: var(--tf-lh-base);
	min-height: 100vh;
	overflow-x: hidden;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	letter-spacing: -0.006em;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: var(--tf-accent); text-decoration: none; transition: color 0.18s var(--tf-ease); }
a:hover { color: var(--tf-btn-hover); }
:focus-visible { outline: 2px solid var(--tf-accent); outline-offset: 2px; border-radius: 4px; }
h1[id], h2[id], h3[id], h4[id] { scroll-margin-top: calc(var(--tf-nav-h) + 24px); }
::selection { background: var(--tf-accent); color: #fff; }

/* ============================================================ 3. TYPE */
h1, h2, h3, h4, h5, h6 {
	font-family: var(--tf-font-head);
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: -0.02em;
	margin: 0 0 0.5em;
	color: var(--tf-text);
}
h1 { font-size: clamp(2rem, 4.5vw, 3rem); }
h2 { font-size: clamp(1.55rem, 3vw, 2.1rem); }
h3 { font-size: clamp(1.25rem, 2.2vw, 1.5rem); }
h4 { font-size: 1.2rem; }
p { margin: 0 0 1.15em; }
strong { font-weight: 700; }
blockquote {
	margin: 1.6em 0;
	padding: 0.8em 1.4em;
	border-left: 4px solid var(--tf-accent);
	background: var(--tf-accent-bg);
	border-radius: 0 var(--tf-radius-sm) var(--tf-radius-sm) 0;
	font-style: italic;
	color: var(--tf-text-muted);
}
code, pre, kbd { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; font-size: 0.9em; }
:not(pre) > code { background: var(--tf-accent-bg); padding: 0.15em 0.4em; border-radius: 6px; }
pre {
	background: #0d1f17; color: #d6efde; padding: 1.15em 1.35em;
	border-radius: var(--tf-radius-sm); overflow-x: auto; margin: 1.4em 0; line-height: 1.55;
}
hr { border: 0; border-top: 1px solid var(--tf-border); margin: 2.4em 0; }
table { width: 100%; border-collapse: collapse; margin: 1.5em 0; }
th, td { padding: 0.7em 0.9em; border: 1px solid var(--tf-border); text-align: left; }
th { background: var(--tf-accent-bg); font-weight: 600; }

/* ============================================================ 4. LAYOUT */
.tf-container { max-width: var(--tf-maxw); margin-inline: auto; padding-inline: clamp(16px, 4vw, 32px); }
.tf-narrow { max-width: var(--tf-maxw-narrow); margin-inline: auto; }
.tf-main { padding-block: clamp(28px, 5vw, 56px); min-height: 60vh; }
.tf-layout { display: grid; gap: clamp(28px, 4vw, 48px); }
.tf-has-sidebar .tf-layout { grid-template-columns: minmax(0, 1fr) 320px; }
.tf-no-sidebar .tf-layout { grid-template-columns: minmax(0, 1fr); }
.tf-skip-link {
	position: absolute; left: 8px; top: -60px; z-index: 1000;
	background: var(--tf-accent); color: #fff; padding: 10px 16px; border-radius: 8px;
	transition: top 0.2s var(--tf-ease);
}
.tf-skip-link:focus { top: 8px; color: #fff; }

/* ============================================================ 5. HEADER */
.tf-site-header {
	position: relative; z-index: 50; background: var(--tf-bg-nav);
	border-bottom: 1px solid var(--tf-border);
	-webkit-backdrop-filter: saturate(1.4) blur(12px);
	backdrop-filter: saturate(1.4) blur(12px);
}
.tf-site-header.is-sticky { position: sticky; top: 0; }
.tf-nav {
	display: flex; align-items: center; justify-content: space-between;
	gap: 20px; min-height: var(--tf-nav-h);
}
.tf-brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--tf-font-head); font-weight: 700; font-size: 1.4rem; color: var(--tf-text); }
.tf-brand img { max-height: 40px; width: auto; }
.tf-menu { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.tf-menu a {
	display: inline-block; padding: 9px 14px; border-radius: var(--tf-radius-sm);
	color: var(--tf-text-muted); font-weight: 500; font-size: 0.98rem;
	transition: background 0.18s var(--tf-ease), color 0.18s var(--tf-ease);
}
.tf-menu a:hover, .tf-menu .current-menu-item > a { background: var(--tf-accent-bg); color: var(--tf-accent); }
.tf-menu .sub-menu {
	position: absolute; min-width: 210px; list-style: none; margin: 8px 0 0; padding: 8px;
	background: var(--tf-bg-card); border: 1px solid var(--tf-border); border-radius: var(--tf-radius-sm);
	box-shadow: var(--tf-shadow-lg); opacity: 0; visibility: hidden; transform: translateY(6px);
	transition: all 0.2s var(--tf-ease); z-index: 60;
}
.tf-menu li { position: relative; }
.tf-menu li:hover > .sub-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.tf-nav-toggle {
	display: none; width: 44px; height: 44px; border: 1px solid var(--tf-border);
	background: var(--tf-bg-card); border-radius: var(--tf-radius-sm); cursor: pointer;
	align-items: center; justify-content: center; flex-direction: column; gap: 4px;
}
.tf-nav-toggle span { display: block; width: 20px; height: 2px; background: var(--tf-text); border-radius: 2px; transition: transform 0.25s var(--tf-ease), opacity 0.25s; }
.tf-nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.tf-nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.tf-nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ============================================================ 6. BUTTONS */
.tf-btn, .wp-block-button__link, button.tf-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	padding: 12px 24px; border-radius: var(--tf-radius-pill); border: 0; cursor: pointer;
	background: var(--tf-btn); color: var(--tf-btn-text); font-weight: 600; font-size: 1rem;
	font-family: var(--tf-font-body); line-height: 1; text-align: center;
	box-shadow: 0 6px 18px rgba(20, 107, 40, 0.25);
	transition: transform 0.18s var(--tf-ease), background 0.18s var(--tf-ease), box-shadow 0.18s var(--tf-ease);
}
.tf-btn:hover { background: var(--tf-btn-hover); color: #fff; transform: translateY(-2px); box-shadow: 0 10px 26px rgba(20, 107, 40, 0.32); }
.tf-btn--ghost { background: transparent; color: var(--tf-accent); box-shadow: none; border: 1.5px solid var(--tf-border-hover); }
.tf-btn--ghost:hover { background: var(--tf-accent-bg); color: var(--tf-accent); box-shadow: none; }
.tf-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.tf-pill {
	display: inline-block; padding: 5px 13px; border-radius: var(--tf-radius-pill);
	background: var(--tf-accent-bg); color: var(--tf-accent); font-size: 0.82rem; font-weight: 600;
	transition: background 0.18s var(--tf-ease);
}
.tf-pill:hover { background: var(--tf-accent); color: #fff; }

/* ============================================================ 7. HERO */
.tf-hero { position: relative; text-align: center; padding-block: clamp(48px, 8vw, 96px); overflow: hidden; }
.tf-hero::before {
	content: ""; position: absolute; inset: 0; z-index: -1;
	background: radial-gradient(ellipse 110% 65% at 50% 40%, rgba(20, 130, 60, 0.12) 0%, rgba(90, 45, 170, 0.05) 55%, transparent 75%);
}
.tf-hero h1 { max-width: 15ch; margin-inline: auto; }
.tf-hero__sub { font-size: clamp(1.05rem, 2vw, 1.35rem); color: var(--tf-text-muted); max-width: 60ch; margin: 0.6em auto 1.6em; }
.tf-hero__cta { display: inline-flex; gap: 14px; flex-wrap: wrap; justify-content: center; }

/* ============================================================ 8. CARDS */
.tf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--tf-gap); }
.tf-card-post {
	background: var(--tf-bg-card); border: 1px solid var(--tf-border); border-radius: var(--tf-radius);
	overflow: hidden; box-shadow: var(--tf-shadow-sm);
	transition: transform 0.22s var(--tf-ease), box-shadow 0.22s var(--tf-ease), border-color 0.22s var(--tf-ease);
	display: flex; flex-direction: column;
}
.tf-card-post:hover { transform: translateY(-4px); box-shadow: var(--tf-shadow-lg); border-color: var(--tf-border-hover); }
.tf-card-post__thumb { aspect-ratio: 16 / 9; overflow: hidden; background: var(--tf-bg-secondary); }
.tf-card-post__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s var(--tf-ease); }
.tf-card-post:hover .tf-card-post__thumb img { transform: scale(1.05); }
/* Fallback frame shown when a post has no featured image — keeps the 16:9 grid tidy. */
.tf-card-post__thumb-fallback { display: block; width: 100%; height: 100%; aspect-ratio: 16 / 9; background: linear-gradient(135deg, var(--tf-accent-bg) 0%, var(--tf-bg-secondary) 60%, var(--tf-accent-bg) 100%); }
.tf-card-post__thumb-fallback::after { content: ""; display: block; width: 100%; height: 100%; background: radial-gradient(circle at 30% 30%, rgba(20,107,40,0.10), transparent 60%); }
.tf-card-post__body { padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.tf-card-post__title { font-size: 1.25rem; margin: 0; }
.tf-card-post__title a { color: var(--tf-text); }
.tf-card-post__title a:hover { color: var(--tf-accent); }
.tf-card-post__excerpt { color: var(--tf-text-muted); font-size: 0.96rem; margin: 0; }
.tf-card-post__footer { margin-top: auto; }

/* Empty / "nothing found" state (template-parts/content-none.php) */
.tf-none { background: var(--tf-bg-card); border: 1px solid var(--tf-border); border-radius: var(--tf-radius-lg); padding: clamp(28px, 6vw, 56px); text-align: center; box-shadow: var(--tf-shadow); }
.tf-none__title { margin-bottom: 0.35em; }
.tf-none__body { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.tf-none__message { color: var(--tf-text-muted); max-width: 48ch; margin: 0 auto; }
.tf-none__search { width: 100%; max-width: 460px; margin: 1.2em auto 0; }

/* ============================================================ 9. SINGLE */
.tf-article { background: var(--tf-bg-card); border: 1px solid var(--tf-border); border-radius: var(--tf-radius-lg); padding: clamp(22px, 4vw, 52px); box-shadow: var(--tf-shadow); }
.tf-article__header { margin-bottom: 1.8em; }
.tf-article__title { font-size: clamp(1.9rem, 4vw, 2.8rem); margin-bottom: 0.4em; }
.tf-article__hero { border-radius: var(--tf-radius); overflow: hidden; margin: 1.4em 0; box-shadow: var(--tf-shadow); }
.tf-content { font-size: 1.075rem; }
.tf-content > * { max-width: 100%; }
.tf-content img { border-radius: var(--tf-radius-sm); margin: 1.4em auto; box-shadow: var(--tf-shadow-sm); }
.tf-content ul, .tf-content ol { margin: 0 0 1.2em; padding-left: 1.4em; }
.tf-content li { margin-bottom: 0.4em; }
.tf-content h2 { margin-top: 1.6em; }
.tf-content h3 { margin-top: 1.3em; }
.tf-content a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--tf-border-hover); }
.tf-content a:hover { text-decoration-color: var(--tf-accent); }

.tf-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--tf-text-faint); font-size: 0.9rem; }
.tf-meta__sep { opacity: 0.5; }
.tf-breadcrumbs { font-size: 0.85rem; color: var(--tf-text-faint); margin-bottom: 1em; }
.tf-breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.tf-breadcrumbs li:not(:last-child)::after { content: "/"; margin-left: 6px; opacity: 0.5; }

/* Table of contents */
.tf-toc {
	background: var(--tf-bg-secondary); border: 1px solid var(--tf-border); border-radius: var(--tf-radius);
	padding: 18px 22px; margin: 1.6em 0;
}
.tf-toc__toggle { background: none; border: 0; font-family: var(--tf-font-head); font-size: 1.05rem; font-weight: 700; cursor: pointer; color: var(--tf-text); padding: 0; margin-bottom: 8px; }
.tf-toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.tf-toc li { margin: 4px 0; }
.tf-toc a { color: var(--tf-text-muted); font-size: 0.95rem; }
.tf-toc a:hover, .tf-toc a.is-active { color: var(--tf-accent); }
.tf-toc__l3 { padding-left: 16px; font-size: 0.9em; }
.tf-toc[hidden] ol { display: none; }

/* Related + author */
.tf-related { margin-top: 2.4em; }
.tf-author-box { display: flex; gap: 18px; align-items: center; background: var(--tf-bg-secondary); border: 1px solid var(--tf-border); border-radius: var(--tf-radius); padding: 20px 24px; margin-top: 2em; }
.tf-author-box img { width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0; }

/* ============================================================ 10. SIDEBAR */
.tf-sidebar { display: flex; flex-direction: column; gap: 24px; }
.tf-sidebar .widget, .tf-widget {
	background: var(--tf-bg-card); border: 1px solid var(--tf-border); border-radius: var(--tf-radius);
	padding: 20px 22px; box-shadow: var(--tf-shadow-sm);
}
.widget-title { font-size: 1.1rem; margin: 0 0 14px; padding-bottom: 10px; border-bottom: 2px solid var(--tf-accent-bg); }
.tf-widget ul, .widget ul { list-style: none; margin: 0; padding: 0; }
.tf-widget li, .widget li { padding: 7px 0; border-bottom: 1px solid var(--tf-border); }
.tf-widget li:last-child, .widget li:last-child { border-bottom: 0; }

/* ============================================================ 11. FORMS */
input[type="text"], input[type="email"], input[type="url"], input[type="search"], input[type="password"], input[type="number"], textarea, select {
	width: 100%; padding: 11px 14px; border: 1px solid var(--tf-border); border-radius: var(--tf-radius-sm);
	background: var(--tf-bg-card); color: var(--tf-text); font: inherit; font-size: 1rem;
	transition: border-color 0.18s var(--tf-ease), box-shadow 0.18s var(--tf-ease);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--tf-accent); box-shadow: 0 0 0 3px var(--tf-accent-bg); }
label { font-weight: 500; }
.tf-comments { margin-top: 2.6em; }
.tf-comment-list { list-style: none; margin: 0; padding: 0; }
.tf-comment-list .comment { background: var(--tf-bg-card); border: 1px solid var(--tf-border); border-radius: var(--tf-radius); padding: 18px 20px; margin-bottom: 16px; }
.tf-comment-list .children { list-style: none; margin: 16px 0 0 28px; padding: 0; }
.comment-respond { background: var(--tf-bg-card); border: 1px solid var(--tf-border); border-radius: var(--tf-radius); padding: 24px; margin-top: 20px; }

/* ============================================================ 12. FOOTER */
.tf-site-footer { margin-top: clamp(48px, 8vw, 96px); background: var(--tf-bg-secondary); border-top: 1px solid var(--tf-border); }
.tf-footer-widgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 36px; padding-block: clamp(36px, 6vw, 64px); }
.tf-footer-bottom { border-top: 1px solid var(--tf-border); padding-block: 22px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; color: var(--tf-text-faint); font-size: 0.9rem; }
.tf-social { display: flex; gap: 10px; }
.tf-social a { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--tf-bg-card); border: 1px solid var(--tf-border); color: var(--tf-text-muted); }
.tf-social a:hover { background: var(--tf-accent); color: #fff; border-color: var(--tf-accent); transform: translateY(-2px); }
.tf-payment-badges { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tf-payment-badges img { height: 26px; width: auto; opacity: 0.85; }

/* ============================================================ 13. UTIL */
.tf-pagination { margin-top: 2.4em; }
.tf-pagination .nav-links { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.tf-pagination .page-numbers {
	display: inline-flex; align-items: center; justify-content: center; min-width: 42px; height: 42px; padding: 0 12px;
	border: 1px solid var(--tf-border); border-radius: var(--tf-radius-sm); background: var(--tf-bg-card); color: var(--tf-text-muted); font-weight: 600;
}
.tf-pagination .page-numbers.current { background: var(--tf-accent); color: #fff; border-color: var(--tf-accent); }
.tf-pagination a.page-numbers:hover { border-color: var(--tf-accent); color: var(--tf-accent); }
.tf-back-to-top {
	position: fixed; right: 22px; bottom: 22px; z-index: 80; width: 46px; height: 46px; border-radius: 50%;
	background: var(--tf-accent); color: #fff; border: 0; cursor: pointer; box-shadow: var(--tf-shadow-lg);
	opacity: 0; visibility: hidden; transform: translateY(10px); transition: all 0.25s var(--tf-ease);
}
.tf-back-to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.tf-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.aligncenter { margin-inline: auto; }
.alignleft { float: left; margin: 0.4em 1.4em 1em 0; }
.alignright { float: right; margin: 0.4em 0 1em 1.4em; }
.alignwide { width: min(1100px, 92vw); margin-inline: auto; max-width: none; }
.wp-caption-text, figcaption { font-size: 0.85rem; color: var(--tf-text-faint); text-align: center; margin-top: 0.5em; }

/* Motion */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* Responsive */
@media (max-width: 900px) {
	.tf-has-sidebar .tf-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 780px) {
	.tf-nav-toggle { display: inline-flex; }
	.tf-menu {
		position: fixed; inset: var(--tf-nav-h) 0 auto 0; flex-direction: column; align-items: stretch; gap: 2px;
		background: var(--tf-bg-card); border-bottom: 1px solid var(--tf-border); padding: 12px;
		box-shadow: var(--tf-shadow-lg); transform: translateY(-120%); transition: transform 0.3s var(--tf-ease);
		max-height: calc(100vh - var(--tf-nav-h)); overflow-y: auto;
	}
	.tf-menu.is-open { transform: translateY(0); }
	.tf-menu .sub-menu { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: 0; padding-left: 16px; margin: 0; }
}

/* Print */
@media print {
	.tf-site-header, .tf-site-footer, .tf-sidebar, .tf-back-to-top, .tf-toc, .comment-respond { display: none !important; }
	body { background: #fff; }
	.tf-article { border: 0; box-shadow: none; padding: 0; }
}
