/* kult. — техкарты брендов. Швейцарская сетка × космический минимализм.
   Уровень kult.: розовый на чёрном / чёрный на белом. Внутри бренда цвета строятся от цвета его логотипа (app.js → brandPalette). */

@font-face { font-family: 'Onest'; font-style: normal; font-weight: 300 800; font-display: swap;
  src: url(/fonts/onest-cyr.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Onest'; font-style: normal; font-weight: 300 800; font-display: swap;
  src: url(/fonts/onest-lat.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400 500; font-display: swap;
  src: url(/fonts/jbmono-cyr.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400 500; font-display: swap;
  src: url(/fonts/jbmono-lat.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+2212; }

:root {
  --scale: 1;
  --font: 'Onest', 'Helvetica Neue', Helvetica, Arial, system-ui, sans-serif;
  --kult-pink: #FF8FD2;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --r: 18px;
  --r-sm: 12px;
  --gutter: clamp(16px, 3.2vw, 40px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --top: calc(var(--safe-top) + 64px);
  --catbar: 52px;
}
/* Режим «внутри рамки устройства» на странице превью */
html[data-frame] { scrollbar-width: none; }
html[data-frame] ::-webkit-scrollbar { display: none; }
html[data-frame="iphone"] { --safe-top: 54px; --safe-bottom: 24px; }
html[data-frame="android"] { --safe-top: 32px; }

:root[data-theme="dark"] {
  --bg: #050505;
  --bg-2: #0D0D0D;
  --surface: #131313;
  --surface-2: #1B1B1B;
  --line: rgba(255, 255, 255, .09);
  --line-2: rgba(255, 255, 255, .16);
  --text: #F5F5F5;
  --muted: #8F8F8F;
  --faint: #575757;
  --accent: #FF8FD2;
  --accent-ink: #050505;
  --accent-soft: rgba(255, 143, 210, .14);
  --mark: #FF8FD2;
  --heart: #FF5A4E;
  --glass: rgba(5, 5, 5, .72);
  --shadow: 0 24px 60px -20px rgba(0, 0, 0, .7);
  --img-bg: #171717;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #FFFFFF;
  --bg-2: #F4F4F4;
  --surface: #FFFFFF;
  --surface-2: #F7F7F7;
  --line: rgba(0, 0, 0, .08);
  --line-2: rgba(0, 0, 0, .15);
  --text: #000000;
  --muted: #6B6B6B;
  --faint: #ADADAD;
  --accent: #F2349D;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(242, 52, 157, .09);
  --mark: #000000;
  --heart: #E5392D;
  --glass: rgba(255, 255, 255, .8);
  --shadow: 0 24px 50px -24px rgba(0, 0, 0, .22);
  --img-bg: #EFEFEF;
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: calc(16px * var(--scale)); -webkit-text-size-adjust: 100%; scroll-behavior: auto; scrollbar-gutter: stable; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.mono { font-family: var(--mono); font-size: .75rem; letter-spacing: .02em; }
.label { font-family: var(--mono); font-size: .6875rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
::selection { background: var(--accent); color: var(--accent-ink); }

/* ---------- Космос: орбиты на фоне ---------- */
.cosmos { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.cosmos::before {
  content: ''; position: absolute; inset: -20% -10% auto auto; width: 70vmax; height: 70vmax; border-radius: 50%;
  background: radial-gradient(closest-side, var(--accent-soft), transparent 70%);
  opacity: .9;
}
.orbit { position: absolute; right: -28vmax; top: -18vmax; width: 90vmax; height: 90vmax; opacity: .5;
  transform: rotate(-24deg); }
.orbit ellipse { stroke: var(--line-2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.orbit .planet { fill: var(--accent); stroke: none; }
@keyframes orbit-drift { to { transform: rotate(336deg); } }
@media (prefers-reduced-motion: reduce) { .orbit { animation: none; } }

/* ---------- Верхняя панель ----------
   Сетка шапки неизменна на всех экранах: логотип всегда по центру и никогда не сдвигается.
   Кнопка «назад», заголовок и лента категорий только плавно проявляются на своих местах. */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 40;
  padding-top: var(--safe-top);
  background: var(--glass);
  backdrop-filter: saturate(160%) blur(20px); -webkit-backdrop-filter: saturate(160%) blur(20px);
  box-shadow: 0 1px 0 transparent;
  transition: box-shadow .3s var(--ease);
}
body.scrolled:is([data-route="home"], [data-route="fav"], [data-route="brand"]) .topbar { box-shadow: 0 1px 0 var(--line); }
.topbar-inner {
  height: 64px; display: grid; grid-template-columns: 1fr minmax(0, auto) 1fr; align-items: center; gap: 8px;
  padding: 0 calc(var(--gutter) - 10px);
  max-width: 1600px; margin: 0 auto;
}
.tb-left { display: flex; }
.back {
  transition: opacity .3s var(--ease), transform .45s var(--ease-out), background-color .2s;
}
body[data-route="home"] .back { opacity: 0; transform: translateX(-8px); pointer-events: none; }

.tb-center { position: relative; display: grid; place-items: center; min-width: 0; max-width: min(56vw, 520px);
  -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.tb-center > * { grid-area: 1 / 1; }
/* Центр шапки: три слоя в одной ячейке — «kult.», бренд, заголовок. Меняются только прозрачностью. */
.tb-layer {
  display: flex; align-items: center; gap: 10px; max-width: 100%; min-width: 0;
  transition: opacity .35s var(--ease), transform .5s var(--ease-out);
}
.tb-layer.off { opacity: 0; transform: translateY(6px); pointer-events: none; }
.wordmark { font-weight: 800; font-size: 1.5rem; letter-spacing: -.06em; line-height: 1; color: var(--mark); transition: color .4s var(--ease); }
.wordmark.big { font-size: clamp(4rem, 15vw, 12rem); letter-spacing: -.075em; }
.brand-mark { height: 26px; max-width: 44px; object-fit: contain; }
.brand-name { font-weight: 700; font-size: 1.0625rem; letter-spacing: -.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title {
  max-width: 100%; font-weight: 600; font-size: 1.0625rem; letter-spacing: -.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; pointer-events: none;
}
.topbar-actions { display: flex; gap: 2px; justify-content: flex-end; }

.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%;
  position: relative; transition: background-color .2s, transform .2s var(--ease);
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { background: var(--line); }
.icon-btn:active { transform: scale(.92); }
.badge {
  position: absolute; top: 6px; right: 5px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink); font: 600 .625rem/17px var(--mono); text-align: center;
}
.text-btn { font-weight: 600; color: var(--accent); padding: 10px 12px; border-radius: 10px; font-size: .9375rem; }
.text-btn:active { opacity: .6; }

/* Лента категорий — отдельная полоса под шапкой, всегда одной высоты */
.catbar {
  position: fixed; left: 0; right: 0; top: var(--top); z-index: 39; height: var(--catbar);
  background: var(--glass);
  backdrop-filter: saturate(160%) blur(20px); -webkit-backdrop-filter: saturate(160%) blur(20px);
  box-shadow: 0 1px 0 transparent;
  transition: opacity .3s var(--ease), transform .45s var(--ease-out), box-shadow .3s var(--ease), visibility 0s;
}
body:is([data-route="home"], [data-route="fav"], [data-route="brand"]) .catbar {
  opacity: 0; transform: translateY(-10px); pointer-events: none; visibility: hidden;
  transition: opacity .25s var(--ease), transform .35s var(--ease), visibility 0s .35s;
}
body.scrolled .catbar { box-shadow: 0 1px 0 var(--line); }
.catbar-track {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; height: 100%; align-items: flex-start;
  padding: 2px var(--gutter) 0; max-width: 1600px; margin: 0 auto;
  scroll-padding-inline: var(--gutter);
}
.catbar-track::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 36px; padding: 0 14px; border-radius: 18px;
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line-2); font-size: .875rem; font-weight: 500; white-space: nowrap;
  transition: background-color .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease);
}
.chip i { font-style: normal; font-family: var(--mono); font-size: .6875rem; color: var(--muted); transition: color .3s var(--ease); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip.active i { color: inherit; opacity: .6; }
@media (hover: hover) { .chip:not(.active):hover { border-color: var(--muted); } }

/* ---------- Контент ---------- */
.view {
  position: relative; z-index: 1;
  max-width: 1600px; margin: 0 auto;
  padding: calc(var(--top) + 8px) var(--gutter) calc(var(--safe-bottom) + 48px);
  min-height: 100dvh;
}
body[data-route="cat"] .view { padding-top: calc(var(--top) + var(--catbar)); }
body[data-route="dish"] .view { padding-top: calc(var(--top) + var(--catbar) + 12px); }

.enter > * { animation: rise .6s var(--ease-out) backwards; }
.enter > *:nth-child(2) { animation-delay: .04s; }
.enter > *:nth-child(3) { animation-delay: .08s; }
.enter > *:nth-child(4) { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.back-enter > * { animation: fade .35s var(--ease) both; }
@keyframes fade { from { opacity: 0; } }

/* Крупный заголовок страницы */
.hero { padding: clamp(20px, 6vw, 72px) 0 clamp(24px, 4vw, 44px); display: grid; gap: 18px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.hero-meta span { display: inline-flex; gap: 8px; align-items: center; }
.hero-meta .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.hero-meta .dot.off { background: var(--faint); box-shadow: none; }
.display {
  font-size: clamp(3.25rem, 11vw, 9.5rem); font-weight: 700; line-height: .86; letter-spacing: -.055em;
  margin-left: -.04em;
}
.display small { display: block; font-size: .28em; letter-spacing: -.03em; line-height: 1.1; font-weight: 500; color: var(--muted); margin-top: .5em; }
.page-title { font-size: clamp(2.25rem, 7vw, 5.5rem); font-weight: 700; letter-spacing: -.05em; line-height: .92; margin-left: -.03em; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: clamp(8px, 3vw, 32px) 0 clamp(20px, 3vw, 36px); border-bottom: 1px solid var(--line); margin-bottom: clamp(20px, 3vw, 32px); }
.page-head .label { white-space: nowrap; padding-bottom: .5em; }

/* ---------- Плитки брендов (уровень kult.) ---------- */
.brands { display: grid; gap: clamp(12px, 1.6vw, 20px); grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.brand-tile {
  position: relative; overflow: hidden; border-radius: calc(var(--r) + 6px); aspect-ratio: 4 / 3;
  background: var(--tile); color: #fff; display: grid; grid-template-rows: 1fr auto;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: transform .6s var(--ease-out), box-shadow .6s var(--ease-out);
}
.brand-tile::before {
  content: ''; position: absolute; inset: -30% -30% auto auto; width: 90%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--tile-accent) 30%, transparent), transparent 70%);
  transition: transform 1.2s var(--ease-out), opacity .6s;
}
.brand-tile .logo { display: grid; place-items: center; padding: 12% 20% 0; position: relative; }
.brand-tile .logo img { max-width: 100%; max-height: 110px; object-fit: contain; transition: transform .8s var(--ease-out); }
.brand-tile .logo .letter { font-size: 5rem; font-weight: 800; letter-spacing: -.06em; color: var(--tile-accent); }
.brand-tile .meta { position: relative; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 18px 20px 20px; }
.brand-tile .meta b { font-size: 1.5rem; font-weight: 700; letter-spacing: -.04em; line-height: 1; }
.brand-tile .meta span { font-family: var(--mono); font-size: .6875rem; letter-spacing: .08em; text-transform: uppercase; opacity: .6; text-align: right; }
.brand-tile .meta i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--tile-accent); margin-right: 8px; vertical-align: .15em; }
@media (hover: hover) {
  .brand-tile:hover { transform: translateY(-3px); box-shadow: inset 0 0 0 1px var(--line-2), 0 30px 60px -30px rgba(0,0,0,.6); }
  .brand-tile:hover::before { transform: scale(1.15); }
  .brand-tile:hover .logo img { transform: scale(1.04); }
}
.brand-tile:active { transform: scale(.985); transition-duration: .2s; }

/* Шапка экрана бренда */
.brand-hero { display: flex; align-items: center; gap: clamp(16px, 3vw, 32px); }
.brand-hero .logo-box { width: clamp(72px, 12vw, 132px); aspect-ratio: 1; border-radius: 28%; display: grid; place-items: center; background: var(--tile); flex: none; }
.brand-hero .logo-box img { width: 70%; height: 70%; object-fit: contain; }
.brand-hero .logo-box .letter { font-size: 3rem; font-weight: 800; color: var(--accent); }

/* Сетка категорий */
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 1px; background: var(--line); border-block: 1px solid var(--line); }
@media (max-width: 599px) { .cats { grid-template-columns: 1fr; } }
.cat {
  position: relative; background: var(--bg); padding: 20px 0; display: grid;
  grid-template-columns: 2.5rem 1fr auto; align-items: center; gap: 4px 16px;
  transition: background-color .3s var(--ease);
}
@media (min-width: 600px) { .cat { padding: 22px 22px 22px 0; } .cats .cat:nth-child(n) { padding-left: 22px; } }
.cat-num { font-family: var(--mono); font-size: .75rem; color: var(--faint); align-self: start; padding-top: .35rem; }
.cat-title { font-size: clamp(1.375rem, 2.4vw, 1.75rem); font-weight: 600; letter-spacing: -.035em; line-height: 1.05; }
.cat-count { grid-column: 2; font-family: var(--mono); font-size: .75rem; color: var(--muted); }
.cat-thumbs { grid-row: 1 / span 2; grid-column: 3; display: flex; }
.cat-thumbs img {
  width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--img-bg);
  border: 2px solid var(--bg); margin-left: -20px;
  position: relative; transform: translateX(0);
  transition: transform .7s var(--ease-out), border-color .45s var(--ease);
}
/* Явный порядок слоёв: каждая следующая миниатюра лежит поверх предыдущей — и в покое, и при наведении */
.cat-thumbs img:nth-child(1) { z-index: 1; }
.cat-thumbs img:nth-child(2) { z-index: 2; }
.cat-thumbs img:nth-child(3) { z-index: 3; }
.cat-thumbs img:first-child { margin-left: 0; }
/* Веер миниатюр — только transform, чтобы соседний текст не перестраивался */
@media (hover: hover) {
  .cat:hover .cat-thumbs img { border-color: var(--bg-2); }
  .cat:hover .cat-thumbs img:nth-child(1) { transform: translateX(-20px); }
  .cat:hover .cat-thumbs img:nth-child(2) { transform: translateX(-8px); }
}
.cat:active { background: var(--surface); }
@media (hover: hover) { .cat:hover { background: var(--bg-2); } }
.cat { transition: background-color .45s var(--ease); }

.home-foot { display: flex; justify-content: space-between; gap: 16px; padding-top: 28px; }

/* Сетка блюд */
.dishes { display: grid; gap: clamp(14px, 2vw, 28px) clamp(12px, 1.6vw, 22px); grid-template-columns: repeat(auto-fill, minmax(min(46%, 220px), 1fr)); }
@media (min-width: 1100px) { .dishes { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); } }
.dish { display: flex; flex-direction: column; gap: 12px; position: relative;
  /* плитки за пределами экрана не отрисовываются, пока до них не долистали */
  content-visibility: auto; contain-intrinsic-size: auto 320px; }
.dish-img {
  transition: transform .45s var(--ease-out);
  position: relative; aspect-ratio: 1; border-radius: var(--r); overflow: hidden; background: var(--img-bg);
}
.dish-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease-out), opacity .6s var(--ease); opacity: 0; }
.dish-img img.loaded { opacity: 1; }
@media (hover: hover) { .dish:hover .dish-img img { transform: scale(1.045); } }
.dish:active .dish-img { transform: scale(.985); transition-duration: .15s; }
.dish-img .noimg { position: absolute; inset: 0; display: grid; place-items: center; }
.dish-img .noimg img { width: 40%; opacity: .18 !important; object-fit: contain; }
.dish-fav { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0,0,0,.55); color: #fff; }
.dish-fav svg { width: 15px; height: 15px; fill: var(--heart); stroke: var(--heart); }
.dish-idx { position: absolute; left: 12px; top: 12px; font-family: var(--mono); font-size: .6875rem; color: #fff;
  background: rgba(0,0,0,.55); padding: 3px 7px; border-radius: 6px; }
.dish-name { font-size: clamp(1rem, 1.3vw, 1.125rem); font-weight: 600; letter-spacing: -.02em; line-height: 1.2; padding-right: 8px; }
.dish-meta { display: flex; gap: 10px; margin-top: -6px; }
.dish-meta .mono { color: var(--muted); }
.dish-meta .cat-tag { color: var(--accent); }

/* ---------- Карточка блюда ---------- */
.detail { display: grid; gap: clamp(24px, 4vw, 56px); }
.detail-media { position: relative; }
@media (min-width: 700px) {
  .detail { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
  .detail-media { position: sticky; top: calc(var(--top) + var(--catbar) + 12px); }
}
.detail-photo {
  aspect-ratio: 1; border-radius: calc(var(--r) + 6px); overflow: hidden; background: var(--img-bg); cursor: zoom-in;
  box-shadow: var(--shadow);
}
.detail-photo img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 599px) {
  .detail-media { margin: 0 calc(var(--gutter) * -1); }
  .detail-photo { border-radius: 0; box-shadow: none; }
}
.photo-actions { position: absolute; right: 14px; bottom: 14px; display: flex; gap: 8px; }
.round-btn {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(10, 11, 10, .5); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); color: #fff;
  transition: transform .25s var(--ease), background-color .25s;
}
.round-btn svg { width: 22px; height: 22px; }
.round-btn:active { transform: scale(.9); }
.round-btn.on svg { fill: var(--heart); stroke: var(--heart); animation: pop .45s var(--ease-out); }
@keyframes pop { 40% { transform: scale(1.3); } }

