/* ═══════════════════════════════════════════════════════
   ზრდა — design system
   Brand: growth green. Georgian-first typography.
   ═══════════════════════════════════════════════════════ */

:root {
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-2: #eef2ef;
  --ink: #14231b;
  --ink-2: #46564d;
  --muted: #6b7c72;
  --line: #dde5e0;

  --accent: #15803d;
  --accent-hover: #166534;
  --accent-ink: #ffffff;
  --accent-soft: #dcfce7;
  --accent-soft-ink: #14532d;

  --good: #15803d;
  --good-soft: #dcfce7;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 35, 27, .05), 0 6px 24px rgba(20, 35, 27, .06);
  --font: "Noto Sans Georgian", "Sylfaen", system-ui, -apple-system, "Segoe UI", sans-serif;
}

:root:not([data-theme="light"]) {
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0c1310;
    --surface: #141c18;
    --surface-2: #1b2620;
    --ink: #e7efe9;
    --ink-2: #b0c0b6;
    --muted: #85978b;
    --line: #27332c;

    --accent: #4ade80;
    --accent-hover: #6ee7a0;
    --accent-ink: #072b15;
    --accent-soft: #16301f;
    --accent-soft-ink: #a7e8bf;

    --good: #4ade80;
    --good-soft: #16301f;
    --warn: #fbbf24;
    --warn-soft: #33280d;
    --danger: #f87171;
    --danger-soft: #3a1414;

    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 24px rgba(0, 0, 0, .25);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1310;
  --surface: #141c18;
  --surface-2: #1b2620;
  --ink: #e7efe9;
  --ink-2: #b0c0b6;
  --muted: #85978b;
  --line: #27332c;

  --accent: #4ade80;
  --accent-hover: #6ee7a0;
  --accent-ink: #072b15;
  --accent-soft: #16301f;
  --accent-soft-ink: #a7e8bf;

  --good: #4ade80;
  --good-soft: #16301f;
  --warn: #fbbf24;
  --warn-soft: #33280d;
  --danger: #f87171;
  --danger-soft: #3a1414;

  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 24px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.6rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1rem;
}

.narrow { max-width: 780px; }

/* ── Header / nav ─────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.site-header .bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1rem;
  max-width: 1080px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 30px;
  height: 30px;
  flex: none;
}

.nav {
  display: flex;
  gap: .15rem;
  overflow-x: auto;
  scrollbar-width: none;
  margin-left: auto;
}
.nav::-webkit-scrollbar { display: none; }

.nav a {
  padding: .45rem .7rem;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: .92rem;
  white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active {
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
  font-weight: 600;
}

.theme-toggle,
.menu-toggle {
  flex: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1rem;
}
.theme-toggle:hover,
.menu-toggle:hover { background: var(--surface-2); }

.menu-toggle { display: none; }

@media (max-width: 768px) {
  .site-header .bar { position: relative; }
  .menu-toggle { display: grid; }
  .theme-toggle { margin-left: auto; }
  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: .25rem;
    margin-left: 0;
    padding: .5rem .75rem .85rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    overflow: visible;
  }
  .site-header.open .nav { display: flex; }
  .nav a {
    padding: .75rem 1rem;
    font-size: 1rem;
    border-radius: var(--radius-sm);
  }
}

/* ── Buttons ──────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .65rem 1.25rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-ink);
  transition: background .15s;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }

.btn.ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: var(--line);
}
.btn.ghost:hover { background: var(--surface-2); }

.btn.soft {
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
}
.btn.soft:hover { background: color-mix(in srgb, var(--accent-soft) 80%, var(--accent) 20%); }

.btn.danger { background: var(--danger); color: #fff; }

.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn.lg { padding: .85rem 1.7rem; font-size: 1.05rem; }
.btn.sm { padding: .35rem .8rem; font-size: .85rem; }

/* ── Cards, grid ──────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.grid.cols-2 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

a.card-link {
  color: inherit;
  display: block;
  transition: transform .12s, border-color .12s;
}
a.card-link:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: var(--accent);
}

.card .icon-lg {
  font-size: 1.7rem;
  line-height: 1;
  margin-bottom: .5rem;
  display: block;
}

/* ── Stat tiles & meters ──────────────────────────────── */

.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .9rem 1.1rem;
}
.tile .label {
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: .15rem;
}
.tile .value {
  font-size: 1.55rem;
  font-weight: 650;
  line-height: 1.2;
  color: var(--ink);
}
.tile .sub { font-size: .8rem; color: var(--ink-2); }

.meter {
  height: 8px;
  border-radius: 4px;
  background: var(--accent-soft);
  overflow: hidden;
}
.meter > i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width .4s;
}
.meter.warn { background: var(--warn-soft); }
.meter.warn > i { background: var(--warn); }
.meter.danger { background: var(--danger-soft); }
.meter.danger > i { background: var(--danger); }

/* ── Badges ───────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .15rem .6rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--ink-2);
}
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.accent { background: var(--accent-soft); color: var(--accent-soft-ink); }

/* ── Hero ─────────────────────────────────────────────── */

