/* TreeDoctor — базови стилове */
:root {
  --green: #2e7d4f;
  --green-dark: #1f5a38;
  --green-light: #eef5f0;
  --ink: #17201c;
  --muted: #5f6f67;
  --line: #e0e7e2;
  --bg: #fff;
  --bg-soft: #f7faf8;
  --warn: #b4531a;
  --radius: 10px;
  --wrap: 1120px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
}
img { max-width: 100%; display: block; }
a { color: var(--green-dark); text-underline-offset: 2px; }
a:hover { color: var(--green); }
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.7rem, 1.2rem + 1.8vw, 2.4rem); margin: 0 0 .6em; }
h2 { font-size: clamp(1.25rem, 1.05rem + .8vw, 1.5rem); margin: 2em 0 .6em; }
h3 { font-size: 1.1rem; margin: 1.6em 0 .4em; }
p { margin: 0 0 1em; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
main { padding: 32px 0 64px; }
.lead { font-size: 1.08rem; color: var(--muted); max-width: 62ch; }
.muted { color: var(--muted); }
.latin { font-style: italic; }

/* ---------- хедър ---------- */
.site-header { border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 20; }
.site-header .wrap { display: flex; align-items: center; gap: 28px; min-height: 64px; }
.brand { font-weight: 700; font-size: 1.25rem; text-decoration: none; color: var(--ink); letter-spacing: -0.02em; }
.brand span { color: var(--green); }
.site-nav { display: flex; gap: 22px; flex-wrap: wrap; margin-left: auto; }
.site-nav a { text-decoration: none; color: var(--ink); font-size: .97rem; padding: 4px 0; border-bottom: 2px solid transparent; }
.site-nav a:hover, .site-nav a[aria-current="page"] { border-bottom-color: var(--green); }

/* ---------- футър ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-soft); padding: 36px 0; margin-top: 64px; font-size: .92rem; color: var(--muted); }
.site-footer a { color: var(--muted); }
.footer-cols { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.eu-note { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); font-size: .82rem; line-height: 1.5; }

/* ---------- решетки и карти ---------- */
.grid { display: grid; gap: 18px; list-style: none; padding: 0; margin: 0; }
.grid-species { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid-tiles { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

.card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; transition: box-shadow .15s, border-color .15s; }
.card:hover { border-color: var(--green); box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.card > a { display: block; text-decoration: none; color: inherit; height: 100%; }
.card-img { aspect-ratio: 4 / 3; background: var(--green-light) center/cover no-repeat; }
.card-body { padding: 12px 14px 14px; }
.card-title { font-weight: 600; display: block; }
.card-sub { font-size: .88rem; color: var(--muted); }
.card-meta { font-size: .8rem; color: var(--muted); margin-top: 6px; }

/* плочка на определителя */
.tile { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.tile > a { display: block; text-decoration: none; color: inherit; }
.tile:hover { border-color: var(--green); }
.tile-img { aspect-ratio: 1 / 1; background: var(--green-light) center/cover no-repeat; }
.tile-label { padding: 12px 14px; font-weight: 600; text-align: center; min-height: 58px; display: flex; align-items: center; justify-content: center; }

/* ---------- трохи ---------- */
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: 18px; display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.crumbs a { color: var(--muted); }
.crumbs span[aria-hidden] { opacity: .5; }

/* ---------- таблица с факти ---------- */
.facts { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 24px 0; }
.facts div { display: grid; grid-template-columns: minmax(150px, 34%) 1fr; border-bottom: 1px solid var(--line); }
.facts div:last-child { border-bottom: 0; }
.facts dt { padding: 10px 14px; background: var(--bg-soft); font-size: .92rem; color: var(--muted); margin: 0; }
.facts dd { padding: 10px 14px; margin: 0; }

/* ---------- значки ---------- */
.badges { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 18px; padding: 0; list-style: none; }
.badge { display: inline-block; font-size: .8rem; padding: 3px 10px; border-radius: 99px; background: var(--green-light); color: var(--green-dark); border: 1px solid #d3e4d9; }
.badge-warn { background: #fdf2e8; color: var(--warn); border-color: #f2ddc9; }

/* ---------- галерия ---------- */
.gallery { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); padding: 0; list-style: none; }
.gallery figure { margin: 0; }
.gallery img { border-radius: var(--radius); border: 1px solid var(--line); }
.gallery figcaption { font-size: .78rem; color: var(--muted); margin-top: 6px; line-height: 1.4; }

/* ---------- търсачка и филтри ---------- */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 0 0 24px; }
.toolbar input[type="search"], .toolbar select {
  font: inherit; font-size: .95rem; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: inherit;
}
.toolbar input[type="search"] { flex: 1 1 260px; min-width: 0; }
.toolbar input:focus, .toolbar select:focus { outline: 2px solid var(--green); outline-offset: 1px; border-color: var(--green); }
.result-count { font-size: .9rem; color: var(--muted); margin: -12px 0 18px; }
[hidden] { display: none !important; }

/* ---------- бутони ---------- */
.btn { display: inline-block; font: inherit; font-size: .95rem; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--green); background: var(--green); color: #fff; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--green-dark); border-color: var(--green-dark); color: #fff; }
.btn-ghost { background: #fff; color: var(--green-dark); }
.btn-ghost:hover { background: var(--green-light); color: var(--green-dark); }

/* ---------- карта ---------- */
.map { height: min(70vh, 620px); border-radius: var(--radius); border: 1px solid var(--line); background: var(--green-light); }
.map-home { height: min(78vh, 680px); }
.maplibregl-popup-content { font-family: var(--font); font-size: .9rem; padding: 12px 14px; border-radius: 8px; }
.maplibregl-popup-content strong { display: block; margin-bottom: 2px; }

/* ---------- форма ---------- */
.form { max-width: 620px; display: grid; gap: 18px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: .95rem; }
.field .hint { font-size: .85rem; color: var(--muted); }
.field input, .field textarea, .field select {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: inherit; width: 100%;
}
.field textarea { min-height: 120px; resize: vertical; }
.notice { padding: 14px 16px; border-radius: var(--radius); background: var(--green-light); border: 1px solid #d3e4d9; font-size: .93rem; }

/* ---------- проза ---------- */
.prose { max-width: 70ch; }
.prose img { border-radius: var(--radius); margin: 1.4em 0; }
.prose ul, .prose ol { padding-left: 1.3em; }

@media (max-width: 720px) {
  body { font-size: 16px; }
  .site-header .wrap { flex-wrap: wrap; gap: 14px; min-height: 0; padding-top: 12px; padding-bottom: 12px; }
  .site-nav { margin-left: 0; width: 100%; gap: 16px; overflow-x: auto; }
  .facts div { grid-template-columns: 1fr; }
  .facts dt { padding-bottom: 0; background: none; }
}
