/* ═══════════════════════════════════════════════════════════════
   TI-SAM DESIGN SYSTEM — Matter Edition
   Material Typography. 8pt Grid. Inter 4.1.

   v1.3 — Matter (Constitution v1.4)

   CHANGES from v1.2:
   - LAYOUT: --max-w 1248px → 1200px (Tilda alignment)
   - SHADOWS: --sh-lift updated for material lift
   - HOVER: Removed translateY — shadow-only lift
   - TOKENS: Added --opacity-disabled, --icon-lg, z-index levels
   - BREAKPOINTS: Added 360px, 480px
   - PREFIX: All utility classes now use m- namespace
   - LEADING: --leading-hero 0.9 → 1.1
   - TRACKING: --tracking-hero -0.04em → -0.03em

   Font Setup (Tilda):
   CSS Link: https://rsms.me/inter/inter.css

   Systems:
   - Typography: Inter 4.1, Apple recipes, optical sizing
   - Spacing: 8pt Grid, 5-level hierarchy
   - Material: Glass surfaces, shadow-based lift, physical depth
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* ─────────────────────────────────────────────────────────────
     PALETTE — Light Mode
     ───────────────────────────────────────────────────────────── */

  /* Surfaces */
  --paper: #fafafc;
  --card: #FFFFFF;
  --card-inset: #f2f2f5;

  /* Glass */
  --glass: rgba(255, 255, 255, 0.85);
  --glass-strong: rgba(255, 255, 255, 0.92);
  --glass-fallback: rgba(255, 255, 255, 0.97);

  /* Ink scale */
  --ink: #111111;
  --ink-70: #444446;
  --ink-60: #636366;
  --ink-50: #6e6e73;
  --ink-40: rgba(0, 0, 0, 0.4);
  --ink-20: rgba(0, 0, 0, 0.2);
  --ink-10: rgba(0, 0, 0, 0.1);
  --ink-08: rgba(0, 0, 0, 0.08);
  --ink-06: rgba(0, 0, 0, 0.06);
  --ink-05: rgba(0, 0, 0, 0.05);
  --ink-04: rgba(0, 0, 0, 0.04);

  /* Borders */
  --border: rgba(0, 0, 0, 0.08);
  --border-glass: rgba(255, 255, 255, 0.6);

  /* Accents */
  --accent: #D6001C;
  --accent-hover: #b8001a;
  --accent-soft: rgba(214, 0, 28, 0.06);
  --accent-grn: #34C759;
  --green: #34C759;                                   /* deprecated alias → use --accent-grn */

  /* ─────────────────────────────────────────────────────────────
     PALETTE — Dark Mode
     ───────────────────────────────────────────────────────────── */

  /* Surfaces */
  --dark: #1a1a1a;
  --dark-up: #2a2a2a;
  --dark-up2: #333333;

  /* Ink on dark */
  --on-dark: #f5f5f7;
  --ink-on-dark: #FFFFFF;
  --on-dark-70: rgba(245, 245, 247, 0.7);
  --ink-on-dark-50: rgba(255, 255, 255, 0.5);
  --on-dark-50: rgba(245, 245, 247, 0.5);
  --on-dark-12: rgba(255, 255, 255, 0.12);
  --on-dark-06: rgba(255, 255, 255, 0.06);
  --ink-on-dark-20: rgba(255, 255, 255, 0.2);

  /* Border on dark */
  --border-on-dark: rgba(255, 255, 255, 0.1);

  /* ─────────────────────────────────────────────────────────────
     TYPOGRAPHY — Inter 4.1 + Matter Scale
     ───────────────────────────────────────────────────────────── */

  --font: Inter, sans-serif;

  /* Type Scale (Matter)
     48 → 36 → 28 → 21 → 17 → 15 → 13 → 11 */

  /* Display Zone — fluid scaling (clamp) */
  --text-hero: clamp(1.75rem, 6vw, 3rem);           /* 28px → 48px */
  --text-display: clamp(1.75rem, 3vw, 2.25rem);    /* 28px → 36px */
  --text-xxl: clamp(1.3125rem, 2vw, 1.75rem);      /* 21px → 28px */
  --text-xl: 21px;                                  /* Card titles — stable */

  /* Reading Zone — stable across breakpoints */
  --text-md: 17px;                                  /* Body READ */
  --text-base: 15px;                                /* Body SCAN */
  --text-sm: 13px;                                  /* Specs, meta */
  --text-xs: 11px;                                  /* Labels, legal */

  /* Tracking — Apple Values (UPDATED) */
  --tracking-hero: -0.03em;       /* 48px hero — CHANGED from -0.04em */
  --tracking-display: -0.02em;    /* 36px */
  --tracking-title: -0.015em;     /* 28px */
  --tracking-card: -0.01em;       /* 21px */
  --tracking-normal: 0;           /* 17px */
  --tracking-base: 0.01em;        /* 15px */
  --tracking-small: 0.02em;       /* 13px */
  --tracking-micro: 0.03em;       /* 11px */
  --tracking-wider: 0.05em;       /* Uppercase labels */

  /* Leading (UPDATED) */
  --leading-hero: 1.1;            /* Hero titles — CHANGED from 0.9 */
  --leading-display: 1.14;        /* Section headers (36px) */
  --leading-title: 1.14;          /* Category headers (28px) */
  --leading-tight: 1.2;           /* Card titles */
  --leading-card: 1.24;           /* Card titles alt */
  --leading-normal: 1.4;          /* Body text */
  --leading-relaxed: 1.45;        /* Descriptions */
  --leading-small: 1.43;          /* Specs, meta (13px) */
  --leading-loose: 1.5;           /* Small text */

  /* Weights */
  --weight-hero: 700;             /* ONLY for logo */
  --weight-section: 600;          /* Hero, section titles, card titles */
  --weight-card: 600;             /* alias → same as --weight-section */
  --weight-nav: 700;              /* Uppercase labels, badges */
  --weight-emphasis: 500;         /* Inline emphasis */
  --weight-body: 400;             /* Body text, nav links */
  --weight-light: 400;            /* alias → same as --weight-body */

  /* ─────────────────────────────────────────────────────────────
     SPACING — 8pt Grid (Primitives)
     ───────────────────────────────────────────────────────────── */
  --sp-0: 0;
  --sp-px: 1px;
  --sp-05: 4px;
  --sp-1: 8px;
  --sp-2: 16px;
  --sp-3: 24px;
  --sp-4: 32px;
  --sp-5: 48px;
  --sp-6: 64px;
  --sp-7: 96px;

  /* ─────────────────────────────────────────────────────────────
     SPACING — Level 1: Page Rhythm
     ───────────────────────────────────────────────────────────── */
  --gap-after-hero: var(--sp-6);
  --gap-section: var(--sp-5);
  --gap-before-footer: var(--sp-5);

  /* ─────────────────────────────────────────────────────────────
     SPACING — Level 2: Section Internal
     ───────────────────────────────────────────────────────────── */
  --gap-section-header: var(--sp-3);
  --gap-grid: var(--sp-2);

  /* ─────────────────────────────────────────────────────────────
     SPACING — Level 3: Component Internal
     ───────────────────────────────────────────────────────────── */
  --gap-after-label: var(--sp-2);
  --gap-after-title: var(--sp-1);
  --gap-after-text: var(--sp-2);
  --gap-before-action: var(--sp-4);

  /* ─────────────────────────────────────────────────────────────
     SPACING — Level 4: Card Padding
     ───────────────────────────────────────────────────────────── */
  --pad-card: var(--sp-3);
  --pad-card-footer-y: var(--sp-2);
  --pad-card-footer-x: var(--sp-3);

  /* ─────────────────────────────────────────────────────────────
     SPACING — Level 5: Micro
     ───────────────────────────────────────────────────────────── */
  --gap-icon: var(--sp-1);
  --gap-inline: var(--sp-05);
  --pad-badge-y: var(--sp-05);
  --pad-badge-x: var(--sp-1);

  /* ─────────────────────────────────────────────────────────────
     LAYOUT (UPDATED)
     ───────────────────────────────────────────────────────────── */
  --max-w: 1200px;                /* CHANGED from 1248px — Tilda alignment */
  --nav-h: 56px;
  --icon-btn: 44px;
  --icon-sm: 16px;
  --icon-md: 18px;
  --icon-lg: 24px;                /* NEW */

  /* Navbar clearance */
  --nav-offset: calc(var(--sp-2) + var(--nav-h) + var(--sp-4));

  /* ─────────────────────────────────────────────────────────────
     RADII
     ───────────────────────────────────────────────────────────── */
  --rad-xs: 4px;
  --rad-sm: 8px;
  --rad-md: 12px;
  --rad-lg: 16px;
  --rad-xl: 24px;
  --rad-full: 9999px;

  /* ─────────────────────────────────────────────────────────────
     SHADOWS — Standard (elevation)
     ───────────────────────────────────────────────────────────── */
  --shadow-subtle: 0 1px 2px rgba(0,0,0,0.03), 0 1px 1px rgba(0,0,0,0.02);
  --shadow-soft: 0 4px 24px rgba(0,0,0,0.05), 0 1px 4px rgba(0,0,0,0.03);
  --shadow-medium: 0 8px 32px rgba(0,0,0,0.07), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-heavy: 0 20px 60px rgba(0,0,0,0.10), 0 8px 24px rgba(0,0,0,0.06);
  --shadow-mega: 0 25px 80px rgba(0,0,0,0.14), 0 10px 40px rgba(0,0,0,0.08);

  /* ─────────────────────────────────────────────────────────────
     SHADOWS — Material (physical objects) UPDATED
     ───────────────────────────────────────────────────────────── */
  --sh-subtle: 0 1px 2px rgba(0,0,0,0.04), 0 0 1px rgba(0,0,0,0.03);
  --sh-card: 0 1px 3px rgba(0,0,0,0.05), 0 4px 16px rgba(0,0,0,0.04);
  --sh-lift: 0 8px 24px rgba(0,0,0,0.08), 0 16px 48px rgba(0,0,0,0.06);  /* UPDATED — bigger, softer */
  --sh-float: 0 12px 32px rgba(0,0,0,0.10), 0 24px 64px rgba(0,0,0,0.08);
  --sh-inset: inset 0 1px 3px rgba(0,0,0,0.06), inset 0 0 1px rgba(0,0,0,0.04);

  /* ─────────────────────────────────────────────────────────────
     MOTION
     ───────────────────────────────────────────────────────────── */
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --smooth: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);          /* NEW */

  /* Scale tokens — components reference these */
  --dur-xs: 0.05s;                                  /* Micro-feedback */
  --dur-sm: 0.1s;                                   /* Hover states */
  --dur-md: 0.15s;                                  /* Quick transitions */
  --dur-normal: 0.2s;                               /* Standard transitions */
  --dur-lg: 0.3s;                                   /* Reveals, dropdown */
  --dur-xl: 0.5s;                                   /* Page transitions */
  /* Semantic aliases */
  --dur-instant: 0.05s;                             /* = dur-xs */
  --dur-fast: 0.1s;                                 /* = dur-sm */
  --dur-slow: 0.3s;                                 /* = dur-lg */
  --dur-slower: 0.5s;                               /* = dur-xl */

  /* ─────────────────────────────────────────────────────────────
     BLUR — Glassmorphism
     ───────────────────────────────────────────────────────────── */
  --blur-sm: 8px;
  --blur-md: 16px;
  --blur-lg: 24px;
  --blur-xl: 32px;

  /* ─────────────────────────────────────────────────────────────
     OPACITY (UPDATED)
     ───────────────────────────────────────────────────────────── */
  --opacity-muted: 0.6;
  --opacity-hint: 0.4;
  --opacity-disabled: 0.38;                         /* NEW */

  /* ─────────────────────────────────────────────────────────────
     Z-INDEX (UPDATED)
     ───────────────────────────────────────────────────────────── */
  --z-base: 0;                                      /* NEW */
  --z-dropdown: 100;
  --z-sticky: 200;                                  /* NEW */
  --z-overlay: 900;
  --z-nav: 1000;
  --z-modal: 1100;                                  /* NEW */
  --z-toast: 1200;                                  /* NEW */

  /* ─────────────────────────────────────────────────────────────
     IMAGE RATIOS (NEW)
     ───────────────────────────────────────────────────────────── */
  --ratio-card: 4/3;
  --ratio-hero: 16/9;
  --ratio-square: 1/1;
  --ratio-product: 3/4;

  /* ─────────────────────────────────────────────────────────────
     PLACEHOLDER COLORS (NEW)
     ───────────────────────────────────────────────────────────── */
  --placeholder-1: #f0f0f2;
  --placeholder-2: #e8e8eb;
  --placeholder-3: #e0e0e4;
}


