/* =========================================================
   Site styles.
   Palette: the colours of the Tatarstan flag (green, white),
   muted for the subject. Decoration: the Tatar tulip ornament.

   Themes: every colour is a custom property. Light is the default;
   dark applies when the device prefers it (prefers-color-scheme) or
   when chosen with the header toggle (<html data-theme="dark">).
   ========================================================= */

/* ---------- Tokens: light theme ---------- */
:root {
  --bg: #ffffff;
  --bg-alt: #faf7f1;          /* tinted tiles: advantages, contacts, consult box */
  --surface: #ffffff;         /* cards */
  --text: #2a2a2a;
  --muted: #6b6b6b;
  --border: #e8e2d6;
  --link: #1d5c45;

  --brand: #1d5c45;           /* green: buttons, header */
  --brand-strong: #143f30;
  --on-brand: #ffffff;
  --on-brand-muted: #cfe0d8;
  --header-line: transparent;  /* hairline under the header; none in light theme */
  --sand: #b08a4e;            /* prices, ornament */

  --header-bg: #1d5c45;
  --footer-bg: #143f30;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .06);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, .06), 0 16px 32px rgba(0, 0, 0, .1);

  --radius: 10px;
  --font-head: 'PT Serif', Georgia, serif;
  --font-body: 'PT Sans', Arial, sans-serif;
  --container: 1200px;
  --gutter: 24px;
  --header-h: 76px;

  /* Tulip from the Tatar ornament as inline SVG. The colour is in fill (%23 = #) */
  --tulip: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 32'%3E%3Cpath d='M12 31V16' stroke='%23b08a4e' stroke-width='1.5'/%3E%3Cpath d='M12 16c-5 0-8-4-8-10 2 1 4 3 5 5 0-4 1-7 3-10 2 3 3 6 3 10 1-2 3-4 5-5 0 6-3 10-8 10z' fill='%23b08a4e'/%3E%3Cpath d='M12 27c-3-3-6-3-8-2 2 3 5 4 8 2zM12 27c3-3 6-3 8-2-2 3-5 4-8 2z' fill='%23b08a4e'/%3E%3C/svg%3E");

  color-scheme: light;
}

/* ---------- Tokens: dark theme ---------- */
/* Two identical sets: one for the device preference (unless a theme was picked by hand)
   and one for the manual choice. CSS cannot merge them into one rule without repeating. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1714;
    --bg-alt: #141e1a;
    --surface: #18241f;
    --text: #e8e4dc;
    --muted: #a0a8a2;
    --border: #26342e;
    --link: #7cc4a2;
    --brand: #2a7a5c;
    --brand-strong: #1f5f47;
    --header-line: var(--border);
    --header-bg: #13201b;
    --footer-bg: #0b110f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, .35), 0 16px 32px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1714;
  --bg-alt: #141e1a;
  --surface: #18241f;
  --text: #e8e4dc;
  --muted: #a0a8a2;
  --border: #26342e;
  --link: #7cc4a2;
  --brand: #2a7a5c;
  --brand-strong: #1f5f47;
  --header-line: var(--border);
  --header-bg: #13201b;
  --footer-bg: #0b110f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, .35), 0 16px 32px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
/* The footer sticks to the bottom even on a short page */
body {
  display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; margin: 0;
  font: 17px/1.6 var(--font-body); color: var(--text); background: var(--bg);
  transition: background-color .2s, color .2s;
}
main { flex: 1; }
a { color: var(--link); }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 700; line-height: 1.25; margin: 0 0 .6em; text-wrap: balance; }
h1 { font-size: clamp(28px, 2.2vw + 18px, 40px); }
p { margin: 0 0 1em; }
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
.icon { width: 1.1em; height: 1.1em; flex: none; vertical-align: -.15em; }
:focus-visible { outline: 2px solid var(--sand); outline-offset: 3px; }
/* Anchor targets are not hidden under the sticky header */
[id] { scroll-margin-top: calc(var(--header-h) + 16px); }

