/*
Theme Name: Terrazo
Theme URI: https://example.com/terrazo
Author: Your name
Description: A fast, search-focused theme for guides about buying a home abroad. Answer-first articles, key-facts ledger, automatic table of contents, built-in structured data, reserved ad slots, and cost and rental-yield calculators. No jQuery, no page builder, no external fonts.
Version: 1.0.0
Requires at least: 6.2
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: terrazo
*/

/* ---------- Fonts (self-hosted: no Google Fonts request, no GDPR issue) ---------- */
@font-face {
	font-family: "Bricolage Grotesque";
	src: url("assets/fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2");
	font-weight: 200 800;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: "Literata";
	src: url("assets/fonts/literata-latin-wght-normal.woff2") format("woff2");
	font-weight: 200 900;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: "Literata";
	src: url("assets/fonts/literata-latin-wght-italic.woff2") format("woff2");
	font-weight: 200 900;
	font-style: italic;
	font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
	--chalk: #f4f6f4;
	--paper: #ffffff;
	--ink: #10252b;
	--muted: #475b60;
	--line: #d6ddda;
	--sea: #0e6b6b;
	--sea-dark: #0a4f52;
	--sea-wash: #e3efee;
	--sun: #f2b632;
	--alert: #a83a25;
	--ui: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
	--read: "Literata", Georgia, "Times New Roman", serif;
	--wrap: 78rem;
	--gutter: clamp(1rem, 4vw, 2rem);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }
body {
	margin: 0;
	background: var(--chalk);
	color: var(--ink);
	font-family: var(--read);
	font-size: 1.1875rem;
	line-height: 1.7;
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
}
img, svg, video { max-width: 100%; height: auto; }
a { color: var(--sea); text-decoration-thickness: 1.5px; text-underline-offset: 0.2em; }
a:hover { color: var(--sea-dark); }
:focus-visible { outline: 3px solid var(--sea); outline-offset: 3px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: 0.75rem 1rem; z-index: 100; font-family: var(--ui); }
.skip:focus { left: 0; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1, h2, h3, h4 { font-family: var(--ui); color: var(--ink); line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 0.6em; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 1.2rem + 3.6vw, 3.6rem); font-weight: 750; letter-spacing: -0.03em; line-height: 1.04; }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); font-weight: 700; }
h3 { font-size: 1.3rem; font-weight: 650; }
p { margin: 0 0 1.2em; }

.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }
.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.section-title { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); margin-bottom: 1.25rem; }

