/* Растишка — справочник домашнего садовода
   Мотив: бирка из питомника. Палитра: гербарная бумага, хвойные чернила,
   мох и фиолетовый свет фитолампы. */

@font-face {
  font-family: "Vollkorn";
  src: url("../fonts/vollkorn-var.woff2") format("woff2-variations");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Golos Text";
  src: url("../fonts/golos-var.woff2") format("woff2-variations");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JB Mono";
  src: url("../fonts/jbmono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #16211c;
  --ink-soft: #45564d;
  --paper: #edf1e8;
  --card: #f8faf4;
  --haze: #cbd6c4;
  --moss: #356042;
  --lamp: #6a46d9;
  --lamp-soft: #ece7fb;
  --ph-bg: #e3e9df;

  --ff-display: "Vollkorn", Georgia, "Times New Roman", serif;
  --ff-body: "Golos Text", "Segoe UI", Arial, sans-serif;
  --ff-mono: "JB Mono", "Courier New", monospace;

  --step: 1.6rem;
  --rail: 2px;
  --measure: 66ch;
  --radius: 3px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ff-body);
  font-size: 1.0625rem;
  line-height: 1.68;
  font-variant-numeric: oldstyle-nums;
  text-rendering: optimizeLegibility;
}

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

a { color: var(--moss); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--lamp); }

:focus-visible {
  outline: 2px solid var(--lamp);
  outline-offset: 2px;
  border-radius: 1px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 1rem;
  z-index: 20;
}
.skip:focus { left: 0; }

/* ---------- каркас ---------- */

.wrap {
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 1.15rem;
}

.page { padding-bottom: 3.5rem; }

/* ---------- бирка: фирменный элемент ---------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.3em 0.7em 0.3em 1.35em;
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  line-height: 1.25;
  color: var(--moss);
  background: var(--card);
  border: 1px solid var(--haze);
  border-radius: 0 var(--radius) var(--radius) 0;
  clip-path: polygon(0.55em 0, 100% 0, 100% 100%, 0.55em 100%, 0 50%);
  position: relative;
  text-decoration: none;
}
.tag::before {
  content: "";
  position: absolute;
  left: 0.72em;
  top: 50%;
  width: 0.3em;
  height: 0.3em;
  margin-top: -0.15em;
  border-radius: 50%;
  background: var(--haze);
}
.tag--lamp { color: var(--lamp); background: var(--lamp-soft); border-color: #d6ccf6; }
.tag--lamp::before { background: #c3b5f0; }
a.tag:hover { color: var(--lamp); border-color: #d6ccf6; }

/* ---------- шапка ---------- */

.top {
  border-bottom: 1px solid var(--haze);
  background: var(--card);
}
.top__in {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding-top: 1rem;
  padding-bottom: 0.9rem;
}
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { color: var(--ink); }
.brand__mark {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  align-self: center;
}
.brand__sub {
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.05rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav a {
  font-size: 0.9rem;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.15rem 0;
  border-bottom: 1px solid transparent;
  display: inline-block;
}
.nav a:hover { color: var(--lamp); border-bottom-color: var(--lamp); }
.nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--moss);
}

/* ---------- заголовки ---------- */

h1, h2, h3 {
  font-family: var(--ff-display);
  color: var(--ink);
  line-height: 1.18;
  letter-spacing: -0.012em;
  margin: 0 0 0.6rem;
  text-wrap: balance;
}
h1 {
  font-weight: 700;
  font-size: clamp(1.95rem, 5.4vw, 3.05rem);
}
h2 {
  font-weight: 600;
  font-size: clamp(1.35rem, 3.4vw, 1.85rem);
  margin-top: calc(var(--step) * 1.6);
  padding-left: 1rem;
  position: relative;
}
h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.24em;
  bottom: 0.22em;
  width: var(--rail);
  background: var(--moss);
}
h2::after {
  content: "";
  position: absolute;
  left: -0.2rem;
  top: 0.08em;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--moss);
}
h3 {
  font-family: var(--ff-body);
  font-weight: 600;
  font-size: 1.08rem;
  letter-spacing: 0;
  margin-top: var(--step);
}

/* ---------- текст ---------- */

.prose { max-width: var(--measure); }
.prose > p { margin: 0 0 1.05rem; }
.prose > ul,
.prose > ol { margin: 0 0 1.15rem; padding-left: 1.25rem; }
.prose li { margin-bottom: 0.42rem; }
.prose li::marker { color: var(--moss); }
.prose strong { font-weight: 600; }

.lead {
  font-size: 1.16rem;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 54ch;
}

.dash {
  border: 0;
  border-top: 1px solid var(--haze);
  margin: calc(var(--step) * 1.5) 0;
  max-width: var(--measure);
}

.note {
  background: var(--card);
  border: 1px solid var(--haze);
  border-left: 3px solid var(--moss);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.95rem 1.05rem;
  margin: 0 0 1.2rem;
  max-width: var(--measure);
  font-size: 0.98rem;
}
.note > :last-child { margin-bottom: 0; }
.note > p { margin: 0 0 0.7rem; }
.note__t {
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--moss);
  display: block;
  margin-bottom: 0.35rem;
}

.tbl-scroll { overflow-x: auto; max-width: var(--measure); margin-bottom: 1.3rem; }
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
  min-width: 30rem;
}
th, td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--haze);
  vertical-align: top;
}
th {
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--moss);
}

/* ---------- шапка страницы ---------- */

.head { padding: 2.5rem 0 0.6rem; }
.head .tag { margin-bottom: 0.9rem; }

/* ---------- гербарий: сетка ссылок на разделы ---------- */

.grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: 1fr;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}
@media (min-width: 40rem) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
}

