/* ==========================================================================
   FAMECHASE DESIGN SYSTEM (AUTO-UPDATED)
   ========================================================================== */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
  
  --bg-page: #ffffff;
  --bg-surface: #f8fafc;
  --bg-surface-elevated: #ffffff;
  --border: #e2e8f0;
  --border-subtle: #f1f5f9;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --ad-bg: #f8fafc;
  --ad-border: #cbd5e1;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --transition: 0.2s ease-in-out;
}

[data-theme="dark"] {
  --bg-page: #09090b;
  --bg-surface: #121215;
  --bg-surface-elevated: #18181b;
  --border: #27272a;
  --border-subtle: #1e1e24;
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --ad-bg: #121215;
  --ad-border: #27272a;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--transition), color var(--transition);
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent);
}

.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ==========================================================================
   AD UNITS (CLS Protected)
   ========================================================================== */
.ad-slot-frame {
  margin: 2rem auto;
  padding: 8px;
  background: var(--ad-bg);
  border: 1px dashed var(--ad-border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ad-label {
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.ad-top-wrapper {
  min-height: 90px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   NAVIGATION & DRAWER
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-page);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo span {
  color: var(--accent);
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.desktop-nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.desktop-nav a.active,
.desktop-nav a:hover {
  color: var(--text-primary);
}

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

.theme-toggle, .menu-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.theme-toggle:hover, .menu-btn:hover {
  background: var(--bg-surface);
  border-color: var(--text-muted);
}

.menu-btn {
  display: none;
}

.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 90;
}

.nav-drawer {
  position: fixed;
  top: 0;
  right: -280px;
  width: 280px;
  height: 100vh;
  background: var(--bg-surface-elevated);
  z-index: 100;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  border-left: 1px solid var(--border);
  transition: right 0.3s ease;
}

.nav-drawer.is-open { right: 0; }
.nav-backdrop.is-active { display: block; }

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

.drawer-links {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.drawer-links a {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ==========================================================================
   HERO & SEARCH
   ========================================================================== */
.hero {
  padding: 4rem 0 2.5rem;
  text-align: center;
}

.hero-pill {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--accent);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 1rem;
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  max-width: 800px;
  margin-inline: auto;
}

.hero-lead {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 650px;
  margin: 0 auto 2rem;
}

.search-box {
  max-width: 520px;
  margin: 0 auto;
}

.search-box input {
  width: 100%;
  padding: 12px 18px;
  font-size: 0.95rem;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition);
}

.search-box input:focus {
  border-color: var(--accent);
  background: var(--bg-page);
}

/* ==========================================================================
   CARDS & GRIDS
   ========================================================================== */
.section-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.pillars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
  margin-bottom: 3rem;
}

.pillar-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform var(--transition), border-color var(--transition);
}

.pillar-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.pillar-meta {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.pillar-card h3 {
  font-size: 1.15rem;
  line-height: 1.4;
  margin-bottom: 0.75rem;
}

.pillar-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.pillar-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.directory-controls {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  padding-bottom: 4px;
}

.tab-btn {
  background: none;
  border: none;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 8px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}

.tab-btn.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.spoke-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.spoke-item {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all var(--transition);
}

.spoke-item:hover {
  border-color: var(--accent);
}

.spoke-tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.spoke-item h4 {
  font-size: 1rem;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

.spoke-item p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   THUMBNAILS (For Category Cards)
   ========================================================================== */
.spoke-item.has-thumb {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 1rem;
  align-items: center;
}

.spoke-thumb {
  width: 88px;
  height: 88px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-surface);
  flex-shrink: 0;
}

.spoke-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ==========================================================================
   IN-ARTICLE MEDIA (HALF SIZE, CENTERED & NEVER TRUNCATED)
   ========================================================================== */
.article-media {
  max-width: 380px;            /* Forces half width */
  width: 100%;
  margin: 2.5rem auto;         /* Centered in article */
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-surface);
}

.article-media img {
  width: 100%;
  height: auto;
  max-height: none;            /* Fixes truncation: allows natural full height */
  object-fit: contain;         /* Fixes truncation: displays 100% of the image */
  display: block;
}

.article-media figcaption {
  padding: 0.75rem 1rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--bg-surface-elevated);
}

/* Side-by-Side Dual Image Grid */
.article-media-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 2.5rem 0;
}

.article-media-grid .article-media {
  max-width: 100%;             /* Stretches to fill each half of the grid */
  margin: 0;
}

/* ==========================================================================
   FOOTER & RESPONSIVE
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 3rem 0 2rem;
  margin-top: 4rem;
  background: var(--bg-surface);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 1.25rem;
}

@media (max-width: 768px) {
  .desktop-nav { display: none; }
  .menu-btn { display: inline-flex; }
  .spoke-list { grid-template-columns: 1fr; }
  .article-media-grid { grid-template-columns: 1fr; }
  .spoke-item.has-thumb { grid-template-columns: 1fr; }
  .spoke-thumb { width: 100%; height: 160px; }
}