@layer reset, tokens, base, layout, components, pages, utilities;

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

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

  body {
    margin: 0;
    min-height: 100vh;
    overflow-x: clip;
  }

  img,
  picture,
  svg,
  video {
    max-width: 100%;
  }

  img {
    height: auto;
    display: block;
  }

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

  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  p,
  figure,
  blockquote {
    margin: 0;
  }

  [hidden] {
    display: none;
  }
}

@layer tokens {
  :root {
    /* Поверхности и текст (V7A «Лазурь») */
    --bp-bg-page: #f2f7f6;
    --bp-bg-surface: #ffffff;
    --bp-bg-surface-soft: #e9f2f0;
    --bp-bg-surface-subtle: #f4fbfa;
    --bp-bg-summary-head: #eef6f4;
    --bp-border: #d0e1dc;
    --bp-border-subtle: #e4eeeb;
    --bp-border-strong: #9ec8c3;

    --bp-ink: #102a27;
    --bp-ink-strong: #0f2d24;
    --bp-ink-muted: #4f6a66;
    --bp-ink-inverse: #ffffff;

    /* Брендовый акцент (Лазурный изумруд + Золото) */
    --bp-accent: #196c64;
    --bp-accent-end: #21857c;
    --bp-accent-hover: #135852;
    --bp-accent-hover-end: #1a6e66;
    --bp-accent-ink: #145e57;
    --bp-accent-tint: #eef6f2;
    --bp-accent-border: #b8dacb;
    --bp-accent-soft: rgba(29, 105, 81, 0.11);

    --bp-gold: #e2af3c;
    --bp-gold-bright: #f3ce6c;
    --bp-gold-deep: #e0ab34;
    --bp-gold-soft: rgba(226, 175, 60, 0.16);
    --bp-gold-border: rgba(242, 206, 108, 0.62);
    --bp-gold-ink: #f7da88;

    /* Статусы и Danger (Blush-Rose для «Выйти из аккаунта») */
    --bp-danger-bg: #f9eff0;
    --bp-danger-bg-hover: #f3dce0;
    --bp-danger-border: #d9b4b8;
    --bp-danger-border-hover: #c88b92;
    --bp-danger-ink: #8c343d;
    --bp-danger-ink-hover: #721f28;

    --bp-wait-bg: #f4f4f6;
    --bp-wait-ink: #4d545d;

    /* Шапка (Desktop >= 768px / Mobile <= 767px) — V7A 72px desktop */
    --bp-header-h-desktop: 72px;
    --bp-header-h-mobile: 52px;
    --bp-header-bg-desktop: linear-gradient(90deg, #0c2c3d 0%, #123f52 54%, #165056 100%);
    --bp-header-bg-mobile: linear-gradient(90deg, #133c50 0%, #195168 52%, #1d6469 100%);
    --bp-header-bg-fallback: #0c2c3d;
    --bp-header-border: rgba(158, 242, 224, 0.24);
    --bp-header-shadow: 0 4px 18px rgba(4, 16, 22, 0.26);
    --bp-header-ink: #f4faf7;
    --bp-header-hover-bg: rgba(255, 255, 255, 0.10);

    /* Кнопка «Корзина» в десктопной шапке */
    --bp-header-cart-bg: linear-gradient(180deg, #f3ce6c 0%, #e0ab34 100%);
    --bp-header-cart-bg-hover: linear-gradient(180deg, #f8da85 0%, #e8b742 100%);
    --bp-header-cart-border: rgba(210, 154, 38, 0.46);
    --bp-header-cart-ink: #0f242c;
    --bp-header-cart-badge-bg: #10323e;
    --bp-header-cart-badge-ink: #ffffff;

    /* Мобильный Hero (<= 767px) */
    --bp-mhero-bg: radial-gradient(circle at 82% 8%, rgba(138, 245, 226, 0.30), transparent 54%),
                   linear-gradient(155deg, #15445a 0%, #1c5c6e 50%, #22706c 100%);
    --bp-mhero-border: rgba(154, 242, 226, 0.26);
    --bp-mhero-shadow: 0 12px 28px rgba(15, 52, 62, 0.18);
    --bp-mhero-eyebrow: #9ef5de;
    --bp-mhero-title: #ffffff;
    --bp-mhero-lead: #dff5f1;
    --bp-mhero-cta-bg: linear-gradient(135deg, #e5b23a 0%, #f6d577 100%);
    --bp-mhero-cta-bg-hover: linear-gradient(135deg, #f8da85 0%, #e8b742 100%);
    --bp-mhero-cta-ink: #102a22;
    --bp-mhero-cta-shadow: 0 6px 18px rgba(10, 32, 36, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.45);
    --bp-mhero-sec-bg: rgba(255, 255, 255, 0.12);
    --bp-mhero-sec-border: rgba(255, 255, 255, 0.42);

    /* Нижний мобильный таб-бар и дровер меню (чистый safe-area; в Firefox = 0px, в Chrome Android добавляется класс) */
    --bp-safe-bottom: env(safe-area-inset-bottom, 0px);
    --bp-tabbar-h: calc(54px + var(--bp-safe-bottom));
    --bp-tabbar-bg: #1b313b;
    --bp-tabbar-border: rgba(158, 242, 224, 0.20);
    --bp-tabbar-shadow: 0 -8px 24px rgba(10, 28, 36, 0.24);
    --bp-tabbar-ink: #9eb7c2;
    --bp-tabbar-active-ink: #8ef2d4;
    --bp-tabbar-active-pill: rgba(142, 242, 212, 0.16);
    --bp-tabbar-badge-bg: #ebc052;
    --bp-tabbar-badge-ink: #102a22;

    --bp-drawer-bg: #18323d;
    --bp-drawer-border: rgba(158, 242, 224, 0.26);
    --bp-drawer-head: #9ef5de;
    --bp-drawer-link-bg: rgba(255, 255, 255, 0.08);
    --bp-drawer-link-border: rgba(255, 255, 255, 0.15);
    --bp-drawer-link-ink: #f1faf8;
    --bp-backdrop-bg: rgba(8, 16, 20, 0.56);

    /* Подвал (#bp-legal-footer + #footer-nav) */
    --bp-footer-top-bg: linear-gradient(180deg, #163c48 0%, #12313b 100%);
    --bp-footer-bot-bg: #0e262f;
    --bp-footer-border: rgba(158, 242, 224, 0.18);
    --bp-footer-heading: #9ef5de;
    --bp-footer-link: #e8f6f4;
    --bp-footer-muted: #9ebbc2;
    --bp-footer-btn-bg: rgba(255, 255, 255, 0.08);
    --bp-footer-btn-border: rgba(158, 242, 224, 0.30);

    /* Кнопки Primary (V7A Лазурь — чистые границы без двойной жёлтой обводки) */
    --bp-btn-primary-bg: linear-gradient(135deg, #196c64 0%, #208178 100%);
    --bp-btn-primary-bg-hover: linear-gradient(135deg, #135852 0%, #196c64 100%);
    --bp-btn-primary-border: #155b54;
    --bp-btn-primary-border-hover: #104943;
    --bp-btn-primary-shadow: 0 2px 6px rgba(16, 68, 63, 0.16),
                             inset 0 1px 0 rgba(255, 255, 255, 0.16);

    /* Типографика (с метрическим fallback для 0 CLS при холодной загрузке) */
    --bp-font-sans: "Inter", "Inter Fallback", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    --bp-font-display: "Montserrat", "Montserrat Fallback", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Радиусы */
    --bp-radius-xs: 8px;
    --bp-radius-sm: 10px;
    --bp-radius-md: 12px;
    --bp-radius-card: 14px;
    --bp-radius-lg: 16px;
    --bp-radius-xl: 20px;
    --bp-radius-hero: 22px;
    --bp-radius-pill: 999px;

    /* Тени */
    --bp-shadow-card: 0 6px 20px rgba(15, 45, 36, 0.06);
    --bp-shadow-card-hover: 0 10px 26px rgba(15, 45, 36, 0.12);
    --bp-shadow-elevated: 0 18px 46px rgba(6, 18, 22, 0.28);
    --bp-focus-ring: 0 0 0 3px rgba(25, 108, 100, 0.18);

    /* Отступы и контейнеры */
    --bp-container-max: 1240px;
    --bp-account-max: 960px;
    --bp-auth-max: 520px;
    --bp-gutter-desktop: 24px;
    --bp-gutter-mobile: 12px;

    /* Чистая z-index шкала */
    --bp-z-sticky: 100;
    --bp-z-header: 200;
    --bp-z-dock: 250;
    --bp-z-backdrop: 300;
    --bp-z-drawer: 350;
    --bp-z-tabbar: 400;
    --bp-z-modal: 500;
    --bp-z-progress: 600;
  }
}
