/*
Theme Name: The Fiscalist
Theme URI: https://fiscalist.news
Description: Custom theme for The Fiscalist — economic and financial news
Version: 1.0
Author: The Fiscalist
Text Domain: fiscalist
*/

/* ============================================
   CSS CUSTOM PROPERTIES
   ============================================ */
:root {
  --color-primary:    #0f4c2a;
  --color-accent:     #16a34a;
  --color-accent-lt:  #dcfce7;
  --color-bg:         #ffffff;
  --color-surface:    #f8fafc;
  --color-border:     #e2e8f0;
  --color-text:       #0f172a;
  --color-muted:      #64748b;

  --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-sans:  'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;

  --radius:    6px;
  --shadow:    0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);

  --max-width:     1200px;
  --content-width: 700px;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================
   HEADER
   ============================================ */
.site-header {
  background: var(--color-primary);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-logo {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
}
.site-logo:hover { color: #a7f3d0; text-decoration: none; }

/* Primary nav */
.primary-nav ul {
  display: flex;
  gap: 2px;
  list-style: none;
}

.primary-nav a {
  color: rgba(255,255,255,0.82);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius);
  transition: background 0.15s, color 0.15s;
  display: block;
}
.primary-nav a:hover {
  background: rgba(255,255,255,0.13);
  color: #ffffff;
  text-decoration: none;
}
.primary-nav .current-menu-item a,
.primary-nav .current-cat a {
  background: rgba(255,255,255,0.15);
  color: #ffffff;
}

/* Green accent bar */
.header-accent-bar {
  height: 3px;
  background: var(--color-accent);
}

/* Mobile hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: white;
  border-radius: var(--radius);
  transition: background 0.15s;
}
.nav-toggle:hover { background: rgba(255,255,255,0.12); }

/* ============================================
   LAYOUT
   ============================================ */
.site-main { min-height: 60vh; }

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

/* ============================================
   CATEGORY PILL
   ============================================ */
.cat-pill {
  display: inline-block;
  background: var(--color-accent);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 9px;
  border-radius: 3px;
  line-height: 1.7;
  transition: background 0.15s;
}
.cat-pill:hover {
  background: var(--color-primary);
  color: #fff;
  text-decoration: none;
}

/* ============================================
   CARD META
   ============================================ */
.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--color-muted);
  margin-top: 8px;
  flex-wrap: wrap;
}

/* ============================================
   HOMEPAGE — HERO
   ============================================ */
.hero-section { padding: 36px 0 0; }

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 32px;
  align-items: start;
}

/* Hero main */
.hero-main .post-thumbnail {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: var(--radius);
}

.hero-main .card-body { padding: 18px 0 0; }

.hero-main .card-title {
  font-size: 1.875rem;
  font-weight: 800;
  line-height: 1.22;
  color: var(--color-text);
  margin: 10px 0 10px;
  letter-spacing: -0.025em;
}
.hero-main .card-title a { color: inherit; }
.hero-main .card-title a:hover { color: var(--color-accent); text-decoration: none; }

.hero-main .card-excerpt {
  color: var(--color-muted);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Hero sidebar */
.hero-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-left: 1px solid var(--color-border);
  padding-left: 32px;
}

.hero-secondary {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 0;
}
.hero-secondary:first-child { padding-top: 0; }
.hero-secondary + .hero-secondary { border-top: 1px solid var(--color-border); }

.hero-secondary .post-thumbnail {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: var(--radius);
}

.hero-secondary .card-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.38;
  color: var(--color-text);
  margin: 6px 0 4px;
}
.hero-secondary .card-title a { color: inherit; }
.hero-secondary .card-title a:hover { color: var(--color-accent); text-decoration: none; }

/* ============================================
   SECTION LABEL
   ============================================ */
.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-muted);
  border-bottom: 2px solid var(--color-border);
  padding-bottom: 10px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-label span { color: var(--color-accent); }
.section-label a { color: var(--color-muted); font-weight: 500; margin-left: auto; text-transform: none; letter-spacing: 0; }
.section-label a:hover { color: var(--color-accent); }

/* ============================================
   CARD GRID
   ============================================ */
.card-grid-section { padding: 48px 0 0; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

/* ============================================
   ARTICLE CARD
   ============================================ */
.article-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s, transform 0.18s;
}
.article-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.article-card .post-thumbnail {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  display: block;
}

.no-thumb-placeholder {
  width: 100%;
  aspect-ratio: 16/10;
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-border);
}

