:root {
  color-scheme: light dark;

  /* Цвета взяты у кофейного дерева, а не у обжарки */
  --bean: #e8ecdf;      /* зелёное зерно: фон */
  --husk: #d3dbc4;      /* шелуха: подложки */
  --leaf: #17301f;      /* лист: текст */
  --leaf-soft: #4a5f50; /* лист в тени: подписи */
  --cherry: #b3202a;    /* спелая ягода: ссылки, проливы */
  --bourbon: #dda11e;   /* жёлтый бурбон: предсмачивание */
  --line: rgba(23, 48, 31, .24);

  /* Шрифты: узкий гротеск для заголовков, антиква для текста */
  --display: Bahnschrift, "PT Sans Narrow", "Avenir Next Condensed", "DIN Alternate",
    "Roboto Condensed", "Arial Narrow", "Liberation Sans Narrow",
    "DejaVu Sans Condensed", sans-serif-condensed, sans-serif;
  --text: "PT Serif", "Noto Serif", "DejaVu Serif", Georgia, Cambria, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bean: #13231a;
    --husk: #21382a;
    --leaf: #e4ead9;
    --leaf-soft: #a9b8a6;
    --cherry: #ee6f77;
    --bourbon: #e9b949;
    --line: rgba(228, 234, 217, .26);
  }
}

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

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

body {
  margin: 0;
  background: var(--bean);
  color: var(--leaf);
  font: 1.125rem/1.62 var(--text);
}

.wrap { max-width: 64rem; margin: 0 auto; padding: 0 1.25rem; }

a { color: var(--cherry); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }

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

/* Шапка */

.site-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .6rem 2rem;
  padding: 1.25rem 0 1rem;
  border-bottom: 2px solid var(--leaf);
}

.site-name {
  font: 700 1.4rem/1 var(--display);
  font-stretch: condensed;
  color: inherit;
  text-decoration: none;
}

.site-nav ul { display: flex; flex-wrap: wrap; gap: .2rem 1.35rem; list-style: none; margin: 0; padding: 0; }

.site-nav a {
  font: 700 1.05rem/1.5 var(--display);
  font-stretch: condensed;
  color: inherit;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { border-bottom-color: var(--cherry); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--leaf); }

/* Текст */

main { padding: 3.25rem 0 4rem; }

h1, h2 { font-family: var(--display); font-weight: 700; font-stretch: condensed; }

h1 {
  font-size: clamp(2.5rem, 7.2vw, 4.6rem);
  line-height: 1;
  letter-spacing: -.01em;
  margin: 0 0 1.25rem;
  max-width: 17ch;
  text-wrap: balance;
}

h2 { font-size: 1.8rem; line-height: 1.1; margin: 3.25rem 0 1rem; }

p, .steps, table { max-width: 40rem; }
p { margin: 0 0 1rem; }

.lead { font-size: 1.3rem; line-height: 1.5; max-width: 37rem; margin-bottom: 2.75rem; }

/* Главная: список рецептов */

.recipes { list-style: none; margin: 0; padding: 0; }
.recipes > li { border-top: 2px solid var(--leaf); padding: 1.2rem 0 1.9rem; }

.recipe-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .2rem 1.5rem;
  margin-bottom: .95rem;
}

.recipes h2 { margin: 0; font-size: 2.15rem; }
.recipes h2 a { color: inherit; text-decoration: none; }
.recipes h2 a:hover { color: var(--cherry); }
.recipes p { margin: .95rem 0 0; }

.dose {
  font: 700 1.15rem/1.2 var(--display);
  font-stretch: condensed;
  font-variant-numeric: tabular-nums;
  color: var(--leaf-soft);
}

/* Схема заваривания: ширина участка = его длительность */

.brew { margin: 2.75rem 0 0; }

.strip { display: flex; gap: 2px; height: 3.25rem; }
.strip.small { height: .9rem; }

.seg { flex: 1 1 0; min-width: 2px; }
.pour { background: var(--cherry); }
.bloom { background: var(--bourbon); }
.steep {
  background:
    repeating-linear-gradient(135deg, var(--line) 0 2px, transparent 2px 7px),
    var(--husk);
}
.drain { background: var(--husk); box-shadow: inset 0 0 0 1px var(--line); }
.press { background: var(--leaf); }

.ticks {
  position: relative;
  height: 1.9rem;
  font: 700 1rem/1 var(--display);
  font-stretch: condensed;
  font-variant-numeric: tabular-nums;
  color: var(--leaf-soft);
}
.ticks span { position: absolute; top: .55rem; white-space: nowrap; }
.ticks .end { right: 0; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1.4rem;
  list-style: none;
  margin: .6rem 0 0;
  padding: 0;
  font-size: .95rem;
  color: var(--leaf-soft);
}
.legend i { display: inline-block; width: 1.1rem; height: .7rem; margin-right: .45rem; }

@media (prefers-reduced-motion: no-preference) {
  .brew .strip { animation: fill 1.1s cubic-bezier(.3, .6, .2, 1) both; }
  @keyframes fill {
    from { clip-path: inset(0 100% 0 0); }
    to { clip-path: inset(0 0 0 0); }
  }
}

/* Параметры рецепта */

.params {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 0 1.5rem;
  margin: 0;
}
.params div { border-top: 1px solid var(--line); padding: .6rem 0 1rem; }
.params dt { font-size: .92rem; color: var(--leaf-soft); }
.params dd {
  margin: 0;
  font: 700 1.5rem/1.15 var(--display);
  font-stretch: condensed;
  font-variant-numeric: tabular-nums;
}

/* Шаги */

.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; }
.steps li { counter-increment: step; position: relative; padding: .1rem 0 .95rem 2.75rem; }
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -.05rem;
  font: 700 1.6rem/1.3 var(--display);
  font-stretch: condensed;
  font-variant-numeric: tabular-nums;
  color: var(--cherry);
}

/* Таблицы */

table { border-collapse: collapse; width: 100%; margin: 0 0 1.6rem; }
th, td { text-align: left; vertical-align: top; padding: .7rem 1.25rem .75rem 0; border-top: 1px solid var(--line); }
th:last-child, td:last-child { padding-right: 0; }
thead th {
  border-top: 0;
  font: 700 1.05rem/1.3 var(--display);
  font-stretch: condensed;
  color: var(--leaf-soft);
}
tbody th { font-weight: 400; }
tbody tr:last-child > * { border-bottom: 1px solid var(--line); }

.grind { max-width: 46rem; }
.grind tbody th { font: 700 1.25rem/1.25 var(--display); font-stretch: condensed; white-space: nowrap; }

/* Крупинки: диаметр точки растёт вместе с помолом */
.grain {
  display: block;
  width: calc((var(--d) + 3px) * var(--n));
  height: 12px;
  margin-top: .5rem;
  background:
    radial-gradient(circle closest-side, currentColor 96%, transparent)
    0 50% / calc(var(--d) + 3px) var(--d) repeat-x;
}

.next { margin-top: 3.25rem; padding-top: 1.1rem; border-top: 2px solid var(--leaf); max-width: none; }

/* Подвал */

.site-foot {
  border-top: 1px solid var(--line);
  padding: 1.4rem 0 3rem;
  font-size: .95rem;
  color: var(--leaf-soft);
}
.site-foot p { margin: 0; max-width: none; }

@media (max-width: 34rem) {
  body { font-size: 1.0625rem; }
  main { padding-top: 2.25rem; }
  .lead { font-size: 1.18rem; }
  .recipes h2 { font-size: 1.85rem; }
  .strip { height: 2.75rem; }
  .grind tbody th { white-space: normal; }
}
