/* ── Fonts ─────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ── Tokens — Indian Earth ─────────────────────────────── */
:root {
  --bg:          #faf6f0;
  --surface:     #ffffff;
  --border:      #ede4d5;
  --text:        #3d2b1f;
  --text-muted:  #8b7560;
  --accent:      #c2452d;
  --action:      #1a5c4c;
  --action-hover:#145040;
  --sand:        #c4a67d;
  --shadow:      rgba(61,43,31,0.08);
  --shadow-md:   rgba(61,43,31,0.14);

  --stage-1: #c2452d;
  --stage-2: #1a5c4c;
  --stage-3: #7a5c2e;
  --stage-4: #3d2b1f;

  --font-heading: 'Libre Baskerville', Georgia, serif;
  --font-body:    'IBM Plex Sans', system-ui, sans-serif;
  --font-mono:    'IBM Plex Mono', 'Courier New', monospace;

  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --max-width:   680px;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Typography ────────────────────────────────────────── */
h1, h2, h3 { font-family: var(--font-heading); font-weight: 400; line-height: 1.3; }

/* ── Layout ────────────────────────────────────────────── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ── Nav ───────────────────────────────────────────────── */
.nav {
  border-bottom: 1px solid var(--border);
  padding: 0.875rem 0;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}
.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
}
.nav-logo span { color: var(--accent); }
.nav-back {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.nav-back:hover { color: var(--text); }

/* ── Hero ──────────────────────────────────────────────── */
.hero {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--border);
}
.hero h1 {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  margin-bottom: 0.75rem;
}
.hero h1 span { color: var(--accent); }
.hero p {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 520px;
}
.hero-kannada {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--sand);
  margin-top: 0.5rem;
}

/* ── Stage cards (index page) ──────────────────────────── */
.stages { padding: 2rem 0 3rem; display: flex; flex-direction: column; gap: 1rem; }

.stage-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: start;
  box-shadow: 0 1px 3px var(--shadow);
}
.stage-card:hover { box-shadow: 0 2px 8px var(--shadow-md); }

.stage-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--surface);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}
.stage-card[data-stage="1"] .stage-badge { background: var(--stage-1); }
.stage-card[data-stage="2"] .stage-badge { background: var(--stage-2); }
.stage-card[data-stage="3"] .stage-badge { background: var(--stage-3); }
.stage-card[data-stage="4"] .stage-badge { background: var(--stage-4); }

.stage-card h2 { font-size: 1.2rem; margin-bottom: 0.25rem; }
.stage-tagline { font-size: 0.9rem; color: var(--accent); margin-bottom: 0.5rem; font-style: italic; }
.stage-desc { font-size: 0.9rem; color: var(--text-muted); line-height: 1.5; }

.stage-meta { text-align: right; min-width: 100px; }
.stage-count { font-size: 0.8rem; color: var(--text-muted); font-family: var(--font-mono); }

.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 1rem;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--action);
  border-radius: 2px;
  transition: width 0.4s ease;
}
.stage-card[data-stage="1"] .progress-fill { background: var(--stage-1); }
.stage-card[data-stage="2"] .progress-fill { background: var(--stage-2); }
.stage-card[data-stage="3"] .progress-fill { background: var(--stage-3); }
.stage-card[data-stage="4"] .progress-fill { background: var(--stage-4); }

.stage-action { margin-top: 1.25rem; }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: translateY(1px); }

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

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }

.btn-large { padding: 0.875rem 1.75rem; font-size: 1rem; }

.btn[disabled] {
  background: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* ── Learn page ────────────────────────────────────────── */
.learn-header {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
}
.learn-progress {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.learn-progress-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.learn-progress-fill {
  height: 100%;
  background: var(--action);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.learn-progress-label {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  white-space: nowrap;
}
.stage-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Sentence card ─────────────────────────────────────── */
.card-area {
  padding: 2rem 0;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sentence-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem;
  box-shadow: 0 2px 8px var(--shadow);
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  position: relative;
}

.card-gloss {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-style: italic;
}

.card-reveal { display: none; flex-direction: column; gap: 0.75rem; }
.card-reveal.visible { display: flex; }

.card-kannada {
  font-family: var(--font-heading);
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  color: var(--text);
  line-height: 1.4;
}
.card-roman {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--accent);
  letter-spacing: 0.01em;
}
.card-divider {
  width: 40px;
  height: 1px;
  background: var(--border);
  margin: 0.25rem auto;
}

.new-word-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.625rem;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--action);
  margin: 0.25rem auto;
}

.grammar-note {
  background: var(--bg);
  border-left: 3px solid var(--sand);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: left;
  margin-top: 0.5rem;
  line-height: 1.5;
}

.show-btn-area {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0 0;
}

.card-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 0;
  gap: 1rem;
}

/* ── Stage complete ────────────────────────────────────── */
.stage-complete {
  text-align: center;
  padding: 3rem 0;
  display: none;
}
.stage-complete.visible { display: block; }
.stage-complete h2 { font-size: 1.75rem; margin-bottom: 0.75rem; }
.stage-complete p { color: var(--text-muted); margin-bottom: 2rem; }
.complete-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--action);
}

/* ── Locked state ──────────────────────────────────────── */
.locked-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ── Coming soon ───────────────────────────────────────── */
.coming-soon {
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Footer ────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  margin-top: 3rem;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 480px) {
  .stage-card { grid-template-columns: 1fr; }
  .stage-meta { text-align: left; }
  .sentence-card { padding: 1.5rem 1.25rem; }
  .card-kannada { font-size: 1.5rem; }
}