.article-card .card-body {
  padding: 14px 16px 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.article-card .card-title {
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--color-text);
  margin: 8px 0 auto;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-card .card-title a { color: inherit; }
.article-card .card-title a:hover { color: var(--color-accent); text-decoration: none; }

/* ============================================
   CATEGORY SECTION ROWS
   ============================================ */
.category-section { padding: 40px 0 0; }

.category-section-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

/* ============================================
   SINGLE ARTICLE PAGE
   ============================================ */
.article-wrap {
  max-width: var(--content-width);
  margin: 48px auto 80px;
  padding: 0 24px;
}

.article-kicker { margin-bottom: 14px; }

.article-title {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.03em;
  color: var(--color-text);
  margin-bottom: 22px;
}

.article-byline {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 30px;
  font-size: 0.875rem;
  color: var(--color-muted);
  flex-wrap: wrap;
}
.article-byline .author { font-weight: 600; color: var(--color-text); }
.byline-sep { color: var(--color-border); }

.article-featured-image {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: 30px;
  aspect-ratio: 16/9;
  object-fit: cover;
}

/* Article content body */
.article-content {
  font-size: 1.0625rem;
  line-height: 1.82;
  color: #1e293b;
}

.article-content p { margin-bottom: 1.5em; }
.article-content p:last-child { margin-bottom: 0; }

.article-content a {
  color: var(--color-accent);
  border-bottom: 1px solid var(--color-accent-lt);
  transition: border-color 0.15s, color 0.15s;
}
.article-content a:hover {
  border-color: var(--color-accent);
  text-decoration: none;
}

.article-content figure {
  margin: 2em 0;
}
.article-content figure img {
  width: 100%;
  border-radius: var(--radius);
}
.article-content figcaption {
  font-size: 0.8125rem;
  color: var(--color-muted);
  text-align: center;
  margin-top: 8px;
  font-style: italic;
}

/* WP block image */
.article-content .wp-block-image { margin: 2em 0; }
.article-content .wp-block-image img { border-radius: var(--radius); width: 100%; }

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  background: var(--color-primary);
  color: rgba(255,255,255,0.75);
  margin-top: 72px;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 56px 24px 28px;
}

.footer-top {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 56px;
  padding-bottom: 40px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 28px;
}

.footer-logo {
  font-family: var(--font-serif);
  font-size: 1.375rem;
  font-weight: 700;
  color: #ffffff;
  display: inline-block;
  margin-bottom: 12px;
}
.footer-logo:hover { color: #a7f3d0; text-decoration: none; }

.footer-tagline {
  font-size: 0.875rem;
  line-height: 1.6;
  color: rgba(255,255,255,0.55);
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.footer-col-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.35);
  margin-bottom: 14px;
}

.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 8px; }
.footer-col a {
  color: rgba(255,255,255,0.65);
  font-size: 0.875rem;
  transition: color 0.15s;
}
.footer-col a:hover { color: #ffffff; text-decoration: none; }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.35);
  flex-wrap: wrap;
  gap: 8px;
}

/* ============================================
   ARCHIVE / CATEGORY PAGE
   ============================================ */
.archive-header {
  padding: 40px 0 28px;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 36px;
}

.archive-kicker {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-accent);
  margin-bottom: 8px;
}

.archive-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  padding-bottom: 56px;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination,
.nav-links {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 28px 0 48px;
  flex-wrap: wrap;
}

.pagination a,
.pagination .current,
.page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.page-numbers:hover,
.pagination a:hover {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
  text-decoration: none;
}
.page-numbers.current,
.pagination .current {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}
.page-numbers.dots { border: none; background: none; }

/* ============================================
   SEARCH & 404
   ============================================ */
.page-empty {
  text-align: center;
  padding: 96px 24px;
}
.page-empty h1 {
  font-size: 5rem;
  font-weight: 800;
  color: var(--color-border);
  line-height: 1;
  margin-bottom: 16px;
}
.page-empty h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.page-empty p {
  color: var(--color-muted);
  margin-bottom: 28px;
}
.btn-primary {
  display: inline-block;
  background: var(--color-accent);
  color: white;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9375rem;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--color-primary); color: white; text-decoration: none; }

/* ============================================
   RESPONSIVE — TABLET (1024px)
   ============================================ */
@media (max-width: 1024px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .category-section-grid { grid-template-columns: repeat(2, 1fr); }
  .archive-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-top { grid-template-columns: 1fr; gap: 32px; }
}

/* ============================================
   RESPONSIVE — MOBILE (768px)
   ============================================ */
@media (max-width: 768px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--color-border);
    padding-top: 24px;
    gap: 0;
  }
  .hero-secondary { flex: 1 1 calc(50% - 12px); }
  .hero-secondary + .hero-secondary { border-top: none; }

  .card-grid { grid-template-columns: 1fr; }
  .category-section-grid { grid-template-columns: 1fr; }
  .archive-grid { grid-template-columns: 1fr; }
  .footer-links { grid-template-columns: repeat(2, 1fr); }

  .article-title { font-size: 1.625rem; }
  .hero-main .card-title { font-size: 1.375rem; }

  /* Mobile nav */
  .primary-nav {
    display: none;
    position: absolute;
    top: 67px;
    left: 0; right: 0;
    background: #0a3a20;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 8px 0;
    z-index: 99;
  }
  .primary-nav.is-open { display: block; }
  .primary-nav ul { flex-direction: column; gap: 0; }
  .primary-nav li { border-bottom: 1px solid rgba(255,255,255,0.06); }
  .primary-nav a { border-radius: 0; padding: 12px 24px; }
  .nav-toggle { display: flex; }
}

@media (max-width: 480px) {
  .hero-sidebar { flex-direction: column; }
  .hero-secondary { flex: 1 1 100%; }
  .footer-links { grid-template-columns: 1fr; }
  .article-title { font-size: 1.375rem; }
}
