/* ============================================================
   Цветовые темы сайта
   Тема ставится атрибутом data-theme на <html> (themes.js), без атрибута - терракота.
   Все цвета страницы идут через токены из styles.css, поэтому тема = набор переменных.
   Подключается ПОСЛЕ styles.css
   ============================================================ */

/* токены, которых не было в styles.css: шапка, тёмные блоки, текст на кнопке */
:root {
  --header-bg: rgba(251,246,241,.9);
  --ink: #2B2521;             /* фон блока «Доверие» и подвала */
  --on-ink: #FFFFFF;
  --on-ink-muted: #E7DFD6;
  --ink-soft-text: #C9BFB4;
  --on-accent: #FFFFFF;       /* текст на залитой кнопке */
  --danger: #A2432F;
  --glass: rgba(255,255,255,.62);
  color-scheme: light;
}

/* ---- Лаванда ---- */
html[data-theme="lavender"] {
  --bg: #F7F5FB;
  --surface: #FFFFFF;
  --surface-alt: #EEE9F7;
  --accent: #9C88CC;
  --accent-hover: #6B55A6;
  --accent-soft: #E3DBF3;
  --sage: #5F8A7A;
  --sage-soft: #E3EEE9;
  --gold: #C4A266;
  --text: #28233A;
  --text-muted: #66607C;
  --border: #E3DDEF;
  --header-bg: rgba(247,245,251,.9);
  --ink: #2D2743;
  --on-ink-muted: #DDD7EC;
  --ink-soft-text: #B7B0CB;
  --shadow-soft: 0 20px 40px -20px rgba(40,35,58,.2);
  --shadow-lift: 0 30px 60px -25px rgba(40,35,58,.3);
}

/* ---- Пудра (мягкая розовая) ---- */
html[data-theme="blush"] {
  --bg: #FDF7F7;
  --surface: #FFFFFF;
  --surface-alt: #F9E8EA;
  --accent: #D4949E;
  --accent-hover: #A94F63;
  --accent-soft: #F6DCE0;
  --sage: #6F8C74;
  --sage-soft: #E5EEE5;
  --gold: #C49A5E;
  --text: #3A2529;
  --text-muted: #7A5E63;
  --border: #F1DDE0;
  --header-bg: rgba(253,247,247,.9);
  --ink: #3B252B;
  --on-ink-muted: #EEDDE0;
  --ink-soft-text: #CDB5BA;
  --shadow-soft: 0 20px 40px -20px rgba(58,37,41,.18);
  --shadow-lift: 0 30px 60px -25px rgba(58,37,41,.28);
}

/* ---- Графит (тёмная) ---- */
html[data-theme="graphite"] {
  --bg: #1B1D20;
  --surface: #26292D;
  --surface-alt: #222529;
  --accent: #B99B6B;
  --accent-hover: #D8BA87;
  --accent-soft: #37332C;
  --sage: #A3B59C;
  --sage-soft: #2A302A;
  --gold: #D4B46F;
  --text: #EEEAE3;
  --text-muted: #A9A59E;
  --border: #373A3F;
  --header-bg: rgba(27,29,32,.86);
  --ink: #111214;
  --on-ink: #F4F1EC;
  --on-ink-muted: #CFCAC1;
  --ink-soft-text: #97928A;
  --on-accent: #1B1D20;
  --danger: #EE9A86;
  --glass: rgba(38,41,45,.72);
  --shadow-soft: 0 20px 40px -20px rgba(0,0,0,.6);
  --shadow-lift: 0 30px 60px -25px rgba(0,0,0,.75);
  color-scheme: dark;
}

/* ---- Песок ---- */
html[data-theme="sand"] {
  --bg: #FAF7F0;
  --surface: #FFFFFF;
  --surface-alt: #F2EBDB;
  --accent: #C4A574;
  --accent-hover: #8A6A3A;
  --accent-soft: #ECE1C9;
  --sage: #6E7F5C;
  --sage-soft: #E6EAD9;
  --gold: #B8904A;
  --text: #2E2921;
  --text-muted: #6C6453;
  --border: #E8DECA;
  --header-bg: rgba(250,247,240,.9);
  --ink: #37312A;
  --on-ink-muted: #E8E0D0;
  --ink-soft-text: #C3B9A6;
  --shadow-soft: 0 20px 40px -20px rgba(46,41,33,.18);
  --shadow-lift: 0 30px 60px -25px rgba(46,41,33,.28);
}

/* ---- места, где в styles.css цвет был зашит числом, переводим на токены ---- */
.site-header { background: var(--header-bg); }
.btn-primary, .call-fab { color: var(--on-accent); }
.skip-link { background: var(--ink); color: var(--on-ink); }
.trust { background: var(--ink); color: var(--on-ink); }
.trust h2 { color: var(--on-ink); }
.trust-grid span { color: var(--on-ink-muted); }
.site-footer { background: var(--ink); color: var(--ink-soft-text); }
/* в styles.css телефон в подвале красился var(--text) по фону var(--text) и сливался */
.footer-inner a, .footer-contacts a { color: var(--on-ink-muted); }
.footer-contacts a:hover { color: var(--gold); }
.form-status.err { color: var(--danger); }
html[data-theme="graphite"] .site-header.is-scrolled { box-shadow: 0 8px 24px -14px rgba(0,0,0,.7); }

