@layer reset, tokens, components, themes;

@layer reset {
  *,
  *::before,
  *::after { box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  body { margin: 0; }
  img { max-width: 100%; display: block; }
  button, input { font: inherit; }
  a { color: inherit; }
  ul, ol { margin: 0; padding: 0; list-style: none; }
  h1, h2, p { margin: 0; }
}

@layer tokens {
  :root {
    --font: Arial, "Segoe UI", sans-serif;
    --measure: 74rem;
    --aside: 16.5rem;
    --radius: 0.15rem;
    --space: 1rem;
    --header-columns: minmax(12rem, auto) minmax(14rem, 1fr) auto;
    --header-areas: "brand search phones" "brand hours phones";
    --slider-ratio: 3.15;
    --color-bg: #f4efe4;
    --color-surface: #fffdf8;
    --color-ink: #241c14;
    --color-muted: #5c5348;
    --color-line: #e4d8c4;
    --color-accent: #8d5a16;
    --color-accent-ink: #fffdf8;
    --color-nav: #f0c14d;
    --color-nav-ink: #241c14;
    --shadow: none;
  }
}

@layer components {
  body {
    background: var(--color-bg);
    color: var(--color-ink);
    font-family: var(--font);
    line-height: 1.45;
  }
  [data-component="header"],
  [data-component="nav"] [data-part="links"],
  [data-component="frame"],
  [data-component="subscribe"],
  [data-component="footer"] > div {
    width: min(100% - 2rem, var(--measure));
    margin-inline: auto;
  }
  [data-component="header"] {
    display: grid;
    grid-template-columns: var(--header-columns);
    grid-template-areas: var(--header-areas);
    gap: 0.75rem 1.25rem;
    align-items: center;
    padding: 0.9rem 0 0.75rem;
  }
  [data-component="brand"] { grid-area: brand; display: flex; align-items: center; gap: 0.75rem; text-decoration: none; }
  [data-component="brand"] img { width: 3.5rem; height: 3.5rem; object-fit: contain; }
  [data-component="brand"] strong { display: block; font-size: 1.35rem; color: var(--color-accent); }
  [data-component="brand"] span { display: block; color: var(--color-accent); font-size: 0.78rem; }
  [data-component="search"] { grid-area: search; display: flex; min-width: 0; position: relative; }
  [data-component="search"] input {
    min-width: 0;
    flex: 1;
    height: 2.75rem;
    border: 1px solid var(--color-line);
    border-right: 0;
    border-radius: var(--radius) 0 0 var(--radius);
    background: var(--color-surface);
    padding: 0 0.9rem;
  }
  [data-component="hours"] { grid-area: hours; color: var(--color-muted); font-size: 0.78rem; }
  [data-component="phones"] { grid-area: phones; display: grid; grid-template-columns: 1fr 1fr; gap: 0.1rem 0.8rem; justify-items: end; font-size: 0.82rem; font-style: normal; }
  [data-component="phones"] a { white-space: nowrap; text-decoration: none; }
  [data-component="phones"] a[data-slot="company.email"] { grid-column: 1 / -1; color: var(--color-accent); }
  [data-component="nav"] { background: var(--color-nav); color: var(--color-nav-ink); }
  [data-component="nav"] [data-part="links"] { display: flex; flex-wrap: wrap; }
  [data-component="nav"] a { display: block; min-height: 2.75rem; padding: 0.75rem 0.85rem; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; text-decoration: none; text-transform: uppercase; }
  [data-component="nav"] a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--color-accent); }
  [data-action="menu"],
  [data-action="catalog"] { display: none; }
  [data-component="frame"] { display: grid; grid-template-columns: var(--aside) minmax(0, 1fr); align-items: start; }
  [data-component="catalog"] { border-right: 1px solid var(--color-line); }
  [data-component="catalog"] > p { padding: 0.7rem 0.8rem; font-size: 0.86rem; font-weight: 700; }
  [data-component="catalog"] li { border-top: 1px solid var(--color-line); }
  [data-component="catalog"] li > div { display: flex; }
  [data-component="catalog"] a { display: flex; align-items: center; gap: 0.45rem; padding: 0.45rem 0.8rem; text-decoration: none; font-size: 0.8rem; }
  [data-action="branch"] { width: 2.75rem; border: 0; background: transparent; cursor: pointer; }
  [data-component="main"] { min-width: 0; padding: 1rem 1rem 2rem; }
  [data-component="slider"] { position: relative; aspect-ratio: var(--slider-ratio); overflow: hidden; border-radius: var(--radius); background: var(--color-line); }
  [data-component="slider"] ol { height: 100%; }
  [data-component="slider"] li { display: none; height: 100%; }
  [data-component="slider"] li[data-state="current"] { display: block; }
  [data-component="slider"] img { width: 100%; height: 100%; object-fit: cover; }
  [data-component="slider"] a { display: block; height: 100%; }
  [data-action="prev"],
  [data-action="next"] {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 2.75rem;
    height: 2.75rem;
    border: 0;
    border-radius: 999px;
    background: var(--color-surface);
    cursor: pointer;
  }
  [data-action="prev"] { left: 0.6rem; }
  [data-action="next"] { right: 0.6rem; }
  [data-part="dots"] { position: absolute; bottom: 0.4rem; left: 0; right: 0; display: flex; justify-content: center; }
  [data-part="dots"] button { width: 2.75rem; height: 2.75rem; border: 0; background: transparent; cursor: pointer; }
  [data-part="dots"] button span { display: block; height: 0.35rem; border-radius: 999px; background: #fff; margin: auto; }
  [data-part="dots"] button[data-state="current"] span { width: 1.4rem; background: var(--color-accent); }
  [data-part="dots"] button span { width: 0.45rem; }
  [data-component="advantages"] { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; margin-top: 1rem; }
  [data-component="advantages"] li,
  [data-component="cards"] a,
  [data-component="payments"] li,
  [data-component="reviews"] li {
    background: var(--color-surface);
    border: 1px solid var(--color-line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }
  [data-component="advantages"] li { padding: 0.85rem; font-size: 0.86rem; }
  [data-component="mosaic"] { display: grid; grid-template-columns: 1.3fr 1fr; gap: 0.75rem; margin-top: 1rem; }
  [data-component="mosaic"] a:first-child { grid-row: span 2; min-height: 23rem; }
  [data-component="mosaic"] a { position: relative; display: block; min-height: 11rem; overflow: hidden; border-radius: var(--radius); color: #fff; text-decoration: none; }
  [data-component="mosaic"] img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
  [data-component="mosaic"] span { position: absolute; left: 0; right: 0; bottom: 0; padding: 0.8rem; background: linear-gradient(transparent, rgb(0 0 0 / 0.72)); }
  [data-component="mosaic"] em { display: inline-block; margin-top: 0.35rem; background: #ffe14a; color: #241c14; font-style: normal; font-size: 0.75rem; font-weight: 700; padding: 0.2rem 0.45rem; }
  [data-component="article"] { max-width: 46rem; margin-top: 1.5rem; }
  [data-component="article"] h1,
  [data-component="main"] > h1 { font-size: 1.8rem; line-height: 1.2; font-weight: 700; }
  [data-component="article"] h2 { margin-top: 1.2rem; font-size: 1.15rem; }
  [data-component="article"] p,
  [data-component="prose"] p { margin-top: 0.7rem; font-size: 0.95rem; }
  [data-component="article"] ul { margin: 0.4rem 0 0 1.1rem; list-style: disc; }
  [data-component="kicker"] { margin-top: 1.4rem; color: var(--color-accent); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
  [data-component="cards"],
  [data-component="payments"] { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; margin-top: 1rem; }
  [data-component="cards"] a,
  [data-component="payments"] li,
  [data-component="reviews"] li { display: block; padding: 0.9rem; text-decoration: none; }
  [data-component="reviews"] { display: grid; gap: 0.75rem; margin-top: 1rem; }
  [data-component="reviews"] article { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius); padding: 0.9rem; }
  [data-component="cards"] a { display: flex; align-items: center; gap: 0.6rem; }
  [data-component="subscribe"] {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    margin: 1.5rem auto;
    padding: 1rem 1.2rem;
    background: var(--color-ink);
    color: var(--color-accent-ink);
    border-radius: var(--radius);
  }
  [data-component="subscribe"] a { color: var(--color-ink); background: var(--color-surface); text-decoration: none; min-height: 2.75rem; display: inline-flex; align-items: center; padding: 0 1rem; border-radius: var(--radius); font-weight: 700; }
  [data-component="footer"] { border-top: 1px solid var(--color-line); padding: 1.5rem 0 2rem; font-size: 0.86rem; }
  [data-component="footer"] > div { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.2rem; }
  [data-component="footer"] a { text-decoration: none; }
  [data-component="pay"] { display: flex; gap: 0.4rem; margin-top: 0.6rem; }
  [data-component="pay"] img { width: 4.1rem; height: 1.9rem; object-fit: contain; background: #fff; }
  [data-slot="company.address"] { width: min(100% - 2rem, var(--measure)); margin: 1.2rem auto 0; color: var(--color-muted); font-size: 0.75rem; }
  button[data-intent="primary"] {
    height: 2.75rem;
    border: 0;
    background: var(--color-accent);
    color: var(--color-accent-ink);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 0 1rem;
    font-weight: 700;
    cursor: pointer;
  }
  :focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
  @media (max-width: 900px) {
    [data-component="header"] { grid-template-columns: 1fr; grid-template-areas: "brand" "phones" "search" "hours"; }
    [data-component="phones"] { justify-items: start; }
    [data-component="advantages"],
    [data-component="cards"],
    [data-component="payments"],
    [data-component="footer"] > div { grid-template-columns: 1fr 1fr; }
    [data-component="mosaic"] { grid-template-columns: 1fr; }
    [data-component="frame"] { grid-template-columns: 1fr; }
    [data-action="menu"],
    [data-action="catalog"] { display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 0.8rem; border: 0; background: transparent; font-weight: 700; cursor: pointer; }
    [data-component="nav"]:not([data-open]) [data-part="links"] { display: none; }
    [data-component="catalog"]:not([data-open]) [data-part="tree"] { display: none; }
  }
  @media (max-width: 560px) {
    [data-component="advantages"],
    [data-component="cards"],
    [data-component="payments"],
    [data-component="footer"] > div,
    [data-component="phones"] { grid-template-columns: 1fr; }
  }
}

@layer themes {
  [data-theme="shop"] {
    --font: Arial, "Segoe UI", sans-serif;
    --measure: 75rem;
    --aside: 16.5rem;
    --radius: 0.2rem;
    --slider-ratio: 3.15;
    --color-bg: #f3ecdf;
    --color-surface: #fffdf8;
    --color-ink: #241c14;
    --color-muted: #5e564c;
    --color-line: #e3d5bc;
    --color-accent: #8a5412;
    --color-accent-ink: #fffdf8;
    --color-nav: #f0c14d;
    --color-nav-ink: #241c14;
    --header-columns: minmax(12rem, auto) minmax(14rem, 1fr) auto;
    --header-areas: "brand search phones" "brand hours phones";
    --shadow: none;
  }
  [data-theme="y2026"] {
    --font: "Segoe UI", "Helvetica Neue", sans-serif;
    --measure: 70rem;
    --aside: 15rem;
    --radius: 1rem;
    --slider-ratio: 2.05;
    --color-bg: hsl(200 18% 96%);
    --color-surface: hsl(200 30% 99%);
    --color-ink: hsl(208 24% 16%);
    --color-muted: hsl(208 10% 38%);
    --color-line: hsl(200 16% 86%);
    --color-accent: hsl(200 46% 30%);
    --color-accent-ink: hsl(40 35% 97%);
    --color-nav: hsl(200 30% 99%);
    --color-nav-ink: hsl(208 24% 16%);
    --header-columns: 1fr auto;
    --header-areas: "brand phones" "search search" "hours hours";
    --shadow: 0 10px 28px hsl(208 24% 16% / 0.06);
  }
  [data-theme="y2026"] [data-component="nav"] { border-bottom: 1px solid var(--color-line); }
  [data-theme="y2026"] [data-component="nav"] a { text-transform: none; letter-spacing: 0; font-size: 0.95rem; }
  [data-theme="y2026"] [data-component="catalog"] { background: transparent; }
}
