/* Общие цвета витрины и личного кабинета. Светлая тема сохраняет исходный дизайн. */
:root {
  color-scheme: light;
  --theme-bg: #fff;
  --theme-surface: #fff;
  --theme-raised: #f4f4f4;
  --theme-text: #111;
  --theme-muted: #666;
  --theme-border: #e5e5e5;
  --theme-hover: #999;
  --theme-action: #111;
  --theme-on-action: #fff;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --theme-bg: #111213;
  --theme-surface: #1b1c1e;
  --theme-raised: #282a2d;
  --theme-text: #ededed;
  --theme-muted: #b1b3b7;
  --theme-border: #414347;
  --theme-hover: #9b9da2;
  --theme-action: #ededed;
  --theme-on-action: #171819;
}
.site-controls { position:absolute; top:22px; right:22px; z-index:1000; display:flex; align-items:center; gap:8px; }
.site-controls .account-entry { position:static; }
.theme-toggle {
  position:relative; display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px;
  padding:0; box-sizing:border-box; border:1px solid var(--theme-border); border-radius:10px;
  background:var(--theme-surface); color:var(--theme-text); cursor:pointer; touch-action:manipulation;
}
.theme-toggle svg { position:absolute; width:21px; height:21px; fill:none; stroke:currentColor; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; }
.theme-toggle .theme-icon-sun { opacity:0; transform:rotate(-45deg) scale(.7); }
[data-theme="dark"] .theme-toggle .theme-icon-moon { opacity:0; transform:rotate(45deg) scale(.7); }
[data-theme="dark"] .theme-toggle .theme-icon-sun { opacity:1; transform:none; }
.theme-toggle:hover { border-color:var(--theme-hover); }
.theme-toggle:focus-visible { outline:2px solid var(--theme-text); outline-offset:4px; }
.reference-product-view .site-controls { display:none; }
.account-header-actions { display:flex; align-items:center; gap:16px; }
.account-header-actions>a { font-size:13px; text-decoration:none; color:var(--theme-muted); }