/* ═══════════════════════════════════════════════════════════════
   DARK MODE — @media (prefers-color-scheme: dark)

   Strategy:
   - Light tokens (--paper, --card, --ink-*, --border, --glass)
     remap to dark equivalents
   - Dark-native tokens (--dark, --dark-up, --on-dark-*)
     stay UNCHANGED — used by always-dark components
   - Shadows strengthen (more opaque on dark surfaces)
   - Accent slightly brightened for contrast on dark bg

   Elevation model (Material-inspired):
     --paper  #111111  —  lowest (page background)
     --dark   #1a1a1a  —  dark bands (anchor, footer)
     --card   #1e1e1e  —  cards, dropdowns
     --dark-up  #2a2a2a  —  hover states on dark
     --dark-up2 #333333  —  active states on dark
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    /* ─── Surfaces ─────────────────────────────────────────────── */
    --paper: #111111;
    --card: #1e1e1e;
    --card-inset: #171717;

    /* ─── Glass → dark glass ──────────────────────────────────── */
    --glass: rgba(30, 30, 30, 0.85);
    --glass-strong: rgba(30, 30, 30, 0.92);
    --glass-fallback: rgba(30, 30, 30, 0.97);

    /* ─── Ink scale → light on dark ──────────────────────────── */
    --ink: #f5f5f7;
    --ink-70: rgba(245, 245, 247, 0.7);
    --ink-60: rgba(245, 245, 247, 0.6);
    --ink-50: rgba(245, 245, 247, 0.5);
    --ink-40: rgba(245, 245, 247, 0.4);
    --ink-20: rgba(245, 245, 247, 0.2);
    --ink-10: rgba(245, 245, 247, 0.1);
    --ink-08: rgba(245, 245, 247, 0.08);
    --ink-06: rgba(245, 245, 247, 0.06);
    --ink-05: rgba(245, 245, 247, 0.05);
    --ink-04: rgba(245, 245, 247, 0.04);

    /* ─── Borders ─────────────────────────────────────────────── */
    --border: rgba(255, 255, 255, 0.1);
    --border-glass: rgba(255, 255, 255, 0.08);

    /* ─── Accent — slightly brighter for dark bg contrast ────── */
    --accent: #E8002B;
    --accent-hover: #FF1A40;
    --accent-soft: rgba(232, 0, 43, 0.12);

    /* ─── Shadows — stronger on dark surfaces ─────────────────── */
    --shadow-subtle: 0 1px 2px rgba(0,0,0,0.2), 0 1px 1px rgba(0,0,0,0.15);
    --shadow-soft: 0 4px 24px rgba(0,0,0,0.25), 0 1px 4px rgba(0,0,0,0.15);
    --shadow-medium: 0 8px 32px rgba(0,0,0,0.3), 0 2px 8px rgba(0,0,0,0.2);
    --shadow-heavy: 0 20px 60px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.25);
    --shadow-mega: 0 25px 80px rgba(0,0,0,0.5), 0 10px 40px rgba(0,0,0,0.3);

    --sh-subtle: 0 1px 2px rgba(0,0,0,0.2), 0 0 1px rgba(0,0,0,0.15);
    --sh-card: 0 1px 3px rgba(0,0,0,0.2), 0 4px 16px rgba(0,0,0,0.15);
    --sh-lift: 0 8px 24px rgba(0,0,0,0.3), 0 16px 48px rgba(0,0,0,0.2);
    --sh-float: 0 12px 32px rgba(0,0,0,0.4), 0 24px 64px rgba(0,0,0,0.3);
    --sh-inset: inset 0 1px 3px rgba(0,0,0,0.25), inset 0 0 1px rgba(0,0,0,0.15);

    /* ─── Placeholders ────────────────────────────────────────── */
    --placeholder-1: #1e1e1e;
    --placeholder-2: #222222;
    --placeholder-3: #2a2a2a;
  }
}


