/*
Theme Name: StackPick
Theme URI: https://example.com/
Author: Custom
Description: A calm, modern blog theme for honest reviews and comparisons of digital products and online learning. Built for fast reading, simple navigation and clear affiliate disclosure.
Version: 2.1.0
Requires at least: 6.3
Requires PHP: 7.4
License: GPL-2.0-or-later
Text Domain: stackpick
*/

/* ==========================================================================
   Tokens
   ========================================================================== */
:root {
  --paper: #f8fafa;
  --surface: #ffffff;
  --ink: #2c3e50;
  --muted: #586573;
  --line: #e2e8ea;
  --brand: #0a7aa8;
  --brand-strong: #075f85;
  --on-brand: #ffffff;
  --tint: #e6f4fb;
  --logo-ink: #2c3e50;
  --logo-blue: #13a0da;
  --note: #f0f4f5;
  --pro-bg: #eaf5ef;
  --pro-ink: #1f6b45;
  --con-bg: #fbefec;
  --con-ink: #9a3b2b;

  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;

  --wrap: 1160px;
  --read: 700px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f161c;
    --surface: #151e26;
    --ink: #e8eef2;
    --muted: #9aa8b4;
    --line: #25313b;
    --brand: #4cc0ee;
    --brand-strong: #8bd6f5;
    --on-brand: #06293a;
    --tint: #12303f;
    --logo-ink: #e8eef2;
    --note: #18232b;
    --pro-bg: #16281f;
    --pro-ink: #8fd3ae;
    --con-bg: #2a1b18;
    --con-ink: #f0a99b;
  }
}

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-strong); }

:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
  border-radius: 4px;
}

.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 16px; top: -60px;
  background: var(--ink); color: var(--paper);
  padding: 10px 16px; border-radius: var(--r-sm);
  z-index: 100;
}
.skip-link:focus { top: 12px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }

.meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: .875rem; }

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 68px; gap: 24px; }

.site-title {
  font-weight: 700; font-size: 1.25rem; letter-spacing: -.02em;
  color: var(--ink); text-decoration: none;
}
.site-title:hover { color: var(--ink); }
.custom-logo { max-height: 40px; width: auto; }
.site-logo { display: inline-flex; align-items: center; }
.brand-logo { height: 34px; width: auto; display: block; }
.brand-logo .lg-b { fill: var(--logo-blue); }
.brand-logo .lg-i { fill: var(--logo-ink); }
.footer-logo .brand-logo { height: 30px; }

.main-nav ul { list-style: none; display: flex; gap: 6px; margin: 0; padding: 0; }
.main-nav a {
  display: block; padding: 8px 14px; border-radius: 999px;
  color: var(--ink); text-decoration: none; font-weight: 500; font-size: .95rem;
}
.main-nav a:hover,
.main-nav .current-menu-item > a,
.main-nav .current-cat > a { background: var(--tint); color: var(--brand-strong); }

.nav-toggle {
  display: none; align-items: center; gap: 8px;
  background: transparent; color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 16px; font: inherit; font-weight: 500; cursor: pointer;
}

@media (max-width: 800px) {
  .nav-toggle { display: inline-flex; }
  .main-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--paper); border-bottom: 1px solid var(--line); padding: 8px 24px 20px; }
  .site-header.is-open .main-nav { display: block; }
  .main-nav ul { flex-direction: column; gap: 2px; }
  .main-nav a { padding: 12px 8px; border-radius: var(--r-sm); font-size: 1.05rem; }
}

/* ==========================================================================
   Home
   ========================================================================== */
.hero { padding: 72px 0 56px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 56px; align-items: center; }

.hero h1 {
  font-size: clamp(2.2rem, 4.6vw, 3.5rem);
  line-height: 1.08; font-weight: 650; letter-spacing: -.03em;
  margin: 0 0 18px; max-width: 14em;
}
.hero-lead { font-size: 1.2rem; color: var(--muted); max-width: 34em; margin: 0 0 36px; }

