/* ──────────────────────────────────────────────────────────
   Oakland Habla — Tutorial Series Shared Styles
   Warm terracotta palette, bilingual, mobile-first
   ────────────────────────────────────────────────────────── */

:root {
  --clay:       #c0541a;
  --clay-dark:  #8a3a10;
  --clay-light: #e8845a;
  --night:      #1a0a00;
  --gold:       #e6b800;
  --sage:       #2e8b57;
  --cream:      #fdf6ee;
  --text:       #2d1a0a;
  --muted:      #7a5a42;
  --code-bg:    #1e1008;
  --code-text:  #f8c98a;
  --radius:     12px;
  --shadow:     0 4px 24px rgba(0,0,0,0.18);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Nunito', 'Segoe UI', Arial, sans-serif;
  background: var(--cream);
  color: var(--text);
  line-height: 1.7;
  font-size: 1.05rem;
}

/* ── Typography ── */
h1, h2, h3 {
  font-family: 'Pacifico', 'Georgia', serif;
  color: var(--clay-dark);
  line-height: 1.2;
}
h1 { font-size: clamp(1.8rem, 5vw, 3rem); }
h2 { font-size: clamp(1.3rem, 3vw, 1.9rem); margin: 2rem 0 0.8rem; }
h3 { font-size: 1.2rem; margin: 1.5rem 0 0.5rem; }

.subtitle {
  font-size: 1.05rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 0.25rem;
}

/* ── Layout ── */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

