/* =============================================================================
   Rental theme — design foundation.
   Neutral, modern, premium-lite default design system.
   Components, layouts and pages compose these tokens.
   Per-site theming (sites/<site>/theme.css) re-declares tokens to re-skin.
   ============================================================================= */

:root {
  /* ---------------------------------------------------------------------------
     Surfaces — cool, neutral, no warm/beige tints
     --------------------------------------------------------------------------- */
  --bg-page: #f5f7fa;
  --bg-section: #ffffff;
  --bg-section-alt: #eef3f6;

  --surface-1: #ffffff;
  --surface-2: #f8fbfc;
  --surface-3: #f1f5f7;
  --surface-inverse: #0b141c;

  /* ---------------------------------------------------------------------------
     Text
     --------------------------------------------------------------------------- */
  --text-strong: #111827;
  --text-base: #25313c;
  --text-muted: #647381;
  --text-soft: #8a97a3;
  --text-on-accent: #ffffff;
  --text-on-inverse: rgba(255, 255, 255, 0.86);
  --text-on-inverse-muted: rgba(255, 255, 255, 0.58);

  /* ---------------------------------------------------------------------------
     Accent (brand/secondary) + primary action (CTA)
     --------------------------------------------------------------------------- */
  --accent: #1f6fb8;
  --accent-hover: #185b97;
  --accent-strong: #114674;
  --accent-soft: #eaf2fa;
  --accent-contrast: #ffffff;

  --action-primary: #e97a2b;
  --action-primary-hover: #d86c20;
  --action-primary-contrast: #ffffff;

  /* ---------------------------------------------------------------------------
     Borders
     --------------------------------------------------------------------------- */
  --border-soft: #e5ebf0;
  --border-base: #d6dee5;
  --border-strong: #c5d0d8;
  --border-on-accent: rgba(255, 255, 255, 0.22);
  --border-on-inverse: rgba(255, 255, 255, 0.08);

  /* ---------------------------------------------------------------------------
     Shadows — neutral, based on dark translucent ink. No colored glow.
     --------------------------------------------------------------------------- */
  --shadow-xs: 0 1px 2px rgba(17, 24, 39, 0.04);
  --shadow-sm: 0 8px 24px rgba(17, 24, 39, 0.06);
  --shadow-md: 0 16px 40px rgba(17, 24, 39, 0.08);
  --shadow-lg: 0 28px 72px rgba(17, 24, 39, 0.12);
  --shadow-xl: 0 36px 96px rgba(17, 24, 39, 0.16);
  --focus-ring: 0 0 0 4px rgba(31, 111, 184, 0.18);

  /* ---------------------------------------------------------------------------
     Radii
     --------------------------------------------------------------------------- */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --radius-2xl: 36px;
  --radius-pill: 999px;

  /* ---------------------------------------------------------------------------
     Spacing (4px grid, px-based)
     --------------------------------------------------------------------------- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-14: 56px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;
  --space-32: 128px;

  /* Section rhythm */
  --section-pad-y: 96px;
  --section-pad-y-tight: 72px;

  /* ---------------------------------------------------------------------------
     Typography — single source of truth.
     5 weights, strict size scale, paired line-heights / letter-spacing.
     Mobile adaptation happens via token overrides in the media query below.
     --------------------------------------------------------------------------- */
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-heading: "Manrope", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Weights (5 tokens — only these values are allowed in the codebase) */
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-black: 800;

  /* Headings (responsive via clamp: mobile → desktop) */
  --fs-display: clamp(40px, 5.6vw, 64px);
  --fs-h1: clamp(34px, 4.4vw, 52px);
  --fs-h2: clamp(26px, 3vw, 36px);
  --fs-h3: clamp(20px, 1.8vw, 24px);
  --fs-h4: 18px;

  /* Card-scoped title size — for heading inside grid/card components
     (benefits, steps, conditions). Deliberately smaller than --fs-h3
     to keep hierarchy against the section H2. */
  --fs-card-title: clamp(17px, 1.4vw, 20px);

  /* Inner-page / article scale — smaller than hero/section H1/H2.
     Use for .page-intro h1 and article body headings.
     Can be re-declared per site in sites/<brand>/theme.css. */
  --fs-page-title: clamp(28px, 3.4vw, 40px);
  --fs-article-h2: clamp(22px, 2.2vw, 28px);
  --fs-article-h3: 20px;
  --fs-page-lead: var(--fs-body);

  /* Body / helper */
  --fs-body-lg: 18px;
  --fs-body: 17px;
  --fs-body-sm: 15px;
  --fs-small: 13px;
  --fs-tiny: 12px;
  --fs-eyebrow: 11px;

  /* Component-scoped sizes */
  --fs-header-nav: 16px;
  --fs-header-contact: 16px;
  --fs-footer-nav: 15px;
  --fs-logo: 18px;
  --fs-btn: 16px;
  --fs-btn-sm: 14px;
  --fs-input: 16px;

  /* Mobile body reference — overrides below rewrite --fs-body to this */
  --fs-body-mobile: 16px;

  /* Line-heights — one per semantic role, no per-component fine-tuning */
  --lh-display: 1.04;
  --lh-heading: 1.06;
  --lh-heading-md: 1.12;
  --lh-heading-sm: 1.2;
  --lh-tight: 1.35;
  --lh-lead: 1.55;
  --lh-body: 1.65;
  --lh-small: 1.5;
  --lh-nav: 1.2;
  --lh-flat: 1;

  /* Legacy alias — older rules still reference --lh-heading-compact */
  --lh-heading-compact: var(--lh-display);

  /* Letter-spacing — negative for large display, positive for small/label text.
     Inter/Manrope are optically tight by default; nudge apart at <=13px,
     tighten at >=18px. */
  --ls-display: -0.035em;
  --ls-heading: -0.025em;
  --ls-heading-sm: -0.02em;
  --ls-h4: -0.01em;
  --ls-body: 0;
  --ls-nav: 0;
  --ls-btn: -0.01em;
  --ls-small: 0.005em;
  --ls-tiny: 0.01em;
  --ls-eyebrow: 0.1em;

  /* ---------------------------------------------------------------------------
     Layout
     --------------------------------------------------------------------------- */
  --max-width: 1200px;
  --max-width-narrow: 760px;
  --max-width-prose: 44rem;
  --max-width-lead: 42rem;
  --max-width-heading: 34ch;
  /* Реальная высота хедера около 90px на десктопе.
     На мобиле переопределяется ниже в @media (max-width: 719px).
     Используется как scroll-padding-top для якорей и отрицательный margin-top
     для cover-hero. */
  --header-h: 90px;

  /* ---------------------------------------------------------------------------
     Motion
     --------------------------------------------------------------------------- */
  --ease-standard: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 0.16s;
  --dur-base: 0.22s;
  --dur-slow: 0.4s;
  --motion-panel-duration: 0.22s;
  --motion-panel-ease: var(--ease-out);
  --motion-panel-offset-y: -8px;

  /* ---------------------------------------------------------------------------
     Legacy aliases — keep older references resolving. Prefer tokens above.
     --------------------------------------------------------------------------- */
  --color-bg: var(--bg-page);
  --color-surface: var(--surface-1);
  --color-surface-soft: var(--surface-3);
  --color-text: var(--text-strong);
  --color-text-muted: var(--text-muted);
  --color-accent: var(--accent);
  --color-accent-hover: var(--accent-hover);
  --color-accent-soft: var(--accent-soft);
  --color-warm: var(--action-primary);
  --color-warm-soft: #fdecdc;
  --color-border: var(--border-base);
  --color-hero-gradient: none;
  --accent-warm: var(--action-primary);
  --accent-warm-soft: #fdecdc;
  --surface-accent-soft: var(--accent-soft);
  --surface-warm-soft: #fdecdc;
  --shadow-accent: var(--shadow-sm);
  --shadow-inset-hi: none;
  --space-xs: var(--space-2);
  --space-sm: var(--space-3);
  --space-md: var(--space-4);
  --space-lg: var(--space-6);
  --space-xl: var(--space-8);
  --space-2xl: var(--space-12);
  --space-3xl: var(--space-16);
}