/* ---------- Buttons ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 26px; border: 2px solid var(--brand); border-radius: var(--radius);
  background: var(--brand); color: var(--on-brand); font: 700 16px/1.2 var(--font-body); text-decoration: none;
  transition: background-color .2s, border-color .2s, color .2s;
}
.button:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.button--ghost { background: transparent; color: var(--link); border-color: currentColor; }
.button--ghost:hover { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }

/* ---------- Header: sticky ---------- */
/* A 1px shadow instead of a border: keeps the header height and does not drift at fractional zoom */
.header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg); color: var(--on-brand); box-shadow: 0 1px 0 var(--header-line);
}
.header__inner { display: flex; align-items: center; gap: 28px; min-height: var(--header-h); }
/* The link is as tall as the header: an easy target for a finger */
.header__logo { display: flex; align-items: center; align-self: stretch; gap: 12px; color: inherit; text-decoration: none; min-width: 0; }
.header__logo img { height: 48px; width: 48px; flex: none; object-fit: contain; border-radius: 6px; }
.header__logo span { min-width: 0; }
/* A long company name takes a second line and is cut after it: it never runs over the menu */
.header__logo strong {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  font: 700 21px/1.15 var(--font-head); overflow-wrap: break-word;
}
.header__logo small {
  display: block; overflow: hidden; color: var(--on-brand-muted); font-size: 13px; line-height: 1.3;
  white-space: nowrap; text-overflow: ellipsis;
}

.menu { display: flex; gap: 22px; margin-left: auto; }
.menu a { position: relative; padding: 6px 0; color: inherit; text-decoration: none; font-weight: 700; white-space: nowrap; }
.menu a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: var(--sand); transform: scaleX(0); transition: transform .2s;
}
.menu a:hover::after { transform: scaleX(1); }
/* Dropdown with the goods categories */
.menu__group { position: relative; display: flex; }
.menu__sub {
  position: absolute; top: 100%; left: -16px; min-width: 220px; max-height: 70vh; overflow-y: auto; padding: 8px 0;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-hover); visibility: hidden; opacity: 0; transition: opacity .2s, visibility .2s;
}
.menu__group:hover .menu__sub, .menu__group:focus-within .menu__sub { visibility: visible; opacity: 1; }
.menu .menu__sub a { display: block; padding: 8px 16px; font-weight: 400; }
.menu .menu__sub a::after { display: none; }
.menu .menu__sub a:hover { background: var(--bg-alt); }
.menu__toggle { position: absolute; opacity: 0; pointer-events: none; }
.menu__burger { display: none; }

.header__contacts { display: flex; flex-direction: column; align-items: flex-end; font-size: 13px; color: var(--on-brand-muted); }
.header__phone { color: inherit; color: var(--on-brand); font: 700 20px/1.2 var(--font-body); text-decoration: none; white-space: nowrap; }
/* Working hours: one line as wide as the phone number above it, cut when longer */
.header__contacts span { width: 0; min-width: 100%; overflow: hidden; white-space: nowrap; text-align: right; text-overflow: ellipsis; }

/* Messenger buttons, the size of the theme toggle, each in its service's colour */
.messengers { display: flex; gap: 8px; }
.messenger {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 50%; color: #fff; background: var(--sand);
  transition: box-shadow .2s, opacity .2s;
}
.messenger:hover { box-shadow: 0 0 0 3px rgba(255, 255, 255, .25); }
.messenger .icon { width: 22px; height: 22px; }
/* Brand colours: Simple Icons; MAX: its logo's gradient */
.messenger--max { background: linear-gradient(45deg, #4cf, #53e 66%, #93d); }
.messenger--telegram { background: #26a5e4; }
.messenger--vk { background: #0077ff; }
.messenger--ok { background: #ee8208; }
/* An uploaded icon keeps its own shape: no circle, nothing cropped, as tall as the other
   buttons; a wide logo may take up to three times their width */
.messenger--custom { display: block; width: auto; border-radius: 0; background: none; }
.messenger--custom:hover { box-shadow: none; opacity: .85; }
.messenger__img { width: auto; max-width: 120px; height: 40px; object-fit: contain; }
.menu__messengers { display: none; }

/* Theme toggle: the moon is shown in light theme, the sun in dark */
.theme-toggle {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none; padding: 0;
  border: 1px solid rgba(255, 255, 255, .25); border-radius: 50%;
  background: transparent; color: var(--on-brand); cursor: pointer; font-size: 18px;
  transition: background-color .2s;
}
.theme-toggle:hover { background: rgba(255, 255, 255, .1); }
.icon--sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon--sun { display: block; }
  :root:not([data-theme="light"]) .icon--moon { display: none; }
}
:root[data-theme="dark"] .icon--sun { display: block; }
:root[data-theme="dark"] .icon--moon { display: none; }

/* ---------- Sections ---------- */
/* All sections share the page background; spacing and ornamented headings separate them */
.section { padding: clamp(40px, 5vw, 72px) 0; }

/* Centered section heading with a tulip between two lines underneath */
.section__title { text-align: center; font-size: clamp(26px, 1.5vw + 18px, 34px); margin-bottom: 40px; }
.section__title::after {
  content: ""; display: block; height: 32px; margin: 14px auto 0; max-width: 220px;
  background: var(--tulip) center / 24px 32px no-repeat,
              linear-gradient(var(--sand), var(--sand)) left center / 40% 1px no-repeat,
              linear-gradient(var(--sand), var(--sand)) right center / 40% 1px no-repeat;
}

/* Card grid: as many columns as fit; a short row is centered */
.grid {
  display: grid; gap: 24px; justify-content: center;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 340px));
}

/* ---------- Hero ---------- */
.hero__inner {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center;
  padding-top: clamp(48px, 7vw, 104px); padding-bottom: clamp(48px, 7vw, 104px);
}
.hero__title { font-size: clamp(32px, 3.2vw + 16px, 56px); color: var(--link); }
.hero__text { font-size: clamp(17px, .4vw + 15px, 21px); color: var(--muted); max-width: 36em; }
.hero__buttons { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.hero__img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); }
/* Emblem shown instead of a picture: a circle with a large tulip and two rings */
.hero__emblem {
  justify-self: center; width: min(100%, 360px); aspect-ratio: 1; border-radius: 50%;
  background: var(--tulip) center / 38% auto no-repeat, var(--surface);
  border: 1px solid var(--sand); box-shadow: 0 0 0 14px var(--bg), 0 0 0 15px var(--sand);
}

/* ---------- Service cards ---------- */
.card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); text-decoration: none; box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
/* Pictures are always 4:3 and cropped, so cards stay the same height */
.card__img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.card__img--empty { background: var(--tulip) center / 48px 64px no-repeat, var(--bg-alt); }
.card__body { display: flex; flex-direction: column; flex: 1; padding: 20px 22px 22px; }
.card__body p { color: var(--muted); font-size: 15px; }
.card__title { font-size: 20px; margin-bottom: 8px; }