.detail-info { display: grid; gap: clamp(28px, 4vw, 44px); min-width: 0; }
.detail-head { display: grid; gap: 14px; }
.detail-crumbs { display: flex; gap: 10px; align-items: center; }
.detail-crumbs a { color: var(--accent); }
.detail-name { font-size: clamp(2.25rem, 5.4vw, 4.25rem); font-weight: 700; letter-spacing: -.05em; line-height: .95; margin-left: -.03em; overflow-wrap: anywhere; }
.detail-desc { color: var(--muted); font-size: 1.0625rem; line-height: 1.45; max-width: 52ch; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); border-block: 1px solid var(--line); }
.stat { padding: 16px 0; display: grid; gap: 6px; }
.stat + .stat { border-left: 1px solid var(--line); padding-left: 18px; }
.stat b { font-size: 1.625rem; font-weight: 600; letter-spacing: -.03em; line-height: 1; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section-head h2 { font-size: 1.375rem; letter-spacing: -.03em; font-weight: 600; }

.ing { list-style: none; border-top: 1px solid var(--line); }
.ing li { display: flex; align-items: baseline; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 1.0625rem; line-height: 1.3; }
.ing li .n { flex: 1; }
.ing li .q { font-family: var(--mono); font-size: .9375rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ing li.note { color: var(--muted); font-size: .9375rem; }
.ing li.link { cursor: pointer; }
.ing li.link .n { color: var(--accent); display: inline-flex; align-items: center; gap: 8px; }
.ing li.link .n::after { content: '→'; font-family: var(--mono); font-size: .8em; transition: transform .3s var(--ease-out); }
.ing li.link:hover .n::after { transform: translateX(4px); }
.ing li .n b { font-weight: 600; }

.recipe { font-size: 1.0625rem; line-height: 1.6; display: grid; gap: .9em; max-width: 64ch; }
.recipe b { font-weight: 650; color: var(--text); background: var(--accent-soft); padding: 0 .2em; border-radius: 4px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }

.steps { list-style: none; border-top: 1px solid var(--line); }
.steps li { display: grid; grid-template-columns: 2.5rem 1fr; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.step-n { font-family: var(--mono); font-size: .8125rem; color: var(--accent); padding-top: .2em; }
.steps li > div { display: grid; gap: 4px; }
.step-label { font-family: var(--mono); font-size: .6875rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

.pager { display: grid; grid-template-columns: 1fr 1fr; border-block: 1px solid var(--line); margin-top: 8px; }
.pager a { padding: 18px 0; display: grid; gap: 6px; min-width: 0; }
.pager a + a { border-left: 1px solid var(--line); }
.pager a.next { grid-column: 2; text-align: right; padding-left: 16px; }
.pager a.prev { padding-right: 16px; }
.pager a span:last-child { font-weight: 600; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pager a:active { opacity: .6; }

/* ---------- Пусто / загрузка ---------- */
.empty { padding: 80px 0; text-align: center; display: grid; gap: 14px; justify-items: center; color: var(--muted); }
.empty img { width: 90px; opacity: .35; }
.empty h3 { color: var(--text); font-size: 1.375rem; letter-spacing: -.03em; font-weight: 600; }
.skeleton { background: linear-gradient(90deg, var(--surface) 0, var(--surface-2) 40%, var(--surface) 80%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--r); }
@keyframes shimmer { to { background-position: -200% 0; } }
.loader { display: grid; place-items: center; min-height: 60dvh; gap: 18px; }
.loader-orbit { width: 72px; height: 72px; position: relative; border-radius: 50%; border: 1px solid var(--line-2); }
.loader-orbit::after { content: ''; position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); top: -4px; left: calc(50% - 4px); transform-origin: 4px 40px; animation: spin 1.2s var(--ease) infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Поиск ---------- */
.search { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column; animation: fade .25s var(--ease); }
.search-head { display: flex; align-items: center; gap: 12px; padding: calc(var(--safe-top) + 12px) calc(var(--gutter) - 8px) 12px var(--gutter); border-bottom: 1px solid var(--line); max-width: 1600px; width: 100%; margin: 0 auto; }
.search-ico { width: 22px; height: 22px; color: var(--muted); flex: none; }
.search input { flex: 1; min-width: 0; height: 48px; border: 0; outline: 0; background: none; color: var(--text); font: 500 clamp(1.25rem, 3vw, 1.75rem) var(--font); letter-spacing: -.03em; }
.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { display: none; }
.search-body { flex: 1; overflow-y: auto; padding: 20px var(--gutter) 60px; max-width: 1600px; width: 100%; margin: 0 auto; -webkit-overflow-scrolling: touch; }
.hit { display: grid; grid-template-columns: 56px 1fr auto; gap: 16px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); animation: rise .4s var(--ease-out) backwards; }
.hit img, .hit .ph { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; background: var(--img-bg); }
.hit b { display: block; font-weight: 600; letter-spacing: -.02em; font-size: 1.0625rem; }
.hit small { color: var(--muted); font-size: .875rem; }
.hit mark { background: var(--accent-soft); color: var(--accent); border-radius: 3px; }
.hit .mono { color: var(--muted); }
.search-hint { color: var(--muted); display: grid; gap: 12px; }
.search-hint .chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Нижний лист (настройки) ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.45); animation: fade .3s var(--ease); }
.sheet {
  position: fixed; z-index: 71; left: 50%; bottom: 0; width: min(560px, 100%); transform: translateX(-50%);
  background: var(--surface); border-radius: 24px 24px 0 0; padding: 8px 22px calc(var(--safe-bottom) + 22px);
  box-shadow: 0 -20px 60px rgba(0,0,0,.35); animation: sheet-in .5s var(--ease-out);
}
@keyframes sheet-in { from { transform: translate(-50%, 100%); } }
.sheet.closing { animation: sheet-out .3s var(--ease) forwards; }
@keyframes sheet-out { to { transform: translate(-50%, 100%); } }
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 4px auto 8px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); font-weight: 500; }
.setting small { display: block; color: var(--muted); font-weight: 400; font-size: .8125rem; margin-top: 2px; }
.seg { display: flex; background: var(--bg-2); border-radius: 12px; padding: 3px; }
.seg button { padding: 8px 12px; border-radius: 9px; font-size: .875rem; font-weight: 500; color: var(--muted); transition: all .25s var(--ease); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
:root[data-theme="dark"] .seg button.on { background: var(--surface-2); }
.switch { width: 52px; height: 32px; border-radius: 16px; background: var(--line-2); position: relative; transition: background-color .3s var(--ease); flex: none; }
.switch i { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform .35s var(--ease-out); box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"] i { transform: translateX(20px); }
.meta-row { color: var(--muted); }

/* ---------- Лайтбокс ---------- */
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,0); display: grid; place-items: center; touch-action: none; overflow: hidden; transition: background-color .38s var(--ease); cursor: zoom-out; }
.lightbox.shown { background: rgba(0,0,0,.94); }
.lightbox-close { opacity: 0; transition: opacity .3s var(--ease); }
.lightbox.shown .lightbox-close { opacity: 1; }
.lightbox img { max-width: 100vw; max-height: 100dvh; object-fit: contain; transform-origin: 0 0; will-change: transform; user-select: none; -webkit-user-drag: none; }
.lightbox-close { position: absolute; top: calc(var(--safe-top) + 12px); right: 12px; color: #fff; background: rgba(255,255,255,.1); }

/* ---------- Тост ---------- */
.toast {
  position: fixed; z-index: 90; left: 50%; bottom: calc(var(--safe-bottom) + 20px);
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 500; font-size: .9375rem;
  display: flex; gap: 10px; align-items: center; box-shadow: var(--shadow);
  transition: opacity .35s var(--ease), transform .5s var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* ---------- Экран кода доступа ---------- */
.gate { min-height: 70dvh; display: grid; place-content: center; gap: 22px; text-align: center; justify-items: center; }
.gate img { width: 88px; }
.gate h1 { font-size: 2rem; letter-spacing: -.04em; }
.gate form { display: flex; gap: 8px; }
.gate input { height: 52px; width: 220px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: 500 1.25rem var(--mono); text-align: center; letter-spacing: .3em; outline: none; }
.gate input:focus { border-color: var(--accent); }
.gate button { height: 52px; padding: 0 22px; border-radius: 14px; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.gate .err { color: var(--heart); min-height: 1.2em; }

/* View Transitions — плавные переходы между экранами.
   Старый экран быстро гаснет на месте, новый мягко всплывает. Фото блюда «перетекает» из плитки в карточку и обратно.
   Шапка и лента категорий живые и меняются только своими мягкими анимациями — логотип не двигается. */
@view-transition { navigation: none; }
::view-transition-old(root) { animation: vt-out .22s var(--ease) both; }
::view-transition-new(root) { animation: vt-in .5s var(--ease-out) both; }
html.vt-back::view-transition-new(root) { animation-name: vt-in-back; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(14px); } }
@keyframes vt-in-back { from { opacity: 0; transform: translateY(-8px); } }
::view-transition-group(hero) { animation-duration: .55s; animation-timing-function: cubic-bezier(.2, .9, .1, 1); z-index: 5; }
::view-transition-old(hero), ::view-transition-new(hero) { animation-duration: .55s; height: 100%; object-fit: cover; }
.topbar { view-transition-name: topbar; }
.catbar { view-transition-name: catbar; }
.cosmos { view-transition-name: cosmos; }
::view-transition-group(topbar), ::view-transition-group(catbar), ::view-transition-group(cosmos) { animation: none; }
::view-transition-old(topbar), ::view-transition-old(catbar), ::view-transition-old(cosmos) { display: none; }
::view-transition-new(topbar), ::view-transition-new(catbar), ::view-transition-new(cosmos) { animation: none; }

/* Смена темы: весь экран — один непрозрачный снимок, новый вид мягко проявляется поверх старого.
   Шапку и ленту отдельно не снимаем: полупрозрачные копии накладывались и в конце «дёргались». */
html.vt-theme .topbar, html.vt-theme .catbar, html.vt-theme .cosmos { view-transition-name: none; }
html.vt-theme::view-transition-group(*) { animation: none; }
html.vt-theme::view-transition-old(*) { display: block; animation: none; }
html.vt-theme::view-transition-new(*) { animation: vt-fade .5s var(--ease) both; }
@keyframes vt-fade { from { opacity: 0; } }

/* ---------- Прелоадер (лёгкий, только при запуске) ---------- */
.splash {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: var(--bg);
  transition: opacity .6s var(--ease), visibility 0s .6s;
}
.splash.done { opacity: 0; visibility: hidden; }
.splash .wordmark { font-size: clamp(3.5rem, 12vw, 6rem); animation: splash-in .9s var(--ease-out) both; }
.splash .wordmark em { font-style: normal; color: var(--kult-pink); display: inline-block; animation: splash-dot 1.4s var(--ease) .5s infinite; }
:root[data-theme="light"] .splash .wordmark em { color: var(--mark); }
.splash .bar { position: absolute; bottom: calc(var(--safe-bottom) + 12vh); width: 120px; height: 2px; border-radius: 2px; background: var(--line); overflow: hidden; }
.splash .bar::after { content: ''; position: absolute; inset: 0; width: 40%; background: var(--mark); border-radius: 2px; animation: splash-bar 1.1s var(--ease) infinite; }
@keyframes splash-in { from { opacity: 0; transform: translateY(10px) scale(.98); filter: blur(6px); } }
@keyframes splash-dot { 50% { transform: translateY(-.12em); } }
@keyframes splash-bar { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

.detail-photo { position: relative; }
.noimg .wordmark { font-size: 2rem; }
.detail-photo .noimg .wordmark { font-size: 4rem; }
.gate .wordmark.big { font-size: clamp(3.5rem, 12vw, 6rem); }
.empty .wordmark.big { font-size: 4rem; }

/* ---------- Полосы прокрутки: тонкие, в цвет интерфейса, везде (меню и админка) ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; background: transparent; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background-color: var(--line-2); border-radius: 10px;
  border: 3px solid transparent; background-clip: padding-box; min-height: 40px;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--muted); border-width: 2px; }
::-webkit-scrollbar-thumb:active { background-color: var(--accent); border-width: 2px; }
::-webkit-scrollbar-corner { background: transparent; }
/* Firefox понимает только стандартные свойства (в Chrome они бы отключили красивый вариант выше) */
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
}

/* Скрытый вход администратора: удержание логотипа в шапке 3 секунды.
   Первые 0,4 с ничего не видно (обычное нажатие), затем тонкая рамка обводит логотип. */
.hold-ring { position: absolute; inset: -8px -14px; width: calc(100% + 28px); height: calc(100% + 16px); pointer-events: none; overflow: visible; opacity: 0; transition: opacity .25s var(--ease); }
.hold-ring rect { x: 1px; y: 1px; width: calc(100% - 2px); height: calc(100% - 2px); rx: 22px; fill: none; stroke: var(--mark); stroke-width: 1.5; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; }
.tb-center.holding .hold-ring { opacity: 1; transition-delay: .4s; }
.tb-center.holding .hold-ring rect { animation: hold-ring 2.6s linear .4s forwards; }
.tb-center.unlocked .hold-ring { opacity: 1; }
.tb-center.unlocked .hold-ring rect { stroke-dashoffset: 0; fill: var(--accent-soft); }
@keyframes hold-ring { to { stroke-dashoffset: 0; } }

/* Лента категорий: мышью тянется как на телефоне, колесо прокручивает вбок, по краям — мягкое затухание */
.catbar-track { cursor: grab; }
.catbar-track.dragging { cursor: grabbing; }
.catbar-track.dragging .chip { pointer-events: none; }
.catbar-track.fade-l { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 48px); mask-image: linear-gradient(90deg, transparent 0, #000 48px); }
.catbar-track.fade-r { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent 100%); mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent 100%); }
.catbar-track.fade-l.fade-r { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 48px, #000 calc(100% - 48px), transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 48px, #000 calc(100% - 48px), transparent 100%); }

/* ---------- Производительность на телефонах и планшетах ----------
   Размытие фона под шапкой пересчитывается при каждой прокрутке — на сенсорных устройствах
   заменяем его почти непрозрачной заливкой: выглядит так же, а прокрутка остаётся плавной. */
@media (hover: none) {
  .topbar, .catbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: color-mix(in srgb, var(--bg) 94%, transparent); }
  .round-btn, .photo-tools button { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(10, 11, 10, .62); }
}

/* Долгое нажатие не показывает адрес ссылки и меню «Открыть / Копировать»; картинки не перетаскиваются */
a, img, button { -webkit-touch-callout: none; -webkit-user-drag: none; }
.dish, .cat, .chip, .brand-tile, .hit, .pager a, .tb-center, .icon-btn, .round-btn { user-select: none; -webkit-user-select: none; }
