/* hydroklas.com.ua — світла тема «м'ятний туман + глибока бірюза» */

:root {
  /* Палітра */
  --bg: #eef4f1;
  --bg-deep: #e3ece8;
  --surface: #ffffff;
  --surface-soft: #f6faf8;
  --ink: #1d2a2a;
  --ink-soft: #2f3d3d;
  --muted: #536462;
  --line: #d4e0db;
  --line-soft: #e4ece8;
  --accent: #0a6464;
  --accent-hover: #074c4c;
  --accent-tint: #dcefeb;
  --accent-wash: #eaf5f2;
  --second: #9a4a22;
  --second-tint: #f6e9df;
  --threat: #a52a2a;
  --focus: #0a6464;

  /* Типографіка */
  --f-head: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-body: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --f-mono: ui-monospace, SFMono-Regular, "Cascadia Code", Menlo, Consolas, "Liberation Mono", monospace;

  --fs-base: 1rem;
  --fs-sm: 0.875rem;
  --fs-xs: 0.8125rem;
  --fs-h1: 1.3125rem;
  --fs-h2: 1.1875rem;
  --fs-h3: 1.0625rem;
  --lh-body: 1.7;
  --lh-head: 1.3;

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;
  --sp-9: 88px;

  /* Радіуси, тіні */
  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(18, 52, 48, 0.05);
  --shadow-md: 0 2px 6px rgba(18, 52, 48, 0.04), 0 10px 30px rgba(18, 52, 48, 0.06);

  /* Макет */
  --wrap: 1160px;
  --measure: 68ch;
  --gutter: 16px;
  --tap: 44px;
  --ease: 160ms ease;
}

@media (min-width: 480px) {
  :root { --gutter: 20px; --fs-h1: 1.4375rem; }
}

@media (min-width: 768px) {
  :root {
    --fs-base: 1.0625rem;
    --fs-h1: 1.625rem;
    --fs-h2: 1.3125rem;
    --fs-h3: 1.125rem;
    --gutter: 28px;
  }
}

@media (min-width: 1024px) {
  :root {
    --fs-base: 1.125rem;
    --fs-h1: 1.875rem;
    --fs-h2: 1.4375rem;
    --fs-h3: 1.1875rem;
    --gutter: 36px;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 120px;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 500px at 100% -10%, rgba(10, 100, 100, 0.06), transparent 60%),
    radial-gradient(900px 420px at -10% 0%, rgba(154, 74, 34, 0.035), transparent 60%);
  background-repeat: no-repeat;
  color: var(--ink);
  font-family: var(--f-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, picture, video, canvas, svg, iframe, embed, object {
  display: block;
  max-width: 100%;
}
img, video { height: auto; }
iframe { border: 0; }

button, input, select, textarea { font: inherit; color: inherit; }

::selection { background: var(--accent-tint); color: var(--ink); }

/* Посилання */
a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(10, 100, 100, 0.45);
  text-underline-offset: 0.2em;
  transition: color var(--ease), text-decoration-color var(--ease), background-color var(--ease);
}
a:hover {
  color: var(--accent-hover);
  text-decoration-color: currentColor;
  text-decoration-thickness: 2px;
}
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* Skip */
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
}
.skip:focus {
  left: var(--sp-3);
  top: var(--sp-3);
  z-index: 300;
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: var(--sp-2) var(--sp-4);
  background: var(--surface);
  color: var(--accent);
  font-family: var(--f-head);
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
}

/* Шапка */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(248, 251, 250, 0.92);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar::before {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent) 70%, var(--second) 70%, var(--second) 100%);
}

.topbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2) var(--sp-4);
  min-height: 60px;
  padding-top: var(--sp-2);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--tap);
  color: var(--ink);
  text-decoration: none;
  font-family: var(--f-head);
  font-weight: 750;
  font-size: 1.125rem;
  letter-spacing: -0.015em;
}
.brand:hover { color: var(--ink); text-decoration: none; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: #ffffff;
  font-size: 0.95rem;
  line-height: 1;
}