/* Variable font support */
@supports (font-variation-settings: normal) {
  :root { --font: InterVariable, Inter, sans-serif; }
}


/* ═══════════════════════════════════════════════════════════════
   BASE STYLES
   ═══════════════════════════════════════════════════════════════ */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

body {
  font-family: var(--font);
  font-size: var(--text-md);
  line-height: var(--leading-relaxed);
  color: var(--ink);
  background: var(--paper);

  /* Inter 4.1 features */
  font-feature-settings: 'liga' 1, 'calt' 1;
  font-optical-sizing: auto;

  /* Rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.menu-open {
  position: fixed;
  width: 100%;
  overflow: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
  padding: 0;
  margin: 0;
}

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


/* ═══════════════════════════════════════════════════════════════
   TYPOGRAPHY UTILITIES — m- namespace
   ═══════════════════════════════════════════════════════════════ */

/* ─── Display Zone (≥21px) ─────────────────────────────────────── */

.m-text-hero {
  font-size: var(--text-hero);
  font-weight: var(--weight-section);
  line-height: var(--leading-hero);
  letter-spacing: var(--tracking-hero);
}

.m-text-display {
  font-size: var(--text-display);
  font-weight: var(--weight-section);
  line-height: var(--leading-display);
  letter-spacing: var(--tracking-display);
}

.m-text-xxl {
  font-size: var(--text-xxl);
  font-weight: var(--weight-section);
  line-height: var(--leading-title);
  letter-spacing: var(--tracking-title);
}

.m-text-xl {
  font-size: var(--text-xl);
  font-weight: var(--weight-section);
  line-height: var(--leading-card);
  letter-spacing: var(--tracking-card);
}

/* ─── Reading Zone (<21px) ─────────────────────────────────────── */

.m-text-md {
  font-size: var(--text-md);
  font-weight: var(--weight-body);
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-normal);
}