/* ---- плавная смена темы там, где нет View Transitions (старые браузеры) ---- */
html.theme-fade, html.theme-fade *, html.theme-fade *::before, html.theme-fade *::after {
  transition: background-color .45s ease, color .45s ease, border-color .45s ease,
              fill .45s ease, stroke .45s ease, box-shadow .45s ease !important;
}
/* новая тема «опускается» сверху, как рулонная штора: анимация в themes.js */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { z-index: 2; }

/* ============================================================
   Переключатель тем: полоса между шапкой и плашкой «Своё производство»
   ============================================================ */
.theme-picker, .theme-picker-note { display: none; }
.js .theme-picker-wrap { max-width: 100%; margin: 0 0 14px; }
.hero { padding-top: 30px; }
.js .theme-picker-note {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 10px 0 0; padding: 10px 20px;
  background: var(--accent-soft); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px;
  font-size: 1rem; font-weight: 500; line-height: 1.3;
}
.theme-note-ico { width: 21px; height: 21px; flex: none; color: var(--accent-hover); }
.js .theme-picker {
  display: flex; align-items: center; gap: 14px;
  width: fit-content; max-width: 100%;
  margin: 0; padding: 6px 8px 6px 18px;
  position: relative; z-index: 3;
  background: var(--glass);
  border: 1px solid var(--border); border-radius: 999px;
  box-shadow: var(--shadow-soft);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  backdrop-filter: blur(10px) saturate(140%);
}
.theme-picker-label {
  margin: 0; line-height: 1.2;
  font-size: .76rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  color: var(--accent-hover); white-space: nowrap;
}
.theme-swatches { display: flex; gap: 4px; }
.theme-sw {
  -webkit-appearance: none; appearance: none; border: 0; background: none; margin: 0;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 4px 5px; border-radius: 16px; cursor: pointer;
  font: inherit; color: var(--text-muted);
  -webkit-tap-highlight-color: transparent;
}
.theme-sw:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 1px; }
.theme-sw-icon {
  width: 40px; height: 40px; border-radius: 13px;
  display: grid; place-items: center;
  background: var(--sw-bg);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.07), 0 6px 14px -8px rgba(0,0,0,.35);
  transition: transform .2s ease, box-shadow .2s ease;
}
.theme-sw-icon svg { width: 32px; height: 32px; display: block; }
.theme-sw-name { font-size: .7rem; font-weight: 600; line-height: 1; letter-spacing: .01em; }
.theme-sw:hover .theme-sw-icon { transform: translateY(-2px); }
.theme-sw[aria-checked="true"] .theme-sw-icon {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent-hover), 0 8px 18px -8px rgba(0,0,0,.4);
}
.theme-sw[aria-checked="true"] .theme-sw-name { color: var(--text); }

/* мини-окно с рулонной шторой: у выбранной темы штора опущена до подоконника */
.sw-win  { fill: var(--sw-glass); stroke: var(--sw-frame); stroke-width: 1.4; }
.sw-mull { stroke: var(--sw-frame); stroke-width: 1; opacity: .3; fill: none; }
.sw-cass, .sw-sill, .sw-bar { fill: var(--sw-frame); }
.sw-fabric {
  fill: var(--sw-fabric);
  transform-box: fill-box; transform-origin: 50% 0;
  transform: scaleY(.35);
  transition: transform .55s cubic-bezier(.3,.8,.3,1);
}
.sw-bar { transform: translateY(7px); transition: transform .55s cubic-bezier(.3,.8,.3,1); }
.theme-sw:hover .sw-fabric { transform: scaleY(.7); }
.theme-sw:hover .sw-bar { transform: translateY(14px); }
.theme-sw[aria-checked="true"] .sw-fabric { transform: scaleY(1); }
.theme-sw[aria-checked="true"] .sw-bar { transform: translateY(20px); }

@media (prefers-reduced-motion: reduce) {
  .sw-fabric, .sw-bar, .theme-sw-icon { transition: none; }
  .theme-sw:hover .theme-sw-icon { transform: none; }
}

/* мобильный: подпись сверху, пять иконок на всю ширину */
@media (max-width: 860px) {
  .hero { padding-top: 18px; }
  .js .theme-picker-wrap { width: 100%; margin-bottom: 22px; }
  .js .theme-picker {
    width: 100%; flex-direction: column; align-items: stretch; gap: 8px;
    padding: 10px 8px 8px; border-radius: 22px;
  }
  .js .theme-picker-note { display: flex; justify-content: center; margin: 10px 0 0; padding: 11px 16px; border-radius: 18px; font-size: .95rem; }
  .theme-picker-label { text-align: center; font-size: .7rem; }
  .theme-swatches { justify-content: space-between; gap: 0; }
  .theme-sw { flex: 1 1 0; min-width: 0; padding: 3px 0; }
  .theme-sw-name { font-size: .66rem; }
}
@media (max-width: 370px) {
  .theme-sw-icon { width: 42px; height: 42px; border-radius: 13px; }
  .theme-sw-icon svg { width: 32px; height: 32px; }
  .theme-sw-name { font-size: .6rem; }
}