.menu {
  order: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--sp-1);
  width: 100%;
  margin: 0 calc(var(--sp-2) * -1);
  padding-bottom: var(--sp-1);
  font-family: var(--f-head);
  font-size: 0.9375rem;
  font-weight: 500;
}
.menu a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 var(--sp-2);
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--r-sm);
  position: relative;
}
.menu a:hover {
  color: var(--accent);
  background: var(--accent-wash);
  text-decoration: none;
}
.menu a[aria-current="page"] {
  color: var(--ink);
  font-weight: 650;
}
.menu a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: var(--sp-2);
  right: var(--sp-2);
  bottom: 8px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.lang {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg-deep);
  border-radius: var(--r-pill);
  font-family: var(--f-head);
  font-size: var(--fs-sm);
}
.lang a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 38px;
  padding: 0 var(--sp-3);
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--r-pill);
}
.lang a:hover { color: var(--accent); text-decoration: none; }
.lang a[aria-current="true"] {
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 768px) {
  .topbar-row {
    flex-wrap: nowrap;
    gap: var(--sp-5);
    min-height: 68px;
    padding-top: 0;
  }
  .menu {
    order: 0;
    width: auto;
    margin: 0 auto 0 var(--sp-4);
    padding-bottom: 0;
    flex-wrap: wrap;
  }
}

/* Хлібні крихти */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--sp-2);
  margin: var(--sp-5) 0 var(--sp-3);
  font-family: var(--f-head);
  font-size: var(--fs-sm);
  color: var(--muted);
}
.crumbs a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  color: var(--muted);
  text-decoration: none;
}
.crumbs a:hover { color: var(--accent); text-decoration: underline; }

/* Заголовок статті */
.post-head { max-width: 860px; }
.post-head h1 {
  font-family: var(--f-head);
  font-weight: 750;
  font-size: var(--fs-h1);
  line-height: var(--lh-head);
  letter-spacing: -0.012em;
  color: var(--ink);
  max-width: 40ch;
  overflow-wrap: anywhere;
  hyphens: auto;
  text-wrap: balance;
}

.post-info {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-4);
  margin: var(--sp-4) 0 var(--sp-6);
  font-family: var(--f-head);
  font-size: var(--fs-sm);
  color: var(--muted);
}
.post-info > * {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}
.post-info > * + *::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--second);
  opacity: 0.7;
}

@media (min-width: 768px) {
  .crumbs { margin-top: var(--sp-6); }
}

/* Обкладинка */
.cover {
  width: 100%;
  max-width: calc(var(--wrap) + 120px);
  margin: 0 auto var(--sp-6);
  padding: 0 var(--gutter);
}
.cover img {
  width: 100%;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  border-radius: var(--r-md);
  background: var(--bg-deep);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-md);
}
@media (min-width: 1024px) {
  .cover { margin-bottom: var(--sp-7); }
  .cover img { border-radius: var(--r-lg); }
}

/* Сітка статті */
.post-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-5);
}
.post-layout > * { min-width: 0; }

@media (min-width: 1024px) {
  .post-layout {
    grid-template-columns: 230px minmax(0, 1fr);
    gap: var(--sp-7);
  }
  .toc {
    position: sticky;
    top: 104px;
    align-self: start;
    max-height: calc(100vh - 130px);
    overflow-y: auto;
  }
}

/* Зміст */
.toc {
  font-family: var(--f-head);
  font-size: var(--fs-sm);
  background: var(--surface-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: var(--sp-4);
}
.toc-title {
  margin-bottom: var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--second);
}
.toc ol {
  list-style: none;
  display: grid;
  gap: 2px;
  counter-reset: toc;
}
.toc li { counter-increment: toc; }
.toc a {
  display: flex;
  gap: var(--sp-2);
  align-items: baseline;
  min-height: var(--tap);
  padding: 11px var(--sp-2);
  color: var(--ink-soft);
  text-decoration: none;
  line-height: 1.4;
  border-radius: var(--r-sm);
  overflow-wrap: anywhere;
}
.toc a::before {
  content: counter(toc, decimal-leading-zero);
  flex: none;
  font-family: var(--f-mono);
  font-size: 0.75rem;
  color: var(--accent);
  opacity: 0.85;
}
.toc a:hover {
  background: var(--accent-wash);
  color: var(--accent);
  text-decoration: none;
}
@media (min-width: 1024px) {
  .toc { background: transparent; border: 0; border-left: 2px solid var(--line); border-radius: 0; padding: 0 0 0 var(--sp-3); }
  .toc a { min-height: 0; padding: 6px var(--sp-2); }
}