.goals-title { font-size: 1rem; font-weight: 600; margin: 0 0 12px; }
.goals { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 0 0 28px; padding: 0; list-style: none; }
.goals a {
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600;
  transition: border-color .15s ease, background-color .15s ease;
}
.goals a small { font-weight: 400; color: var(--muted); font-size: .85rem; }
.goals a:hover { border-color: var(--brand); background: var(--tint); }

.hero-feature { display: block; color: inherit; text-decoration: none; }
.hero-feature:hover { color: inherit; }
.hero-feature-img {
  aspect-ratio: 16 / 11; border-radius: var(--r-lg); overflow: hidden;
  background: var(--tint); border: 1px solid var(--line);
}
.hero-feature-img img { width: 100%; height: 100%; object-fit: cover; }
.hero-feature-label { margin: 18px 0 4px; color: var(--muted); font-size: .875rem; }
.hero-feature h2 { font-size: 1.5rem; line-height: 1.25; letter-spacing: -.02em; margin: 0 0 8px; font-weight: 650; }
.hero-feature:hover h2 { color: var(--brand-strong); }
.hero-feature p { margin: 0; color: var(--muted); }

.search-form { display: flex; gap: 8px; max-width: 460px; width: 100%; }
.search-form input[type="search"] {
  flex: 1; min-width: 0; padding: 12px 16px; font: inherit;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px;
}
.search-form input[type="search"]::placeholder { color: var(--muted); }
.search-form button {
  padding: 0 22px; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--ink); color: var(--paper); border: 0; border-radius: 999px;
}
.search-form button:hover { background: var(--brand-strong); color: var(--on-brand); }

@media (max-width: 900px) {
  .hero { padding: 40px 0 32px; }
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 40px; }
}

.section { padding: 24px 0 8px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 0 0 8px; }
.section-head h2 { font-size: 1.5rem; letter-spacing: -.02em; margin: 0; font-weight: 650; }

/* ==========================================================================
   Article list (rows) and cards
   ========================================================================== */
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px;
  padding: 28px 0; border-top: 1px solid var(--line);
}
.row:first-child { border-top: 0; }
.row-img { aspect-ratio: 4 / 3; border-radius: var(--r-md); overflow: hidden; background: var(--tint); display: block; }
.row-img img { width: 100%; height: 100%; object-fit: cover; }
.row-cat { font-size: .875rem; font-weight: 600; color: var(--brand); text-decoration: none; }
.row h3 { font-size: 1.35rem; line-height: 1.3; letter-spacing: -.015em; margin: 4px 0 8px; font-weight: 650; }
.row h3 a { color: var(--ink); text-decoration: none; }
.row h3 a:hover { color: var(--brand-strong); text-decoration: underline; text-underline-offset: 4px; }
.row p { margin: 0 0 10px; color: var(--muted); max-width: 40em; }

@media (max-width: 640px) {
  .row { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 24px 0; }
}

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
.card { display: flex; flex-direction: column; gap: 12px; }
.card-img { aspect-ratio: 16 / 10; border-radius: var(--r-md); overflow: hidden; background: var(--tint); display: block; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card h3 { font-size: 1.1rem; line-height: 1.35; margin: 0; font-weight: 650; letter-spacing: -.01em; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--brand-strong); text-decoration: underline; text-underline-offset: 4px; }

/* ==========================================================================
   Pagination
   ========================================================================== */