.m-text-base {
  font-size: var(--text-base);
  font-weight: var(--weight-body);
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-base);
}

.m-text-sm {
  font-size: var(--text-sm);
  font-weight: var(--weight-body);
  line-height: var(--leading-small);
  letter-spacing: var(--tracking-small);
}

.m-text-xs {
  font-size: var(--text-xs);
  font-weight: var(--weight-body);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-micro);
}

/* ─── Labels ───────────────────────────────────────────────────── */

.m-text-eyebrow {
  font-size: var(--text-xs);
  font-weight: var(--weight-section);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
}

.m-text-badge {
  font-size: var(--text-xs);
  font-weight: var(--weight-nav);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
}


/* ═══════════════════════════════════════════════════════════════
   SPACING UTILITIES — m- namespace
   ═══════════════════════════════════════════════════════════════ */

/* ─── Level 1: Page Rhythm ────────────────────────────────────── */

.m-section {
  margin-bottom: var(--gap-section);
}

.m-section-after-hero {
  margin-top: var(--gap-after-hero);
}

/* ─── Level 2: Section Internal ───────────────────────────────── */

.m-section-header {
  margin-bottom: var(--gap-section-header);
}

.m-grid-gap {
  gap: var(--gap-grid);
}

/* ─── Level 3: Component Internal ─────────────────────────────── */