/* Стаття */
.post {
  width: 100%;
  max-width: calc(var(--measure) + 2 * var(--sp-7));
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-5) var(--sp-4);
  overflow-wrap: break-word;
}
.post > * { max-width: var(--measure); }

@media (min-width: 480px) {
  .post { padding: var(--sp-6) var(--sp-5); }
}
@media (min-width: 768px) {
  .post { padding: var(--sp-7); border-radius: var(--r-lg); }
}

.post p { margin: 0 0 1.15em; }
.post .intro {
  font-size: 1.08em;
  line-height: 1.65;
  color: var(--ink-soft);
  padding-bottom: var(--sp-4);
  margin-bottom: var(--sp-5);
  border-bottom: 1px solid var(--line-soft);
}

.post h2,
.post h3,
.post h4 {
  font-family: var(--f-head);
  color: var(--ink);
  line-height: var(--lh-head);
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.post h2 {
  position: relative;
  font-size: var(--fs-h2);
  font-weight: 720;
  letter-spacing: -0.01em;
  margin: var(--sp-7) 0 var(--sp-3);
  padding-top: var(--sp-3);
}
.post h2::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 32px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
}
.post h3 {
  font-size: var(--fs-h3);
  font-weight: 680;
  color: var(--accent-hover);
  margin: var(--sp-6) 0 var(--sp-2);
}
.post h4 {
  font-size: 1rem;
  font-weight: 650;
  margin: var(--sp-5) 0 var(--sp-2);
}
.post > :first-child { margin-top: 0; }

.post strong, .post b { font-weight: 700; color: var(--ink); }

/* Списки */
.post ul,
.post ol {
  margin: 0 0 1.2em;
  padding-left: 1.4em;
}
.post li { margin-bottom: 0.45em; padding-left: 0.2em; }
.post li > ul, .post li > ol { margin: 0.45em 0 0; }
.post ul { list-style: none; padding-left: 1.3em; }
.post ul > li { position: relative; }
.post ul > li::before {
  content: "";
  position: absolute;
  left: -1.05em;
  top: 0.72em;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--accent);
  transform: rotate(45deg);
  opacity: 0.85;
}
.post ol > li::marker {
  color: var(--second);
  font-family: var(--f-head);
  font-weight: 700;
  font-size: 0.92em;
}

/* Підсумок */
.summary {
  background: var(--accent-wash);
  border: 1px solid var(--accent-tint);
  border-radius: var(--r-md);
  padding: var(--sp-4) var(--sp-4);
  margin: 0 0 var(--sp-5);
}
@media (min-width: 768px) {
  .summary { padding: var(--sp-5) var(--sp-5); }
}
.summary-title {
  font-family: var(--f-head);
  font-weight: 700;
  font-size: var(--fs-sm);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--sp-2) !important;
}
.summary p:last-child,
.summary ul:last-child,
.summary ol:last-child { margin-bottom: 0; }

/* Терміни */
.terms {
  display: grid;
  gap: var(--sp-3);
  margin: 0 0 1.5em;
}
.terms div {
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-soft);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--second);
  border-radius: var(--r-sm);
}
.terms dt {
  font-family: var(--f-head);
  font-weight: 700;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.terms dd { color: var(--muted); margin-top: 2px; }

/* Цитати */
.post blockquote {
  margin: var(--sp-6) 0;
  padding: var(--sp-4) var(--sp-4) var(--sp-4) var(--sp-5);
  background: var(--second-tint);
  border-left: 3px solid var(--second);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  color: var(--ink-soft);
}
@media (min-width: 768px) {
  .post blockquote { padding: var(--sp-5) var(--sp-6); }
}
.post blockquote p {
  margin: 0 0 0.6em;
  font-size: 1.05em;
  line-height: 1.6;
  font-style: italic;
  color: var(--ink-soft);
}
.post blockquote p:last-child { margin-bottom: 0; }
.post blockquote cite,
.post blockquote footer {
  display: block;
  margin-top: var(--sp-2);
  font-family: var(--f-head);
  font-style: normal;
  font-size: var(--fs-sm);
  color: var(--muted);
}

/* Код */
code, kbd, samp, pre { font-family: var(--f-mono); font-size: 0.875em; }
:not(pre) > code,
kbd {
  padding: 0.12em 0.4em;
  background: var(--accent-wash);
  border: 1px solid var(--accent-tint);
  border-radius: 4px;
  color: var(--accent-hover);
  overflow-wrap: anywhere;
  word-break: break-word;
}
pre {
  max-width: 100%;
  margin: 0 0 1.3em;
  padding: var(--sp-4);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #f3f7f5;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  line-height: 1.6;
  color: var(--ink);
  tab-size: 2;
}
pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; white-space: pre; }

