/* Learn Lingala — shared styles */

:root {
  --bg: #fdfaf5;
  --surface: #ffffff;
  --ink: #241f1a;
  --muted: #6f675e;
  --line: #e8e0d4;
  --primary: #1a6b52;       /* deep green */
  --primary-ink: #ffffff;
  --accent: #e0a422;        /* warm gold */
  --accent-soft: #fdf3dd;
  --highlight: #c7402d;     /* warm red */
  --radius: 14px;
  --shadow: 0 2px 10px rgba(36, 31, 26, 0.06);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}

main { max-width: 880px; margin: 0 auto; padding: 0 1.25rem 4rem; }

/* Header */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav {
  max-width: 880px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  font-weight: 800;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.brand span { color: var(--primary); }

.nav-links { display: flex; gap: 1.25rem; }
.nav-links a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
}
.nav-links a:hover, .nav-links a.active { color: var(--primary); }

/* Hero */
.hero { padding: 4rem 0 2.5rem; text-align: center; }
.hero-greeting { font-size: 1.3rem; font-weight: 700; color: var(--highlight); margin-bottom: 0.5rem; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.15; letter-spacing: -0.02em; }
.hero h1 .muted { color: var(--muted); font-weight: 600; font-size: 0.55em; display: inline-block; margin-top: 0.4rem; }
.hero-sub { max-width: 560px; margin: 1.25rem auto 2rem; color: var(--muted); font-size: 1.05rem; }

.btn {
  display: inline-block;
  padding: 0.8rem 1.6rem;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.btn-primary { background: var(--primary); color: var(--primary-ink); box-shadow: var(--shadow); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(26, 107, 82, 0.3); }

/* Lesson cards on home */
.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin: 2rem 0 3rem;
}