.m-mb-after-label {
  margin-bottom: var(--gap-after-label);
}

.m-mb-after-title {
  margin-bottom: var(--gap-after-title);
}

.m-mb-after-text {
  margin-bottom: var(--gap-after-text);
}

.m-mt-before-action {
  margin-top: var(--gap-before-action);
}

/* ─── Level 4: Card Padding ───────────────────────────────────── */

.m-pad-card {
  padding: var(--pad-card);
}

.m-pad-card-footer {
  padding: var(--pad-card-footer-y) var(--pad-card-footer-x);
}

/* ─── Level 5: Micro ──────────────────────────────────────────── */

.m-gap-icon {
  gap: var(--gap-icon);
}

.m-gap-inline {
  gap: var(--gap-inline);
}

.m-pad-badge {
  padding: var(--pad-badge-y) var(--pad-badge-x);
}


/* ═══════════════════════════════════════════════════════════════
   MATERIAL PATTERNS — m- namespace, shadow-only lift
   ═══════════════════════════════════════════════════════════════ */

/* ─── Glass Surface ────────────────────────────────────────────── */

.m-glass {
  background: var(--glass-strong);
  backdrop-filter: blur(var(--blur-xl)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur-xl)) saturate(180%);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-soft), inset 0 0 0 0.5px rgba(255,255,255,0.5);
}

