/*
Theme Name: BlogMate
Theme URI: https://github.com/blogmate/theme
Author: BlogMate
Author URI: https://github.com/blogmate
Description: A fast, modern, ad-ready magazine theme for niche content sites. Evolved from the classic DIY-blog layout: Open Sans typography, a red accent, a front-page featured cover block, post cards with thumbnails and category labels, breadcrumbs, reading time, zero-JS social sharing, related posts, a sticky nav, a sidebar, and clean IAB ad zones (leaderboard, in-post, sidebar, footer). No JavaScript beyond ad loaders; built for Core Web Vitals and monetization.
Version: 2.2.2
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: blogmate-minimal
Tags: blog, news, two-columns, right-sidebar, custom-menu, featured-images, editor-style, translation-ready
*/

:root {
  --accent: #d3241f;          /* DIY red; overridden per-site by the brand color */
  --accent-dark: #a81c18;
  --bg: #ffffff;
  --ink: #1b1b1b;
  --muted: #707070;
  --border: #e5e5e5;
  --soft: #f6f5f4;
  --maxw: 1120px;
  --sidebar: 320px;
  --gap: 48px;
  /* Footer palette (intentionally dark in both light & dark modes; overridable via Customizer). */
  --footer-bg: #171613;
  --footer-ink: #ecece6;
  --footer-muted: #9c968b;
  --footer-border: rgba(255,255,255,0.10);
  --sans: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg:#161511; --ink:#e9e6de; --muted:#9d968a; --border:#2c2a25; --soft:#1c1b16; }
}

* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: clip; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 17px; line-height: 1.65;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; }
input, select, textarea { max-width: 100%; }
textarea { width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 2px; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ── Header ── */
.site-header { border-bottom: 3px solid var(--accent); }
.site-header .wrap { text-align: center; padding: 26px 22px 20px; }
.site-title { margin: 0; font-weight: 800; font-size: 34px; letter-spacing: -0.02em; }
.site-title a { color: var(--ink); }
.site-title a:hover { color: var(--accent); text-decoration: none; }
.site-desc { margin: 5px 0 0; color: var(--muted); font-size: 15px; }

.site-nav { border-bottom: 1px solid var(--border); background: var(--bg); }
.site-nav-sticky { position: sticky; top: 0; z-index: 40; box-shadow: 0 1px 0 var(--border), 0 6px 18px -14px rgba(0,0,0,0.35); }
.site-nav .wrap { padding: 0 22px; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
.site-nav li { position: relative; }
.site-nav a { display: block; padding: 13px 16px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink); }
.site-nav a:hover { color: var(--accent); text-decoration: none; }
.site-nav .current-menu-item a { box-shadow: inset 0 -3px 0 var(--accent); }

/* ── Layout: content + sidebar ── */
.site-body { padding: 40px 0 20px; }
.site-inner { display: grid; grid-template-columns: minmax(0,1fr) var(--sidebar); gap: var(--gap); }
.site-main, .single-post, .post-content, .sidebar { min-width: 0; max-width: 100%; }
@media (max-width: 900px) { .site-inner { grid-template-columns: minmax(0,1fr); } }

/* ── Ad zones ── */
.ad-zone { width: 100%; max-width: 100%; min-width: 0; margin: 0 auto 28px; text-align: center; overflow: hidden; }
.ad-zone > *, .ad-zone iframe, .ad-zone img, .ad-zone ins {
  max-width: 100% !important;
}
.ad-zone .ad-label { display: block; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.ad-leaderboard { padding: 16px 0; border-bottom: 1px solid var(--border); background: var(--soft); }
.ad-incontent { margin: 34px 0; }
.ad-footer { padding: 20px 0; border-top: 1px solid var(--border); background: var(--soft); margin-bottom: 0; }
.ad-sidebar { margin-bottom: 36px; }
.ad-post-top { margin: 4px 0 28px; }
.ad-post-mid { margin: 30px 0; }
.ad-post-bottom { margin: 30px 0 4px; }
.ad-placeholder {
  width: 100%;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--border));
  background: var(--soft); color: var(--muted); border-radius: 6px;
  font-size: 12px; letter-spacing: 0.04em;
}
.ad-placeholder .sz { font-weight: 700; color: var(--accent); font-size: 13px; }
.ad-ph-leaderboard { height: 90px; max-width: 728px; margin: 0 auto; }
.ad-ph-rect { height: 250px; }
.ad-ph-inline { height: 120px; }