.tile {
  background: var(--card);
  border: 1px solid var(--haze);
  border-radius: var(--radius);
  padding: 1rem 1.05rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.tile:hover { border-color: var(--moss); transform: translateY(-2px); }
.tile__n {
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
}
.tile__h {
  font-family: var(--ff-display);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
}
.tile__h a { text-decoration: none; color: var(--ink); }
.tile__h a:hover { color: var(--lamp); }
.tile p { margin: 0; font-size: 0.95rem; color: var(--ink-soft); }

/* ---------- карточки материалов ---------- */

.cards {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: 1fr;
  margin: 0 0 1.8rem;
  padding: 0;
  list-style: none;
}
@media (min-width: 38rem) {
  .cards { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 58rem) {
  .cards { grid-template-columns: repeat(3, 1fr); }
}

.card {
  background: var(--card);
  border: 1px solid var(--haze);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.18s ease;
}
.card:hover { border-color: var(--moss); }
.card__img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-bottom: 1px solid var(--haze);
  background: var(--ph-bg);
}
.card__b { padding: 0.85rem 0.95rem 1rem; display: flex; flex-direction: column; gap: 0.4rem; }
.card__h {
  font-family: var(--ff-display);
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.22;
  margin: 0;
}
.card__h a { color: var(--ink); text-decoration: none; }
.card__h a:hover { color: var(--lamp); }
.card__d { margin: 0; font-size: 0.93rem; color: var(--ink-soft); }
.card__m {
  font-family: var(--ff-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  text-transform: uppercase;
}

.empty {
  border: 1px dashed var(--haze);
  border-radius: var(--radius);
  padding: 1.4rem 1.15rem;
  color: var(--ink-soft);
  font-size: 0.97rem;
  max-width: var(--measure);
  margin-bottom: 1.6rem;
}

/* ---------- пагинация ---------- */

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 2rem;
}
.pager__i,
.pager__nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.35rem;
  height: 2.35rem;
  padding: 0 0.7rem;
  font-family: var(--ff-mono);
  font-size: 0.82rem;
  text-decoration: none;
  color: var(--ink-soft);
  background: var(--card);
  border: 1px solid var(--haze);
  border-radius: var(--radius);
}
.pager__i:hover,
.pager__nav:hover { color: var(--lamp); border-color: #d6ccf6; }
.pager__i--cur {
  color: var(--lamp);
  background: var(--lamp-soft);
  border-color: #d6ccf6;
}

/* ---------- статья ---------- */

.article__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 1.4rem;
}
.figure { margin: 0 0 1.5rem; max-width: var(--measure); }
.figure img {
  width: 100%;
  border: 1px solid var(--haze);
  border-radius: var(--radius);
}
.figure figcaption {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 0.45rem;
}

/* ---------- аккордеон (словарь, разбор ошибок) ---------- */

.acc { max-width: var(--measure); margin: 0 0 1.6rem; }
.acc > details {
  border-bottom: 1px solid var(--haze);
  background: transparent;
}
.acc > details > summary {
  cursor: pointer;
  padding: 0.8rem 1.8rem 0.8rem 0;
  position: relative;
  font-weight: 600;
  list-style: none;
  display: block;
}
.acc > details > summary::-webkit-details-marker { display: none; }
.acc > details > summary::after {
  content: "+";
  position: absolute;
  right: 0.2rem;
  top: 0.72rem;
  font-family: var(--ff-mono);
  color: var(--moss);
  font-size: 1.05rem;
}
.acc > details[open] > summary::after { content: "−"; }
.acc > details > summary:hover { color: var(--lamp); }
.acc > details > .acc__b {
  display: none;
  padding: 0 0 1rem;
  font-size: 0.99rem;
  color: var(--ink-soft);
}
.acc > details[open] > .acc__b { display: block; }
.acc > details > .acc__b > p { margin: 0 0 0.7rem; }
.acc > details > .acc__b > :last-child { margin-bottom: 0; }

/* ---------- главная: карта окна ---------- */

.hero { padding: 2.6rem 0 0.5rem; }
.hero__grid { display: grid; gap: 1.8rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 52rem) {
  .hero__grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 2.6rem; }
}
.compass {
  background: var(--card);
  border: 1px solid var(--haze);
  border-radius: var(--radius);
  padding: 1.1rem;
}
.compass svg { width: 100%; height: auto; display: block; }
.compass__c {
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin: 0.8rem 0 0;
  line-height: 1.5;
  text-transform: uppercase;
}

/* ---------- подвал ---------- */

.foot {
  border-top: 1px solid var(--haze);
  background: var(--card);
  padding: 2rem 0 2.4rem;
  font-size: 0.92rem;
}
.foot__cols {
  display: grid;
  gap: 1.4rem;
  grid-template-columns: 1fr;
}
@media (min-width: 40rem) {
  .foot__cols { grid-template-columns: repeat(3, 1fr); }
}
.foot h2 {
  font-family: var(--ff-mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 500;
  margin: 0 0 0.6rem;
  padding-left: 0;
}
.foot h2::before,
.foot h2::after { content: none; }
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li { margin-bottom: 0.32rem; }
.foot a { color: var(--ink-soft); text-decoration: none; }
.foot a:hover { color: var(--lamp); text-decoration: underline; }
.foot__end {
  margin-top: 1.8rem;
  padding-top: 1rem;
  border-top: 1px solid var(--haze);
  color: var(--ink-soft);
  font-family: var(--ff-mono);
  font-size: 0.66rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.2rem;
}

/* ---------- служебное ---------- */

.next {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.2rem;
  padding: 0;
  list-style: none;
}

.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .tile:hover { transform: none; }
}