/* ---------- Header ---------- */
.site-header { background: var(--chalk); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.site-header__in { display: flex; align-items: center; gap: 1.5rem; min-height: 4rem; }
.brand { font-family: var(--ui); font-weight: 800; font-size: 1.35rem; letter-spacing: -0.03em; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 0.6rem; }
.brand:hover { color: var(--sea); }
.brand__mark { width: 1.5rem; height: 1.5rem; flex: none; }
.site-nav { margin-left: auto; }
.site-nav ul { list-style: none; display: flex; gap: 1.5rem; margin: 0; padding: 0; }
.site-nav a { font-family: var(--ui); font-weight: 550; font-size: 1rem; color: var(--ink); text-decoration: none; padding: 0.4rem 0; border-bottom: 2px solid transparent; }
.site-nav a:hover, .site-nav .current-menu-item > a { border-bottom-color: var(--sea); color: var(--ink); }
.nav-toggle { display: none; margin-left: auto; background: none; border: 2px solid var(--ink); font: 600 0.95rem var(--ui); padding: 0.35rem 0.8rem; color: var(--ink); cursor: pointer; }
.search-form { display: flex; }
.search-form__field { width: 9rem; border: 1.5px solid var(--ink); border-right: 0; background: var(--paper); padding: 0.4rem 0.6rem; font: 500 0.95rem var(--ui); color: var(--ink); border-radius: 2px 0 0 2px; }
.search-form__btn { border: 1.5px solid var(--ink); background: var(--ink); color: #fff; font: 600 0.9rem var(--ui); padding: 0.4rem 0.8rem; cursor: pointer; border-radius: 0 2px 2px 0; }
.search-form__btn:hover { background: var(--sea); border-color: var(--sea); }

@media (max-width: 52rem) {
	.nav-toggle { display: inline-block; }
	.site-header__in { flex-wrap: wrap; padding-block: 0.6rem; }
	.site-nav, .site-header .search-form { display: none; width: 100%; margin: 0; }
	.site-nav.is-open, .site-nav.is-open + .search-form { display: flex; }
	.site-nav ul { flex-direction: column; gap: 0.25rem; width: 100%; padding-block: 0.5rem; }
	.search-form__field { flex: 1; width: auto; }
}

/* ---------- Buttons and fields ---------- */
.btn { display: inline-block; font-family: var(--ui); font-weight: 650; font-size: 1rem; line-height: 1.2; padding: 0.8em 1.3em; border: 2px solid var(--ink); color: var(--ink); background: transparent; text-decoration: none; border-radius: 2px; cursor: pointer; }
.btn:hover { background: var(--ink); color: #fff; }
.btn-solid { background: var(--ink); color: #fff; }
.btn-solid:hover { background: var(--sea); border-color: var(--sea); }
.field { display: block; width: 100%; font: 500 1.05rem var(--ui); color: var(--ink); background: var(--paper); border: 1.5px solid var(--ink); border-radius: 2px; padding: 0.6em 0.75em; }
.label { display: block; font: 600 0.95rem var(--ui); margin-bottom: 0.35rem; }

/* ---------- Home hero ---------- */
.hero { position: relative; overflow: hidden; padding-block: clamp(2.5rem, 7vw, 5.5rem); border-bottom: 1px solid var(--line); }
.hero::before {
	content: "";
	position: absolute;
	inset: 0 0 0 38%;
	opacity: 0.55;
	pointer-events: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 360 360'%3E%3Cpolygon points='22,40 46,26 54,52 30,64' fill='%23c9dad7'/%3E%3Cpolygon points='120,18 140,30 128,52 108,40' fill='%239cc3bf'/%3E%3Cpolygon points='210,70 236,62 242,88 214,96' fill='%23e3efee'/%3E%3Cpolygon points='300,24 322,38 306,60 286,46' fill='%23f2d58a'/%3E%3Cpolygon points='70,130 98,118 108,146 78,158' fill='%23e3efee'/%3E%3Cpolygon points='170,150 188,140 202,162 182,178' fill='%23c9dad7'/%3E%3Cpolygon points='262,140 290,150 280,178 252,170' fill='%239cc3bf'/%3E%3Cpolygon points='330,120 350,134 336,152' fill='%23d6ddda'/%3E%3Cpolygon points='24,220 52,212 58,240 30,250' fill='%23c9dad7'/%3E%3Cpolygon points='118,232 134,222 148,244 128,258' fill='%23f2d58a'/%3E%3Cpolygon points='214,236 242,228 250,256 220,266' fill='%23e3efee'/%3E%3Cpolygon points='300,230 322,244 306,266 286,252' fill='%23c9dad7'/%3E%3Cpolygon points='60,310 84,300 94,326 66,338' fill='%239cc3bf'/%3E%3Cpolygon points='160,308 184,316 172,340 150,330' fill='%23d6ddda'/%3E%3Cpolygon points='262,312 288,306 296,334 268,342' fill='%23e3efee'/%3E%3C/svg%3E");
	background-size: 360px 360px;
}
.hero__grid { position: relative; display: grid; gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.hero__lead { font-size: 1.25rem; color: var(--muted); max-width: 32rem; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }
@media (min-width: 60rem) {
	.hero__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 27rem); align-items: center; }
}

/* ---------- Ledger (cost estimator and key facts) ---------- */
.ledger { background: var(--paper); border-top: 4px solid var(--ink); box-shadow: 0 1px 0 var(--line), 0 0 0 1px var(--line); padding: 1.25rem 1.25rem 1rem; font-family: var(--ui); }
.ledger__title { font-size: 1.15rem; font-weight: 700; margin: 0 0 0.9rem; }
.ledger__group { border: 0; padding: 0; margin: 0 0 1rem; }
.ledger__legend { font-weight: 600; font-size: 0.95rem; padding: 0; margin-bottom: 0.4rem; }
.ledger__choices { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.ledger__choice { position: relative; }
.ledger__choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.ledger__choice span { display: block; padding: 0.4rem 0.75rem; border: 1.5px solid var(--ink); font-weight: 600; font-size: 0.9rem; border-radius: 2px; background: var(--paper); }
.ledger__choice input:checked + span { background: var(--ink); color: #fff; }
.ledger__choice input:focus-visible + span { outline: 3px solid var(--sea); outline-offset: 2px; }
.ledger__price { display: grid; gap: 0.5rem; margin-bottom: 1rem; }
.ledger__range { width: 100%; accent-color: var(--sea); }
.ledger__rows { margin: 0; }
.ledger__row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.55rem 0; border-bottom: 1px dashed var(--line); }
.ledger__row dt { font-weight: 500; font-size: 0.97rem; }
.ledger__row dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger__note { display: block; font-weight: 400; font-size: 0.82rem; color: var(--muted); line-height: 1.3; }
.ledger__sum { border-bottom: 0; border-top: 2px solid var(--ink); margin-top: 0.15rem; }
.ledger__total { background: var(--ink); color: #fff; padding: 0.85rem 1rem; margin: 0.6rem -1.25rem 0; display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; border-bottom: 5px solid var(--sun); }
.ledger__total dt { font-weight: 600; }
.ledger__total dd { margin: 0; font-size: 1.6rem; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.ledger__fine { font-size: 0.8rem; color: var(--muted); line-height: 1.45; margin: 0.8rem 0 0; }
.ledger--facts { margin-block: 0 2rem; }
.ledger--facts .ledger__row dt { font-weight: 600; }
.ledger--facts .ledger__row dd { white-space: normal; text-align: right; font-weight: 500; font-size: 0.97rem; }

/* ---------- Home sections ---------- */
.countries { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.countries__link { display: grid; gap: 0.25rem 2rem; padding: 1.4rem 0.25rem; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.countries__link:hover { background: var(--sea-wash); color: var(--ink); }
.countries__name { font: 700 clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem)/1.1 var(--ui); letter-spacing: -0.025em; }
.countries__text { color: var(--muted); max-width: 40rem; margin: 0; }
.countries__count { font: 600 0.95rem var(--ui); color: var(--sea); }
@media (min-width: 52rem) {
	.countries__link { grid-template-columns: 16rem minmax(0, 1fr) auto; align-items: baseline; }
}

.rows { list-style: none; margin: 0; padding: 0; }
.row { padding: 1.25rem 0; border-bottom: 1px solid var(--line); }
.row:first-child { padding-top: 0; }
.row__title { font-size: 1.35rem; margin: 0 0 0.35rem; }
.row__title a { color: var(--ink); text-decoration: none; }
.row__title a:hover { color: var(--sea); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 0.18em; }
.row__excerpt { color: var(--muted); font-size: 1.05rem; margin: 0 0 0.4rem; max-width: 46rem; }
.meta { display: flex; flex-wrap: wrap; gap: 0.2rem 1.25rem; font: 500 0.9rem var(--ui); color: var(--muted); margin: 0; }

.about { background: var(--sea-wash); border-block: 1px solid var(--line); }
.about__text { font-size: 1.3rem; max-width: 42rem; margin: 0; }

/* ---------- Page and article ---------- */
.crumbs { font: 500 0.9rem var(--ui); color: var(--muted); padding-top: 1.5rem; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.15rem 0.5rem; margin: 0; padding: 0; }
.crumbs li + li::before { content: "/"; margin-right: 0.5rem; color: var(--line); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--sea); }

.entry-head { padding-block: 1rem 1.5rem; }
.entry-head h1 { max-width: 24ch; }
.answer { font-size: 1.35rem; line-height: 1.55; color: var(--ink); border-left: 5px solid var(--sea); padding-left: 1rem; margin: 1.25rem 0 1rem; max-width: 44rem; }
.byline { font-family: var(--ui); }
.byline strong { font-weight: 650; color: var(--ink); }
.disclosure { font: 400 0.85rem/1.5 var(--ui); color: var(--muted); max-width: 44rem; margin: 0.75rem 0 0; }
.entry-figure { margin: 0 0 2rem; }
.entry-figure img { display: block; width: 100%; }

.article-grid { display: grid; gap: 2rem; padding-bottom: 3rem; }
.toc-col:empty { display: none; }
@media (min-width: 70rem) {
	.article-grid { grid-template-columns: 12.5rem minmax(0, 42rem); justify-content: start; gap: 3rem; }
	.toc-col:empty { display: block; }
}
@media (min-width: 82rem) {
	.article-grid.has-sidebar { grid-template-columns: 12.5rem minmax(0, 40rem) 18.75rem; gap: 2.5rem; }
}
.toc { font-family: var(--ui); font-size: 0.95rem; }
.toc__box { border-top: 3px solid var(--ink); padding-top: 0.75rem; }
.toc summary { font-weight: 700; cursor: pointer; padding-block: 0.15rem; }
.toc ol { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.toc li { margin: 0; }
.toc a { display: block; padding: 0.3rem 0 0.3rem 0.75rem; border-left: 2px solid var(--line); color: var(--muted); text-decoration: none; line-height: 1.35; }
.toc a:hover { color: var(--ink); border-left-color: var(--ink); }
.toc a.is-active { color: var(--ink); border-left-color: var(--sea); font-weight: 600; }
.toc .toc__sub a { padding-left: 1.5rem; font-size: 0.9rem; }
@media (min-width: 70rem) {
	.toc { position: sticky; top: 5.5rem; align-self: start; max-height: calc(100vh - 7rem); overflow: auto; }
	.toc summary { pointer-events: none; }
}

.entry-content { min-width: 0; }
.entry-content > * { max-width: 100%; }
.entry-content h2 { margin-top: 2.4em; padding-top: 0.2em; }
.entry-content h3 { margin-top: 1.8em; }
.entry-content ul, .entry-content ol { padding-left: 1.4em; margin: 0 0 1.3em; }
.entry-content li { margin-bottom: 0.4em; }
.entry-content blockquote { margin: 1.5em 0; padding: 0.2em 0 0.2em 1.1rem; border-left: 4px solid var(--sun); font-style: italic; }
.entry-content table { width: 100%; border-collapse: collapse; font: 450 0.95rem/1.45 var(--ui); margin: 1.5em 0; display: block; overflow-x: auto; }
.entry-content th, .entry-content td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.entry-content thead th { border-bottom: 2px solid var(--ink); font-weight: 650; }
.entry-content img { height: auto; }
.entry-content figure { margin: 1.5em 0; }
.entry-content figcaption { font: 400 0.85rem var(--ui); color: var(--muted); margin-top: 0.4rem; }
.entry-content .wp-block-button__link { font-family: var(--ui); font-weight: 650; border-radius: 2px; }

.notice { font: 500 1rem/1.5 var(--ui); background: var(--paper); border-left: 5px solid var(--alert); padding: 0.9rem 1rem; margin: 1.5em 0; }

.sidebar { display: none; min-width: 0; }
.sidebar__sticky { position: sticky; top: 5.5rem; }
@media (min-width: 82rem) { .sidebar { display: block; } }

/* ---------- Ads (space is reserved so the page never jumps) ---------- */
.ad-slot { margin: 2rem 0; text-align: center; }
.ad-slot__label { display: block; font: 500 0.75rem var(--ui); color: var(--muted); margin-bottom: 0.25rem; }
.ad-slot__box { min-height: 280px; background: transparent; }
.ad-slot--sidebar .ad-slot__box { min-height: 600px; }

/* ---------- Author, related, comments ---------- */
.author { display: flex; gap: 1rem; align-items: flex-start; border-top: 2px solid var(--ink); padding-top: 1.25rem; margin-top: 3rem; font-family: var(--ui); }
.author img { border-radius: 50%; flex: none; }
.author__name { font-weight: 700; margin: 0 0 0.25rem; }
.author__bio { font-size: 0.98rem; color: var(--muted); margin: 0; line-height: 1.55; }
.related { margin-top: 3rem; }
.comments { margin-top: 3rem; font-family: var(--ui); }
.comments ol { list-style: none; padding: 0; }
.comments .comment-body { border-top: 1px solid var(--line); padding: 1rem 0; }
.comments textarea, .comments input[type="text"], .comments input[type="email"], .comments input[type="url"] { width: 100%; font: 500 1rem var(--ui); border: 1.5px solid var(--ink); border-radius: 2px; padding: 0.55rem 0.7rem; background: var(--paper); }
.comments .submit { font: 650 1rem var(--ui); background: var(--ink); color: #fff; border: 2px solid var(--ink); padding: 0.7em 1.3em; border-radius: 2px; cursor: pointer; }

/* ---------- Archives ---------- */
.archive-head { padding-block: 2rem 1.5rem; max-width: 50rem; }
.archive-head__text { font-size: 1.25rem; color: var(--muted); }
.subnav { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; padding: 0; margin: 1rem 0 0; font-family: var(--ui); }
.subnav a { display: block; padding: 0.35rem 0.8rem; border: 1.5px solid var(--ink); text-decoration: none; color: var(--ink); font-weight: 600; font-size: 0.92rem; border-radius: 2px; }
.subnav a:hover { background: var(--ink); color: #fff; }
.pagination { font-family: var(--ui); margin-top: 2rem; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pagination a, .pagination span { padding: 0.4rem 0.8rem; border: 1.5px solid var(--ink); text-decoration: none; color: var(--ink); font-weight: 600; border-radius: 2px; }
.pagination .current { background: var(--ink); color: #fff; }

/* ---------- Newsletter and footer ---------- */
.signup { background: var(--sea-wash); border-top: 1px solid var(--line); }
.signup__in { display: grid; gap: 1.5rem; align-items: center; padding-block: 2.5rem; }
.signup__title { font-size: 1.6rem; margin: 0 0 0.3rem; }
.signup__text { margin: 0; color: var(--muted); }
.signup__form { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.signup__form .field { flex: 1 1 14rem; width: auto; }
@media (min-width: 52rem) { .signup__in { grid-template-columns: 1fr 1fr; } }

.site-footer { background: var(--ink); color: #dfe8e6; font-family: var(--ui); font-size: 0.95rem; }
.site-footer a { color: #fff; }
.site-footer__in { display: grid; gap: 2rem; padding-block: 2.5rem; }
.site-footer__brand { font-weight: 800; font-size: 1.3rem; letter-spacing: -0.03em; color: #fff; margin: 0 0 0.4rem; }
.site-footer__text { margin: 0; max-width: 30rem; line-height: 1.55; color: #c3d2cf; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1.5rem; }
.site-footer__small { border-top: 1px solid #284149; padding-block: 1.25rem; color: #a9bdb9; font-size: 0.85rem; }
@media (min-width: 52rem) { .site-footer__in { grid-template-columns: 1.4fr 1fr; } }

/* ---------- 404 ---------- */
.notfound { padding-block: 4rem; max-width: 40rem; }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	* { transition: none !important; animation: none !important; }
}