@supports not (backdrop-filter: blur(1px)) {
  .m-glass { background: var(--glass-fallback); }
}

/* ─── Inset Slot ──────────────────────────────────────────────── */

.m-slot {
  background: var(--card-inset);
  box-shadow: var(--sh-inset);
}

.m-slot-hover:hover {
  background: #ebebee;
  box-shadow: var(--sh-inset), 0 0 0 1px var(--ink-06);
}

/* ─── Material Card — SHADOW-ONLY LIFT ────────────────────────── */

.m-card {
  background: var(--card);
  border-radius: var(--rad-lg);
  box-shadow: var(--sh-card);
  transition: box-shadow var(--dur-normal) var(--smooth);
  /* GPU acceleration */
  transform: translateZ(0);
}

/* Hover: карточка ПОДНИМАЕТСЯ — тень растёт, позиция НЕ меняется */
.m-card:hover {
  box-shadow: var(--sh-lift);
}

/* Active/Press: карточка ВДАВЛИВАЕТСЯ — тень уменьшается */
.m-card:active {
  box-shadow: var(--shadow-subtle);
}

.m-card-footer {
  background: var(--card-inset);
  border-radius: 0 0 var(--rad-lg) var(--rad-lg);
}

/* ─── Dark Band Card — SHADOW-ONLY ────────────────────────────── */

.m-band-card {
  background: var(--dark-up);
  border-radius: var(--rad-lg);
  border: 1px solid var(--on-dark-06);
  transition:
    border-color var(--dur-lg),
    background var(--dur-lg),
    box-shadow var(--dur-normal) var(--smooth);
}

/* Hover: только цвет и тень, без translateY */
.m-band-card:hover {
  background: var(--dark-up2);
  border-color: var(--on-dark-12);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}


/* ═══════════════════════════════════════════════════════════════
   HOVER PATTERNS — m- namespace
   ═══════════════════════════════════════════════════════════════ */

/* Text links — opacity */
.m-link-fade {
  transition: opacity var(--dur-sm);
}
.m-link-fade:hover {
  opacity: var(--opacity-muted);
}

/* CTA with arrow */
.m-cta-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-05);
  transition: opacity var(--dur-sm);
}
.m-cta-arrow::after {
  content: "→";
  transition: transform var(--dur-md) ease;
}
.m-cta-arrow:hover {
  opacity: var(--opacity-muted);
}
.m-cta-arrow:hover::after {
  transform: translateX(var(--sp-05));
}

/* Dark background — color to accent */
.m-link-dark {
  color: var(--on-dark);
  transition: color var(--dur-sm);
}
.m-link-dark:hover {
  color: var(--accent);
}


/* ═══════════════════════════════════════════════════════════════
   BUTTONS — m- namespace
   ═══════════════════════════════════════════════════════════════ */

.m-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  padding: 13px 28px;
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: var(--weight-section);
  letter-spacing: var(--tracking-small);
  border: none;
  border-radius: var(--rad-md);
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
  transition:
    background var(--dur-md),
    box-shadow var(--dur-normal) var(--smooth);
}