/* Локальные правила имеют приоритет над цветами экспортированных блоков. */
html[data-theme="dark"], [data-theme="dark"] body { background:var(--theme-bg); color:var(--theme-text); }
[data-theme="dark"] #allrecords .t-store__card__wrap_all,
[data-theme="dark"] #allrecords .t-rec,
[data-theme="dark"] #allrecords .t396__artboard,
[data-theme="dark"] #allrecords .t396__carrier,
[data-theme="dark"] #allrecords .t396__filter,
[data-theme="dark"] #allrecords [data-elem-type="shape"] .tn-atom { background-color:var(--theme-bg)!important; }
[data-theme="dark"] #allrecords,
[data-theme="dark"] #allrecords a,
[data-theme="dark"] #allrecords .tn-atom,
[data-theme="dark"] #allrecords .tn-atom :is(p,span,a,strong,b,em,h1,h2,h3),
[data-theme="dark"] #allrecords :is(.t-name,.t-descr,.t-text,.t-store__card__price-item,.t-store__card__sold-out-msg) { color:var(--theme-text)!important; }
[data-theme="dark"] :is(button,a,input,select,textarea):focus-visible { outline-color:var(--theme-text); }
[data-theme="dark"] .account-entry { background:var(--theme-surface); color:var(--theme-text); border-color:var(--theme-border); }
[data-theme="dark"] :is(.skip,.reference-product-popup,.reference-product-popup .t-popup__container,.reference-product-popup .t-popup__close,#image-zoom) { background:var(--theme-bg); color:var(--theme-text); }
[data-theme="dark"] .reference-product-popup :is(.t-store__prod-popup__close-txt,.t-product__option-select) { color:var(--theme-text); }
[data-theme="dark"] .reference-product-popup .t-popup__close-icon { fill:var(--theme-text); }
[data-theme="dark"] .reference-product-popup .t-popup__close-icon_cross path { stroke:var(--theme-text); }
[data-theme="dark"] .reference-product-popup .t-product__option-select { background-color:var(--theme-surface); border-color:var(--theme-border); }
[data-theme="dark"] .reference-product-popup .t-product__option-variants:after { border-top-color:var(--theme-text); }
[data-theme="dark"] #allrecords .t-store__prod-popup__btn { background:var(--theme-action)!important; color:var(--theme-on-action)!important; }
[data-theme="dark"] .reference-thumb[aria-pressed=true]::after { border-color:var(--theme-hover); }
[data-theme="dark"] .reference-gallery-arrow { background:#1b1c1ee6; color:var(--theme-text); }
[data-theme="dark"] .dolyame-preview { background:var(--theme-raised); color:var(--theme-text); }
[data-theme="dark"] .reference-menu { border-color:var(--theme-border); }

/* Корзина, увеличение фотографий и оформление. Изображения товаров не фильтруются. */
[data-theme="dark"] .bag-button { background:var(--theme-surface); color:var(--theme-text); box-shadow:0 0 10px #0006; }
[data-theme="dark"] .bag-button span { background:var(--theme-action); color:var(--theme-on-action); }
[data-theme="dark"] #bag { background:#0009; color:var(--theme-text); }
[data-theme="dark"] #bag :is(.t706__sidebar-content,.t706__cartpage-top,.t706__cartpage-totals,.t706__cartpage,.bag-head) { background:var(--theme-surface); color:var(--theme-text); }
[data-theme="dark"] #bag :is(.t-name,.t-descr,.t706__product-title,.t706__product-title a,.t706__product-plusminus,.t706__product-quantity,.t706__product-amount,.t706__cartwin-totalamount-wrap,.t706__cartwin-prodamount-wrap,.t706__cartpage-info,.t706__cartpage-info-item,.t706__cartpage-order-total,.t706__sidebar-prodamount-wrap) { color:var(--theme-text); }
[data-theme="dark"] #bag :is(.t706__sidebar-top,.t706__sidebar-products,.t706__cartwin-top,.t706__cartwin-bottom,.t706__cartpage-top,.t706__cartpage-totals,.bag-total) { border-color:var(--theme-border); }
[data-theme="dark"] #bag .t-btnflex.t-btnflex_type_button,
[data-theme="dark"] .bag-primary { background:var(--theme-action); color:var(--theme-on-action); }
[data-theme="dark"] #bag [class*="totalamount"] { color:var(--theme-text); }
[data-theme="dark"] #bag .t706__close-icon g { fill:var(--theme-text); }
[data-theme="dark"] #bag :is(.t706__product-minus,.t706__product-plus,.t706__product-del) { opacity:1; }
[data-theme="dark"] #bag :is(.t706__product-minus,.t706__product-plus,.t706__product-del) img { filter:invert(1); opacity:.7; }
[data-theme="dark"] :is(.icon-button,.bag-back,.bag-secondary) { color:var(--theme-text); }
[data-theme="dark"] .checkout-form :is(input,textarea,select) { background:var(--theme-raised); color:var(--theme-text); border-color:var(--theme-border); }
[data-theme="dark"] .form-error { color:#ffabab; }
[data-theme="dark"] .toast { background:var(--theme-action); color:var(--theme-on-action); }

/* Личный кабинет. */
[data-theme="dark"] .account-page { background:var(--theme-bg); color:var(--theme-text); }
[data-theme="dark"] .account-card { background:var(--theme-surface); border-color:var(--theme-border); }
[data-theme="dark"] :is(.account-muted,.account-eyebrow,.account-policy,.account-empty,.account-text-button,.account-identity small,.account-order-head small) { color:var(--theme-muted); }
[data-theme="dark"] .account-tabs { background:var(--theme-raised); }
[data-theme="dark"] .account-tabs button { color:var(--theme-muted); }
[data-theme="dark"] .account-tabs button[aria-selected=true] { background:var(--theme-surface); color:var(--theme-text); }
[data-theme="dark"] .account-form input { background:var(--theme-surface); color:var(--theme-text); border-color:var(--theme-border); }
[data-theme="dark"] .account-form input::placeholder { color:var(--theme-muted); }
[data-theme="dark"] .account-primary { background:var(--theme-action); color:var(--theme-on-action); border-color:var(--theme-action); }
[data-theme="dark"] .account-primary:hover:not(:disabled) { background:#ccc; }
[data-theme="dark"] .account-notice { background:var(--theme-raised); color:var(--theme-muted); }
[data-theme="dark"] :is(.account-identity,.account-order) { border-color:var(--theme-border); }
[data-theme="dark"] .account-error { color:#ffabab; }

/* Приглашение dx44. */
[data-theme="dark"] .dx44-promo { color:var(--theme-text); }
[data-theme="dark"] :is(.dx44-promo-trigger,.dx44-promo-panel) { background:var(--theme-surface); border-color:var(--theme-border); }
[data-theme="dark"] .dx44-promo-brand span:last-child { color:var(--theme-muted); }
[data-theme="dark"] :is(.dx44-promo-links,.dx44-promo-links a+a) { border-color:var(--theme-border); }
[data-theme="dark"] .dx44-promo-links a { color:var(--theme-text); }
[data-theme="dark"] .dx44-promo-links a:hover { color:var(--theme-muted); }
@media(max-width:600px) {
  .site-controls { top:16px; right:16px; }
  .storefront #reference-header { padding-top:60px; }
  .account-header-actions { gap:10px; }
  .account-header-actions>a { max-width:80px; font-size:11px; text-align:right; }
}
@media(max-width:479px) {
  .storefront:not(.reference-product-view) .bag-button { top:76px; right:16px; }
}
@media(prefers-reduced-motion:no-preference) {
  .theme-toggle { transition:background-color .18s ease,border-color .18s ease; }
  .theme-toggle svg { transition:opacity .18s ease,transform .18s ease; }
}

/* Текстовые настройки по краям оригинальной навигации. */
.storefront .site-controls-text {
  top:33.8px; right:auto; left:0; width:100%; height:44px;
  display:block; pointer-events:none;
}
.site-controls-text > a[data-route] { display:none; }
.site-controls-text :is(.theme-toggle,.site-control-link) {
  display:inline-flex; align-items:center; justify-content:center;
  flex:0 0 auto; width:auto; height:auto; min-width:44px; min-height:44px;
  padding:0 4px; border:0; border-radius:0; background:transparent;
  color:#000; font:400 12px/1.55 Roboto,Arial,sans-serif;
  text-decoration:none; white-space:nowrap; pointer-events:auto;
  /* Как у ссылок «наличие» и «история»: то же сглаживание, иначе текст кажется жирнее. */
  -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale;
}
[data-theme="dark"] .site-controls-text :is(.theme-toggle,.site-control-link) { color:var(--theme-text); }
.site-controls-text .theme-toggle { position:absolute; top:0; right:calc(50% + 304px); }
.site-controls-text .site-account-link { position:absolute; top:0; left:calc(50% + 368px); }
.site-controls-text :is(.theme-toggle,.site-control-link):hover { text-decoration:underline; text-underline-offset:3px; }
.site-controls-text .site-control-link:focus-visible { outline:2px solid var(--theme-text); outline-offset:4px; }
@media (min-width:960px) and (max-width:1199px) {
  .site-controls-text .site-account-link { left:calc(50% + 304px); }
}
@media (max-width:959px) {
  .storefront .site-controls-text {
    top:125px; left:50%; transform:translateX(-50%); display:flex;
    justify-content:space-between; width:min(430px,calc(100% - 32px)); gap:8px;
  }
  .site-controls-text :is(.theme-toggle,.site-control-link) { position:static; padding:0; }
  .site-controls-text > a[data-route] { display:inline-flex; }
  .storefront #reference-header .tn-elem:is([data-elem-id="1741910240089"],[data-elem-id="1741910289953"]) { display:none!important; }
}
@media (min-width:601px) and (max-width:639px) {
  .storefront .site-controls-text { top:95px; }
}
@media (max-width:600px) {
  .storefront .site-controls-text { top:145px; }
}
@media (max-width:479px) {
  .storefront .site-controls-text { top:158.5px; }
}
.reference-product-view .site-controls-text { display:none; }

/* Исходная картинка и размеры значка корзины Тильды. */
.storefront .bag-button {
  display:block; width:60px; height:60px; padding:0;
  background:transparent; border-radius:0; box-shadow:none;
}
.storefront .bag-button .cart-original-image {
  display:block; width:60px; height:60px; max-width:none;
  border-radius:50px; object-fit:cover; transition:transform .2s ease-in-out;
}
.storefront .bag-button:hover .cart-original-image { transform:scale(1.1); }
.storefront .bag-button #bag-count {
  right:-6px; bottom:-6px; width:auto; min-width:24px; height:24px;
  padding:0 5px; box-sizing:border-box; border-radius:30px; text-align:center;
  background:var(--theme-bg); color:var(--theme-text);
  font:400 14px/24px Arial,Helvetica,sans-serif;
}
[data-theme="dark"] .bag-button .cart-original-image { filter:invert(1); }
@media (prefers-reduced-motion:reduce) {
  .storefront .bag-button .cart-original-image { transition:none; }
  .storefront .bag-button:hover .cart-original-image { transform:none; }
}

/* Пока витрина собирается, служебные кнопки не появляются в случайных местах. */
:is(.site-controls,#dx44-promo,#open-bag,#reference-footer) { transition:opacity .45s ease-out, visibility 0s; }
.is-booting :is(.site-controls,#dx44-promo,#open-bag,#reference-footer) { visibility:hidden; opacity:0; transition:none; }
/* Надпись о загрузке видна, только если сборка заметно затянулась. */
.is-booting #main .loading { opacity:0; animation:hiki-loading-in .3s ease-out 1.2s forwards; }
@keyframes hiki-loading-in { to { opacity:1; } }
@media (prefers-reduced-motion:reduce) { .is-booting #main .loading { animation-duration:.01s; } }

/* Смена темы раскрывается кругом от кнопки (theme.js), стандартное перетекание отключено. */
.hk-theme-switch::view-transition-old(root), .hk-theme-switch::view-transition-new(root) { animation:none; mix-blend-mode:normal; }
.hk-theme-switch::view-transition-new(root) { z-index:2; }

/* Шапка Тильды на ширине от 1200px стоит на 33px правее центра: выравниваем её по сетке витрины. */
@media (min-width:1200px) {
  .storefront #reference-header .t396__elem { translate:-33px 0; }
  .site-controls-text .theme-toggle { right:calc(50% + 337px); }
  .site-controls-text .site-account-link { left:calc(50% + 335px); }
}

/* Короткие страницы (статус заказа, 404): кот и подвал прижаты к низу окна, а не висят посередине. */
.storefront #allrecords { display:flex; flex-direction:column; min-height:100vh; min-height:100dvh; }
.storefront #allrecords > #main { flex:1 0 auto; }
/* Цвета, перенесённые из встроенных стилей старой вёрстки: в тёмной теме белые фоны и чёрный текст заменяются цветами темы. */
[data-theme="dark"] :is(.ref-inline-e4aa2bab5b57,.ref-inline-d921ae505960,.ref-inline-4735a41a539e,.ref-inline-871380f3f86a,.ref-inline-016355610105,.ref-inline-d2147bc21f6c,.ref-inline-39e31c56d51c):not(#reference-inline-sentinel) { background-color:var(--theme-bg); }
[data-theme="dark"] .ref-inline-5fb8d6df9da1:not(#reference-inline-sentinel) { background-image:none; background-color:var(--theme-bg); }
[data-theme="dark"] :is(.ref-inline-1aca33464152,.ref-inline-6dbfd3ffaea3,.ref-inline-ff4489b7e523):not(#reference-inline-sentinel) { color:var(--theme-text); }
[data-theme="dark"] .reference-product-popup .t-product__option-select option:disabled { color:#6b6b6b; }
