/* =====================================================
   THEME.CSS - Ash & Ember Education Premium Redesign
   ===================================================== */

/* =====================================================
   ROOT CSS VARIABLES - Theme System
   ===================================================== */

:root {
  /* Light Mode Colors */
  --color-bg-primary: #F8F5F2;
  --color-bg-secondary: #FFFFFF;
  --color-text-primary: #2D2D2D;
  --color-text-secondary: #6B6B6B;
  --color-text-muted: #999999;
  --color-border: rgba(0, 0, 0, 0.08);
  --color-shadow: rgba(0, 0, 0, 0.08);
  --color-shadow-dark: rgba(0, 0, 0, 0.12);

  /* Dark Mode Colors (overridden by [data-theme="dark"]) */
  --color-accent-primary: #D95F30;
  --color-accent-secondary: #E8A557;
  --color-accent-light: #F0C892;

  /* Typography */
  --font-serif: "Crimson Text", "Playfair Display", Georgia, serif;
  --font-sans: "Raleway", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Menlo", "Monaco", monospace;

  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.5rem;
  --font-size-5xl: 3rem;

  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Spacing Scale (8px base) */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-1: 0.75rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 2.5rem;
  --space-6: 3rem;
  --space-8: 4rem;
  --space-10: 5rem;
  --space-12: 6rem;

  /* Borders & Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-2xl: 28px;

  /* Shadows */
  --shadow-sm: 0 1px 2px var(--color-shadow);
  --shadow-md: 0 4px 6px var(--color-shadow), 0 1px 3px var(--color-shadow);
  --shadow-lg: 0 10px 15px var(--color-shadow-dark), 0 4px 6px var(--color-shadow);
  --shadow-xl: 0 20px 25px var(--color-shadow-dark), 0 10px 10px var(--color-shadow);

  /* Transitions */
  --transition-fast: 0.15s ease-in-out;
  --transition-base: 0.3s ease-in-out;
  --transition-slow: 0.5s ease-in-out;

  /* Bento Grid */
  --grid-gap: 1.5rem;
  --grid-cols: 12;
}

/* Dark Mode Overrides */
[data-theme="dark"] {
  --color-bg-primary: #1A1A1A;
  --color-bg-secondary: #2D2D2D;
  --color-text-primary: #F5F5F5;
  --color-text-secondary: #D0D0D0;
  --color-text-muted: #909090;
  --color-border: rgba(255, 255, 255, 0.1);
  --color-shadow: rgba(0, 0, 0, 0.3);
  --color-shadow-dark: rgba(0, 0, 0, 0.5);
}

/* System preference fallback */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg-primary: #1A1A1A;
    --color-bg-secondary: #2D2D2D;
    --color-text-primary: #F5F5F5;
    --color-text-secondary: #D0D0D0;
    --color-text-muted: #909090;
    --color-border: rgba(255, 255, 255, 0.1);
    --color-shadow: rgba(0, 0, 0, 0.3);
    --color-shadow-dark: rgba(0, 0, 0, 0.5);
  }
}

/* =====================================================
   GLOBAL STYLES
   ===================================================== */

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

html {
  scroll-behavior: smooth;
  color-scheme: light dark;
}

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
  transition: background-color var(--transition-base), color var(--transition-base);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
  margin-bottom: var(--space-3);
}

h1 {
  font-size: var(--font-size-5xl);
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--font-size-4xl);
  letter-spacing: -0.01em;
}

h3 {
  font-size: var(--font-size-3xl);
}

h4 {
  font-size: var(--font-size-2xl);
}

h5 {
  font-size: var(--font-size-xl);
}

h6 {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

p {
  margin-bottom: var(--space-3);
  color: var(--color-text-secondary);
}

a {
  color: var(--color-accent-primary);
  text-decoration: none;
  transition: color var(--transition-base);
}

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

/* =====================================================
   HEADER & NAVIGATION
   ===================================================== */

header {
  background-color: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
  transition: all var(--transition-base);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.navbar {
  padding: var(--space-3) 0;
}

.navbar-brand {
  font-family: var(--font-serif);
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary) !important;
  transition: color var(--transition-base);
}

.nav-link {
  font-family: var(--font-sans);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary) !important;
  transition: color var(--transition-base);
  position: relative;
}

.nav-link:hover,
.nav-link.active {
  color: var(--color-accent-primary) !important;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-accent-primary);
  transition: width var(--transition-base);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

/* Header Controls */
.header-controls {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.theme-toggle,
.lang-toggle {
  background: transparent;
  border: 1px solid var(--color-border);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--color-text-primary);
  font-weight: var(--font-weight-medium);
  transition: all var(--transition-base);
  font-size: var(--font-size-sm);
}

.theme-toggle:hover,
.lang-toggle:hover {
  background-color: var(--color-accent-primary);
  color: white;
  border-color: var(--color-accent-primary);
}

/* =====================================================
   HERO SECTION
   ===================================================== */

.hero-section {
  position: relative;
  overflow: hidden;
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-bg-secondary);
}

.hero-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--color-bg-secondary) 0%, var(--color-bg-secondary) 100%);
  z-index: -1;
}

.hero-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.7;
  z-index: 1;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(45, 45, 45, 0.5) 0%, rgba(45, 45, 45, 0.3) 100%);
  z-index: 2;
}

.hero-content {
  position: relative;
  z-index: 3;
  text-align: center;
  color: white;
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-8);
}

.hero-content h1 {
  color: white;
  font-size: var(--font-size-5xl);
  margin-bottom: var(--space-4);
  animation: fadeInUp 0.8s ease-out;
}

.hero-content p {
  color: rgba(255, 255, 255, 0.95);
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-4);
  animation: fadeInUp 0.8s ease-out 0.1s backwards;
}

