/*
Theme Name: Dice & Dragons
Theme URI: https://ttrpg.blog
Description: A versatile TTRPG theme supporting multiple game flavors with adaptive light/dark modes
Version: 1.0
Author: r0zzin
*/

/* ============================================
   ROOT VARIABLES - DESIGN SYSTEM FOUNDATION
   ============================================ */

:root {
  /* === LIGHT MODE PALETTE === */
  
  /* Primary: Parchment & Ink (Classic TTRPG aesthetic) */
  --primary-bg: #f8f5f0;           /* Aged parchment */
  --primary-text: #2c2416;         /* Deep sepia ink */
  --primary-accent: #8b4513;       /* Leather-bound brown */
  
  /* Secondary: Mystical Accents */
  --accent-fantasy: #6b46c1;       /* Arcane purple */
  --accent-scifi: #00d9ff;         /* Neon cyan */
  --accent-horror: #8b0000;        /* Blood crimson */
  --accent-western: #d4a574;       /* Desert sand */
  --accent-solarpunk: #52b788;     /* Living green */
  
  /* Neutral Layers */
  --surface-primary: #ffffff;      /* Card backgrounds */
  --surface-secondary: #ebe6dd;    /* Subtle panels */
  --surface-tertiary: #d4cfc4;     /* Borders & dividers */
  
  /* Text Hierarchy */
  --text-primary: #2c2416;
  --text-secondary: #5a4d3a;
  --text-muted: #8b7d6b;
  --text-inverse: #f8f5f0;
  
  /* Interactive States */
  --hover-overlay: rgba(139, 69, 19, 0.1);
  --active-overlay: rgba(139, 69, 19, 0.2);
  --focus-ring: #8b4513;
  
  /* Shadows & Depth */
  --shadow-sm: 0 1px 3px rgba(44, 36, 22, 0.12);
  --shadow-md: 0 4px 6px rgba(44, 36, 22, 0.15);
  --shadow-lg: 0 10px 25px rgba(44, 36, 22, 0.2);
  --shadow-dice: 2px 2px 8px rgba(139, 69, 19, 0.3);
}

[data-theme="dark"] {
  /* === DARK MODE PALETTE === */
  
  /* Primary: Midnight Tavern */
  --primary-bg: #1a1612;           /* Charcoal slate */
  --primary-text: #e8e3d9;         /* Moonlit parchment */
  --primary-accent: #d4a574;       /* Warm gold */
  
  /* Accent colors remain vibrant but slightly desaturated */
  --accent-fantasy: #9d7bd8;       
  --accent-scifi: #4dd4ff;         
  --accent-horror: #c94747;        
  --accent-western: #e0b98a;       
  --accent-solarpunk: #6dd4a3;     
  
  /* Neutral Layers */
  --surface-primary: #242019;      
  --surface-secondary: #2e2820;    
  --surface-tertiary: #3a342a;     
  
  /* Text Hierarchy */
  --text-primary: #e8e3d9;
  --text-secondary: #c4bcac;
  --text-muted: #8b8376;
  --text-inverse: #1a1612;
  
  /* Interactive States */
  --hover-overlay: rgba(212, 165, 116, 0.12);
  --active-overlay: rgba(212, 165, 116, 0.2);
  --focus-ring: #d4a574;
  
  /* Enhanced shadows for depth */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.7);
  --shadow-dice: 2px 2px 12px rgba(212, 165, 116, 0.4);
}

/* ============================================
   FLAVOR-SPECIFIC ACCENT OVERRIDES
   ============================================ */

