/* ==========================================================================
   base.css — reset + typography + layout primitives for the Whalik help site.
   No frameworks. Mobile-first. See site/docs/SITE_ARCHITECTURE.md §5.
   ========================================================================== */

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

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, "Noto Sans", sans-serif,
               "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* Prevent accidental horizontal scroll on narrow phones when a long
   * unbreakable token (URL, long foreign word) slips through the more
   * specific overflow-wrap rules below. Contained width + wrap =
   * horizontal scrollbar should never appear. */
  overflow-x: hidden;
}

/* Long words, URLs and other unbreakable tokens must wrap on narrow
 * screens instead of forcing a horizontal scrollbar on the whole page.
 * `anywhere` is the most aggressive option — it allows a break at any
 * character boundary when there is no other place to wrap, which is
 * exactly what we want for code snippets and pathological long words. */
body, p, li, h1, h2, h3, h4, a, code, figcaption, strong, em {
  overflow-wrap: anywhere;
  word-break: normal;
}

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

/* ---- Links -------------------------------------------------------------- */

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color .15s ease, color .15s ease;
}
a:hover, a:focus { border-bottom-color: var(--accent); }

/* ---- Headings ----------------------------------------------------------- */

h1, h2, h3, h4 {
  margin: 1.5em 0 .5em;
  line-height: 1.25;
  font-weight: 700;
  color: var(--text-strong);
}
h1 { font-size: 2.15rem; margin-top: 0; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }

p { margin: 0 0 1em; }

ul, ol { padding-left: 1.4em; margin: 0 0 1em; }
li { margin-bottom: .25em; }

code, kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .92em;
  background: var(--code-bg);
  padding: .1em .35em;
  border-radius: 4px;
}

hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }

/* ---- Layout ------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

main { flex: 1 0 auto; padding: 32px 0 64px; }

/* ---- Header ------------------------------------------------------------- */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: 16px 24px;        /* row-gap smaller than column-gap — tighter 2-row header on mobile */
  flex-wrap: wrap;
}
.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-strong);
  font-weight: 700;
  font-size: 1.15rem;
  border-bottom: none;
  flex-shrink: 0;
}
.site-logo:hover { border-bottom: none; color: var(--accent); }
/* Логотип в шапке — круглый. Первичное скругление уже сделано в самом
 * SVG через <clipPath><circle/></clipPath> (см. whalik-mark-circle.svg
 * и site/scripts/generate_circle_logo.py), но CSS-radius оставлен
 * страховкой: если favicon когда-нибудь подменят на PNG или
 * некруглый SVG, рамка в шапке всё равно останется круглой. */
.site-logo img { width: 32px; height: 32px; border-radius: 50%; }

.site-nav {
  display: flex;
  gap: 20px;
  align-items: center;
  flex: 1 1 auto;
  flex-wrap: wrap;
  min-width: 0;
}
/* Plain nav links (не-кнопки). Исключаем .btn, чтобы не перебивать
 * цвет текста на кнопке «Установить» — иначе специфичность .site-nav a
 * (0,1,1) побеждает .btn-primary (0,1,0) и белый текст кнопки становится
 * тёмным, что делает его нечитаемым на синем фоне.
 */
.site-nav a:not(.btn) {
  color: var(--text);
  font-weight: 500;
  padding: 4px 0;
}
.site-nav a.active:not(.btn) { color: var(--accent); border-bottom-color: var(--accent); }

.site-nav .cta { margin-left: auto; flex-shrink: 0; }

/* Переключатель темы (Auto / Light / Dark). Перекрывает
 * prefers-color-scheme, чтобы пользователь мог выбрать светлую тему
 * сайта даже при системной тёмной (см. theme.css и
 * RESPONSIVE_DESIGN.md §3.2a). */