.m-btn svg {
  width: var(--icon-sm);
  height: var(--icon-sm);
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* Primary — dark bg */
.m-btn-primary {
  background: var(--ink);
  color: var(--on-dark);
  box-shadow: var(--sh-card);
}
.m-btn-primary:hover {
  background: #2a2a2e;
  box-shadow: var(--sh-lift);
}

/* Accent — red bg */
.m-btn-accent {
  background: var(--accent);
  color: white;
  box-shadow: var(--sh-card);
}
.m-btn-accent:hover {
  background: var(--accent-hover);
  box-shadow: var(--sh-lift);
}

/* Ghost — outline */
.m-btn-ghost {
  background: transparent;
  border: 1px solid var(--ink-20);
  color: var(--ink);
}
.m-btn-ghost:hover {
  background: var(--ink-05);
}

/* On dark — inverted */
.m-btn-on-dark {
  background: var(--on-dark);
  color: var(--dark);
  box-shadow: var(--sh-card);
}
.m-btn-on-dark:hover {
  background: #ffffff;
  box-shadow: var(--sh-lift);
}

/* Disabled */
.m-btn:disabled,
.m-btn.m-disabled {
  opacity: var(--opacity-disabled);
  pointer-events: none;
  cursor: not-allowed;
}


/* ═══════════════════════════════════════════════════════════════
   STATES — m- namespace (NEW)
   ═══════════════════════════════════════════════════════════════ */

/* Skeleton loading */
.m-skeleton {
  background: linear-gradient(
    90deg,
    var(--ink-04) 0%,
    var(--ink-08) 50%,
    var(--ink-04) 100%
  );
  background-size: 200% 100%;
  animation: m-skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: var(--rad-sm);
}

@keyframes m-skeleton-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Empty state */
.m-empty {
  text-align: center;
  padding: var(--sp-6);
  color: var(--ink-50);
}

/* Error state */
.m-error {
  color: var(--accent);
  background: var(--accent-soft);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--rad-md);
  border-left: 3px solid var(--accent);
}

/* Disabled state */
.m-disabled,
[disabled] {
  opacity: var(--opacity-disabled);
  pointer-events: none;
  cursor: not-allowed;
}


/* ═══════════════════════════════════════════════════════════════
   ANIMATIONS — m- namespace (NEW)
   ═══════════════════════════════════════════════════════════════ */

@keyframes m-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes m-slide-up {
  from {
    opacity: 0;
    transform: translateY(var(--sp-2));
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stagger children */
.m-stagger > * {
  animation: m-slide-up var(--dur-slow) var(--smooth) both;
}

.m-stagger > *:nth-child(1) { animation-delay: 0ms; }
.m-stagger > *:nth-child(2) { animation-delay: 50ms; }
.m-stagger > *:nth-child(3) { animation-delay: 100ms; }
.m-stagger > *:nth-child(4) { animation-delay: 150ms; }
.m-stagger > *:nth-child(5) { animation-delay: 200ms; }
.m-stagger > *:nth-child(6) { animation-delay: 250ms; }


/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile (≤640px)
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
  :root {
    /* Level 1: Page Rhythm — компактнее */
    --gap-after-hero: var(--sp-5);       /* 64→48px */
    --gap-section: var(--sp-4);          /* 48→32px */
    --gap-before-footer: var(--sp-4);    /* 48→32px */

    /* Level 2: Section Internal */
    --gap-section-header: var(--sp-2);   /* 24→16px */
    --gap-grid: var(--sp-2);             /* 16→16px (same) */

    /* Level 3: Component Internal */
    --gap-after-label: var(--sp-1);      /* 16→8px */
    --gap-before-action: var(--sp-3);    /* 32→24px */

    /* Level 4: Card Padding — компактнее */
    --pad-card: var(--sp-2);             /* 24→16px */
    --pad-card-footer-y: calc(var(--sp-1) + var(--sp-05));  /* 16→12px */
    --pad-card-footer-x: var(--sp-2);   /* 24→16px */
  }
}

/* Tablet landscape (≤960px) */
@media (max-width: 960px) {
  :root {
    --gap-after-hero: var(--sp-5);       /* 64→48px — tighter on tablet */
  }
}

/* Small mobile (≤480px) */
@media (max-width: 480px) {
  :root {
    --gap-section: var(--sp-3);          /* 32→24px — tighter on small screens */
    --gap-before-footer: var(--sp-3);    /* 32→24px */
  }
}

/* Very small mobile (≤360px) */
@media (max-width: 360px) {
  :root {
    --pad-card: calc(var(--sp-1) + var(--sp-05));  /* 16→12px — minimal card padding */
    --gap-section-header: var(--sp-1);              /* 16→8px */
  }
}


/* ═══════════════════════════════════════════════════════════════
   ACCESSIBILITY
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Screen reader only */
.m-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip link */
.m-skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  padding: var(--sp-2) var(--sp-3);
  background: var(--ink);
  color: var(--on-dark);
  border-radius: var(--rad-md);
  z-index: var(--z-toast);
  transition: top var(--dur-fast);
}