[data-flavor="fantasy"] {
  --flavor-accent: var(--accent-fantasy);
  --flavor-gradient: linear-gradient(135deg, #6b46c1 0%, #9d7bd8 100%);
}

[data-flavor="scifi"] {
  --flavor-accent: var(--accent-scifi);
  --flavor-gradient: linear-gradient(135deg, #00d9ff 0%, #00a8cc 100%);
}

[data-flavor="horror"] {
  --flavor-accent: var(--accent-horror);
  --flavor-gradient: linear-gradient(135deg, #8b0000 0%, #5c0000 100%);
}

[data-flavor="western"] {
  --flavor-accent: var(--accent-western);
  --flavor-gradient: linear-gradient(135deg, #d4a574 0%, #b8915f 100%);
}

[data-flavor="solarpunk"] {
  --flavor-accent: var(--accent-solarpunk);
  --flavor-gradient: linear-gradient(135deg, #52b788 0%, #40916c 100%);
}

/* ============================================
   BASE STYLES
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Crimson Text', 'Georgia', serif;
  background: var(--primary-bg);
  color: var(--text-primary);
  line-height: 1.7;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ============================================
   TYPOGRAPHY SYSTEM
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  font-family: 'Cinzel', 'Georgia', serif;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
h2 { font-size: clamp(2rem, 4vw, 3rem); }
h3 { font-size: clamp(1.5rem, 3vw, 2rem); }
h4 { font-size: 1.25rem; }

p {
  margin-bottom: 1.5rem;
  font-size: 1.125rem;
}

.lead {
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */

.site-header {
  background: var(--surface-primary);
  border-bottom: 2px solid var(--surface-tertiary);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: all 0.3s ease;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
}

.logo-icon {
  width: 50px;
  height: 50px;
  background: var(--flavor-gradient, var(--primary-accent));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  box-shadow: var(--shadow-dice);
}

.site-title {
  font-family: 'Cinzel', serif;
  font-size: 1.75rem;
  color: var(--text-primary);
  margin: 0;
}

.main-nav ul {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.main-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.1rem;
  transition: color 0.2s ease;
  position: relative;
}

.main-nav a::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--flavor-accent, var(--primary-accent));
  transition: width 0.3s ease;
}

.main-nav a:hover {
  color: var(--flavor-accent, var(--primary-accent));
}

.main-nav a:hover::after {
  width: 100%;
}

/* ============================================
   THEME CONTROLS
   ============================================ */

.theme-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.theme-toggle, .flavor-selector {
  background: var(--surface-secondary);
  border: 2px solid var(--surface-tertiary);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-primary);
  font-family: inherit;
}

.theme-toggle:hover, .flavor-selector:hover {
  background: var(--hover-overlay);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ============================================
   HERO SECTION
   ============================================ */

.hero-section {
  background: var(--flavor-gradient, var(--primary-accent));
  color: var(--text-inverse);
  padding: 6rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><path d="M10 10 L30 30 M30 10 L10 30" stroke="white" stroke-opacity="0.05" stroke-width="2"/></svg>');
  opacity: 0.3;
}

.hero-content {
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero-section h1 {
  color: var(--text-inverse);
  margin-bottom: 1.5rem;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
}

/* ============================================
   MAIN CONTENT GRID
   ============================================ */

.content-wrapper {
  max-width: 1400px;
  margin: 0 auto;
  padding: 4rem 2rem;
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 3rem;
}

/* ============================================
   POST CARDS
   ============================================ */

.post-card {
  background: var(--surface-primary);
  border: 2px solid var(--surface-tertiary);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  margin-bottom: 2rem;
}

.post-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--flavor-accent, var(--primary-accent));
}

.post-thumbnail {
  width: 100%;
  height: 300px;
  object-fit: cover;
  border-bottom: 3px solid var(--flavor-accent, var(--primary-accent));
}

.post-content {
  padding: 2rem;
}

.post-meta {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.post-category {
  background: var(--flavor-accent, var(--primary-accent));
  color: var(--text-inverse);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85rem;
}

.post-card h2 {
  font-size: 1.75rem;
  margin-bottom: 1rem;
}

.post-card h2 a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.post-card h2 a:hover {
  color: var(--flavor-accent, var(--primary-accent));
}

.post-excerpt {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.read-more {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--flavor-accent, var(--primary-accent));
  text-decoration: none;
  font-weight: 600;
  transition: gap 0.3s ease;
}

.read-more:hover {
  gap: 1rem;
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.widget {
  background: var(--surface-primary);
  border: 2px solid var(--surface-tertiary);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

.widget-title {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 3px solid var(--flavor-accent, var(--primary-accent));
}

.widget ul {
  list-style: none;
}

.widget li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--surface-tertiary);
}

.widget li:last-child {
  border-bottom: none;
}

.widget a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.widget a:hover {
  color: var(--flavor-accent, var(--primary-accent));
}

/* ============================================
   FOOTER
   ============================================ */

.site-footer {
  background: var(--surface-secondary);
  border-top: 3px solid var(--flavor-accent, var(--primary-accent));
  padding: 3rem 2rem;
  margin-top: 4rem;
  text-align: center;
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
}

.footer-nav {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.footer-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.footer-nav a:hover {
  color: var(--flavor-accent, var(--primary-accent));
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1024px) {
  .content-wrapper {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    order: -1;
  }
}

@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    gap: 1rem;
  }
  
  .main-nav ul {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .theme-controls {
    flex-direction: column;
    width: 100%;
  }
  
  .theme-toggle, .flavor-selector {
    width: 100%;
  }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--flavor-accent, var(--primary-accent));
  color: var(--text-inverse);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  opacity: 0.9;
}

.dice-icon::before {
  content: '🎲';
  margin-right: 0.5rem;
}