/* Таблиці */
.post table,
table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-collapse: collapse;
  margin: 0 0 1.4em;
  font-family: var(--f-head);
  font-size: 0.9375rem;
  line-height: 1.5;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
@media (min-width: 768px) {
  .post table, table { display: table; overflow: visible; }
}
th, td {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line-soft);
  min-width: 120px;
}
th {
  background: var(--accent-wash);
  color: var(--ink);
  font-weight: 700;
  border-bottom: 1px solid var(--line);
}
tbody tr:nth-child(even) td { background: var(--surface-soft); }
tbody tr:hover td { background: var(--accent-wash); }
tbody tr:last-child td { border-bottom: 0; }

/* Медіа */
.post figure { margin: var(--sp-6) 0; }
.post figure img,
.post > img,
.post p img { border-radius: var(--r-sm); }
.post figcaption {
  margin-top: var(--sp-2);
  font-family: var(--f-head);
  font-size: var(--fs-sm);
  color: var(--muted);
}
.post iframe, .post video { width: 100%; border-radius: var(--r-sm); }
.post iframe { aspect-ratio: 16 / 9; height: auto; }

hr {
  border: 0;
  height: 1px;
  margin: var(--sp-7) 0;
  background: var(--line);
}

/* Читайте також */
.more {
  margin-top: var(--sp-8);
  padding: var(--sp-7) 0;
  background: var(--surface-soft);
  border-top: 1px solid var(--line);
}
@media (min-width: 1024px) {
  .more { margin-top: var(--sp-9); padding: var(--sp-8) 0; }
}
.more h2 {
  font-family: var(--f-head);
  font-size: var(--fs-h2);
  font-weight: 720;
  line-height: var(--lh-head);
  letter-spacing: -0.01em;
  margin-bottom: var(--sp-4);
}
.more-list {
  list-style: none;
  display: grid;
  gap: var(--sp-3);
}
.more-list li { min-width: 0; }
.more-list a {
  display: grid;
  gap: var(--sp-1) var(--sp-5);
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}
.more-list a:hover {
  border-color: var(--accent-tint);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  text-decoration: none;
}
.more-list a:hover .more-name { color: var(--accent); }
.more-list a:focus-visible { outline-offset: 2px; border-radius: var(--r-md); }

@media (min-width: 768px) {
  .more-list a {
    grid-template-columns: 120px minmax(0, 220px) minmax(0, 1fr);
    align-items: baseline;
    padding: var(--sp-4) var(--sp-5);
  }
}

.more-topic {
  justify-self: start;
  font-family: var(--f-head);
  font-size: var(--fs-xs);
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}
.more-topic.is-threat { color: var(--threat); }
.more-name {
  font-family: var(--f-head);
  font-weight: 700;
  font-size: 1.0625rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
  transition: color var(--ease);
}
.more-desc {
  color: var(--muted);
  font-size: 0.95em;
  line-height: 1.6;
}

/* Підвал */
.foot {
  background: var(--bg-deep);
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-family: var(--f-head);
  font-size: var(--fs-sm);
}
.foot-row {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding-top: var(--sp-6);
  padding-bottom: var(--sp-6);
}
@media (min-width: 768px) {
  .foot-row { flex-direction: row; flex-wrap: wrap; justify-content: space-between; align-items: center; }
}
.foot-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--sp-4);
}
.foot a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  color: var(--ink-soft);
  text-decoration: none;
}
.foot a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.dmca {
  padding: 0 var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: var(--fs-xs);
  color: var(--muted);
}
.foot a.dmca { min-height: 36px; }

/* Рух */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .more-list a:hover { transform: none; }
}

/* Друк */
@media print {
  body { background: #fff; }
  .topbar, .toc, .more, .foot, .skip { display: none; }
  .post { border: 0; box-shadow: none; padding: 0; max-width: none; }
}