.hero-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
  animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =====================================================
   BUTTONS
   ===================================================== */

.btn {
  font-weight: var(--font-weight-semibold);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
  border: none;
  cursor: pointer;
  display: inline-block;
  text-align: center;
  font-size: var(--font-size-base);
}

.btn-primary {
  background-color: var(--color-accent-primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--color-accent-secondary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background-color: transparent;
  color: white;
  border: 2px solid white;
}

.btn-secondary:hover {
  background-color: white;
  color: var(--color-text-primary);
}

.btn-lg {
  padding: var(--space-3) var(--space-6);
  font-size: var(--font-size-lg);
}

.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-sm);
}

/* =====================================================
   BENTO GRID SYSTEM
   ===================================================== */

.bento-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), 1fr);
  gap: var(--grid-gap);
  margin-bottom: var(--space-8);
}

.bento-item {
  background-color: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: all var(--transition-base);
  animation: fadeInUp 0.6s ease-out;
}

.bento-item:nth-child(1) { animation-delay: 0s; }
.bento-item:nth-child(2) { animation-delay: 0.1s; }
.bento-item:nth-child(3) { animation-delay: 0.2s; }
.bento-item:nth-child(4) { animation-delay: 0.3s; }
.bento-item:nth-child(5) { animation-delay: 0.4s; }
.bento-item:nth-child(6) { animation-delay: 0.5s; }

/* Bento Item Spans */
.bento-item.span-2 { grid-column: span 2; }
.bento-item.span-full { grid-column: span var(--grid-cols); }
.bento-item.span-half { grid-column: span calc(var(--grid-cols) / 2); }

/* Mobile: Single column */
@media (max-width: 768px) {
  .bento-grid {
    --grid-cols: 1;
    gap: var(--space-4);
  }

  .bento-item.span-2,
  .bento-item.span-full,
  .bento-item.span-half {
    grid-column: span 1;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .bento-grid {
    --grid-cols: 2;
  }

  .bento-item.span-2 { grid-column: span 2; }
  .bento-item.span-full { grid-column: span 2; }
  .bento-item.span-half { grid-column: span 1; }
}

@media (min-width: 1025px) {
  .bento-grid {
    --grid-cols: 3;
    --grid-gap: 2rem;
  }

  .bento-item.span-2 { grid-column: span 2; }
  .bento-item.span-full { grid-column: span 3; }
  .bento-item.span-half { grid-column: span 1; }
}

.bento-item:hover {
  border-color: var(--color-accent-primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.bento-item img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  object-fit: cover;
}

/* =====================================================
   CARDS & CONTAINERS
   ===================================================== */

.card {
  background-color: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: all var(--transition-base);
}

.card:hover {
  border-color: var(--color-accent-primary);
  box-shadow: var(--shadow-lg);
}

.card-title {
  font-family: var(--font-serif);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.card-text {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
}

/* =====================================================
   SECTIONS
   ===================================================== */

section {
  padding: var(--space-10) 0;
  border-bottom: 1px solid var(--color-border);
}

section:last-child {
  border-bottom: none;
}

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

.section-title {
  text-align: center;
  margin-bottom: var(--space-8);
}

.section-title h2 {
  margin-bottom: var(--space-3);
}

.section-subtitle {
  color: var(--color-text-secondary);
  font-size: var(--font-size-lg);
}

/* =====================================================
   FOOTER
   ===================================================== */

footer {
  background-color: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border);
  padding: var(--space-8) 0;
  margin-top: var(--space-12);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.footer-section h3 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-section a {
  display: block;
  margin-bottom: var(--space-2);
  color: var(--color-text-secondary);
}

.footer-section a:hover {
  color: var(--color-accent-primary);
}

.footer-divider {
  height: 2px;
  width: 60px;
  background-color: var(--color-accent-primary);
  margin: var(--space-2) 0 var(--space-3) 0;
}

.footer-bottom {
  text-align: center;
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

/* =====================================================
   FORMS
   ===================================================== */

input, textarea, select {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
  background-color: var(--color-bg-secondary);
  transition: all var(--transition-base);
  margin-bottom: var(--space-3);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-accent-primary);
  box-shadow: 0 0 0 3px rgba(217, 95, 48, 0.1);
}

label {
  display: block;
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-1);
  color: var(--color-text-primary);
}

/* =====================================================
   IMAGES & MEDIA
   ===================================================== */

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

.img-responsive {
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* =====================================================
   UTILITIES
   ===================================================== */

.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }

.py-4 { padding: var(--space-4) 0; }
.py-6 { padding: var(--space-6) 0; }
.py-8 { padding: var(--space-8) 0; }

.px-4 { padding: 0 var(--space-4); }

.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

/* =====================================================
   RESPONSIVE DESIGN
   ===================================================== */

@media (max-width: 768px) {
  h1 { font-size: var(--font-size-3xl); }
  h2 { font-size: var(--font-size-2xl); }
  h3 { font-size: var(--font-size-xl); }

  section {
    padding: var(--space-6) 0;
  }

  .container {
    padding: 0 var(--space-3);
  }

  .hero-content {
    padding: var(--space-6);
  }

  .hero-content h1 {
    font-size: var(--font-size-3xl);
  }
}

/* =====================================================
   ACCESSIBILITY
   ===================================================== */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Focus visible for keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--color-accent-primary);
  outline-offset: 2px;
}

/* =====================================================
   ANIMATIONS
   ===================================================== */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* =====================================================
   PRINT STYLES
   ===================================================== */

@media print {
  header, footer, .no-print {
    display: none;
  }

  body {
    background-color: white;
    color: black;
  }
}