/* ── Post cards (home / archive list) ── */
.cat-label { display: inline-block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); margin-bottom: 6px; }
.cat-label:hover { color: var(--accent-dark); text-decoration: none; }
.post-meta { font-size: 13px; color: var(--muted); }
.post-meta a { color: var(--muted); } .post-meta a:hover { color: var(--accent); }

.post-card { display: grid; grid-template-columns: 240px minmax(0,1fr); gap: 22px; padding-bottom: 30px; margin-bottom: 30px; border-bottom: 1px solid var(--border); }
.post-card:last-of-type { border-bottom: 0; }
@media (max-width: 560px) { .post-card { grid-template-columns: 1fr; gap: 12px; } }
.post-card-thumb { display: block; overflow: hidden; border-radius: 8px; }
.post-card-thumb img, .thumb-ph { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; transition: transform 0.4s ease; }
.post-card-thumb:hover img { transform: scale(1.05); }
.thumb-ph {
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 12px;
  overflow: hidden; line-height: 1.2; word-break: break-word; hyphens: auto;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff; font-weight: 800; font-size: 14px; letter-spacing: 0.02em; text-transform: uppercase;
}
.post-card-title { font-size: 22px; line-height: 1.25; letter-spacing: -0.01em; margin: 4px 0 8px; }
.post-card-title a { color: var(--ink); } .post-card-title a:hover { color: var(--accent); text-decoration: none; }
.post-excerpt { margin: 8px 0 10px; color: var(--ink); }
.read-more { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }

/* ── Featured cover block (front-page magazine hero; zero-JS) ── */
.featured {
  display: grid; gap: 16px; margin-bottom: 38px;
  grid-template-columns: repeat(2, 1fr);
  grid-template-areas: "lead lead" "a b" "c d";
}
.featured .feat-lead  { grid-area: lead; }
.featured .feat-item:nth-of-type(2) { grid-area: a; }
.featured .feat-item:nth-of-type(3) { grid-area: b; }
.featured .feat-item:nth-of-type(4) { grid-area: c; }
.featured .feat-item:nth-of-type(5) { grid-area: d; }
.feat-card { position: relative; margin: 0; border-radius: 10px; overflow: hidden; }
.feat-link { display: block; position: relative; color: #fff; }
.feat-link:hover { text-decoration: none; }
.feat-card .post-card-thumb { display: block; }
.feat-card .post-card-thumb img, .feat-card .thumb-ph {
  width: 100%; object-fit: cover; transition: transform 0.5s ease;
}
/* The overlay already shows the category + title, so the placeholder's own label is redundant
   here — hide it (keeps the gradient) so nothing can spill from behind the overlay. */
.feat-card .thumb-ph { font-size: 0; }
.feat-lead .post-card-thumb img, .feat-lead .thumb-ph { aspect-ratio: 16 / 8; }
.feat-item .post-card-thumb img, .feat-item .thumb-ph { aspect-ratio: 16 / 10; }
.feat-card:hover .post-card-thumb img { transform: scale(1.06); }
.feat-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 18px 20px; background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.35) 45%, rgba(0,0,0,0) 78%);
}
.feat-cat { display: inline-block; align-self: flex-start; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 3px 9px; border-radius: 3px; margin-bottom: 9px; }
.feat-title { margin: 0; color: #fff; font-weight: 800; line-height: 1.2; letter-spacing: -0.01em; text-shadow: 0 1px 12px rgba(0,0,0,0.4); }
.feat-lead .feat-title { font-size: 30px; }
.feat-item .feat-title { font-size: 17px; }
@media (max-width: 700px) {
  .featured { grid-template-columns: 1fr 1fr; grid-template-areas: "lead lead" "a b" "c d"; gap: 12px; }
  .feat-lead .feat-title { font-size: 22px; }
  .feat-item .feat-title { font-size: 15px; }
}
@media (max-width: 460px) {
  .featured { grid-template-columns: 1fr; grid-template-areas: "lead" "a" "b" "c" "d"; }
}

/* Section headings (Latest / Related) */
.section-head {
  font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em;
  margin: 0 0 22px; padding-bottom: 10px; border-bottom: 2px solid var(--accent);
  display: flex; align-items: center;
}
.section-head::after { content: ""; flex: 1; height: 1px; background: var(--border); margin-left: 14px; }

/* ── Breadcrumbs ── */
.breadcrumbs { font-size: 12px; color: var(--muted); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.breadcrumbs a { color: var(--muted); font-weight: 600; }
.breadcrumbs a:hover { color: var(--accent); text-decoration: none; }
.breadcrumbs .crumb-sep { color: var(--border); margin: 0 2px; }
.breadcrumbs .crumb-current { color: var(--ink); }

/* ── Social share row (zero-JS) ── */
.share { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 18px 0 4px; }
.share-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-right: 2px; }
.share-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border-radius: 50%; background: var(--soft); border: 1px solid var(--border); color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.share-btn:hover { color: #fff; background: var(--accent); border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }

/* ── Related posts grid ── */
.related { margin-top: 46px; padding-top: 8px; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
@media (max-width: 640px) { .related-grid { grid-template-columns: 1fr 1fr; gap: 14px; } }
.rel-card { margin: 0; }
.rel-thumb { display: block; overflow: hidden; border-radius: 8px; margin-bottom: 10px; }
.rel-thumb img, .rel-card .thumb-ph { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; transition: transform 0.4s ease; }
.rel-thumb:hover img { transform: scale(1.05); }
.rel-title { font-size: 16px; line-height: 1.3; margin: 4px 0 0; font-weight: 700; }
.rel-title a { color: var(--ink); } .rel-title a:hover { color: var(--accent); text-decoration: none; }
.read-time { white-space: nowrap; }

/* Archive header */
.archive-header { margin-bottom: 30px; }
.archive-title { font-size: 15px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 700; margin: 0; }
.archive-title span { color: var(--accent); }

/* ── Single post ── */
.single-post .post-header { margin-bottom: 20px; }
.post-title { max-width: 100%; overflow-wrap: anywhere; word-break: normal; font-weight: 800; font-size: 38px; line-height: 1.15; letter-spacing: -0.025em; margin: 4px 0 12px; }
.single-post .post-meta { font-size: 14px; }
.post-thumb { margin: 0 0 28px; }
.post-thumb img { width: 100%; border-radius: 8px; }

.post-content { font-size: 18px; line-height: 1.72; overflow-wrap: anywhere; }
.post-content > * { margin: 0 0 1.3em; }
.post-content h2 { font-size: 25px; line-height: 1.25; letter-spacing: -0.01em; margin: 1.8em 0 0.5em; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.post-content h3 { font-size: 20px; margin: 1.5em 0 0.45em; }
.post-content h2 + p, .post-content h3 + p { margin-top: 0; }
.post-content a { text-decoration: underline; text-underline-offset: 2px; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.post-content ul, .post-content ol { padding-left: 1.4em; } .post-content li { margin-bottom: 0.5em; }
.post-content img, .post-content video, .post-content iframe, .post-content embed, .post-content object {
  display: block; max-width: 100% !important; height: auto;
}
.post-content img { border-radius: 6px; }
.post-content blockquote { margin: 1.5em 0; padding: 6px 0 6px 20px; border-left: 4px solid var(--accent); color: var(--muted); font-style: italic; }
.post-content code { font-family: ui-monospace, Consolas, monospace; font-size: 0.88em; background: var(--soft); padding: 2px 6px; border-radius: 4px; }
.post-content pre { background: var(--soft); padding: 16px; border-radius: 6px; overflow-x: auto; border: 1px solid var(--border); }
.post-content pre code { background: none; padding: 0; }
.post-content table { display: block; width: 100%; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 15px; }
.post-content th, .post-content td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.post-content th { font-weight: 700; background: var(--soft); }
.post-content figure { width: auto !important; max-width: 100%; margin: 1.5em 0; } .post-content figcaption { font-size: 14px; color: var(--muted); text-align: center; margin-top: 8px; overflow-wrap: anywhere; }
.post-content hr { border: 0; border-top: 1px solid var(--border); }

.post-footer { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); font-size: 15px; }
.post-tags { color: var(--muted); margin-bottom: 16px; }
.post-tags a { color: var(--accent); }
.author-box { background: var(--soft); border: 1px solid var(--border); border-radius: 8px; padding: 18px 20px; color: var(--muted); }
.author-box strong { color: var(--ink); }

/* Pagination */
.pagination .nav-links, .pagination { margin: 40px 0; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.pagination .page-numbers { padding: 8px 14px; border: 1px solid var(--border); border-radius: 6px; color: var(--ink); font-weight: 600; font-size: 14px; }
.pagination .page-numbers.current { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination a.page-numbers:hover { border-color: var(--accent); text-decoration: none; }

/* ── Sidebar ── */
.sidebar { font-size: 15px; }
@media (min-width: 901px) { .sidebar { position: sticky; top: 20px; align-self: start; } }
.widget { margin-bottom: 36px; }
.widget-title { font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 14px; padding-bottom: 8px; border-bottom: 2px solid var(--accent); }
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.widget li:last-child { border-bottom: 0; }
.widget a { color: var(--ink); } .widget a:hover { color: var(--accent); }
.widget .count { color: var(--muted); font-size: 13px; }
.rp-item { display: grid; grid-template-columns: 60px 1fr; gap: 12px; align-items: center; }
/* Recent-posts thumb is only 60px — too small for a category name, so show a clean gradient chip
   (no cramped/clipped text). The post title sits alongside it. */
.rp-item .thumb-ph { aspect-ratio: 1; border-radius: 6px; font-size: 0; }
.rp-item img { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; }
.rp-item .rp-title { font-size: 14px; font-weight: 600; line-height: 1.3; }

/* ── Footer (dark magazine footer) ── */
.site-footer { margin-top: 48px; border-top: 3px solid var(--accent); background: var(--footer-bg); color: var(--footer-ink); }
.footer-top { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; padding: 44px 22px 36px; }
@media (max-width: 760px) { .footer-top { grid-template-columns: 1fr 1fr; gap: 28px; } }
@media (max-width: 460px) { .footer-top { grid-template-columns: 1fr; gap: 24px; } }
.footer-col { min-width: 0; }
.footer-title { margin: 0 0 10px; font-size: 22px; font-weight: 800; letter-spacing: -0.01em; color: #fff; }
.footer-desc { margin: 0; color: var(--footer-muted); font-size: 14px; line-height: 1.6; }
.footer-head { margin: 0 0 14px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.09em; color: #fff; padding-bottom: 9px; border-bottom: 2px solid var(--accent); display: inline-block; }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { padding: 6px 0; border-bottom: 1px solid var(--footer-border); }
.footer-col li:last-child { border-bottom: 0; }
.footer-col a { color: var(--footer-muted); font-size: 14px; }
.footer-col a:hover { color: #fff; text-decoration: none; }
.footer-col .count { color: var(--footer-muted); opacity: 0.7; font-size: 12px; }
.footer-bottom { border-top: 1px solid var(--footer-border); }
.footer-bottom .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 18px 22px 22px; }
.copyright { font-size: 13px; color: var(--footer-muted); margin: 0; }
.footer-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 18px; flex-wrap: wrap; }
.footer-nav a { font-size: 13px; color: var(--footer-muted); }
.footer-nav a:hover { color: #fff; text-decoration: none; }

@media (max-width: 640px) {
  .site-title { font-size: 28px; }
  .post-title { font-size: 30px; }
  .post-hero .post-card-title { font-size: 26px; }
  .post-content h2 { font-size: 22px; }
}