.theme-toggle {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 12px;
  font: inherit;
  font-size: .85rem;
  line-height: 1.4;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.theme-toggle:hover,
.theme-toggle:focus-visible {
  background: var(--surface-raised);
  border-color: var(--border-strong);
  outline: none;
}
.theme-toggle[data-mode="light"] { color: var(--accent); }
.theme-toggle[data-mode="dark"]  { color: var(--accent); }

.locale-switcher {
  color: var(--text-muted);
  font-size: .9rem;
  flex-shrink: 0;
  position: relative;
}

/* Static (no-JS) label inside .locale-switcher — preserves the visual
 * weight of the previous static span so layout doesn't shift before
 * theme-toggle.js upgrades it into a dropdown. */
.locale-switcher-label {
  display: inline-block;
  padding: 2px 6px;
}

/* No-JS fallback: a plain link list to every sibling locale, only
 * rendered when JavaScript is disabled. Crawlers see these links and
 * can follow them; sighted users with JS see the dropdown instead. */
.locale-switcher-fallback {
  position: absolute;
  top: 100%;
  right: 0;
  margin: 4px 0 0 0;
  padding: 4px 0;
  list-style: none;
  background: var(--surface, #fff);
  border: 1px solid var(--border, rgba(0,0,0,.12));
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  min-width: 160px;
  z-index: 20;
}
.locale-switcher-fallback li { margin: 0; padding: 0; }
.locale-switcher-fallback li > a {
  display: block;
  padding: 6px 12px;
  color: var(--text);
  text-decoration: none;
}
.locale-switcher-fallback li > a:hover,
.locale-switcher-fallback li > a:focus-visible {
  background: var(--surface-subtle, rgba(0,0,0,.05));
  outline: none;
}

/* Locale switcher upgraded into a real dropdown by theme-toggle.js.
 * The script replaces the contents of <div class="locale-switcher"> with
 * a <details class="locale-switcher-dropdown"> element. Before the
 * script runs (or when JS is disabled) the static label is still visible
 * and a <noscript> fallback list provides working anchor links to every
 * sibling locale — so there is no layout collapse and no dead end. */
.locale-switcher-dropdown {
  display: inline-block;
}
.locale-switcher-dropdown > summary.locale-switcher-current {
  cursor: pointer;
  list-style: none;
  padding: 2px 6px;
  border-radius: 6px;
  color: var(--text);
  user-select: none;
}
.locale-switcher-dropdown > summary.locale-switcher-current::-webkit-details-marker {
  display: none;
}
.locale-switcher-dropdown > summary.locale-switcher-current:hover,
.locale-switcher-dropdown > summary.locale-switcher-current:focus-visible {
  background: var(--surface-subtle, rgba(0,0,0,.05));
  outline: none;
}
.locale-switcher-dropdown[open] > summary.locale-switcher-current {
  background: var(--surface-subtle, rgba(0,0,0,.05));
}
.locale-switcher-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin: 4px 0 0 0;
  padding: 4px 0;
  list-style: none;
  background: var(--surface, #fff);
  border: 1px solid var(--border, rgba(0,0,0,.12));
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  min-width: 160px;
  z-index: 20;
}
.locale-switcher-menu li {
  margin: 0;
  padding: 0;
}
.locale-switcher-menu li > a,
.locale-switcher-menu li > span {
  display: block;
  padding: 6px 12px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.locale-switcher-menu li > a:hover,
.locale-switcher-menu li > a:focus-visible {
  background: var(--surface-subtle, rgba(0,0,0,.05));
  outline: none;
}
.locale-switcher-menu li.is-current > span {
  color: var(--text-muted);
  cursor: default;
}

/* ---- Footer ------------------------------------------------------------- */

.site-footer {
  background: var(--surface-subtle);
  border-top: 1px solid var(--border);
  padding: 24px 0;
  color: var(--text-muted);
  font-size: .92rem;
  margin-top: 48px;
}
.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}
.site-footer a { color: var(--text); }

/* ---- Call-to-action ----------------------------------------------------- */

.cta-band {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 24px;
  margin: 48px 0 0;
  text-align: center;
}
.cta-band h2 { margin-top: 0; }
.cta-band p { max-width: 60ch; margin: 0 auto 1.25em; color: var(--text); }

.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.4;
  text-align: center;
  border: 2px solid transparent;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-on);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--accent-strong);
  color: var(--accent-on);
  border-bottom: none;
}
.btn-ghost {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}
.btn-ghost:hover, .btn-ghost:focus {
  background: var(--accent-soft);
  border-bottom: none;
}
.btn-lg { font-size: 1.1rem; padding: 14px 32px; }

/* ---- Cards / sections --------------------------------------------------- */

.feature-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  margin: 32px 0;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.feature-card h3 { margin-top: 0; }
.feature-card p { color: var(--text-muted); margin-bottom: .5em; }

.hero {
  text-align: center;
  padding: 48px 0 32px;
}
.hero h1 { font-size: 2.6rem; line-height: 1.15; }
.hero p.lead {
  font-size: 1.2rem;
  max-width: 56ch;
  margin: 1em auto 1.5em;
  color: var(--text-muted);
}
/* Margin on all four sides (not only horizontal) so that when the two
 * hero buttons wrap onto separate lines on a narrow phone, they still
 * have visible vertical space between them. A horizontal-only margin
 * collapses to zero on wrap and the buttons end up glued together. */