/* ── Site Header ── */
.site-header {
  background: linear-gradient(135deg, var(--night) 0%, #3a1500 100%);
  color: #fff;
  padding: 2.5rem 1.25rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 60% 40%, rgba(192,84,26,0.35) 0%, transparent 70%);
  pointer-events: none;
}
.site-header h1 { color: #fff; }
.site-header .subtitle { color: rgba(255,255,255,0.7); }

.lang-badges {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.lang-badge {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 20px;
  padding: 0.2rem 0.75rem;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.9);
}

/* ── Lesson Nav Bar ── */
.lesson-nav {
  background: var(--night);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.lesson-nav a {
  color: var(--clay-light);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: color 0.2s;
}
.lesson-nav a:hover { color: var(--gold); }
.lesson-nav .home-link { font-size: 1rem; }

/* ── Progress Bar ── */
.progress-bar-wrap {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  height: 6px;
  flex: 1;
  min-width: 80px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--clay-light);
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(.4,0,.2,1);
}

/* ── Lesson Prev/Next ── */
.lesson-pagination {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-top: 3rem;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--clay);
  color: #fff;
  text-decoration: none;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.95rem;
  transition: background 0.2s, transform 0.15s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.btn:hover { background: var(--clay-dark); transform: translateY(-1px); }
.btn.secondary { background: var(--night); }
.btn.secondary:hover { background: #3a1500; }
.btn.gold { background: var(--gold); color: var(--night); }
.btn.gold:hover { background: #c9a000; }

/* ── Lesson Cards (Hub) ── */
.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}
.lesson-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.25rem;
  text-decoration: none;
  color: var(--text);
  border: 2px solid transparent;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  display: block;
  animation: fadeUp 0.5s ease both;
}
.lesson-card:hover {
  border-color: var(--clay);
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}
.lesson-card .icon {
  font-size: 2.2rem;
  display: block;
  margin-bottom: 0.6rem;
}
.lesson-card .num {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.lesson-card h3 {
  margin: 0.3rem 0 0.2rem;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--clay-dark);
}
.lesson-card .sub { font-size: 0.85rem; color: var(--muted); }

/* staggered card animation */
.lesson-card:nth-child(1) { animation-delay: 0.05s; }
.lesson-card:nth-child(2) { animation-delay: 0.10s; }
.lesson-card:nth-child(3) { animation-delay: 0.15s; }
.lesson-card:nth-child(4) { animation-delay: 0.20s; }
.lesson-card:nth-child(5) { animation-delay: 0.25s; }
.lesson-card:nth-child(6) { animation-delay: 0.30s; }
.lesson-card:nth-child(7) { animation-delay: 0.35s; }

/* ── Step Blocks ── */
.step {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem 1.5rem;
  margin: 1.5rem 0;
  border-left: 5px solid var(--clay);
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.step.revealed {
  opacity: 1;
  transform: translateY(0);
}
.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: var(--clay);
  color: #fff;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

/* ── Code Blocks ── */
pre {
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-family: 'Fira Code', 'Cascadia Code', 'Courier New', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 1rem 0;
  position: relative;
}
pre .comment  { color: #7a8a6a; }
pre .string   { color: #98d492; }
pre .keyword  { color: #e6b800; }
pre .number   { color: #e68a4a; }
pre .property { color: #88ccff; }

/* Typewriter on .type-reveal pre */
.type-reveal {
  overflow: hidden;
}
.type-reveal pre {
  width: 0;
  white-space: pre;
  border-right: 2px solid var(--clay-light);
  animation: none;
}
.type-reveal.revealed pre {
  animation: typewriter 1.8s steps(60, end) forwards,
             cursor-blink 0.75s step-end 1.8s 3;
}

code {
  background: rgba(192,84,26,0.12);
  color: var(--clay-dark);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-family: 'Fira Code', monospace;
  font-size: 0.9em;
}
pre code { background: none; color: inherit; padding: 0; }

/* ── Callout Boxes ── */
.callout {
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.callout .icon { font-size: 1.4rem; flex-shrink: 0; margin-top: 0.1rem; }
.callout p { margin: 0; }
.callout.tip  { background: #fff8e6; border-left: 4px solid var(--gold); }
.callout.info { background: #e8f4ed; border-left: 4px solid var(--sage); }
.callout.warn { background: #fff0e8; border-left: 4px solid var(--clay); }

/* ── Try It Section ── */
.try-it {
  background: linear-gradient(135deg, #fff4ec 0%, #ffeedd 100%);
  border: 2px dashed var(--clay-light);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 1.5rem 0;
}
.try-it h3 { color: var(--clay); margin-top: 0; }

/* ── Animations ── */
@keyframes typewriter {
  from { width: 0; }
  to   { width: 100%; }
}
@keyframes cursor-blink {
  50% { border-color: transparent; }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(192,84,26,0.4); }
  70%  { box-shadow: 0 0 0 10px rgba(192,84,26,0); }
  100% { box-shadow: 0 0 0 0 rgba(192,84,26,0); }
}
@keyframes rocket-launch {
  0%   { transform: translateY(0) rotate(-45deg); }
  100% { transform: translateY(-120px) rotate(-45deg); opacity: 0; }
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-40px); }
}
@keyframes axis-draw {
  from { stroke-dashoffset: 200; }
  to   { stroke-dashoffset: 0; }
}
@keyframes swatch-pop {
  0%   { transform: scale(0.7); opacity: 0; }
  60%  { transform: scale(1.1); }
  100% { transform: scale(1);   opacity: 1; }
}

/* ── Color Swatches (Lesson 3) ── */
.swatch-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1.25rem 0;
}
.swatch-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  opacity: 0;
}
.swatch-item.revealed {
  animation: swatch-pop 0.5s ease forwards;
}
.swatch-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  cursor: pointer;
  transition: transform 0.2s;
}
.swatch-circle:hover { transform: scale(1.15); animation: pulse-ring 1s ease; }
.swatch-label { font-size: 0.75rem; font-weight: 700; color: var(--muted); text-align: center; }

/* ── 3D Axis Diagram (Lesson 4) ── */
.axis-diagram {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0;
}
.axis-diagram svg {
  max-width: 320px;
  width: 100%;
  overflow: visible;
}
.axis-line {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  transition: stroke-dashoffset 1.2s ease;
}
.axis-line.revealed { stroke-dashoffset: 0; }

/* ── Bouncing Ball Demo (Lesson 6) ── */
.ball-demo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin: 1.5rem 0;
}
.ball {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--clay-light), var(--clay-dark));
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  animation: bounce 1.2s ease-in-out infinite;
}
.ball-shadow {
  width: 36px;
  height: 10px;
  border-radius: 50%;
  background: rgba(0,0,0,0.15);
  animation: bounce-shadow 1.2s ease-in-out infinite;
}
@keyframes bounce-shadow {
  0%, 100% { transform: scaleX(1); opacity: 0.5; }
  50%       { transform: scaleX(0.6); opacity: 0.2; }
}

/* ── Light Color Demo (Lesson 5) ── */
.light-demo {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1.25rem 0;
}
.light-scene {
  flex: 1;
  min-width: 130px;
  border-radius: var(--radius);
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  text-align: center;
  padding: 0.5rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s;
}
.light-scene:hover { transform: scale(1.04); }

/* ── Rocket (Lesson 7) ── */
.rocket-wrap {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0;
  height: 80px;
  overflow: hidden;
  position: relative;
}
.rocket {
  font-size: 3rem;
  position: relative;
  cursor: pointer;
  transition: none;
}
.rocket.launched {
  animation: rocket-launch 1.2s ease-in forwards;
}

/* ── Data Flow Diagram (Lesson 2) ── */
.flow-diagram {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin: 1.5rem auto;
  max-width: 340px;
}
.flow-node {
  background: var(--night);
  color: var(--code-text);
  border-radius: var(--radius);
  padding: 0.6rem 1.25rem;
  font-family: monospace;
  font-size: 0.9rem;
  text-align: center;
  width: 100%;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.flow-node.revealed { opacity: 1; transform: translateY(0); }
.flow-arrow {
  color: var(--clay);
  font-size: 1.4rem;
  line-height: 1;
  padding: 0.1rem 0;
  opacity: 0;
  transition: opacity 0.4s ease 0.2s;
}
.flow-arrow.revealed { opacity: 1; }

/* ── Footer ── */
.site-footer {
  background: var(--night);
  color: rgba(255,255,255,0.6);
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.85rem;
  margin-top: 3rem;
}
.site-footer a { color: var(--clay-light); text-decoration: none; }
.site-footer a:hover { color: var(--gold); }

/* ── Responsive ── */
@media (max-width: 600px) {
  .lesson-grid { grid-template-columns: 1fr 1fr; }
  .lesson-nav  { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 380px) {
  .lesson-grid { grid-template-columns: 1fr; }
}