.price { margin-top: auto; color: var(--sand); font-weight: 700; font-size: 18px; }
.price--lg { font-size: 24px; margin: 0 0 12px; }
.price--xl { font-size: clamp(26px, 1vw + 20px, 32px); margin: 0 0 16px; }

/* ---------- Tabs (CSS only) ---------- */
.tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.tabs__radio { position: absolute; opacity: 0; pointer-events: none; }
.tabs__label {
  min-width: 150px; padding: 10px 28px; border: 2px solid var(--brand); border-radius: 999px;
  color: var(--link); font-weight: 700; text-align: center; cursor: pointer; transition: background-color .2s, color .2s;
}
.tabs__radio:checked + .tabs__label { background: var(--brand); color: var(--on-brand); }
.tabs__radio:focus-visible + .tabs__label { outline: 2px solid var(--sand); outline-offset: 3px; }
.tabs__panel {
  display: none; width: 100%; margin-top: 28px; gap: 24px; justify-content: center;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 340px));
}
/* The first radio shows the first panel, the second one the second */
#tab-burial:checked ~ .tabs__panel:nth-of-type(1),
#tab-cremation:checked ~ .tabs__panel:nth-of-type(2) { display: grid; }

.package {
  display: flex; flex-direction: column; padding: 28px 24px;
  background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--brand);
  border-radius: var(--radius); color: var(--text); text-decoration: none; box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.package:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.package__title { font-size: 21px; }
.package p { color: var(--muted); font-size: 15px; }
.package__more { margin-top: auto; color: var(--link); font-weight: 700; }

/* ---------- Advantages: a small tulip as the bullet ---------- */
.advantages {
  display: grid; gap: 16px 32px; margin: 0 auto; padding: 0; list-style: none; max-width: 1000px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}
.advantages li {
  padding: 18px 20px 18px 56px; border-radius: var(--radius); background: var(--bg-alt);
  background-image: var(--tulip); background-repeat: no-repeat; background-position: 20px center; background-size: 18px 24px;
}

/* ---------- How we work: steps on a line, numbered with a CSS counter ---------- */
.steps {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 24px;
  margin: 0; padding: 0; list-style: none; counter-reset: step; position: relative;
}
/* Connector to the next step: every step but the last draws a segment to the right,
   from the edge of its circle to the edge of the next one (column width + gap − diameter) */
