/* ==========================================================================
   ClojureKid - Kid-friendly Clojure learning site
   Big fonts, clear layout, bright-but-calm colors.
   ========================================================================== */

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

:root {
  --bg:          #f0f4f8;
  --surface:     #ffffff;
  --primary:     #6c5ce7;
  --primary-dim: #a29bfe;
  --accent:      #00cec9;
  --accent-dim:  #81ecec;
  --text:        #2d3436;
  --text-light:  #636e72;
  --danger:      #d63031;
  --success:     #00b894;
  --code-bg:     #1e1e2e;
  --code-fg:     #cdd6f4;
  --radius:      12px;
  --shadow:      0 2px 8px rgba(0,0,0,0.08);
}

html {
  font-size: 18px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

/* --- Header --- */
#app-header {
  text-align: center;
  padding: 1.5rem 0 0.5rem;
}

#app-header h1 {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -1px;
}

.logo-paren {
  color: var(--accent);
  font-weight: 400;
}

.tagline {
  font-size: 1rem;
  color: var(--text-light);
  margin-top: 0.2rem;
}

/* --- Lesson navigation --- */
#lesson-nav {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0.75rem 0;
}

.lesson-btn {
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border: 2px solid var(--primary-dim);
  border-radius: 999px;
  background: var(--surface);
  color: var(--primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.lesson-btn:hover {
  background: var(--primary-dim);
  color: #fff;
}

.lesson-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* --- Lesson info --- */
#lesson-info {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow);
}

#lesson-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

#lesson-intro {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
}

#lesson-intro code {
  background: #eee;
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.95em;
  font-family: "Fira Code", "Cascadia Code", "Consolas", monospace;
  color: var(--primary);
}

/* --- Example navigation --- */
#example-nav {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.example-btn {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.9rem;
  border: 2px solid var(--accent-dim);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  transition: all 0.15s ease;
}

.example-btn:hover {
  background: var(--accent-dim);
  color: #fff;
}

.example-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* --- Explanation bar --- */
#explanation-bar {
  background: var(--accent-dim);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 0.6rem 1.25rem;
}

#example-explanation {
  font-size: 0.95rem;
  font-weight: 500;
  color: #1a5653;
}

/* --- Workspace (editor + output) --- */
#workspace {
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  overflow: hidden;
}

#editor-area {
  display: flex;
  min-height: 440px;
}

/* --- Editor pane --- */
#editor-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--code-bg);
  min-width: 0;
}

.pane-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.75rem;
  background: rgba(0,0,0,0.25);
}

.pane-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
}

#editor-pane .pane-label { color: #7f8c8d; }
#output-pane .pane-label { color: var(--text-light); }

#run-btn {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.3rem 1.2rem;
  border: none;
  border-radius: 999px;
  background: var(--success);
  color: #fff;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
}

#run-btn:hover  { background: #00a884; }
#run-btn:active { transform: scale(0.96); }

#clear-btn {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.8rem;
  border: 1px solid #ccc;
  border-radius: 999px;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
}

#clear-btn:hover { background: #eee; }

#code-editor {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  padding: 1rem;
  font-family: "Fira Code", "Cascadia Code", "Consolas", monospace;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--code-fg);
  background: var(--code-bg);
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}

#code-editor::placeholder {
  color: #585b70;
}

/* --- Output pane --- */
#output-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid #e0e0e0;
  min-width: 0;
}

#output-canvas {
  display: block;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  background: #ffffff;
  border-bottom: 1px solid #eee;
}

#text-output {
  flex: 1;
  padding: 0.75rem 1rem;
  font-family: "Fira Code", "Cascadia Code", "Consolas", monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
  overflow: auto;
  white-space: pre-wrap;
  min-height: 2rem;
}

#text-output .error {
  color: var(--danger);
  font-weight: 600;
}

#text-output .result {
  color: var(--success);
}

/* --- Footer --- */
#app-footer {
  text-align: center;
  padding: 1.5rem 0 0.5rem;
  color: var(--text-light);
  font-size: 0.8rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  html { font-size: 16px; }

  #editor-area {
    flex-direction: column;
  }

  #output-pane {
    border-left: none;
    border-top: 1px solid #e0e0e0;
  }

  #code-editor {
    min-height: 200px;
  }
}
