/* История формирования — вариант №3, Joomla 4 / Казводхоз.
   Everything scoped to .khistory; no changes to navigation or other articles. */
.khistory {
  --kh-primary: #064666;
  --kh-accent: #1187c4;
  --kh-ink: #16394d;
  --kh-muted: #536b7a;
  --kh-line: #d9e7ee;
  --kh-soft: #f1f8fc;
  box-sizing: border-box;
  width: 100%;
  max-width: 1350px;
  margin: 0 auto;
  padding: clamp(18px, 2.6vw, 36px);
  border-radius: 16px;
  background: #fff;
  color: var(--kh-ink);
  box-shadow: 0 12px 34px rgba(6,70,102,.045);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.52;
}
.khistory, .khistory *, .khistory *::before, .khistory *::after { box-sizing: border-box; }
.khistory .khistory__content { font-size: inherit; line-height: inherit; }
.khistory .khistory__content p { margin: 0; line-height: 1.58; }
.khistory .khistory__content h2 { margin: 0; color: var(--kh-primary); letter-spacing: -.02em; }
.khistory .khistory__content a { color: #006ca8; overflow-wrap: anywhere; }
.khistory .khistory__content a:focus-visible { outline: 2px solid #148bd0; outline-offset: 3px; }
.khistory .khistory__intro {
  display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr);
  gap: clamp(18px, 2.4vw, 30px);
  align-items: stretch; padding-bottom: 24px;
  border-bottom: 1px solid var(--kh-line);
}
.khistory .khistory__about { min-width: 0; }
.khistory .khistory__eyebrow { display: inline-block; margin-bottom: 10px; color: #1284bb; font-weight: 750; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.khistory .khistory__about h2 { margin: 0 0 12px; font-size: clamp(21px, 2vw, 27px); line-height: 1.23; font-weight: 750; }
.khistory .khistory__about p + p { margin-top: 11px; }
.khistory .khistory__about p { font-size: 14px; }
/* Actual filial-map.svg from the portal (copied once to a stable public path). */
.khistory .khistory__map {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end;
  min-height: 220px; padding: 22px 25px;
  border-radius: 13px;
  background: linear-gradient(125deg, #e6f5fc, #f3f9fc 65%, #d9edf7);
  color: var(--kh-primary);
}
.khistory .khistory__map-image {
  display: block;
  position: absolute; z-index: 0;
  top: 4%; right: 3%; width: 92%; height: 77%;
  object-fit: contain; object-position: center top;
  opacity: .88; pointer-events: none;
}
.khistory .khistory__map::after {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(246,252,255,.96) 2%, rgba(246,252,255,0) 73%);
}
.khistory .khistory__map-kicker,
.khistory .khistory__map strong,
.khistory .khistory__map p { position: relative; z-index: 1; }
.khistory .khistory__map-kicker { font-size: 12px; letter-spacing: .03em; font-weight: 650; }
.khistory .khistory__map strong { display: block; margin: 4px 0 4px; font-size: clamp(20px,2vw,24px); line-height: 1.2; }
.khistory .khistory__map p { max-width: 300px; font-size: 12.5px; color: #44667c; }
.khistory .khistory__columns {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr);
  gap: clamp(24px, 3vw, 40px);
  padding-top: 25px;
}
.khistory .khistory__section + .khistory__section { margin-top: 28px; }
.khistory .khistory__section-title { margin: 0 0 16px !important; color: var(--kh-primary) !important; font-weight: 750; font-size: 18px !important; line-height: 1.3; }
.khistory .khistory__section-title::after { content: ""; display: block; margin-top: 8px; width: 36px; height: 3px; border-radius: 9px; background: #168aca; }
.khistory .khistory__facts { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 0; }
.khistory .khistory__fact { display: flex; flex-direction: column; gap: 7px; padding: 12px 13px; border-right: 1px solid var(--kh-line); min-width: 0; }
.khistory .khistory__fact:first-child { padding-left: 0; }
.khistory .khistory__fact:last-child { border-right: none; }
.khistory .khistory__fact strong { font-size: clamp(21px, 2.5vw, 27px); line-height: 1.1; letter-spacing: -.04em; color: #0874ae; }
.khistory .khistory__fact span { font-size: 12px; line-height: 1.35; color: #314b5c; }
.khistory .khistory__fact small { display: block; font-size: 10.5px; color: #697d88; margin-top: 3px; }
.khistory .khistory__services { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.khistory .khistory__service { min-width: 0; min-height: 74px; padding: 14px; display: flex; gap: 12px; align-items: center; background: var(--kh-soft); border: 1px solid #e5f0f6; border-radius: 10px; font-weight: 600; font-size: 12.5px; line-height: 1.42; color: var(--kh-ink); }
.khistory .khistory__service-icon { flex: 0 0 38px; width: 38px; height: 38px; display: grid; place-items: center; background: #dbf0fb; border-radius: 10px; font-size: 23px; font-weight: 650; color: #087cb5; }
.khistory .khistory__timeline { border-left: 1px solid var(--kh-line); padding-left: clamp(20px,2.2vw,30px); min-width:0; }
.khistory .khistory__timeline-list { counter-reset: item; list-style: none !important; margin: 0 !important; padding: 0 0 0 17px !important; border-left: 2px solid #b1dbea; }
.khistory .khistory__timeline-list li { position: relative; display: grid; grid-template-columns: minmax(66px,87px) minmax(0,1fr); gap: 14px; margin: 0 !important; padding: 0 0 22px 19px !important; }
.khistory .khistory__timeline-list li:last-child { padding-bottom: 0 !important; }
.khistory .khistory__timeline-list li::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: #198fc9; border: 2px solid #fff; box-shadow: 0 0 0 2px #a7d8ec; position: absolute; left: -24px; top: 7px; }
.khistory .khistory__year { display: inline-flex; align-self: start; justify-content: center; padding: 5px 8px; border-radius: 6px; background: #e8f4fa; color: #08699c; font-size: 12px; font-weight: 760; white-space: nowrap; }
.khistory .khistory__timeline-list strong { color: var(--kh-primary); font-size: 13.5px; line-height: 1.3; }
.khistory .khistory__timeline-list p { margin-top: 4px; font-size: 12.5px; color: var(--kh-muted); line-height: 1.46; }
/* Tablet: introduction and timeline stack, facts remain readable. */
@media (max-width: 1050px) {
  .khistory .khistory__intro { grid-template-columns: minmax(0,1fr) minmax(0,.8fr); }
  .khistory .khistory__columns { grid-template-columns: minmax(0,1fr); }
  .khistory .khistory__timeline { border-left: none; border-top: 1px solid var(--kh-line); padding: 22px 0 0; }
}
@media (max-width: 700px) {
  .khistory { border-radius: 12px; padding: 18px 16px; font-size: 14px; }
  .khistory .khistory__intro { grid-template-columns: minmax(0,1fr); gap: 18px; padding-bottom: 19px; }
  .khistory .khistory__about h2 { font-size: 21px; }
  .khistory .khistory__map { min-height: 178px; }
  .khistory .khistory__columns { padding-top: 22px; gap: 24px; }
  .khistory .khistory__facts { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  .khistory .khistory__fact { padding: 12px !important; border: 1px solid var(--kh-line) !important; border-radius: 9px; background: #fafdff; }
  .khistory .khistory__fact strong { font-size: 24px; }
  .khistory .khistory__section-title { font-size: 17px !important; }
  .khistory .khistory__service { align-items: flex-start; flex-direction: column; gap: 8px; padding: 12px; }
  .khistory .khistory__service-icon { width: 34px; height: 34px; flex-basis: 34px; font-size: 20px; }
  .khistory .khistory__timeline-list li { grid-template-columns: minmax(0,1fr); gap: 5px; padding-bottom: 18px !important; }
}
@media (max-width: 380px) {
  .khistory .khistory__services { grid-template-columns: minmax(0,1fr); }
  .khistory .khistory__fact span { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .khistory * { scroll-behavior: auto !important; }
}