.steps li:not(:last-child)::after {
  content: ""; position: absolute; top: 23px; left: calc(50% + 32px); width: calc(100% + 24px - 64px);
  height: 1px; background: var(--sand); opacity: .6;
}
.steps li { position: relative; counter-increment: step; text-align: center; }
.steps li::before {
  content: counter(step); display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; margin: 0 auto 14px; border: 2px solid var(--sand); border-radius: 50%;
  background: var(--bg); color: var(--sand); font: 700 20px var(--font-head); position: relative;
}

/* ---------- Consultation ---------- */
.consult {
  display: flex; align-items: center; justify-content: space-between; gap: 20px 32px; flex-wrap: wrap;
  padding: clamp(24px, 3vw, 40px); background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius);
}
.consult__title { font-size: clamp(24px, 1vw + 18px, 30px); margin-bottom: 4px; }
.consult p { margin: 0; color: var(--muted); }

/* ---------- Contacts: tiles plus a full-width map ---------- */
.contacts { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.contact {
  display: flex; flex-direction: column; gap: 4px; padding: 22px 24px;
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); text-decoration: none; transition: border-color .2s;
}
a.contact:hover { border-color: var(--sand); }
.contact__label { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.contact__value { font-size: 19px; font-weight: 700; }
.map { margin-top: 24px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.map iframe { display: block; width: 100%; height: clamp(300px, 40vw, 460px); border: 0; }

/* ---------- Service page ---------- */
.breadcrumbs { font-size: 14px; color: var(--muted); margin-bottom: 28px; }
.breadcrumbs a { color: var(--muted); }
.service-page { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 4vw, 56px); align-items: start; }
.service-page__img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); }
.lead { font-size: 19px; }

/* Gallery: thumbnails under the main picture */
.gallery { min-width: 0; }
.gallery__thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; margin-top: 12px; }
.gallery__thumb { border-radius: 6px; overflow: hidden; border: 2px solid transparent; }
.gallery__thumb.is-active { border-color: var(--sand); }
.gallery__thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }

/* ---------- 404 ---------- */
.empty-page { text-align: center; max-width: 560px; }
.ornament { height: 64px; margin-bottom: 16px; background: var(--tulip) center / 48px 64px no-repeat; }

