/* Copper Sanctuary — Brand Styles */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700;900&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;700&display=swap');

/* ===== Design Tokens ===== */
:root {
  /* Primary Branding */
  --copper-primary: #b87333;
  --copper-light: #d4924a;
  --copper-dark: #8b5a2b;

  /* Nature Accents */
  --nature-green: #4a7c59;
  --nature-dark: #2d4a36;

  /* Neutral Foundation */
  --neutral-950: #0a0a0a;
  --neutral-900: #121212;
  --neutral-800: #1e1e1e;
  --neutral-700: #2a2a2a;
  --neutral-600: #3a3a3a;
  --neutral-400: #888888;
  --neutral-300: #aaaaaa;
  --neutral-200: #cccccc;
  --neutral-100: #f5f5f5;

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-bg-hover: rgba(255, 255, 255, 0.06);
  --bento-radius: 40px;
  --radius-sm: 16px;
  --radius-xs: 10px;
  --transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);

  /* Feedback Colors */
  --success: #4caf50;
  --success-bg: rgba(76, 175, 80, 0.15);
  --error: #ef5350;
  --error-bg: rgba(239, 83, 80, 0.15);
  --warning: #ff9800;
  --warning-bg: rgba(255, 152, 0, 0.15);
  --info: #42a5f5;
  --info-bg: rgba(66, 165, 245, 0.15);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--neutral-950);
  color: var(--neutral-100);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== Background Mesh ===== */
.mesh-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 10% 20%, rgba(184, 115, 51, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(74, 124, 89, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, #0a0a0a 0%, #050505 100%);
}

/* ===== Typography ===== */
h1, h2, h3, h4 {
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--neutral-100);
}

h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 700; }
h2 { font-size: clamp(1.4rem, 3vw, 1.875rem); font-weight: 600; }
h3 { font-size: clamp(1.15rem, 2.5vw, 1.375rem); font-weight: 600; }
h4 { font-size: 1.1rem; font-weight: 600; }

.mono {
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-size: 0.75rem;
}

a {
  color: var(--copper-light);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover { color: var(--copper-primary); }

/* ===== Container ===== */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 80px;
}

@media (max-width: 1024px) {
  .container { padding: 0 40px; }
}

@media (max-width: 640px) {
  .container { padding: 0 24px; }
}

/* ===== Navigation ===== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  padding: 0 24px;
}

.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-brand {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--copper-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-brand img {
  height: 32px;
  width: 32px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}

.nav-links a, .nav-links button {
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--neutral-300);
  padding: 8px 16px;
  border-radius: var(--radius-xs);
  transition: var(--transition);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
}

.nav-links a:hover, .nav-links button:hover {
  color: var(--neutral-100);
  background: var(--glass-bg-hover);
}

.nav-links a.active {
  color: var(--copper-primary);
  background: rgba(184, 115, 51, 0.1);
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--neutral-100);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
}

@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    flex-direction: column;
    padding: 16px;
    border-bottom: 1px solid var(--glass-border);
  }
  .nav-links.open { display: flex; }
  .nav-links a, .nav-links button {
    width: 100%;
    text-align: left;
    padding: 12px 16px;
  }
}

/* ===== Cards ===== */
.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--bento-radius);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  padding: 32px;
  transition: var(--transition);
}

.card:hover {
  background: var(--glass-bg-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

.card-sm {
  border-radius: var(--radius-sm);
  padding: 20px;
}

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

/* ===== Grid ===== */
.grid {
  display: grid;
  gap: 24px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 0.9375rem;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  line-height: 1.4;
}

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

.btn-primary:hover {
  background: var(--copper-light);
  color: white;
}

.btn-secondary {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--neutral-100);
}

.btn-secondary:hover {
  background: var(--glass-bg-hover);
}

.btn-success {
  background: var(--nature-green);
  color: white;
}

.btn-success:hover {
  background: var(--nature-dark);
  color: white;
}

.btn-sm {
  padding: 8px 18px;
  font-size: 0.8125rem;
  border-radius: var(--radius-xs);
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--neutral-300);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--neutral-900);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs);
  color: var(--neutral-100);
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--copper-primary);
}

.form-input::placeholder {
  color: var(--neutral-600);
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-error {
  color: var(--error);
  font-size: 0.8125rem;
  margin-top: 6px;
}

/* ===== Alerts ===== */
.alert {
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  margin-bottom: 20px;
}

.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(76, 175, 80, 0.3); }
.alert-error { background: var(--error-bg); color: var(--error); border: 1px solid rgba(239, 83, 80, 0.3); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(255, 152, 0, 0.3); }
.alert-info { background: var(--info-bg); color: var(--info); border: 1px solid rgba(66, 165, 245, 0.3); }