.m-skip-link:focus {
  top: var(--sp-2);
}


/* ═══════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════ */

/* Tabular numbers for prices */
.m-tabular-nums {
  font-feature-settings: 'tnum' 1, 'liga' 1, 'calt' 1;
}

.m-price {
  font-feature-settings: 'tnum' 1, 'zero' 1, 'liga' 1, 'calt' 1;
}

/* Image container with aspect ratio */
.m-img-container {
  position: relative;
  overflow: hidden;
}

.m-img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.m-img-ratio-card { aspect-ratio: var(--ratio-card); }
.m-img-ratio-hero { aspect-ratio: var(--ratio-hero); }
.m-img-ratio-square { aspect-ratio: var(--ratio-square); }
.m-img-ratio-product { aspect-ratio: var(--ratio-product); }


/* ═══════════════════════════════════════════════════════════════
   FORM RESETS — m- namespace
   ═══════════════════════════════════════════════════════════════ */

.m-input,
.m-textarea,
.m-select {
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--ink-10);
  border-radius: var(--rad-sm);
  padding: var(--sp-1) var(--sp-2);
  min-height: var(--icon-btn);
  width: 100%;
  transition: border-color var(--dur-sm), box-shadow var(--dur-sm);
  -webkit-appearance: none;
  appearance: none;
}

.m-input::placeholder,
.m-textarea::placeholder {
  color: var(--ink-40);
}

.m-input:focus,
.m-textarea:focus,
.m-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.m-input:disabled,
.m-textarea:disabled,
.m-select:disabled {
  opacity: var(--opacity-disabled);
  cursor: not-allowed;
  background: var(--card-inset);
}

.m-textarea {
  min-height: calc(var(--icon-btn) * 2);
  resize: vertical;
}

.m-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-2) center;
  padding-right: var(--sp-5);
}


/* ═══════════════════════════════════════════════════════════════
   PRINT
   ═══════════════════════════════════════════════════════════════ */

@media print {
  body {
    background: white;
    color: black;
  }

  /* Hide non-content elements */
  nav,
  .m-skip-link,
  .m-btn,
  .m-stagger > * {
    animation: none !important;
  }

  /* Cards — borders instead of shadows */
  .m-card,
  .m-band-card {
    box-shadow: none;
    border: 1px solid var(--ink-10);
  }

  /* Glass — solid white, no blur */
  .m-glass {
    background: white;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--ink-10);
    box-shadow: none;
  }

  /* Links — show URL */
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: var(--text-xs);
    color: var(--ink-50);
  }

  /* Don't show URL for nav/brand links */
  nav a[href]::after,
  .m-hero-brand::after {
    content: none;
  }

  /* Buttons — outline style */
  .m-btn {
    box-shadow: none;
    border: 1px solid var(--ink-20);
    background: white;
    color: black;
  }

  /* No hover effects */
  .m-card:hover,
  .m-band-card:hover {
    box-shadow: none;
  }

  /* Skeleton — hide loading states */
  .m-skeleton {
    animation: none;
    background: var(--ink-06);
  }
}