/*
Theme Name: goodsite
Theme URI: https://cleanelectionsusa.org
Author: Clean Elections USA
Author URI: https://cleanelectionsusa.org
Description: Election integrity research and documentation theme. Clean, authoritative design for presenting court filings, analysis, and election administration research.
Version: 2.0.0
Requires at least: 6.0
Tested up to: 6.6
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: goodsite
Tags: one-column, custom-colors, custom-logo, featured-images, threaded-comments, translation-ready
*/

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  --bg: #ffffff;
  --fg: #1a1a2e;
  --surface: #f8f9fa;
  --surface-alt: #f0f2f5;
  --muted: #5a6577;
  --border: #dee2e6;
  --border-light: #e9ecef;
  --accent: #1e3a5f;
  --accent-light: #2c5282;
  --accent-foreground: #ffffff;
  --primary: #1e3a5f;
  --primary-foreground: #ffffff;
  --secondary: #dc2626;
  --secondary-foreground: #ffffff;
  --success: #059669;
  --warning: #d97706;
  --radius: 4px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Merriweather', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

.dark {
  --bg: #0f172a;
  --fg: #e2e8f0;
  --surface: #1e293b;
  --surface-alt: #273548;
  --muted: #94a3b8;
  --border: #334155;
  --border-light: #475569;
  --accent: #60a5fa;
  --accent-light: #93c5fd;
  --accent-foreground: #0f172a;
  --primary: #60a5fa;
  --primary-foreground: #0f172a;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  color: var(--fg);
  background: var(--bg);
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; transition: color 150ms ease; }
a:hover { color: var(--accent-light); }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-serif); font-weight: 700; line-height: 1.3; color: var(--fg); }
p { line-height: 1.7; }

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  transition: box-shadow 200ms ease;
}

.site-header.scrolled {
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.site-logo {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.site-logo:hover { color: var(--accent); }
.site-logo--inverse { color: var(--primary-foreground); }

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  transition: color 150ms, background 150ms;
}

.nav-link:hover { color: var(--fg); background: var(--surface); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all 150ms ease;
  text-decoration: none;
}

.btn-primary { background: var(--accent); color: var(--accent-foreground); }
.btn-primary:hover { background: var(--accent-light); color: var(--accent-foreground); }

.btn-outline { background: transparent; color: var(--accent); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--surface); border-color: var(--accent); }

.btn-ghost { background: transparent; color: var(--muted); padding: 0.5rem; }
.btn-ghost:hover { color: var(--fg); background: var(--surface); }

.btn-icon { padding: 0.5rem; }

.btn-editorial { background: var(--accent); color: var(--accent-foreground); font-size: 0.8125rem; padding: 0.375rem 0.75rem; }

.btn-inverse-ghost { background: transparent; color: var(--primary-foreground); padding: 0.5rem; }
.btn-inverse-ghost:hover { background: rgba(255,255,255,0.1); }

.header-menu-btn { display: none; }

/* ============================================================
   MOBILE MENU
   ============================================================ */
.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  background: var(--primary);
  z-index: 300;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
}

.mobile-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.mobile-menu-nav { display: flex; flex-direction: column; }

.mobile-menu-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  color: var(--primary-foreground);
  text-decoration: none;
  font-size: 1.125rem;
  font-weight: 500;
}

.mobile-menu-link span:last-child { font-size: 0.75rem; opacity: 0.5; }

/* ============================================================
   SEARCH PANEL
   ============================================================ */
.search-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms;
}

.search-backdrop.open { opacity: 1; pointer-events: auto; }

.search-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 420px;
  background: var(--bg);
  z-index: 201;
  transform: translateX(100%);
  transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  box-shadow: -4px 0 20px rgba(0,0,0,0.1);
}

.search-panel.open { transform: translateX(0); }

.search-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1rem;
  font-family: var(--font-sans);
  color: var(--fg);
  outline: none;
}

.search-results { padding: 1.25rem; }

.search-result-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-light);
  text-decoration: none;
  color: var(--fg);
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item img { width: 56px; height: 56px; border-radius: var(--radius); object-fit: cover; }

.search-jump-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.search-jump-link {
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  text-decoration: none;
}

.search-jump-link:hover { border-color: var(--accent); color: var(--accent); }

/* ============================================================
   ARTICLE META
   ============================================================ */
.article-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.article-meta strong { color: var(--fg); }

/* ============================================================
   PROSE / ARTICLE BODY
   ============================================================ */
.prose { font-size: 1.0625rem; line-height: 1.8; }
.prose p { margin-bottom: 1.25rem; }

.prose h2 {
  font-size: 1.5rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
}

.prose h3 { font-size: 1.25rem; margin-top: 2rem; margin-bottom: 0.75rem; }

.prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--muted);
}

.prose blockquote p:last-child { margin-bottom: 0; }
.prose ul, .prose ol { margin: 1rem 0 1.25rem 1.5rem; }
.prose li { margin-bottom: 0.5rem; }

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 2px;
}

.prose a:hover { text-decoration-color: var(--accent); }
.prose strong { font-weight: 600; color: var(--fg); }
.prose em { font-style: italic; }
.prose figure { margin: 2rem 0; }
.prose figcaption { font-size: 0.8125rem; color: var(--muted); margin-top: 0.5rem; }

.prose-editorial { font-size: 1.0625rem; line-height: 1.8; }
.prose-editorial p { margin-bottom: 1.25rem; }

.prose-editorial h2 {
  font-size: 1.5rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
}

.prose-editorial h3 { font-size: 1.25rem; margin-top: 2rem; margin-bottom: 0.75rem; }

.prose-editorial blockquote {
  border-left: 3px solid var(--accent);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--muted);
}

.prose-editorial blockquote p:last-child { margin-bottom: 0; }
.prose-editorial ul, .prose-editorial ol { margin: 1rem 0 1.25rem 1.5rem; }
.prose-editorial li { margin-bottom: 0.5rem; }

.prose-editorial a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 2px;
}

.prose-editorial a:hover { text-decoration-color: var(--accent); }
.prose-editorial strong { font-weight: 600; color: var(--fg); }
.prose-editorial figure { margin: 2rem 0; }
.prose-editorial figcaption { font-size: 0.8125rem; color: var(--muted); margin-top: 0.5rem; }
.prose-editorial .lead { font-size: 1.25rem; line-height: 1.7; color: var(--fg); font-weight: 400; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: var(--primary);
  color: var(--primary-foreground);
  margin-top: 4rem;
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-brand {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-foreground);
  text-decoration: none;
}

.footer-brand:hover { color: var(--primary-foreground); opacity: 0.9; }

.footer-copy { font-size: 0.8125rem; opacity: 0.6; }

.footer-links-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 1rem;
}

.footer-links-row a {
  font-size: 0.8125rem;
  color: var(--primary-foreground);
  opacity: 0.7;
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
}

.footer-links-row a:hover { opacity: 1; background: rgba(255,255,255,0.1); }

/* ============================================================
   RESPONSIVE (non-Tailwind overrides only)
   ============================================================ */
@media (max-width: 768px) {
  .header-nav { display: none; }
  .header-menu-btn { display: flex; }
  .footer-row { flex-direction: column; align-items: flex-start; }
}

/* ============================================================
   PLACEHOLDER SHIMMER
   ============================================================ */
[class*="placeholder"] { position: relative; overflow: hidden; }
[class*="placeholder"]::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}