/* ===== Progress Bar ===== */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--neutral-800);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--copper-primary), var(--copper-light));
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.progress-fill.green {
  background: linear-gradient(90deg, var(--nature-green), #6aad7b);
}

/* ===== Badges ===== */
.badge-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  font-size: 1.5rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
}

.badge-icon.lg {
  width: 72px;
  height: 72px;
  font-size: 2rem;
}

.badge-icon.earned {
  background: rgba(184, 115, 51, 0.15);
  border-color: var(--copper-primary);
}

.badge-icon.locked {
  opacity: 0.4;
  filter: grayscale(1);
}

/* ===== Quiz Styles ===== */
.quiz-option {
  display: block;
  width: 100%;
  padding: 16px 20px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--neutral-100);
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 12px;
}

.quiz-option:hover {
  background: var(--glass-bg-hover);
  border-color: var(--copper-primary);
}

.quiz-option.correct {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}

.quiz-option.incorrect {
  background: var(--error-bg);
  border-color: var(--error);
  color: var(--error);
}

.quiz-option.revealed {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}

.quiz-option:disabled {
  cursor: default;
}

.quiz-option:disabled:hover {
  background: var(--glass-bg);
  border-color: var(--glass-border);
}

.quiz-option.correct:disabled:hover {
  background: var(--success-bg);
  border-color: var(--success);
}

.quiz-option.incorrect:disabled:hover {
  background: var(--error-bg);
  border-color: var(--error);
}

.quiz-feedback {
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  margin-top: 16px;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.quiz-feedback.correct {
  background: var(--success-bg);
  border: 1px solid rgba(76, 175, 80, 0.3);
  color: var(--success);
}

.quiz-feedback.incorrect {
  background: var(--error-bg);
  border: 1px solid rgba(239, 83, 80, 0.3);
  color: var(--error);
}

/* ===== Topic Card ===== */
.topic-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.topic-meta {
  font-size: 0.8125rem;
  color: var(--neutral-400);
  margin-top: 8px;
}

/* ===== Lesson Content ===== */
.lesson-content {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--neutral-200);
}

.lesson-content p {
  margin-bottom: 16px;
}

.lesson-content strong {
  color: var(--copper-light);
  font-weight: 600;
}

/* ===== Page Layout ===== */
.page-header {
  padding: 40px 0 24px;
}

.page-header h1 {
  margin-bottom: 8px;
}

.page-header p {
  color: var(--neutral-400);
  font-size: 1.0625rem;
}

.page-content {
  padding: 0 0 60px;
}

/* ===== Hero Section ===== */
.hero {
  text-align: center;
  padding: 80px 0 60px;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 900;
  margin-bottom: 16px;
}

.hero h1 .copper { color: var(--copper-primary); }
.hero h1 .green { color: var(--nature-green); }

.hero p {
  color: var(--neutral-300);
  font-size: 1.125rem;
  max-width: 600px;
  margin: 0 auto 32px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== Stats Row ===== */
.stats-row {
  display: flex;
  gap: 32px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 40px;
}

.stat {
  text-align: center;
}

.stat-value {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--copper-primary);
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--neutral-400);
  margin-top: 4px;
}

/* ===== Dashboard ===== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 768px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

/* ===== Utility ===== */
.text-center { text-align: center; }
.text-copper { color: var(--copper-primary); }
.text-green { color: var(--nature-green); }
.text-muted { color: var(--neutral-400); }
.text-sm { font-size: 0.8125rem; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.hidden { display: none; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--neutral-950); }
::-webkit-scrollbar-thumb { background: var(--neutral-700); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--neutral-600); }

/* ===== Footer ===== */
.footer {
  border-top: 1px solid var(--glass-border);
  padding: 32px 0;
  text-align: center;
  color: var(--neutral-400);
  font-size: 0.8125rem;
}

/* ===== HTMX Transitions ===== */
.htmx-settling { opacity: 0; }
.htmx-swapping { opacity: 0; transition: opacity 0.15s ease-out; }
.htmx-added { opacity: 0; }
.htmx-added.htmx-settling { opacity: 1; transition: opacity 0.3s ease-in; }

/* Indicator */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }
.htmx-request.htmx-indicator { display: inline-block; }

/* ===== Loading Spinner ===== */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Disabled button styling — clear feedback for kids */
.btn:disabled {
  opacity: 0.6;
  cursor: wait;
  pointer-events: none;
}
