/*
Theme Name: Aff Base
Description: Parent theme for the buying-guide sites. Child themes set the palette, type and art.
Version: 1.0.0
Requires PHP: 8.0
Text Domain: aff-base
*/

/* ---------- Tokens (child themes override these) ---------- */
:root {
	--bg: #fbfaf7;
	--surface: #ffffff;
	--surface-2: #f2efe8;
	--ink: #1c1d1f;
	--ink-2: #3d4046;
	--muted: #6b6f76;
	--line: #e3dfd6;
	--accent: #2f6b4f;
	--accent-ink: #ffffff;
	--accent-soft: #e4efe8;
	--accent-2: #c9862c;
	--accent-2-ink: #ffffff;
	--good: #2f7a4b;
	--bad: #b2402f;
	--radius: 14px;
	--radius-sm: 8px;
	--shadow: 0 1px 2px rgba(20, 20, 20, .04), 0 8px 24px rgba(20, 20, 20, .06);
	--font-display: Georgia, "Times New Roman", serif;
	--font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--display-weight: 700;
	--display-tracking: -0.01em;
	--wrap: 1180px;
	--narrow: 760px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.65 var(--font-body); -webkit-font-smoothing: antialiased; }
img, svg { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: var(--display-weight); letter-spacing: var(--display-tracking); line-height: 1.18; color: var(--ink); margin: 0 0 .5em; }
p { margin: 0 0 1em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 6px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.wrap--narrow { max-width: calc(var(--narrow) + 48px); }
.kicker { font: 600 12.5px/1.2 var(--font-body); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 0 0 14px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 999px; font: 600 15.5px/1 var(--font-body); text-decoration: none; transition: transform .15s, background .15s, color .15s, border-color .15s; }
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { filter: brightness(1.06); }
.btn--ghost { border: 1.5px solid var(--ink); color: var(--ink); }
.btn--ghost:hover { background: var(--ink); color: var(--bg); }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand__mark { display: inline-flex; width: 36px; height: 36px; color: var(--accent); }
.brand__mark svg { width: 100%; height: 100%; }
.brand__name { font: var(--display-weight) 20px/1 var(--font-display); letter-spacing: var(--display-tracking); }
.nav__list { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; flex-wrap: wrap; }
.nav__list a { display: block; padding: 9px 13px; border-radius: 999px; color: var(--ink-2); font-size: 15px; font-weight: 500; text-decoration: none; }
.nav__list a:hover, .nav__list .current-menu-item a { background: var(--surface-2); color: var(--ink); }
.nav-toggle { display: none; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; position: relative; }
.nav-toggle__bar, .nav-toggle__bar::before, .nav-toggle__bar::after { position: absolute; left: 12px; right: 12px; height: 2px; background: var(--ink); border-radius: 2px; content: ""; }
.nav-toggle__bar { top: 21px; }
.nav-toggle__bar::before { top: -6px; left: 0; right: 0; }
.nav-toggle__bar::after { top: 6px; left: 0; right: 0; }

/* ---------- Hero ---------- */
.hero { padding: 64px 0 56px; border-bottom: 1px solid var(--line); background: radial-gradient(1200px 400px at 85% -10%, var(--accent-soft), transparent 70%); }
.hero__inner { display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center; }
.hero__title { font-size: clamp(36px, 5vw, 60px); margin-bottom: 18px; }
.hero__text { font-size: 19px; color: var(--ink-2); max-width: 34em; margin-bottom: 28px; }
.hero__actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero__art svg { width: 100%; height: auto; display: block; }
.hero-center .hero__inner { grid-template-columns: 1fr; text-align: center; }
.hero-center .hero__text { margin-left: auto; margin-right: auto; }
.hero-center .hero__actions { justify-content: center; }
.hero-center .hero__art { width: 100%; max-width: 760px; margin: 8px auto 0; }

/* ---------- Sections ---------- */
.section { padding: 56px 0; }
.section + .section { padding-top: 8px; }
.section__head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.section__head h2 { font-size: clamp(26px, 3vw, 34px); margin: 0; }

.silos__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.silo { display: flex; flex-direction: column; gap: 6px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; transition: transform .15s, box-shadow .15s, border-color .15s; }
.silo:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: transparent; }
.silo__icon { width: 48px; height: 48px; color: var(--accent); margin-bottom: 6px; }
.silo__icon svg { width: 100%; height: 100%; }
.silo__name { font: var(--display-weight) 19px/1.2 var(--font-display); }
.silo__count { font-size: 14px; color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.cards--feature .card--lg { grid-column: span 1; }
.cards--feature { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.cards--feature .card { grid-column: span 2; }
.cards--feature .card--lg { grid-column: span 3; }
.card__link { display: flex; flex-direction: column; gap: 10px; height: 100%; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; transition: transform .15s, box-shadow .15s, border-color .15s; }
.card__link:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: transparent; }
.card__icon { width: 40px; height: 40px; color: var(--accent); }
.card__icon svg { width: 100%; height: 100%; }
.card__meta { font-size: 12.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.card__title { font: var(--display-weight) 20px/1.25 var(--font-display); letter-spacing: var(--display-tracking); }
.card--lg .card__title { font-size: 25px; }
.card--lg .card__link { padding: 28px; background: linear-gradient(160deg, var(--accent-soft), var(--surface) 60%); }
.card__excerpt { color: var(--ink-2); font-size: 15.5px; }
.card__more { margin-top: auto; font-size: 14.5px; font-weight: 600; color: var(--accent); }

.teaser__inner { display: grid; grid-template-columns: .9fr 1.1fr; gap: 40px; align-items: center; padding: 40px; background: var(--surface-2); border-radius: calc(var(--radius) * 1.6); }
.teaser__art svg { width: 100%; height: auto; display: block; }
.teaser__copy h2 { font-size: clamp(26px, 3vw, 34px); }

.promise__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.promise__item { padding: 24px; border-top: 3px solid var(--accent); background: var(--surface); border-radius: 0 0 var(--radius) var(--radius); }
.promise__item h3 { font-size: 19px; }
.promise__item p { color: var(--ink-2); margin: 0; font-size: 15.5px; }

/* ---------- Silo page ---------- */
.silo-head { padding: 44px 0 36px; border-bottom: 1px solid var(--line); background: radial-gradient(900px 300px at 90% -20%, var(--accent-soft), transparent 70%); }
.silo-head__icon { display: block; width: 64px; height: 64px; color: var(--accent); margin: 18px 0 12px; }
.silo-head h1 { font-size: clamp(32px, 4.5vw, 50px); }
.silo-head__intro { font-size: 18px; color: var(--ink-2); }
.crumbs { font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }

/* ---------- Article ---------- */
.article__head { padding: 40px 0 28px; border-bottom: 1px solid var(--line); }
.article__head .kicker { margin-top: 22px; }
.article__title { font-size: clamp(32px, 4.4vw, 50px); margin-bottom: 14px; }
.article__meta { font-size: 14.5px; color: var(--muted); margin: 0; }
.article__layout { display: grid; grid-template-columns: 250px minmax(0, var(--narrow)); gap: 56px; justify-content: center; padding-top: 36px; padding-bottom: 32px; }
.article__sticky { position: sticky; top: 92px; }
.aff-toc { font-size: 14px; }
.aff-toc__title { font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.aff-toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.aff-toc li a { display: block; padding: 6px 0 6px 14px; margin-left: -2px; border-left: 2px solid transparent; color: var(--ink-2); text-decoration: none; line-height: 1.35; }
.aff-toc li a:hover { color: var(--ink); }
.aff-toc li a.is-active { border-left-color: var(--accent); color: var(--ink); font-weight: 600; }

/* ---------- Prose ---------- */
.prose { font-size: 18px; line-height: 1.72; }
.prose > h1:first-child { display: none; } /* the template prints the title */
.prose h2 { font-size: clamp(25px, 2.6vw, 31px); margin: 2.1em 0 .6em; }
.prose h3 { font-size: 22px; margin: 1.8em 0 .5em; }
.prose h4 { font-size: 18px; margin: 1.5em 0 .4em; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1.2em; }
.prose li { margin: .35em 0; }
.prose li::marker { color: var(--accent); }
.prose strong { color: var(--ink); }
.prose blockquote { margin: 1.5em 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--accent); color: var(--ink-2); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.2em 0; }
.table-wrap { margin: 1.4em 0 1.8em; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); -webkit-overflow-scrolling: touch; }
.prose table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 15px; line-height: 1.45; }
.prose th, .prose td { padding: 11px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.prose th { background: var(--surface-2); font-weight: 700; color: var(--ink); white-space: nowrap; position: relative; }
.prose tr:last-child td { border-bottom: 0; }
.prose tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.prose td:first-child { font-weight: 600; color: var(--ink); }

.aff-disclosure { font-size: 14px; line-height: 1.5; color: var(--muted); padding: 12px 16px; background: var(--surface-2); border-radius: var(--radius-sm); margin-bottom: 1.6em; }
.aff-disclosure a { color: inherit; }

/* Quick picks */
.quick-picks { margin: 1em 0 2em; padding: 6px 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.quick-picks ul { list-style: none; margin: 0; padding: 0; }
.quick-picks li { margin: 0; padding: 14px 20px; border-bottom: 1px solid var(--line); font-size: 16px; line-height: 1.5; }
.quick-picks li:last-child { border-bottom: 0; }
.quick-picks li strong { display: block; font-family: var(--font-display); font-size: 18px; color: var(--ink); }

/* Pros and cons */
.proscons { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 1.2em 0 1.4em; }
.proscons__col { padding: 16px 18px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); }
.proscons__title { font: 700 13px/1 var(--font-body); letter-spacing: .1em; text-transform: uppercase; margin: 0 0 10px; }
.proscons__col--pros .proscons__title { color: var(--good); }
.proscons__col--cons .proscons__title { color: var(--bad); }
.proscons ul { list-style: none; margin: 0; padding: 0; font-size: 15.5px; line-height: 1.5; }
.proscons li { position: relative; padding-left: 22px; margin: 6px 0; }
.proscons__col--pros li::before { content: "+"; position: absolute; left: 0; font-weight: 700; color: var(--good); }
.proscons__col--cons li::before { content: "–"; position: absolute; left: 2px; font-weight: 700; color: var(--bad); }

/* Product box */
.aff-product { display: grid; grid-template-columns: 64px 1fr auto; gap: 18px; align-items: center; margin: 1.4em 0 2em; padding: 18px 20px; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.aff-product__icon { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft); color: var(--accent); padding: 10px; }
.aff-product__icon svg { width: 100%; height: 100%; }
.aff-product__badge { display: inline-block; font: 700 11.5px/1 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); background: var(--accent); padding: 5px 9px; border-radius: 999px; margin-bottom: 7px; }
.aff-product__name { font: var(--display-weight) 18px/1.3 var(--font-display); margin: 0; color: var(--ink); }
.aff-product__brand { margin: 3px 0 0; font-size: 14px; color: var(--muted); }
.aff-product__btn, .aff-cta__btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 20px; border-radius: 999px; background: var(--accent-2); color: var(--accent-2-ink, #fff); font: 700 15px/1 var(--font-body); text-decoration: none; white-space: nowrap; transition: filter .15s, transform .15s; }
.aff-product__btn:hover, .aff-cta__btn:hover { filter: brightness(1.07); transform: translateY(-1px); }

.aff-cta { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 1.6em 0; padding: 18px 20px; border-left: 4px solid var(--accent-2); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; box-shadow: var(--shadow); }
.aff-cta__text { display: flex; flex-direction: column; gap: 3px; font-size: 15.5px; line-height: 1.45; }
.aff-cta__label { font: 700 11.5px/1 var(--font-body); letter-spacing: .1em; text-transform: uppercase; color: var(--accent-2); }
.aff-cta strong { font-family: var(--font-display); font-size: 18px; }

/* Product box with an Amazon photo (PA-API) */
.aff-product--photo { grid-template-columns: 132px 1fr auto; }
.aff-product__photo { display: grid; place-items: center; width: 132px; height: 132px; padding: 8px; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
.aff-product__photo img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.aff-product__price { margin: 6px 0 0; font: 700 17px/1.3 var(--font-body); color: var(--ink); }
.aff-product__asof { display: inline; font: 400 12px/1.3 var(--font-body); color: var(--muted); cursor: help; }
@media (max-width: 760px) {
	.aff-product--photo { grid-template-columns: 96px 1fr; }
	.aff-product__photo { width: 96px; height: 96px; }
}

/* Product-type illustration (until the Amazon photo is available) */
.aff-product:has(.aff-product__icon--art) { grid-template-columns: 132px 1fr auto; }
.aff-product__icon--art { width: 132px; height: 132px; padding: 10px; background: var(--surface-2); color: var(--ink); }
.aff-product__icon--art svg { width: 100%; height: 100%; }
@media (max-width: 760px) {
	.aff-product:has(.aff-product__icon--art) { grid-template-columns: 96px 1fr; }
	.aff-product__icon--art { width: 96px; height: 96px; }
}

/* FAQ */
.faq { margin: 1em 0 2em; border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; list-style: none; padding: 18px 40px 18px 0; position: relative; font: var(--display-weight) 19px/1.35 var(--font-display); color: var(--ink); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 6px; top: 14px; font: 400 26px/1 var(--font-body); color: var(--accent); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq__a { padding: 0 0 18px; color: var(--ink-2); }
.faq__a p:last-child { margin: 0; }

/* Shared sortable/filterable table */
.aff-tablefilter__bar { display: flex; gap: 10px; align-items: center; margin: 1.2em 0 -0.6em; flex-wrap: wrap; }
.aff-tablefilter__bar input { flex: 1 1 220px; min-height: 44px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 999px; font: inherit; font-size: 15px; background: var(--surface); color: var(--ink); }
.aff-tablefilter__bar span { font-size: 13.5px; color: var(--muted); }
.prose th[data-sort] { cursor: pointer; padding-right: 26px; }
.prose th[data-sort]::after { content: "↕"; position: absolute; right: 9px; opacity: .35; font-size: 12px; }
.prose th[data-sort="asc"]::after { content: "↑"; opacity: 1; }
.prose th[data-sort="desc"]::after { content: "↓"; opacity: 1; }

/* Tools (child themes style their own internals) */
.aff-tool { margin: 1.6em 0 2em; padding: 22px; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.aff-tool h3 { margin-top: 0; }
.aff-tool label { display: block; font-size: 14px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.aff-tool select, .aff-tool input:not([type="checkbox"]):not([type="radio"]):not([type="range"]) { width: 100%; min-height: 44px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); font: inherit; font-size: 16px; background: var(--bg); color: var(--ink); }
.aff-tool__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 16px; }
.aff-tool__result { padding: 16px 18px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--ink); font-size: 16px; }
.aff-tool__result strong { font-family: var(--font-display); font-size: 22px; }

.prose .aff-tool table { min-width: 0; }
/* Tools own their lists: undo article list styling inside them */
.prose .aff-tool ul, .prose .aff-tool ol { list-style: none; padding-left: 0; margin: 0; }
.prose .aff-tool li { margin: 0; }
.prose .aff-tool li::marker { content: none; }

/* ---------- Simple pages ---------- */
.page-simple { padding: 48px 0 64px; }

/* ---------- Related ---------- */
.related { border-top: 1px solid var(--line); padding-top: 48px; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 48px; background: var(--ink); color: color-mix(in srgb, var(--bg) 78%, transparent); padding: 56px 0 28px; font-size: 15px; }
.site-footer a { color: inherit; text-decoration: none; display: block; padding: 4px 0; }
.site-footer a:hover { color: var(--bg); }
.site-footer__grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 40px; }
.site-footer .brand { color: var(--bg); display: inline-flex; margin-bottom: 14px; }
.site-footer .brand__mark { color: var(--accent-2); }
.site-footer__title { font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: 12px; color: var(--bg); margin-bottom: 10px; }
.site-footer__legal { margin-top: 40px; padding-top: 22px; border-top: 1px solid rgba(255, 255, 255, .12); font-size: 13px; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.site-footer__legal p { margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
	.article__layout { grid-template-columns: minmax(0, var(--narrow)); }
	.article__aside { display: none; }
}
@media (max-width: 900px) {
	.hero__inner, .teaser__inner { grid-template-columns: 1fr; }
	.hero__art { max-width: 520px; }
	.cards, .promise__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.cards--feature { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.cards--feature .card, .cards--feature .card--lg { grid-column: span 1; }
	.site-footer__grid { grid-template-columns: 1fr 1fr; }
	.site-footer__about { grid-column: 1 / -1; }
}
@media (max-width: 1120px) {
	.nav-toggle { display: inline-block; }
	.nav { position: absolute; left: 0; right: 0; top: 100%; background: var(--bg); border-bottom: 1px solid var(--line); padding: 10px 24px 18px; display: none; box-shadow: var(--shadow); }
	.nav.is-open { display: block; }
	.nav__list { flex-direction: column; }
	.nav__list a { padding: 12px 10px; font-size: 16px; }
}
@media (max-width: 760px) {
	body { font-size: 16.5px; }
	.wrap { padding: 0 16px; }
	.nav { padding: 10px 16px 18px; }
	.hero { padding: 40px 0; }
	.hero__text { font-size: 17.5px; }
	.section { padding: 40px 0; }
	.cards, .cards--feature, .promise__grid { grid-template-columns: 1fr; }
	.teaser__inner { padding: 24px; }
	.prose { font-size: 17px; }
	.proscons { grid-template-columns: 1fr; }
	.aff-product { grid-template-columns: 52px 1fr; }
	.aff-product__icon { width: 52px; height: 52px; padding: 8px; }
	.aff-product__btn { grid-column: 1 / -1; width: 100%; }
	.aff-cta { flex-direction: column; align-items: stretch; }
	.aff-cta__btn { width: 100%; }
	.site-footer__grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; scroll-behavior: auto !important; }
}