.hero .btn { margin: 6px; }

/* ---- Step lists --------------------------------------------------------- */

ol.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 24px 0;
}
ol.steps > li {
  counter-increment: step;
  padding: 20px 20px 20px 64px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  position: relative;
}
ol.steps > li::before {
  content: counter(step);
  position: absolute;
  top: 20px;
  left: 20px;
  width: 30px;
  height: 30px;
  background: var(--accent);
  color: var(--accent-on);
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
ol.steps figure { margin: 12px 0 0; }
ol.steps figcaption {
  font-size: .88rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ---- Callouts ----------------------------------------------------------- */

.callout {
  padding: 14px 18px;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
  margin: 20px 0;
}
.callout.callout-warning {
  border-left-color: var(--warning);
  background: var(--warning-soft);
}
.callout.callout-tip {
  border-left-color: var(--success);
  background: var(--success-soft);
}
.callout strong { display: block; margin-bottom: 4px; }

/* ---- FAQ page helpers --------------------------------------------------- */

.faq-section {
  padding-top: 20px;
  border-top: 1px solid var(--border);
  margin-top: 32px;
}
.faq-section:first-of-type { border-top: none; margin-top: 0; padding-top: 0; }
.faq-section h2 {
  scroll-margin-top: 80px;  /* sticky header compensation */
}
.faq-section .anchor-ref {
  font-size: .85rem;
  color: var(--text-muted);
  margin-left: 8px;
  font-weight: 400;
}

.toc {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 28px;
  margin: 24px 0 32px;
}
.toc h2 { margin-top: 0; font-size: 1.2rem; }
.toc ol { margin-bottom: 0; padding-left: 22px; }
.toc a { color: var(--text); }

/* ---- Figures with screenshots ------------------------------------------- */

figure.screenshot {
  margin: 20px auto;
  text-align: center;
  max-width: 420px;
}
figure.screenshot img {
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
}
figure.screenshot figcaption {
  font-size: .88rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ---- Inline UI-icon ----------------------------------------------------- */

/*
 * .ui-icon — inline glyph that points at a real button or control in
 * the app. Sized relative to the surrounding text so it reads like a
 * letter rather than a decoration.
 *
 * Uses CSS mask so the SVG shape is recolored via currentColor
 * (important for dark-theme auto-switching). An external SVG loaded
 * through <img> would ignore the surrounding text colour even when its
 * fill is "currentColor" — masking avoids that.
 *
 * The specific icon is selected by a modifier class `.ui-icon-<name>`
 * which defines the mask-image URL. All icons live under
 * /assets/icons/ui/<name>.svg; the path is absolute so the CSS works
 * regardless of the page's nesting level.
 */
.ui-icon {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.22em;
  margin: 0 .12em;
  background-color: currentColor;
  color: var(--accent);
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: center;
          mask-position: center;
  -webkit-mask-size: contain;
          mask-size: contain;
}
.ui-icon-auto-awesome { -webkit-mask-image: url("/assets/icons/ui/auto_awesome.svg");   mask-image: url("/assets/icons/ui/auto_awesome.svg"); }
.ui-icon-add          { -webkit-mask-image: url("/assets/icons/ui/add.svg");            mask-image: url("/assets/icons/ui/add.svg"); }
.ui-icon-settings     { -webkit-mask-image: url("/assets/icons/ui/settings.svg");       mask-image: url("/assets/icons/ui/settings.svg"); }
.ui-icon-paste        { -webkit-mask-image: url("/assets/icons/ui/content_paste.svg");  mask-image: url("/assets/icons/ui/content_paste.svg"); }
.ui-icon-copy         { -webkit-mask-image: url("/assets/icons/ui/content_copy.svg");   mask-image: url("/assets/icons/ui/content_copy.svg"); }
.ui-icon-cut          { -webkit-mask-image: url("/assets/icons/ui/content_cut.svg");    mask-image: url("/assets/icons/ui/content_cut.svg"); }
.ui-icon-delete       { -webkit-mask-image: url("/assets/icons/ui/delete.svg");         mask-image: url("/assets/icons/ui/delete.svg"); }
.ui-icon-move         { -webkit-mask-image: url("/assets/icons/ui/drive_file_move.svg");mask-image: url("/assets/icons/ui/drive_file_move.svg"); }
.ui-icon-school       { -webkit-mask-image: url("/assets/icons/ui/school.svg");         mask-image: url("/assets/icons/ui/school.svg"); }
.ui-icon-play         { -webkit-mask-image: url("/assets/icons/ui/play_arrow.svg");     mask-image: url("/assets/icons/ui/play_arrow.svg"); }
.ui-icon-folder       { -webkit-mask-image: url("/assets/icons/ui/folder.svg");         mask-image: url("/assets/icons/ui/folder.svg"); }
.ui-icon-import-export{ -webkit-mask-image: url("/assets/icons/ui/import_export.svg");  mask-image: url("/assets/icons/ui/import_export.svg"); }
.ui-icon-more         { -webkit-mask-image: url("/assets/icons/ui/more_vert.svg");      mask-image: url("/assets/icons/ui/more_vert.svg"); }
.ui-icon-edit         { -webkit-mask-image: url("/assets/icons/ui/edit.svg");           mask-image: url("/assets/icons/ui/edit.svg"); }
.ui-icon-flip         { -webkit-mask-image: url("/assets/icons/ui/autorenew.svg");      mask-image: url("/assets/icons/ui/autorenew.svg"); }
.ui-icon-prev         { -webkit-mask-image: url("/assets/icons/ui/chevron_left.svg");   mask-image: url("/assets/icons/ui/chevron_left.svg"); }
.ui-icon-next         { -webkit-mask-image: url("/assets/icons/ui/chevron_right.svg");  mask-image: url("/assets/icons/ui/chevron_right.svg"); }
.ui-icon-volume       { -webkit-mask-image: url("/assets/icons/ui/volume_up.svg");      mask-image: url("/assets/icons/ui/volume_up.svg"); }
.ui-icon-back         { -webkit-mask-image: url("/assets/icons/ui/arrow_back.svg");     mask-image: url("/assets/icons/ui/arrow_back.svg"); }

/* ---- Pager (previous / next page) -------------------------------------- */

/*
 * Rendered at the bottom of each guide and FAQ page, just above the site
 * footer, so readers can move sequentially through the docs without
 * bouncing back to the table of contents. Left slot = prev, right slot =
 * next. Either slot may be empty (first/last page in the sequence).
 */
.pager-nav {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 16px;
  margin: 48px 0 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.pager-nav a {
  flex: 1 1 0;
  min-width: 0;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  background: var(--surface-subtle);
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.pager-nav a:hover,
.pager-nav a:focus-visible {
  background: var(--surface-raised);
  border-color: var(--border-strong);
  color: var(--text-strong);
}
.pager-nav a.pager-prev { text-align: left; }
.pager-nav a.pager-next { text-align: right; }
.pager-nav .pager-label {
  display: block;
  font-size: .82rem;
  letter-spacing: .02em;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.pager-nav .pager-title {
  display: block;
  font-weight: 600;
  font-size: 1.02rem;
  line-height: 1.35;
}
.pager-nav .pager-spacer { flex: 1 1 0; }

/* ---- Mobile tweaks ------------------------------------------------------ */

@media (max-width: 640px) {
  /* Tighter horizontal padding: 320px - 2*16 = 288px of usable content,
   * vs. 280px with the desktop 20px padding. A visual 4px is nothing on
   * a laptop but noticeable on an iPhone SE. */
  .container { padding: 0 16px; }

  h1 { font-size: 1.8rem; }
  .hero { padding: 32px 0 24px; }
  .hero h1 { font-size: 2rem; }
  .hero p.lead { font-size: 1.05rem; }

  /* Header on mobile: строго ДВЕ строки на телефонах 320-640px.
   *
   * DOM-порядок: [.site-logo] [.site-nav] [.locale-switcher]. На
   * десктопе это даёт «logo ← nav → RU» в одну строку. На мобильных
   * трёх прямых детей `.site-header .container` не хватает места,
   * и каждый переносится на свою строку — получается три-четыре
   * визуальных ряда (логотип, ссылки внутри .site-nav, Установить,
   * RU). Чтобы остановиться на двух:
   *
   *   Строка 1: [логотип Whalik] ← свободное место → [Авто] [RU]
   *   Строка 2: [Главная] [Руководство] [Вопросы] [Установить]
   *
   * В строке 1 — «метаданные» сайта (бренд + переключатели темы и
   * локали). В строке 2 — сама навигация по контенту, заканчивается
   * CTA-кнопкой. На 320-430px обе строки помещаются, независимо
   * от длины «Установить».
   *
   * Почему через CSS-order, а не изменение DOM: .locale-switcher
   * и .theme-toggle семантически не часть основной навигации, а
   * вспомогательные контролы. Порядок в DOM сохраняем для
   * скринридеров/SEO; визуальный порядок меняем стилями.
   */
  .site-header .container { gap: 10px 16px; }
  /* Визуальный порядок на мобильных:
   *   Строка 1: [логотип] … [Авто] [RU]          (order 1, 2, 3)
   *   Строка 2: [Главная] [Руководство] [Вопросы] [Установить]   (order 4)
   *
   * Порядок order реализует перестановку прямо во flex-контейнере.
   * `.site-nav` ставится последним (order: 4) и забирает
   * `flex-basis: 100%` — это гарантирует перенос на новую строку.
   * Первые три элемента (logo, theme-toggle, locale) остаются на
   * одной строке, theme-toggle с margin-left:auto прижимает себя
   * и locale к правому краю. */
  .site-header .container > .site-logo       { order: 1; }
  .site-header .container > .theme-toggle    { order: 2; margin-left: auto; }
  .site-header .container > .locale-switcher { order: 3; }
  .site-header .container > .site-nav        { order: 4; flex-basis: 100%; }

  .site-nav { gap: 8px 10px; font-size: .92rem; justify-content: flex-start; }
  .site-nav a:not(.btn) { padding: 2px 0; }
  .site-nav .cta {
    font-size: .85rem;
    padding: 5px 10px;
    /* Убираем margin-left:auto на мобильных — он провоцировал
     * перенос «Установить» на отдельную (третью) подстроку. В
     * естественном потоке кнопка встаёт сразу после «Вопросы» и
     * помещается в ряд. */
    margin-left: 0;
  }
  .theme-toggle { padding: 3px 10px; font-size: .8rem; }

  /* CTA band and callouts get tighter padding so the call-to-action
   * button doesn't push the pill edge past the container on 320px. */
  .cta-band { padding: 24px 16px; }
  .callout { padding: 12px 14px; }

  /* Step numbers closer to the left edge — otherwise the numeric chip
   * eats ~20% of a narrow screen's width. */
  ol.steps > li { padding: 18px 16px 18px 52px; }
  ol.steps > li::before { left: 12px; top: 18px; }

  /* Screenshots shouldn't take over the whole viewport on phones —
   * cap their rendered height so the surrounding prose stays visible. */
  figure.screenshot { max-width: 100%; }
  figure.screenshot img { max-height: 80vh; width: auto; margin: 0 auto; }

  /* Pager nav: already vertical stack; left-align both slots for a
   * consistent look (the previous rule only flipped the next button). */
  .pager-nav { flex-direction: column; gap: 12px; }
  .pager-nav a.pager-prev,
  .pager-nav a.pager-next { text-align: left; }

  /* Table-of-contents block — slightly smaller padding on mobile so the
   * numbered list doesn't get pushed by the wrapper more than necessary. */
  .toc { padding: 16px 18px; }

  /* Footer: stack the two spans vertically instead of side-by-side,
   * otherwise long email addresses can force an awkward wrap. */
  .site-footer .container { justify-content: flex-start; }
}

/* ---- Very narrow phones (iPhone SE 1st gen, budget Android) ------------- */

/*
 * Second breakpoint for the narrow-narrow case where even 16px padding
 * plus 3 nav links + CTA starts pushing the logo to a third row. We
 * only nudge the typography and drop column-gap slightly — nothing
 * structural changes. The single 640px breakpoint is still the primary
 * one; this is a pure polish tier.
 */
@media (max-width: 380px) {
  h1 { font-size: 1.6rem; }
  .hero h1 { font-size: 1.75rem; }
  /* На 320-380px навигация не помещается в одну подстроку с CTA,
   * поэтому header честно превращается в 3 ряда (logo+Auto+RU /
   * ссылки / Установить). Это ожидаемо и проверяется тестом
   * test_header_rows_count в test_responsive_design.py. */
  .site-nav { gap: 8px 10px; font-size: .88rem; }
  .site-nav .cta { font-size: .82rem; padding: 5px 10px; }
  .btn-lg { font-size: 1rem; padding: 12px 20px; }
  ol.steps > li { padding: 16px 14px 16px 48px; }
  ol.steps > li::before { left: 10px; width: 28px; height: 28px; }
}