/* ---------- Footer ---------- */
.footer { background: var(--footer-bg); color: var(--on-brand-muted); padding: 48px 0 24px; font-size: 15px; }
.footer a { color: #fff; }
.footer__inner { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.footer__name { font: 700 22px var(--font-head); color: #fff; margin-bottom: 6px; }
.footer__links, .footer__contacts { display: flex; flex-direction: column; gap: 8px; }
.footer__links a { text-decoration: none; }
.footer__links a:hover { text-decoration: underline; }
.footer__phone { font-size: 22px; font-weight: 700; text-decoration: none; }
.footer__copy { margin-top: 32px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .12); font-size: 13px; }

/* Call button pinned to the bottom of the screen, phones only (see the responsive rules) */
.call-bar { display: none; }

/* =========================================================
   Responsive
   ========================================================= */

/* Large monitors: a wider container and slightly larger text */
@media (min-width: 1600px) {
  :root { --container: 1400px; }
  body { font-size: 18px; }
}

/* A header with messenger buttons is crowded until the container widens at 1600px: tighter gaps.
   "not (min-width)" is the exact opposite of the rule above, with no gap at fractional widths */
@media not all and (min-width: 1600px) {
  .header__inner:has(.header__messengers) { gap: 20px; }
  .header__inner:has(.header__messengers) .menu { gap: 16px; }
}

/* Narrow laptops: no room for the working hours line next to messenger buttons */
@media (max-width: 1280px) {
  .header__inner:has(.header__messengers) .header__contacts span { display: none; }
}

/* Narrow laptops, tablets and phones: the menu collapses into a burger */
@media (max-width: 1200px) {
  .header__contacts span { display: none; }
  .header__inner { gap: 16px; }
  .header__contacts { margin-left: auto; }

  .menu__burger {
    display: grid; place-items: center; width: 40px; height: 40px; flex: none; cursor: pointer;
    border: 1px solid rgba(255, 255, 255, .25); border-radius: 50%;
  }
  /* Three bars from one span and its ::before/::after; they turn into a cross when open */
  .menu__burger span, .menu__burger span::before, .menu__burger span::after {
    content: ""; display: block; width: 18px; height: 2px; background: currentColor; border-radius: 1px;
    position: relative; transition: transform .2s, background-color .2s;
  }
  .menu__burger span::before { position: absolute; top: -6px; }
  .menu__burger span::after { position: absolute; top: 6px; }
  .menu__toggle:checked ~ .menu__burger span { background: transparent; }
  .menu__toggle:checked ~ .menu__burger span::before { transform: translateY(6px) rotate(45deg); }
  .menu__toggle:checked ~ .menu__burger span::after { transform: translateY(-6px) rotate(-45deg); }
  .menu__toggle:focus-visible ~ .menu__burger { outline: 2px solid var(--sand); outline-offset: 3px; }

  /* The menu drops down as a panel under the header */
  .menu {
    position: absolute; top: 100%; left: 0; right: 0; margin: 0;
    flex-direction: column; gap: 0; padding: 8px var(--gutter) 16px;
    background: var(--header-bg); box-shadow: 0 16px 24px rgba(0, 0, 0, .2);
    visibility: hidden; opacity: 0; transform: translateY(-8px); transition: opacity .2s, transform .2s, visibility .2s;
  }
  .menu a { padding: 14px 0; border-bottom: 1px solid rgba(255, 255, 255, .1); font-size: 18px; }
  .menu a:last-child { border-bottom: 0; }
  .menu a::after { display: none; }
  /* Long with the categories: the panel scrolls inside the visible height */
  .menu { max-height: calc(100vh - var(--header-h)); max-height: calc(100dvh - var(--header-h)); overflow-y: auto; }
  /* Categories are listed under "Товары" in the same panel */
  .menu__group { display: block; }
  .menu__group > a { display: block; }
  .menu__sub {
    position: static; min-width: 0; max-height: none; overflow: visible; padding: 4px 0 8px 16px;
    background: none; color: inherit; border: 0; border-bottom: 1px solid rgba(255, 255, 255, .1); border-radius: 0;
    box-shadow: none; visibility: inherit; opacity: 1; transition: none;
  }
  .menu .menu__sub a { padding: 10px 0; border-bottom: 0; font-size: 16px; }
  .menu .menu__sub a:hover { background: none; }
  .menu__toggle:checked ~ .menu { visibility: visible; opacity: 1; transform: none; }
  .header__messengers { display: none; }
  .menu__messengers { display: flex; flex-wrap: wrap; padding: 14px 0 4px; }
}

/* Tablets and below */
@media (max-width: 1024px) {
  :root { --header-h: 68px; }

  .hero__inner { gap: 32px; }
  .service-page { grid-template-columns: 1fr; }
  .service-page__img { max-width: 720px; }

  /* Steps in two columns, without the connecting line */
  .steps { grid-auto-flow: row; grid-template-columns: repeat(2, 1fr); gap: 28px 24px; }
  .steps li:not(:last-child)::after { display: none; }
  .steps li { text-align: left; display: flex; align-items: center; gap: 16px; }
  .steps li::before { margin: 0; flex: none; }

  .footer__inner { grid-template-columns: 1fr 1fr; }
  .footer__inner > :first-child { grid-column: 1 / -1; }
}

/* Portrait tablets: the hero in a single column */
@media (max-width: 860px) {
  .hero__inner { grid-template-columns: 1fr; }
  .hero__emblem { display: none; }
  .hero__img { max-height: 360px; }
}

/* Phones */
@media (max-width: 600px) {
  :root { --gutter: 16px; --header-h: 60px; }
  body { font-size: 16px; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }

  .header__inner { gap: 10px; }
  /* The call bar covers the bottom of the screen */
  .menu { max-height: calc(100vh - var(--header-h) - 56px); max-height: calc(100dvh - var(--header-h) - 56px - env(safe-area-inset-bottom)); }
  .header__logo img { width: 40px; height: 40px; }
  .header__logo strong { font-size: 18px; }
  .header__logo small { display: none; }
  /* No phone number in the header: the call bar at the bottom has it */
  .header__contacts { display: none; }
  .theme-toggle { margin-left: auto; }

  .hero__buttons .button { flex: 1 1 100%; }
  .section__title { margin-bottom: 28px; }
  .tabs__label { flex: 1; min-width: 0; padding: 10px 12px; }

  /* Steps with a vertical line on the left */
  .steps { grid-template-columns: 1fr; gap: 0; }
  .steps li { padding-bottom: 20px; }
  .steps li:not(:last-child)::after {
    display: block; left: 23px; top: 48px; bottom: 0; width: 1px; height: auto;
  }

  .consult { text-align: center; justify-content: center; }
  .consult .button { width: 100%; }

  .footer__inner { grid-template-columns: 1fr; }

  .call-bar {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    min-height: 56px; padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
    background: var(--brand); color: var(--on-brand); font-weight: 700; font-size: 17px; text-decoration: none;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, .15);
  }
}

/* The user asked the system for fewer animations */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
