/* ============================================================
   Dārzkopības sabiedrība "Rīga" — publiskā mājaslapa
   Tīrs CSS bez ārējām atkarībām. Zaļa dārza palete.
   ============================================================ */

:root {
  --green-900: #14401b;
  --green-800: #1b5e20;
  --green-700: #2e7d32;
  --green-600: #388e3c;
  --green-500: #4caf50;
  --green-300: #a5d6a7;
  --green-100: #e6f2e6;
  --leaf: #66bb6a;
  --bg: #f5f9f4;
  --surface: #ffffff;
  --text: #1f2d24;
  --muted: #5a6b60;
  --border: #d9e6d9;
  --shadow: 0 2px 10px rgba(20, 64, 27, 0.08);
  --radius: 12px;
  --maxw: 1080px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 17px;
}

/* --- Language visibility (toggled via <html> class) --- */
html.lang-lv .ru, html.lang-lv .en { display: none !important; }
html.lang-ru .lv, html.lang-ru .en { display: none !important; }
html.lang-en .lv, html.lang-en .ru { display: none !important; }

/* Skip link (accessibility) */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--green-800);
  color: #fff;
  padding: 8px 14px;
  border-radius: 0 0 8px 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

a { color: var(--green-700); }
a:hover { color: var(--green-800); }

img { max-width: 100%; height: auto; }

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

/* ============================ HEADER ============================ */
.site-header {
  background: var(--surface);
  border-bottom: 3px solid var(--green-700);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  max-width: var(--maxw);
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--green-800);
}
.brand .logo {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--leaf), var(--green-800));
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 20px;
}
.brand .brand-text { line-height: 1.15; }
.brand .brand-name { font-weight: 700; font-size: 1.02rem; }
.brand .brand-sub { font-size: 0.72rem; color: var(--muted); }

.header-controls { display: flex; align-items: center; gap: 10px; }

/* Language switch */
.lang-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--green-100);
}
.lang-switch button {
  border: 0;
  background: transparent;
  padding: 6px 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted);
}
.lang-switch button.active {
  background: var(--green-700);
  color: #fff;
}

.nav-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