.hero {
  padding: 3rem 0 2.5rem;
  text-align: center;
}
.hero h1 { margin-bottom: .4rem; }
.hero .tagline {
  color: var(--ink-2);
  font-size: 1.1rem;
  max-width: 560px;
  margin: 0 auto 1.5rem;
}
.hero .actions {
  display: flex;
  gap: .75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.section { padding: 1.5rem 0; }
.section-title {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  margin-bottom: 1rem;
}
.section-title h2 { margin: 0; }
.section-title .more { margin-left: auto; font-size: .9rem; white-space: nowrap; }

/* ── Quiz ─────────────────────────────────────────────── */

.quiz-top {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.quiz-top .meter { flex: 1 1 120px; }
.quiz-counter { font-size: .9rem; color: var(--ink-2); white-space: nowrap; }

.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  font-size: 1.05rem;
  padding: .25rem .7rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
}
.timer.low { background: var(--danger-soft); color: var(--danger); }

.mistake-dots { display: flex; gap: .3rem; align-items: center; }
.mistake-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.mistake-dots i.used { background: var(--danger); border-color: var(--danger); }

.q-card { margin-bottom: 1rem; }
.q-media {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}
.q-media svg, .q-media img { width: min(180px, 45vw); height: auto; }
.q-text {
  font-size: 1.08rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.answers { display: grid; gap: .6rem; }

.ans {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  width: 100%;
  text-align: left;
  padding: .8rem 1rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: .98rem;
  line-height: 1.5;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.ans:hover:not(:disabled) { border-color: var(--accent); background: var(--surface-2); }
.ans:disabled { cursor: default; }

.ans .key {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: .8rem;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--ink-2);
  margin-top: .1rem;
}

.ans.correct {
  border-color: var(--good);
  background: var(--good-soft);
}
.ans.correct .key { background: var(--good); color: #fff; }
.ans.wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
}
.ans.wrong .key { background: var(--danger); color: #fff; }

.explain {
  margin-top: 1rem;
  padding: .9rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
  font-size: .95rem;
}
.explain b { display: block; margin-bottom: .2rem; }

.quiz-actions {
  display: flex;
  gap: .75rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

/* results */
.result-hero {
  text-align: center;
  padding: 2rem 1rem;
}
.result-hero .big {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.1;
}
.result-hero .verdict { font-size: 1.3rem; font-weight: 700; margin: .5rem 0; }
.result-hero .verdict.pass { color: var(--good); }
.result-hero .verdict.fail { color: var(--danger); }

/* ── Signs catalog ────────────────────────────────────── */

.sign-groups {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.signs-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.sign-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem .75rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .12s, transform .12s;
}
.sign-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.sign-card svg, .sign-card img { width: 72px; height: 72px; object-fit: contain; }
.sign-card .sign-id { font-size: .72rem; color: var(--muted); margin-top: .5rem; }
.sign-card .sign-name {
  font-size: .84rem;
  font-weight: 600;
  line-height: 1.35;
  margin-top: .15rem;
}

dialog.sign-dialog {
  border: none;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  max-width: min(430px, 92vw);
}
dialog.sign-dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog.sign-dialog .sign-big { text-align: center; margin-bottom: 1rem; }
dialog.sign-dialog .sign-big svg,
dialog.sign-dialog .sign-big img { width: 140px; height: 140px; object-fit: contain; }

/* ── Content pages (theory / practical / info) ────────── */

.prose { max-width: 780px; }
.prose h2 {
  margin-top: 2rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid var(--line);
}
.prose h3 { margin-top: 1.4rem; }
.prose ul, .prose ol { padding-left: 1.4rem; margin: 0 0 1em; }
.prose li { margin-bottom: .35em; }
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
  margin-bottom: 1.25em;
}
.prose th, .prose td {
  text-align: left;
  padding: .5rem .7rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.prose th { color: var(--muted); font-size: .8rem; font-weight: 600; }

.table-wrap { overflow-x: auto; }

.callout {
  border-left: 4px solid var(--accent);
  background: var(--surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: .9rem 1.1rem;
  margin: 0 0 1.25em;
  box-shadow: var(--shadow);
}
.callout.warn { border-left-color: var(--warn); }
.callout.danger { border-left-color: var(--danger); }
.callout b:first-child { display: block; margin-bottom: .2rem; }

details.accordion {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: .6rem;
  overflow: hidden;
}
details.accordion summary {
  cursor: pointer;
  padding: .85rem 1.1rem;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: .6rem;
}
details.accordion summary::-webkit-details-marker { display: none; }
details.accordion summary::after {
  content: "▾";
  margin-left: auto;
  color: var(--muted);
  transition: transform .15s;
}
details.accordion[open] summary::after { transform: rotate(180deg); }
details.accordion .acc-body { padding: 0 1.1rem .95rem; }

/* steps */
.steps { counter-reset: step; padding: 0; margin: 0 0 1.25em; list-style: none; }
.steps li {
  position: relative;
  padding: 0 0 1.1rem 2.6rem;
  counter-increment: step;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
  font-weight: 700;
  font-size: .9rem;
}
.steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: calc(.9rem - 1px);
  top: 2rem;
  bottom: .2rem;
  width: 2px;
  background: var(--line);
}

/* ── Topic list rows ──────────────────────────────────── */

.topic-row {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: .85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: .6rem;
  color: inherit;
  transition: border-color .12s;
}
.topic-row:hover { border-color: var(--accent); text-decoration: none; }
.topic-row .t-name { font-weight: 600; flex: 1; min-width: 0; }
.topic-row .t-count { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.topic-row .t-meter { flex: 0 0 90px; }
.topic-row .t-acc {
  font-size: .85rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  width: 3.2em;
  text-align: right;
}

/* ── Footer ───────────────────────────────────────────── */

.site-footer {
  margin-top: 3rem;
  border-top: 1px solid var(--line);
  padding: 1.75rem 0 2.25rem;
  color: var(--muted);
  font-size: .88rem;
}
.site-footer .cols {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: space-between;
}
.site-footer a { color: var(--ink-2); }

/* ── Utilities ────────────────────────────────────────── */

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.flex { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }

@media (max-width: 640px) {
  .hero { padding: 2rem 0 1.5rem; }
  .topic-row .t-meter { display: none; }
}

@media print {
  .site-header, .site-footer, .theme-toggle, .btn { display: none !important; }
}
