/* WagTrove — minimalist, fast, readable */
:root {
  --bg: #fbf8f3;
  --surface: #ffffff;
  --text: #1f1b16;
  --muted: #6b6359;
  --line: #ebe4d8;
  --accent: #b4531a;
  --accent-ink: #8f3f10;
  --chip: #f3ece1;
  --radius: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.65 var(--sans); text-rendering: optimizeLegibility; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; letter-spacing: -0.01em; font-weight: 700; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.wrap-narrow { max-width: 720px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.sr { 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(--text); color: var(--bg); padding: 8px 14px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 8px; font: 700 21px var(--serif); text-decoration: none; color: var(--text); }
.logo svg { color: var(--accent); }
.logo.small { font-size: 19px; }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 20px; font-size: 15px; }
.site-nav a { text-decoration: none; color: var(--muted); white-space: nowrap; }
.site-nav a:hover { color: var(--text); }
.nav-search input { width: 170px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; font-size: 14px; }
.menu-toggle { display: none; margin-left: auto; background: none; border: 0; color: var(--text); padding: 8px; cursor: pointer; }

/* Home */
.hero { padding: 64px 20px 36px; max-width: 820px; }
.hero h1 { font-size: clamp(32px, 5vw, 52px); margin: 0 0 14px; }
.lead { font-size: 19px; color: var(--muted); margin: 0 0 22px; max-width: 640px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 6px 14px; background: var(--chip); border-radius: 999px; font-size: 14px; text-decoration: none; }
.chip:hover { background: var(--accent); color: #fff; }
.page-head { padding: 48px 20px 24px; }
.page-head h1 { font-size: clamp(30px, 4vw, 44px); margin: 6px 0 10px; }
.section-title { font-size: 24px; margin: 48px 0 20px; }
.featured { display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; align-items: center; margin-top: 12px; }
.featured-img img, .card-img img { width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: var(--radius); background: var(--chip); }
.featured h2 { font-size: clamp(26px, 3vw, 36px); margin: 8px 0 12px; }
.featured h2 a, .card h3 a { text-decoration: none; }
.kicker { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); text-decoration: none; font-weight: 600; }
.meta { font-size: 14px; color: var(--muted); margin: 0; }
.meta a { color: inherit; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 36px 28px; }
.card { display: flex; flex-direction: column; gap: 14px; }
.card-body h3 { font-size: 21px; margin: 6px 0 8px; }
.card-body p { margin: 0 0 10px; color: var(--muted); font-size: 16px; }
.card-body .meta { margin: 0; }
.card:hover h3 a { color: var(--accent); }
.empty { padding: 40px 0; color: var(--muted); font-size: 18px; }
.pagination { display: flex; justify-content: space-between; align-items: center; margin: 48px 0 0; padding-top: 24px; border-top: 1px solid var(--line); font-size: 15px; color: var(--muted); }
.pagination a { color: var(--text); font-weight: 600; text-decoration: none; }

/* Search */
.big-search { display: flex; gap: 8px; max-width: 520px; margin-top: 18px; }
.page-head.center .big-search { margin: 18px auto 0; }
.big-search input { flex: 1; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; font: inherit; background: var(--surface); color: var(--text); }
.big-search button { padding: 12px 20px; border: 0; border-radius: 12px; background: var(--text); color: var(--bg); font: inherit; font-weight: 600; cursor: pointer; }
.big-404 { font: 700 88px/1 var(--serif); color: var(--accent); margin: 0; }

/* Post */
.crumbs { font-size: 14px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs a { color: inherit; text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.post-head { padding: 44px 0 24px; }
.post-head h1 { font-size: clamp(32px, 5vw, 46px); margin: 12px 0 16px; }
.post-head .lead { margin-bottom: 18px; }
.post-hero { margin: 0 -20px 32px; }
.post-hero img { width: 100%; border-radius: var(--radius); }
.toc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 22px; margin: 0 0 32px; font-size: 16px; }
.toc summary { font-weight: 700; cursor: pointer; }
.toc ol { margin: 12px 0 2px; padding-left: 20px; }
.toc li { margin: 4px 0; }
.toc a { text-decoration: none; color: var(--muted); }
.toc a:hover { color: var(--accent); }
.prose { font-size: 18.5px; line-height: 1.75; }
.prose > * + * { margin-top: 1.1em; }
.prose p { margin: 0; }
.prose h2 { font-size: 30px; margin: 1.8em 0 .5em; }
.prose h3 { font-size: 23px; margin: 1.5em 0 .4em; }
.prose h4 { font-size: 19px; margin: 1.3em 0 .3em; font-family: var(--sans); }
.prose a { color: var(--accent-ink); text-decoration-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.prose ul, .prose ol { padding-left: 1.3em; margin-bottom: 0; }
.prose li + li { margin-top: .4em; }
.prose li::marker { color: var(--accent); }
.prose blockquote { margin-left: 0; margin-right: 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--accent); font-family: var(--serif); font-size: 21px; font-style: italic; color: var(--muted); }
.prose figure { margin-left: 0; margin-right: 0; }
.prose img { border-radius: 10px; margin: 0 auto; }
.prose figcaption { font-size: 14px; color: var(--muted); text-align: center; margin-top: 8px; }
.prose iframe { width: 100%; aspect-ratio: 16/9; height: auto; border: 0; border-radius: 10px; }
.prose hr { border: 0; text-align: center; margin: 2.2em 0; }
.prose hr::after { content: "🐾 🐾 🐾"; color: var(--muted); letter-spacing: .4em; font-size: 14px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 16px; display: block; overflow-x: auto; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 10px 12px; text-align: left; }
.prose th { background: var(--chip); }
.prose code { background: var(--chip); padding: 2px 6px; border-radius: 5px; font-size: .9em; }
.prose mark { background: #fde7c8; color: inherit; padding: 0 3px; }
.share { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 44px 0 0; padding-top: 22px; border-top: 1px solid var(--line); font-size: 15px; }
.share span { color: var(--muted); }
.share a, .share button { padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.share a:hover, .share button:hover { border-color: var(--accent); color: var(--accent); }
.author-box { display: flex; gap: 16px; margin: 28px 0 0; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.avatar { flex: none; width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font: 700 22px var(--serif); }
.author-box p { margin: 0; font-size: 16px; color: var(--muted); }
.author-box .author-name { color: var(--text); font-weight: 700; margin-bottom: 4px; }
.related { margin-top: 24px; }
.preview-bar { background: #fff3cd; color: #5c4400; text-align: center; padding: 10px; font-size: 14px; }

/* Ads — space is reserved so ads loading in don't shift the text (CLS) */
.ad { display: block; margin: 2.2em auto; text-align: center; overflow: hidden; }
.ad-label { display: block; font: 600 11px var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.ad-ad-in-article, .ad-ad-below-post { min-height: 280px; }
.prose > .ad { margin: 2em 0; }
.grid > .ad-ad-in-feed { grid-column: 1 / -1; min-height: 130px; margin: 0; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
@media (max-width: 760px) { .ad-ad-in-article, .ad-ad-below-post { min-height: 300px; } }
@media print { .ad { display: none; } }

/* Footer */
.site-footer { margin-top: 96px; border-top: 1px solid var(--line); padding: 48px 0 24px; font-size: 15px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.footer-grid h2 { font: 600 13px var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 12px; }
.footer-grid nav a { display: block; text-decoration: none; padding: 3px 0; }
.footer-bottom { display: flex; justify-content: space-between; gap: 20px; margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.footer-bottom p { margin: 0; }

/* Responsive */
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .featured { grid-template-columns: 1fr; gap: 18px; }
}
@media (max-width: 760px) {
  .menu-toggle { display: block; }
  .site-nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 20px 16px; }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 17px; color: var(--text); }
  .nav-search { padding-top: 12px; }
  .nav-search input { width: 100%; padding: 11px 14px; font-size: 16px; }
  .hero { padding-top: 40px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > div:first-child { grid-column: 1 / -1; }
  .footer-bottom { flex-direction: column; gap: 6px; }
  .prose { font-size: 18px; }
  .post-hero { margin: 0 -20px 24px; }
  .post-hero img { border-radius: 0; }
}
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; gap: 32px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media print { .site-header, .site-footer, .share, .related, .toc { display: none; } }
