/*
Theme Name: Kitchenote
Theme URI: https://kitchenote.com
Author: Kitchenote
Description: Lightweight block theme for Kitchenote — backyard smoking, grilling and blending guides. No page builder, self-hosted fonts, AdSense-ready layout.
Version: 1.0.0
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 8.1
License: GPL-2.0-or-later
Text Domain: kitchenote
*/

/* ---- base ---- */
html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img { height: auto; }
a { text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--wp--preset--color--ember); outline-offset: 2px; }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 1rem; top: 1rem; z-index: 100; background: #fff; padding: .5rem 1rem; }

/* ---- header ---- */
.kn-header { border-bottom: 1px solid var(--wp--preset--color--line); background: #fff; }
.kn-logo { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; }
.kn-logo svg { width: 28px; height: 28px; flex: none; }
.kn-logo .wp-block-site-title { margin: 0; }
.kn-logo .wp-block-site-title a { text-decoration: none; }
.kn-header .wp-block-navigation a { text-decoration: none; font-weight: 500; }
.kn-header .wp-block-navigation a:hover { color: var(--wp--preset--color--ember-dark); }

/* ---- hero + tiles ---- */
.kn-badge { display: inline-block; padding: 4px 12px; border-radius: 999px; background: #FAECE7; color: var(--wp--preset--color--ember-dark); font-size: .8125rem; font-weight: 600; letter-spacing: .01em; }
.kn-tiles { gap: 1rem; }
.kn-tile { background: var(--wp--preset--color--surface); border-radius: 10px; padding: 1.25rem; text-align: center; transition: transform .15s ease; }
.kn-tile:hover { transform: translateY(-2px); }
.kn-tile a { text-decoration: none; font-weight: 600; color: var(--wp--preset--color--heading); display: block; }
.kn-tile svg { width: 36px; height: 36px; margin-bottom: .5rem; color: var(--wp--preset--color--ember); }
.kn-tile.is-blending svg { color: var(--wp--preset--color--teal); }
.kn-tiles.wp-block-columns { flex-wrap: wrap; }
.kn-tiles.wp-block-columns > .wp-block-column { min-width: 0; }
/* WordPress sets flex-basis:0 on non-stacking columns; override so tiles go 2x2 on phones */
@media (max-width: 781px) { .wp-block-columns.is-not-stacked-on-mobile.kn-tiles { flex-wrap: wrap !important; } .wp-block-columns.is-not-stacked-on-mobile.kn-tiles > .wp-block-column { flex-basis: calc(50% - .5rem) !important; flex-grow: 0; } }
.kn-tile { padding: 1rem .5rem; box-sizing: border-box; }

/* ---- cards (query loop) ---- */
.kn-card { background: #fff; border: 1px solid var(--wp--preset--color--line); border-radius: 10px; overflow: hidden; height: 100%; }
.kn-card .wp-block-post-featured-image { margin: 0; }
.kn-card .wp-block-post-featured-image img { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; }
.kn-card-body { padding: 1rem 1.1rem 1.25rem; }
.kn-card .wp-block-post-title a { text-decoration: none; color: var(--wp--preset--color--heading); }
.kn-card .wp-block-post-title a:hover { color: var(--wp--preset--color--ember-dark); }
.kn-cat a, .kn-cat { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; text-decoration: none; color: var(--wp--preset--color--ember-text); }
.kn-cat a[rel~="tag"][href*="/blending"] { color: var(--wp--preset--color--teal-text); }

/* ---- single ---- */
.kn-crumbs { font-size: .8125rem; color: var(--wp--preset--color--muted); }
.kn-crumbs a { color: inherit; }
.kn-meta { font-size: .875rem; color: var(--wp--preset--color--muted); }
.kn-meta a { color: inherit; }
.entry-content > * + * { margin-block-start: 1.25em; }
.entry-content h2 { margin-block-start: 2em; }
.entry-content table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.entry-content th, .entry-content td { border: 1px solid var(--wp--preset--color--line); padding: .6rem .75rem; text-align: left; }
.entry-content thead th { background: var(--wp--preset--color--surface); }
.entry-content figure.wp-block-table { overflow-x: auto; }
.kn-author { background: var(--wp--preset--color--surface); border-radius: 10px; padding: 1.25rem; }
.kn-disclosure { font-size: .8125rem; color: var(--wp--preset--color--muted); border-left: 3px solid var(--wp--preset--color--ember); padding-left: .75rem; }

/* ---- footer ---- */
.kn-footer { background: var(--wp--preset--color--charcoal); color: #D3D1C7; }
.kn-footer a { color: #fff; text-decoration: none; }
.kn-footer a:hover { text-decoration: underline; }
.kn-footer h2, .kn-footer h3 { color: #fff; }

/* ---- ad slots (reserved space = no layout shift) ---- */
.kn-ad { margin: 2rem auto; text-align: center; min-height: 280px; contain: layout; }
.kn-ad::before { content: "Advertisement"; display: block; font-size: .6875rem; letter-spacing: .08em; text-transform: uppercase; color: var(--wp--preset--color--muted); margin-bottom: .25rem; }
.kn-ad--placeholder { background: repeating-linear-gradient(45deg, #faf9f6, #faf9f6 10px, #f3f1ec 10px, #f3f1ec 20px); border: 1px dashed #c9c6bb; display: flex; align-items: center; justify-content: center; color: #8a8778; font-size: .8125rem; }

/* ---- table of contents ---- */
.kn-toc { background: var(--wp--preset--color--surface); border: 1px solid var(--wp--preset--color--line); border-radius: 10px; padding: 1rem 1.25rem; margin-block: 1.5rem; }
.kn-toc summary { cursor: pointer; font-weight: 600; color: var(--wp--preset--color--heading); }
.kn-toc ol { margin: .75rem 0 0; padding-left: 1.25rem; }
.kn-toc li { margin: .25rem 0; }
.kn-toc a { text-decoration: none; }
.kn-toc a:hover { text-decoration: underline; }
.entry-content h2[id] { scroll-margin-top: 1rem; }

/* ---- contact form ---- */
.kn-form { max-width: 560px; }
.kn-form label { display: block; font-weight: 600; margin-bottom: .25rem; color: var(--wp--preset--color--heading); }
.kn-form input[type=text], .kn-form input[type=email], .kn-form textarea { width: 100%; padding: .7rem .8rem; border: 1px solid #cfccc1; border-radius: 8px; font: inherit; background: #fff; }
.kn-form input:focus, .kn-form textarea:focus { border-color: var(--wp--preset--color--ember); outline: none; box-shadow: 0 0 0 3px #FAECE7; }
.kn-hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }
.kn-form-note { padding: .75rem 1rem; border-radius: 8px; max-width: 560px; }
.kn-form-ok { background: #E6F5EE; color: #0F6E56; }
.kn-form-err { background: #FCEBE6; color: #993C1D; }

/* ---- reserved ad heights (per slot, no layout shift) ---- */
.kn-ad--in1, .kn-ad--in2, .kn-ad--in3, .kn-ad--end { min-height: 280px; }
@media (min-width: 782px) { .kn-ad--in1, .kn-ad--in2, .kn-ad--in3, .kn-ad--end { min-height: 120px; } }

/* ---- accessibility: touch-friendly footer links, AA-safe text colours ---- */
.kn-footer p a { display: inline-block; padding: .4rem 0; }
.kn-badge { color: var(--wp--preset--color--ember-dark); }

/* ---- wide comparison tables: keep columns readable on phones and let the table scroll sideways ---- */
.entry-content figure.wp-block-table table { table-layout: auto; }
.entry-content figure.wp-block-table table:has(th:nth-child(4)) { min-width: 40rem; }
.entry-content figure.wp-block-table { -webkit-overflow-scrolling: touch; }

/* ---- forms: padding and border must not make fields wider than their container ---- */
.kn-form, .kn-form * { box-sizing: border-box; }
.kn-form input[type=text], .kn-form input[type=email], .kn-form textarea { max-width: 100%; }
.search-form input, .wp-block-search__input { max-width: 100%; box-sizing: border-box; }