/* Navigation */
.main-nav {
  background: var(--green-700);
}
.main-nav ul {
  list-style: none;
  margin: 0 auto;
  padding: 0 20px;
  max-width: var(--maxw);
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}
.main-nav a {
  display: block;
  color: #eafaea;
  text-decoration: none;
  padding: 11px 14px;
  font-size: 0.92rem;
  font-weight: 500;
  border-bottom: 3px solid transparent;
}
.main-nav a:hover { background: var(--green-800); color: #fff; }
.main-nav a.active {
  background: var(--green-800);
  color: #fff;
  border-bottom-color: var(--green-300);
}

/* ============================ HERO ============================ */
.hero {
  background: linear-gradient(135deg, var(--green-800), var(--green-600));
  color: #fff;
  padding: 56px 0;
}
.hero h1 { margin: 0 0 12px; font-size: 2.1rem; line-height: 1.2; }
.hero p { margin: 0 0 8px; font-size: 1.12rem; max-width: 720px; color: #eafaea; }
.hero .hero-meta {
  margin-top: 18px;
  font-size: 0.9rem;
  color: #d6ecd6;
}
.hero .btn-row { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  display: inline-block;
  background: #fff;
  color: var(--green-800);
  text-decoration: none;
  padding: 11px 20px;
  border-radius: 999px;
  font-weight: 600;
  border: 2px solid transparent;
  transition: transform 0.05s ease;
}
.btn:hover { transform: translateY(-1px); color: var(--green-900); }
.btn.btn-outline {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.7);
}
.btn.btn-outline:hover { color: #fff; background: rgba(255,255,255,0.12); }

/* ============================ SECTIONS ============================ */
main { padding: 40px 0 60px; }

.page-title { margin: 0 0 6px; font-size: 1.9rem; color: var(--green-800); }
.page-lead { color: var(--muted); font-size: 1.05rem; margin: 0 0 8px; }

section.block { margin: 34px 0; }
section.block > h2 {
  font-size: 1.35rem;
  color: var(--green-800);
  border-left: 4px solid var(--green-500);
  padding-left: 12px;
  margin: 0 0 14px;
}
h3 { color: var(--green-800); margin: 22px 0 8px; font-size: 1.1rem; }

/* Cards grid */
.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card h3 { margin-top: 0; }
.card .icon {
  font-size: 1.8rem;
  display: block;
  margin-bottom: 6px;
}

.callout {
  background: var(--green-100);
  border: 1px solid var(--green-300);
  border-left: 5px solid var(--green-600);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 20px 0;
}
.callout.warn {
  background: #fff8e1;
  border-color: #ffe082;
  border-left-color: #f9a825;
}

/* Tables */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  font-size: 0.96rem;
}
table.data th, table.data td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.data thead th {
  background: var(--green-700);
  color: #fff;
  font-weight: 600;
}
table.data tbody tr:nth-child(even) { background: #fafcf9; }
table.data td.num { text-align: right; white-space: nowrap; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  padding: 0 0 20px 28px;
  border-left: 2px solid var(--green-300);
  margin-left: 8px;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--green-600);
  border: 3px solid var(--bg);
}
.timeline .year {
  font-weight: 700;
  color: var(--green-800);
  display: inline-block;
  margin-right: 6px;
}

/* Steps */
ol.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
ol.steps li {
  position: relative;
  padding: 14px 16px 14px 58px;
  margin: 12px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
ol.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 14px;
  top: 14px;
  width: 30px;
  height: 30px;
  background: var(--green-700);
  color: #fff;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
}

/* FAQ */
details.faq {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 10px 0;
  box-shadow: var(--shadow);
  overflow: hidden;
}
details.faq summary {
  cursor: pointer;
  padding: 14px 18px;
  font-weight: 600;
  color: var(--green-800);
  list-style: none;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::before { content: "＋ "; color: var(--green-600); font-weight: 700; }
details.faq[open] summary::before { content: "－ "; }
details.faq .faq-body { padding: 0 18px 16px; }

/* Requisites box */
.req {
  background: var(--surface);
  border: 1px dashed var(--green-500);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.req dl { margin: 0; display: grid; grid-template-columns: 190px 1fr; gap: 8px 14px; }
.req dt { color: var(--muted); }
.req dd { margin: 0; font-weight: 600; }
.req .iban { font-family: "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: 0.4px; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.tag {
  display: inline-block;
  background: var(--green-100);
  color: var(--green-800);
  border: 1px solid var(--green-300);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  margin: 0 4px 4px 0;
}

/* ============================ FOOTER ============================ */
.site-footer {
  background: var(--green-900);
  color: #d6ecd6;
  padding: 34px 0 22px;
  font-size: 0.9rem;
}
.site-footer a { color: #a5d6a7; }
.footer-grid {
  display: grid;
  gap: 22px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.site-footer h4 { color: #fff; margin: 0 0 8px; font-size: 0.98rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 4px 0; }
.footer-legal {
  border-top: 1px solid rgba(255,255,255,0.15);
  margin-top: 24px;
  padding-top: 16px;
  color: #a7c3a7;
  font-size: 0.82rem;
}

/* ============================ RESPONSIVE ============================ */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .hero h1 { font-size: 1.65rem; }
  .nav-toggle { display: inline-block; }
  .main-nav ul {
    display: none;
    flex-direction: column;
    padding: 6px 12px 12px;
  }
  .main-nav ul.open { display: flex; }
  .main-nav a { padding: 12px 8px; border-bottom: 1px solid rgba(255,255,255,0.12); }
  .req dl { grid-template-columns: 1fr; gap: 2px; }
  .req dt { margin-top: 8px; }
}

/* ============================ HEADER SEARCH + SOCIAL ============================ */
.brand-name { max-width: 260px; }
.site-search {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
}
.site-search input {
  border: 0;
  padding: 7px 12px;
  font-size: 0.85rem;
  width: 150px;
  background: transparent;
  color: var(--text);
}
.site-search input:focus-visible { outline: 2px solid var(--green-700); outline-offset: -2px; }
.site-search button {
  border: 0;
  background: var(--green-700);
  color: #fff;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 0.95rem;
}
.site-search.big {
  display: flex;
  max-width: 520px;
  margin: 8px 0 20px;
}
.site-search.big input { width: 100%; font-size: 1rem; padding: 12px 16px; }
.site-search.big button { padding: 12px 18px; font-size: 1.1rem; }

.social-links { display: inline-flex; gap: 6px; }
.social {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
}
.social.fb { background: #1877f2; }
.social.wa { background: #25d366; font-size: 0.72rem; }
.social:hover { opacity: 0.88; color: #fff; }

/* ============================ FORMS ============================ */
.ds-form {
  display: grid;
  gap: 14px;
  max-width: 620px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.ds-form label { display: grid; gap: 6px; font-weight: 600; color: var(--text); }
.ds-form input, .ds-form textarea {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fcfefc;
  color: var(--text);
}
.ds-form input:focus, .ds-form textarea:focus {
  outline: 2px solid var(--green-500);
  border-color: var(--green-500);
}
.ds-form label.consent {
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 10px;
  font-weight: 400;
  font-size: 0.9rem;
  color: var(--muted);
}
.ds-form .btn { justify-self: start; cursor: pointer; border: 0; }
.form-note { font-size: 0.85rem; color: var(--muted); }

/* ============================ MAP ============================ */
.map-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
}
.site-map { width: 100%; height: auto; display: block; }
.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 14px;
  font-size: 0.9rem;
  color: var(--muted);
}
.map-legend span { display: inline-flex; align-items: center; gap: 7px; }
.map-legend .lg { width: 18px; height: 12px; border-radius: 2px; display: inline-block; }
.map-legend .lg.road { background: #8a6d3b; }
.map-legend .lg.ditch { background: repeating-linear-gradient(90deg,#4a90d9 0 3px,transparent 3px 8px); }
.map-legend .lg.node { background: var(--green-800); border-radius: 50%; width: 14px; height: 14px; }

/* ============================ SEARCH RESULTS ============================ */
.search-results { display: grid; gap: 12px; margin: 10px 0; }
.search-results a.result {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--green-600);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
}
.search-results a.result:hover { border-left-color: var(--green-800); }
.search-results .result h3 { margin: 0 0 4px; color: var(--green-800); }

/* ============================ RESPONSIVE (extra) ============================ */
@media (max-width: 900px) {
  .site-search input { width: 110px; }
  .brand-name { font-size: 0.9rem; max-width: 190px; }
}
@media (max-width: 760px) {
  .header-controls { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
  .site-search { order: 3; flex: 1 1 100%; }
  .site-search input { width: 100%; }
  .brand-sub { display: none; }
}

/* Total row in data tables (bez inline stila — CSP-draudzīgi) */
table.data tr.trow-total { font-weight: 700; background: #eef7ee; }
table.data tr.trow-total td { border-bottom: 0; }

/* Centrēts bloks (piem., 404) */
.block.center { text-align: center; }

/* ============================ ACCESSIBILITY (WCAG 2.1 AA) ============================ */
/* Видимый фокус для всех интерактивных элементов (2.4.7 Focus Visible) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--green-700);
  outline-offset: 2px;
  border-radius: 4px;
}
/* На тёмном фоне (навигация, hero, footer) — светлый контур */
.main-nav a:focus-visible,
.hero a:focus-visible,
.site-footer a:focus-visible,
.btn:focus-visible {
  outline-color: #fff;
}

/* Тач-цели ≥ 44×44px (2.5.5 / 2.5.8 Target Size) */
.lang-switch button { min-height: 44px; padding: 6px 14px; }
.site-search button { min-height: 44px; min-width: 44px; }
.nav-toggle { min-height: 44px; min-width: 44px; }
.social { width: 44px; height: 44px; font-size: 1rem; }
.social.wa { font-size: 0.8rem; }
.main-nav a { min-height: 44px; display: flex; align-items: center; }

/* Контраст hero-meta (было 3.30 — поднимаем до AA) */
.hero .hero-meta { color: #eafaea; }

/* Уважать снижение анимации (2.3.3 / 2.2.2) */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Поддержка высокого контраста / принудительных цветов (Windows High Contrast) */
@media (forced-colors: active) {
  .btn, .lang-switch button.active, table.data thead th { forced-color-adjust: none; }
  a:focus-visible, button:focus-visible { outline: 3px solid CanvasText; }
}

/* ============================ WCAG 2.2 + доп. ============================ */
/* 2.4.11 Focus Not Obscured: якоря/фокус не под липкой шапкой */
html { scroll-padding-top: 96px; }

/* Новости (Aktualitātes) */
.news-list { display: grid; gap: 16px; }
.news-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--green-600);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.news-item time {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--green-700);
  background: var(--green-100);
  border-radius: 999px;
  padding: 2px 10px;
  margin-bottom: 6px;
}
.news-item h3 { margin: 4px 0 6px; }

/* Печать: убрать хром интерфейса, оставить контент */
@media print {
  .site-header, .site-footer, .nav-toggle, .lang-switch,
  .site-search, .social-links, .skip-link { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  a { color: #000; text-decoration: underline; }
  main { padding: 0; }
  /* при печати показываем только латышскую версию */
  html.lang-ru .lv, html.lang-en .lv { display: revert !important; }
  .ru, .en { display: none !important; }
}

/* ============================ ГАЛЕРЕЯ ============================ */
.gallery {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.gal-item {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.gal-item svg { width: 100%; height: auto; display: block; }
.gal-item figcaption {
  padding: 10px 14px;
  font-weight: 600;
  color: var(--green-800);
  font-size: 0.95rem;
}

/* Реальные фото в галерее — единый аспект */
.gal-item img { width: 100%; height: 220px; object-fit: cover; display: block; }

/* ============================ VIEGLI LASĪT (Easy read) ============================ */
.easy-read { max-width: 760px; font-size: 1.25rem; line-height: 1.9; }
.easy-read h1 { font-size: 2.2rem; }
.easy-read h2 { font-size: 1.6rem; margin-top: 1.2em; }
.easy-read p, .easy-read li { font-size: 1.25rem; }
.easy-read section.block { margin: 1.4em 0; }
.easy-read a { text-decoration: underline; }
