/* -------------------------------------------------------------------------- */
/*                                 THEME ENGINE                               */
/* -------------------------------------------------------------------------- */

:root {
  /* --- DEFAULT THEME (Emerald) --- */
  --primary: #059669; /* Emerald 600 */
  --primary-hover: #10b981; /* Emerald 700 */
  --accent: #059669; /* Emerald 600 */

  /* Structure Colors (Light Mode) */
  --bg-body: #f3f4f6; /* Grey 100 */
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --text-main: #111827; /* Grey 900 */
  --text-muted: #6b7280; /* Grey 500 */
  --border: #e5e7eb; /* Grey 200 */

  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --radius: 8px;

  --font-ui: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-read: 'Georgia', 'Cambria', 'Times New Roman', serif;
}

/* --- DARK MODE DEFAULTS --- */
/* Applied when body has class "dark-mode" */
body.dark-mode {
  /* Remap structural colors */
  --bg-body: #0f172a; /* Slate 900 */
  --bg-card: #1e293b; /* Slate 800 */
  --bg-input: #334155; /* Slate 700 */

  --text-main: #f1f5f9; /* Slate 100 */
  --text-muted: #94a3b8; /* Slate 400 */

  --border: #334155; /* Slate 700 */
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
}

/* --- THEME VARIATIONS --- */

/* Lime (Green) - Redundant if matches :root, but kept for explicit selection */
body.theme-lime {
  --primary: #60b845;
  --primary-hover: #67c64a;
  --accent: #9ef184;
}
body.dark-mode.theme-lime {
  --primary: #60b845;
  --primary-hover: #34d399;
}

/* Emerald (Green) - */
body.theme-emerald {
  --primary: #059669;
  --primary-hover: #047857;
  --accent: #9ef184;
}
body.dark-mode.theme-emerald {
  --primary: #10b981;
  --primary-hover: #34d399;
}

/* Sapphire (Blue) */
body.theme-sapphire {
  --primary: #2563eb; /* Blue 600 */
  --primary-hover: #1d4ed8; /* Blue 700 */
  --accent: #f59e0b; /* Amber 500 */
}
body.dark-mode.theme-sapphire {
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
}

/* Amethyst (Purple) */
body.theme-amethyst {
  --primary: #7c3aed; /* Violet 600 */
  --primary-hover: #6d28d9;
  --accent: #0ea5e9; /* Sky 500 */
}
body.dark-mode.theme-amethyst {
  --primary: #8b5cf6;
  --primary-hover: #a78bfa;
}

/* Sunset (Orange/Red) */
body.theme-sunset {
  --primary: #ea580c; /* Orange 600 */
  --primary-hover: #c2410c;
  --accent: #8b5cf6; /* Violet 500 */
}
body.dark-mode.theme-sunset {
  --primary: #f97316;
  --primary-hover: #fb923c;
}

/* Graphite (Monochrome) */
body.theme-graphite {
  --primary: #374151; /* Grey 700 */
  --primary-hover: #111827;
  --accent: #ef4444; /* Red 500 */
}
body.dark-mode.theme-graphite {
  --primary: #94a3b8;
  --primary-hover: #cbd5e1;
  --accent: #f87171;
}

/* -------------------------------------------------------------------------- */
/*                                 GLOBAL STYLES                              */
/* -------------------------------------------------------------------------- */

html {
  /* 1. Paint the infinite canvas the correct color */
  background-color: var(--bg-body);
  /* 2. Ensure html takes up at least the window height */
  min-height: 100%;
}

body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: var(--font-ui);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Helper classes */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Header & Nav */
header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

header h1,
header a.brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  margin: 0;
}

#hamburger {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
}

nav {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: none;
  box-shadow: var(--shadow);
}
nav.open {
  display: block;
}
nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
nav a {
  display: block;
  padding: 1rem 1.5rem;
  text-decoration: none;
  color: var(--text-main);
  border-top: 1px solid var(--border);
}
nav a:hover {
  background-color: var(--bg-body);
  color: var(--primary);
}

main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1rem;
  min-height: calc(100vh - 160px);
}

button,
select,
input,
textarea {
  font-family: inherit;
  font-size: 0.95rem;
  border-radius: 6px;
}

/* Button standard */
button.btn-primary {
  background-color: var(--primary);
  color: white;
  border: none;
  padding: 0.6rem 1.5rem;
  font-weight: 600;
  cursor: pointer;
}
button.btn-primary:hover {
  background-color: var(--primary-hover);
}

/* Input/Select Standard */
select,
input[type='text'],
textarea {
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 0.5rem;
}