.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin: 24px 0 0; }
.pagination .page-numbers {
  min-width: 42px; padding: 9px 14px; text-align: center;
  border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink); text-decoration: none; background: var(--surface);
}
.pagination a.page-numbers:hover { border-color: var(--brand); }
.pagination .current { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ==========================================================================
   Archive / search / 404 / page
   ========================================================================== */
.page-head { padding: 56px 0 8px; max-width: 46rem; }
.page-head h1 { font-size: clamp(1.9rem, 3.6vw, 2.6rem); line-height: 1.15; letter-spacing: -.025em; margin: 0 0 10px; font-weight: 650; }
.page-head p { margin: 0 0 20px; color: var(--muted); font-size: 1.1rem; }
.empty { padding: 40px 0; color: var(--muted); }
.error-404 { padding-top: 96px; padding-bottom: 96px; max-width: 34rem; }

/* ==========================================================================
   Article
   ========================================================================== */
.post-layout { padding-top: 48px; }
.post-main { max-width: var(--read); margin: 0 auto; min-width: 0; }
.toc-side { display: none; }

@media (min-width: 1080px) {
  .post-layout { display: grid; grid-template-columns: 220px minmax(0, var(--read)); gap: 64px; justify-content: center; align-items: start; }
  .post-main { margin: 0; }
  .toc-side { display: block; position: sticky; top: 96px; }
  .toc-inline { display: none; }
}

.toc-title { font-weight: 600; font-size: .95rem; margin: 0 0 10px; }
.toc-list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc-list a {
  display: block; padding: 6px 0 6px 14px; margin-left: -1px;
  border-left: 2px solid transparent; color: var(--muted);
  text-decoration: none; font-size: .9rem; line-height: 1.4;
}
.toc-list a:hover { color: var(--ink); }
.toc-list a[aria-current="true"] { color: var(--brand-strong); border-left-color: var(--brand); font-weight: 600; }

.toc-inline { margin: 0 0 28px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.toc-inline summary { cursor: pointer; padding: 14px 18px; font-weight: 600; }
.toc-inline .toc-list { border: 0; padding: 0 18px 12px; }
.toc-inline .toc-list a { border-left: 0; padding-left: 0; }

.post-head .row-cat { font-size: .95rem; }
.post-head h1 { font-size: clamp(2rem, 4.4vw, 2.9rem); line-height: 1.12; letter-spacing: -.03em; margin: 8px 0 16px; font-weight: 650; }
.post-lead { font-family: var(--serif); font-size: 1.3rem; line-height: 1.55; color: var(--muted); margin: 0 0 18px; }

.post-thumb { margin: 28px 0 8px; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); }

.disclosure {
  margin: 24px 0 8px; padding: 12px 16px;
  background: var(--note); border-radius: var(--r-sm);
  color: var(--muted); font-size: .9rem; line-height: 1.5;
}

.entry-content { font-family: var(--serif); font-size: 1.1875rem; line-height: 1.75; margin-top: 32px; }
.entry-content > * + * { margin-top: 1.25em; }
.entry-content p, .entry-content ul, .entry-content ol { margin-bottom: 0; }
.entry-content li + li { margin-top: .4em; }
.entry-content a { text-decoration: underline; }

.entry-content h2, .entry-content h3, .entry-content h4 { font-family: var(--sans); letter-spacing: -.02em; line-height: 1.25; font-weight: 650; }
.entry-content h2 { font-size: 1.75rem; margin-top: 2.4em; scroll-margin-top: 96px; }
.entry-content h3 { font-size: 1.3rem; margin-top: 1.9em; }
.entry-content h2 + *, .entry-content h3 + * { margin-top: .7em; }

.entry-content blockquote {
  margin-left: 0; margin-right: 0; padding: .2em 0 .2em 1.2em;
  border-left: 3px solid var(--brand); color: var(--muted); font-style: italic;
}
.entry-content img { border-radius: var(--r-md); }
.entry-content figcaption { font-family: var(--sans); font-size: .875rem; color: var(--muted); margin-top: 8px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.entry-content table { width: 100%; min-width: 520px; border-collapse: collapse; font-family: var(--sans); font-size: .95rem; line-height: 1.5; }
.entry-content th, .entry-content td { padding: 12px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.entry-content tbody tr:last-child td { border-bottom: 0; }
.entry-content th { background: var(--note); font-weight: 600; }
.entry-content th:first-child, .entry-content td:first-child { font-weight: 600; }

/* ==========================================================================
   Affiliate components
   ========================================================================== */
.sp-btn-wrap { font-family: var(--sans); text-align: center; margin: 2em 0; }
.sp-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 12px 28px;
  background: var(--brand); color: var(--on-brand);
  font-weight: 600; font-size: 1rem; line-height: 1.2; text-decoration: none !important;
  border-radius: var(--r-sm);
  transition: background-color .15s ease;
}
.sp-btn:hover { background: var(--brand-strong); color: var(--on-brand); }
.sp-btn-note { display: block; margin-top: 10px; font-size: .8125rem; color: var(--muted); }

.sp-product {
  font-family: var(--sans);
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  padding: 20px 22px; margin: 2em 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
}
.sp-product-name { font-size: 1.15rem; font-weight: 650; letter-spacing: -.01em; margin: 0; }
.sp-product-tagline { margin: 2px 0 0; color: var(--muted); font-size: .95rem; line-height: 1.45; }
.sp-product-action { display: flex; flex-direction: column; align-items: flex-start; }

.sp-proscons { font-family: var(--sans); display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 2em 0; }
.sp-pros, .sp-cons { border-radius: var(--r-md); padding: 20px 22px; }
.sp-pros { background: var(--pro-bg); }
.sp-cons { background: var(--con-bg); }
.sp-pros h4, .sp-cons h4 { margin: 0 0 10px; font-size: 1rem; font-weight: 650; }
.sp-pros h4 { color: var(--pro-ink); }
.sp-cons h4 { color: var(--con-ink); }
.sp-pros ul, .sp-cons ul { list-style: none; margin: 0; padding: 0; font-size: .975rem; line-height: 1.5; }
.sp-pros li, .sp-cons li { position: relative; padding-left: 22px; margin: 0 0 8px; }
.sp-pros li:last-child, .sp-cons li:last-child { margin-bottom: 0; }
.sp-pros li::before, .sp-cons li::before { position: absolute; left: 0; top: 0; font-weight: 700; }
.sp-pros li::before { content: "+"; color: var(--pro-ink); }
.sp-cons li::before { content: "\2212"; color: var(--con-ink); }

.sp-verdict {
  font-family: var(--sans); margin: 2em 0; padding: 20px 24px;
  background: var(--tint); border-left: 4px solid var(--brand);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}
.sp-verdict-title { display: block; font-weight: 650; font-size: 1.05rem; margin: 0 0 6px; color: var(--brand-strong); }
.sp-verdict p { margin: 0; font-size: 1.05rem; line-height: 1.6; }
.sp-verdict p + p { margin-top: .8em; }

@media (max-width: 640px) {
  .sp-proscons { grid-template-columns: 1fr; }
  .entry-content { font-size: 1.125rem; }
  .sp-product-action { width: 100%; }
  .sp-product .sp-btn { width: 100%; }
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer { margin-top: 96px; border-top: 1px solid var(--line); background: var(--surface); padding: 48px 0 32px; }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 40px; }
.footer-brand { font-weight: 700; font-size: 1.1rem; margin: 0 0 6px; }
.footer-about { margin: 0; color: var(--muted); max-width: 30em; }
.footer-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 24px; }
.footer-nav a { color: var(--ink); text-decoration: none; }
.footer-nav a:hover { color: var(--brand-strong); text-decoration: underline; }
.footer-small { margin: 32px 0 0; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; line-height: 1.6; max-width: 56em; }
.footer-small + .footer-small { margin-top: 10px; padding-top: 0; border-top: 0; }

@media (max-width: 720px) {
  .footer-grid { grid-template-columns: minmax(0, 1fr); }
  .site-footer { margin-top: 64px; }
}