.lesson-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.lesson-card:not(.lesson-card-soon):hover { transform: translateY(-3px); border-color: var(--primary); }
.lesson-card h2, .lesson-card h3 { font-size: 1.2rem; margin: 0.35rem 0 0.5rem; }
.lesson-card p { color: var(--muted); font-size: 0.95rem; }
.lesson-num {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.lesson-cta { display: inline-block; margin-top: 0.9rem; font-weight: 700; color: var(--primary); }
.lesson-card-soon { opacity: 0.65; }

/* Home sections */
.builder-section, .flashcards-section, .lesson-grid-section { margin: 2.5rem 0; }
.builder-section h2, .flashcards-section h2, .lesson-grid-section h2 { margin-bottom: 0.35rem; }
.section-sub { color: var(--muted); margin-bottom: 1.1rem; max-width: 620px; }

/* Sentence builder */
.builder {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.builder-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.25rem;
}

.builder-field { display: flex; flex-direction: column; gap: 0.3rem; }
.builder-field label {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.builder-field select {
  font: inherit;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
}
.builder-field select:focus { outline: 2px solid var(--primary); }

.toggle {
  font: inherit;
  font-weight: 800;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
}
.toggle.on { background: var(--highlight); border-color: var(--highlight); color: #fff; }

.builder-output {
  background: var(--accent-soft);
  border: 1px solid #f0dfb6;
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  text-align: center;
}
.builder-lingala { font-size: clamp(1.5rem, 4vw, 2.1rem); font-weight: 800; letter-spacing: -0.01em; }
.builder-breakdown { margin: 0.4rem 0; font-size: 0.95rem; color: var(--muted); }
.builder-english { font-weight: 700; color: var(--primary); font-size: 1.1rem; }
.builder-hint { margin-top: 1rem; font-size: 0.9rem; color: var(--muted); }
.builder-hint a { color: var(--primary); font-weight: 700; text-decoration: none; }
.builder-hint a:hover { text-decoration: underline; }

.chunk { font-weight: 800; padding: 0.05rem 0.3rem; border-radius: 6px; }
.chunk-subject { color: #fff; background: var(--primary); }
.chunk-verb { color: var(--ink); background: #eadfc9; }
.chunk-tense { color: #fff; background: var(--accent); }
.chunk-object { color: var(--ink); background: #eadfc9; }
.chunk-negate { color: #fff; background: var(--highlight); }

/* Flashcards */
.flashcards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.flashcard {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  perspective: 700px;
  height: 90px;
  font: inherit;
}

.flashcard-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transition: transform 0.45s;
  transform-style: preserve-3d;
}
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }

.flashcard-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border-radius: 12px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  font-weight: 800;
  font-size: 1.05rem;
  box-shadow: var(--shadow);
}
.flashcard-front { background: var(--surface); border: 1.5px solid var(--line); color: var(--ink); }
.flashcard-back {
  background: var(--primary);
  color: var(--primary-ink);
  transform: rotateY(180deg);
  font-weight: 700;
  font-size: 0.95rem;
}

/* Word chips */
.teaser { margin-bottom: 2rem; }
.teaser h2 { margin-bottom: 1rem; }
.word-strip { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.word-chip {
  background: var(--accent-soft);
  border: 1px solid #f0dfb6;
  border-radius: 10px;
  padding: 0.5rem 0.9rem;
  display: flex;
  flex-direction: column;
}
.word-chip strong { font-size: 1rem; }
.word-chip span { font-size: 0.8rem; color: var(--muted); }

/* Lesson pages */
.lesson { padding-top: 2.5rem; }
.lesson h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: -0.02em; margin-bottom: 0.75rem; }
.lesson h2 { margin: 2.25rem 0 0.75rem; font-size: 1.35rem; }
.lesson p { margin-bottom: 0.75rem; }
.lead { font-size: 1.1rem; color: var(--muted); }

/* Letter grid */
.letter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.letter-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
}
.letter-card .letter { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.01em; }
.letter-card .sound { font-size: 0.85rem; color: var(--muted); margin: 0.15rem 0 0.35rem; }
.letter-card .example { font-size: 0.9rem; }
.letter-card .example strong { color: var(--primary); }

.letter-card.vowel { border-top: 3px solid var(--primary); }
.letter-card.open-vowel { border-top: 3px solid var(--highlight); }
.letter-card.digraph { border-top: 3px solid var(--accent); }
.letter-card.note { background: var(--accent-soft); }

/* Tables */
.table-wrap { overflow-x: auto; margin: 1rem 0; }
table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
th, td { text-align: left; padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
th { background: var(--primary); color: var(--primary-ink); font-size: 0.85rem; letter-spacing: 0.03em; }
tr:last-child td { border-bottom: none; }

/* Example blocks */
.example-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  padding: 0.5rem 1.25rem;
  margin: 1rem 0;
}
.example-row { padding: 0.75rem 0; border-bottom: 1px dashed var(--line); display: flex; flex-direction: column; gap: 0.15rem; }
.example-row:last-child { border-bottom: none; }
.example-row .lg { font-weight: 700; font-size: 1.1rem; }
.example-row .gloss { font-size: 0.85rem; color: var(--muted); }
.example-row .en { font-size: 0.95rem; color: var(--primary); font-weight: 600; }

.formula {
  text-align: center;
  font-size: 1.15rem;
  background: var(--accent-soft);
  border-radius: 10px;
  padding: 0.75rem;
  margin: 1rem 0;
}

/* Tips */
.tip {
  background: var(--accent-soft);
  border: 1px solid #f0dfb6;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

/* Quiz */
.quiz {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin: 1rem 0 2rem;
}
.quiz-progress { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); margin-bottom: 0.5rem; }
.quiz-question { font-size: 1.15rem; font-weight: 700; margin-bottom: 1rem; }
.quiz-options { display: grid; gap: 0.6rem; }
.quiz-option {
  text-align: left;
  font: inherit;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.1s ease;
}
.quiz-option:hover:not(:disabled) { border-color: var(--primary); }
.quiz-option.correct { border-color: var(--primary); background: #e5f3ee; font-weight: 700; }
.quiz-option.wrong { border-color: var(--highlight); background: #fbe9e6; }
.quiz-option:disabled { cursor: default; }
.quiz-feedback { margin-top: 0.9rem; font-weight: 600; min-height: 1.5em; }
.quiz-feedback.good { color: var(--primary); }
.quiz-feedback.bad { color: var(--highlight); }
.quiz-next {
  margin-top: 0.75rem;
  font: inherit;
  font-weight: 700;
  color: var(--primary-ink);
  background: var(--primary);
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1.4rem;
  cursor: pointer;
}
.quiz-score { text-align: center; padding: 1rem 0; }
.quiz-score .big { font-size: 2.2rem; font-weight: 800; color: var(--primary); }

/* Lesson footer nav */
.lesson-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; flex-wrap: wrap; }
.lesson-nav a { font-weight: 700; color: var(--primary); text-decoration: none; }
.lesson-nav a:hover { text-decoration: underline; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  text-align: center;
  padding: 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 480px) {
  .hero { padding: 2.5rem 0 1.5rem; }
  .letter-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* Links into the learning app */
.nav-links a.nav-app { color: var(--primary-ink); background: var(--primary); padding: 0.3rem 0.8rem; border-radius: 999px; }
.nav-links a.nav-app:hover { color: var(--primary-ink); filter: brightness(1.1); }
.hero-alt { margin-top: 0.9rem; font-size: 0.9rem; color: var(--muted); }
.hero-alt a { color: var(--primary); font-weight: 600; }