/* -----------------------------------------------------------------------------
   Base resets & defaults
   ----------------------------------------------------------------------------- */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Отключаем double-tap-to-zoom на iOS. На narrow viewport карточек,
     быстрый двойной тап во время попытки скролла триггерил zoom всей
     страницы — карточки визуально «растягивались шире экрана».
     `manipulation` оставляет pinch-zoom для accessibility, но убирает
     300ms-задержку и double-tap. */
  touch-action: manipulation;
  /* Belt-and-braces против горизонтального overscroll на iOS Safari.
     Body уже имеет overflow-x: clip, но на iOS жест «оттянуть страницу
     вбок» иногда срабатывает на корневом элементе (html), если какой-то
     потомок шире viewport — даже если визуально он обрезан. `clip` на
     html гарантированно блокирует тач-pan по горизонтали. */
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-body);
  color: var(--text-base);
  background: var(--bg-page);
  /* `clip` (вместо `hidden`) обрезает горизонтальный overflow, но НЕ
     создаёт scroll-container. */
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11", "cv06";
}

body > main {
  flex: 1 0 auto;
}

/* Mobile typography scale — driven by token overrides only.
   Every component reading --fs-body / --fs-body-lg / --lh-heading
   rescales automatically; no per-component mobile hardcode. */
@media (max-width: 719px) {
  :root {
    --fs-body: var(--fs-body-mobile);
    --fs-body-lg: var(--fs-body-mobile);
    --lh-heading: 1.1;
    /* На мобиле хедер: лого 54px + padding-block 12*2 = 78px. */
    --header-h: 78px;
  }
}

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

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--dur-fast) var(--ease-standard);
}

a:hover {
  color: var(--accent-hover);
}

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

button {
  -webkit-tap-highlight-color: transparent;
}

small {
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  letter-spacing: var(--ls-small);
  color: var(--text-muted);
}

::selection {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--text-strong);
}

:focus-visible {
  outline: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
