/* EIWA · base: reset, type, links, focus, header, footer, 404. Tokens live in tokens.css. */

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: var(--header-h); scrollbar-gutter: stable; }
body {
  min-height: 100vh;
  min-height: 100svh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, picture, video, svg { display: block; max-width: 100%; }
img { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul[role='list'], ol[role='list'] { list-style: none; padding: 0; }
h1, h2, h3, h4 { font-weight: 300; line-height: 1.1; text-wrap: balance; }
p { text-wrap: pretty; }
[hidden] { display: none !important; }
::selection { background: var(--ink); color: var(--paper); }

/* Lenis (smooth scroll) — recommended base styles */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: clip; }
html.is-locked { overflow: hidden; }

/* ---------- type helpers ---------- */
.sc { font-variant: all-small-caps; letter-spacing: var(--tracking-sc); }
.jp {
  font-family: var(--font-jp);
  font-weight: 200;
  color: var(--pink-ink);
  letter-spacing: .2em;
  font-feature-settings: normal;
}
.label { font-size: var(--fs-label); color: var(--mute); }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------- links ---------- */
/* .link — always underlined; on hover the line runs out to the right and back in from the left */
.link { position: relative; display: inline-block; padding-bottom: 2px; }
.link::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 1px;
  background: currentColor;
  transform-origin: left;
}
/* hover effects only where a pointer really hovers: on touch a tap would leave them stuck on */
@media (hover: hover) { .link:hover::after { animation: link-rerun .7s var(--ease-out); } }
@keyframes link-rerun {
  0% { transform: scaleX(1); transform-origin: right; }
  45% { transform: scaleX(0); transform-origin: right; }
  46% { transform: scaleX(0); transform-origin: left; }
  100% { transform: scaleX(1); transform-origin: left; }
}
/* .nav-link — line appears on hover and on the current page */
.nav-link { position: relative; display: inline-block; padding-block: .25rem; }
.nav-link::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 2px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--dur) var(--ease-out);
}
.nav-link[aria-current='page']::after { transform: scaleX(1); transform-origin: left; }
@media (hover: hover) { .nav-link:hover::after { transform: scaleX(1); transform-origin: left; } }

/* square-cornered blocks only — never pills */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .6em;
  min-height: 2.75rem;
  padding: .625rem 1.375rem;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 0;
  font-variant: all-small-caps;
  letter-spacing: var(--tracking-sc);
  font-size: 1rem;
  line-height: 1;
  white-space: nowrap;
}
.btn--line { background: transparent; color: currentColor; border-color: currentColor; }
/* phones: square blocks a thumb can't miss, with type to match (client, 2026-10-06) */
@media (max-width: 599px) {
  .btn { min-height: 3.375rem; padding: .875rem 1.5rem; font-size: 1.125rem; }
}

/* ---------- touch ---------- */
/* no double-tap-to-zoom wait on anything tappable */
a, button, summary, label, input, select, textarea, [role='button'], [role='radio'] { touch-action: manipulation; }

/* fingers: every control answers in at least 44 × 44 px. Controls whose look is smaller than that keep it and
   get an invisible hit area instead (::before, centred, only ever growing): the underlined links, the header
   logo, the header nav (tablets in landscape) and «Заказ», the round −/+ steppers (cart, dish cards, booking
   guests, points) and the tag filters. */
@media (pointer: coarse) {
  .link, .header__logo, .header__cart, .header__menu-contacts a,
  .bk-step, .qty__step, .rail__tag { position: relative; }
  .link::before, .header__logo::before, .nav-link::before, .header__cart::before, .header__menu-contacts a::before,
  .bk-step::before, .qty__step::before, .rail__tag::before {
    content: '';
    position: absolute;
    inset: min(0px, calc((100% - 2.75rem) / 2));
  }
}

/* ---------- focus ---------- */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: .1875rem; }
.is-dark, .header--light { --focus: #fff; }

.skip-link {
  position: fixed; left: var(--gutter); top: calc(.75rem + var(--safe-t));
  z-index: calc(var(--z-header) + 10);
  padding: .625rem 1rem;
  background: var(--ink); color: var(--paper);
  transform: translateY(calc(-100% - 1rem - var(--safe-t)));
}
.skip-link:focus-visible { transform: none; outline-color: var(--ink); }

/* ---------- page shell ---------- */
main { display: block; }
body:not(.page--home) main { padding-top: var(--header-h); }

/* ---------- header ---------- */
.header {
  position: fixed; inset: 0 0 auto 0;
  z-index: var(--z-header);
  height: var(--header-h);
  color: var(--ink);
}
/* the bar's backdrop is its own layer (backdrop-filter on .header itself would trap the fixed menu) */
.header::before {
  content: '';
  position: absolute; inset: 0;
  background: rgba(243, 243, 242, .84);
  -webkit-backdrop-filter: blur(.75rem) saturate(1.1);
  backdrop-filter: blur(.75rem) saturate(1.1);
  border-bottom: 1px solid var(--line);
  opacity: 0;
  transition: opacity var(--dur) var(--ease-out), background-color var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
  pointer-events: none;
}
.header--solid::before { opacity: 1; }
.header--light { color: #fff; }
.header--light::before { opacity: 0; }
/* iOS 26 Safari draws the page edge to edge, under the status bar, and tints that strip from a fixed bar's own
   background-color — a translucent pseudo-element backdrop is not sampled, so content showed through above the
   bar (iPhone 17, 2026-10-06). The bar gets a real, opaque colour in each state, and ::after carries it on up past
   the top edge, so nothing can scroll into view behind the status bar. */
.header { transition: background-color var(--dur) var(--ease-out); }
.header--solid:not(.header--light) { background-color: var(--paper); }
.header::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 100%;
  height: 100vh;
  background: inherit;
  pointer-events: none;
}

.header__bar {
  position: relative; z-index: 2;
  display: flex; align-items: center;
  height: 100%;
  padding-top: var(--safe-t); /* the bar sits below the notch; its backdrop runs up behind it */
  padding-inline: var(--gutter);
}
.header__logo { display: grid; flex: none; padding-block: .5rem; }
.header__logo img { grid-area: 1 / 1; height: 1.375rem; width: auto; transition: opacity var(--dur-fast) linear; }
.header__logo-light { opacity: 0; }
.header--light .header__logo-ink { opacity: 0; }
.header--light .header__logo-light { opacity: 1; }

.header__nav {
  display: flex; gap: clamp(1.25rem, 2.4vw, 2.25rem);
  margin-left: clamp(2rem, 4.4vw, 4.5rem);
  font-size: 1rem;
}
.header__actions {
  display: flex; align-items: center; gap: clamp(1.125rem, 2.2vw, 2rem);
  margin-left: auto;
  font-size: 1rem;
}
.header__cart {
  min-height: 2.5rem;
  padding: .5rem .875rem;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}
.header__cart-sep { opacity: .45; padding-inline: .2em; }
/* «№ 1042 · Готовится» while an order from this browser is open (js/ui/active-order.js); phones have it in the bar */
.header__order { font-size: 1rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* below 1180 the nav, «Забронировать» and «Заказ» fill the bar: the order is then in the cart panel's «Ваш заказ…»
   (and on phones in the action bar) */
@media (max-width: 1179px) { .header__order { display: none; } }
.header__toggle { display: none; min-height: 2.75rem; padding-inline: .25rem; font-size: 1rem; }

/* full-screen menu (phones) */
.header__menu {
  position: fixed; inset: 0 0 auto;
  z-index: 1;
  display: flex; flex-direction: column;
  height: 100vh;
  height: 100dvh; /* the visible area, whatever Safari's toolbars are doing */
  padding: calc(var(--header-h) + 1.5rem) var(--gutter) calc(var(--gutter) + var(--safe-b));
  background: var(--paper);
  color: var(--ink);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.header__menu-list { border-bottom: 1px solid var(--line); }
.header__menu-list a {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: .875rem 0 .75rem;
  border-top: 1px solid var(--line);
  font-size: clamp(2.125rem, 9vw, 3.5rem);
  font-weight: 300;
  line-height: 1.1;
}
.header__menu-list .jp { font-size: 1rem; color: var(--mute-lg); } /* one pink per screen: none here */
.header__menu-book { align-self: flex-start; margin-top: 2rem; }
.header__menu-contacts {
  margin-top: auto;
  padding-top: 2.5rem;
  display: grid; gap: .375rem;
  font-size: .9375rem;
  color: var(--ink-2);
}
.header__menu-contacts a { color: var(--ink); }
.header--menu-open { color: var(--ink); --focus: var(--ink); }
.header--menu-open::before { opacity: 0; }
.header--menu-open .header__logo-ink { opacity: 1; }
.header--menu-open .header__logo-light { opacity: 0; }

@media (max-width: 899px) {
  .header__logo img { height: 1.125rem; }
  .header__nav, .header__book { display: none; }
  .header__toggle { display: inline-flex; align-items: center; }
  .header__actions { gap: 1rem; }
  .header__cart { min-height: 2.25rem; padding: .375rem .625rem; font-size: .9375rem; }
}
/* any width: once anything scrolls under the bar over a dark block (the hero past its very top, «Сезон сейчас»),
   the white logo and nav get a quiet dark backdrop — content never runs behind them. Over light blocks it is the
   paper one (.header--solid). Only the untouched hero at scrollY ≈ 0 keeps the bar fully transparent. */
.header--light.header--dim:not(.header--menu-open)::before {
  opacity: 1;
  background: rgba(21, 21, 21, .72);
  border-bottom-color: rgba(255, 255, 255, .08);
}
.header--light.header--dim:not(.header--menu-open) { background-color: rgb(21, 21, 21); }
.header--menu-open { background-color: var(--paper); }
@media (max-width: 359px) {
  /* SE 1st gen: logo · «Заказ · 2» · Меню fit one row; the sum is in the order bar and the panel */
  .header__actions { gap: .75rem; }
  .header__cart { padding-inline: .5rem; }
  .header__cart [data-cart-total], .header__cart [data-cart-count] + .header__cart-sep { display: none; }
}
@media (min-width: 900px) {
  .header__menu { display: none !important; }
}

/* ---------- phone action bar (js/ui/action-bar.js): Меню · Заказ · Бронь ---------- */
/* phones and small tablets only; quiet paper «калька» with a hairline on top, the order cell goes ink once filled.
   It steps aside while a panel or the phone menu is open (html.is-locked); the page keeps room for it below. */
.abar { display: none; }
@media (max-width: 899px) {
  body.has-abar { --abar-h: calc(3.5rem + var(--safe-b)); padding-bottom: var(--abar-h); }
  .has-abar .footer { padding-bottom: var(--gutter); } /* the bar already clears the home indicator */
  .has-abar .header__cart { display: none; } /* the bar's «Заказ · N · сумма» says it once, at the thumb */
  .abar {
    position: fixed; left: 0; right: 0; bottom: 0;
    z-index: calc(var(--z-header) - 5);
    display: block;
    padding: 0 var(--safe-x) var(--safe-b);
    background: var(--paper); /* opaque: iOS 26 Safari tints its floating toolbar from it (see .header) */
    border-top: 1px solid var(--line);
    color: var(--ink);
    transition: transform var(--dur) var(--ease-out), visibility 0s;
  }
  html.is-locked .abar { transform: translateY(100%); visibility: hidden; transition: transform var(--dur-fast) linear, visibility 0s var(--dur-fast); }
  /* the paper runs on below the bar: iOS 26 Safari's floating toolbar leaves a strip under fixed bottom bars */
  .abar::after { content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 100vh; background: inherit; pointer-events: none; }
  .abar__row { display: grid; grid-template-columns: 1fr 1.7fr 1fr; height: 3.5rem; }
  @media (max-width: 599px) {
    body.has-abar { --abar-h: calc(4rem + var(--safe-b)); }
    .abar__row { height: 4rem; }
    .abar__item { font-size: 1.125rem; }
  }
  .abar__item {
    display: flex; align-items: center; justify-content: center;
    min-width: 0; min-height: 2.75rem;
    padding-inline: .5rem;
    font-size: 1rem; line-height: 1.1;
    white-space: nowrap;
  }
  .abar__item + .abar__item { border-left: 1px solid var(--line); }
  .abar__item[aria-current='page'] { text-decoration: underline; text-underline-offset: .3em; text-decoration-thickness: 1px; }
  .abar__item:focus-visible { outline-offset: -.25rem; }
  .abar__cart { font-variant-numeric: tabular-nums; transition: background-color var(--dur-fast) linear, color var(--dur-fast) linear; }
  .abar__cart.is-full { background: var(--ink); color: var(--paper); border-left-color: var(--ink); --focus: var(--paper); }
  .abar__cart.is-full + .abar__item { border-left-color: transparent; }
  .abar__main { display: flex; min-width: 0; max-width: 100%; }
  .abar__sum { overflow: hidden; text-overflow: ellipsis; white-space: pre; }
  /* an open order: «№ 1042 · Готовится» as a second small line in the same cell — the bar stays one row */
  .abar__cart.has-status { flex-direction: column; gap: .125rem; }
  .abar__status {
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: .8125rem; line-height: 1.1; color: var(--ink-2); font-variant-numeric: tabular-nums;
  }
  .abar__cart.is-full .abar__status { color: rgba(243, 243, 242, .78); }
}
@media (max-width: 359px) {
  .abar__row { grid-template-columns: 1fr 1.9fr 1fr; }
  .abar__item { padding-inline: .25rem; font-size: .9375rem; }
}
@media print { .abar { display: none !important; } }

/* ---------- footer ---------- */
.footer {
  padding: var(--section-y) var(--gutter) calc(var(--gutter) + var(--safe-b));
}
.footer__contacts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem var(--gutter);
  padding: 0;
  list-style: none;
  margin-bottom: clamp(2.5rem, 6vw, 6rem);
}
.footer__contacts li { display: grid; gap: .25rem; align-content: start; }
.footer__contacts li > * { justify-self: start; }
.footer__logo { width: 100%; height: auto; }
/* the seller (settings.legal, js/ui/footer-legal.js): one small quiet line under the logo */
.footer__legal { margin-top: 1rem; font-size: .8125rem; color: var(--mute); }
/* documents: three quiet links under the logo (privacy, consent, delivery terms) */
.footer__docs { display: flex; flex-wrap: wrap; gap: .5rem 1.75rem; margin-top: 1.25rem; font-size: .875rem; color: var(--ink-2); }
.footer__docs .link[aria-current='page'] { color: var(--ink); }
@media (max-width: 899px) {
  .footer__contacts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 479px) {
  .footer__contacts { grid-template-columns: 1fr; }
}

/* ---------- 404 ---------- */
.nf {
  position: relative;
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100svh - var(--header-h));
  display: grid; place-items: center;
  padding: var(--gutter);
  text-align: center;
  overflow: hidden;
}
.nf__inner { position: relative; display: grid; justify-items: center; }
.nf__code {
  display: block;
  font-size: clamp(8.25rem, 26vw, 22.5rem);
  font-weight: 200;
  line-height: .86;
  letter-spacing: -.03em;
  color: var(--ghost);
}
.nf__title {
  display: block;
  margin-top: clamp(1rem, 2vw, 1.75rem);
  font-size: clamp(1.5rem, 2.4vw, 2.125rem);
  font-weight: 300;
  color: var(--ink);
  letter-spacing: 0;
}
.nf__home { margin-top: .875rem; font-size: 1.0625rem; }
.nf__koi {
  --w: clamp(2.5rem, 5.4vw, 5.25rem);
  position: absolute;
  left: calc(50% - var(--w) / 2);
  top: 16%; /* rises out of the «0» */
  width: var(--w);
  opacity: .9;
  pointer-events: none;
  will-change: transform, opacity;
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- page transitions (spec §5; the leaving half lives in js/motion/transitions.js) ---------- */
/* arriving: right after an in-site transition (the inline script in <head> sets html.is-arriving) the page starts as
   a sheet of --ink and clears in 0.3 s. First visits, reloads and external entries get no sheet at all.
   Pure CSS from there — nothing to hang, and the opacity rule keeps the page visible if animations are unavailable */
html.is-arriving::after {
  content: '';
  position: fixed; inset: 0;
  z-index: 1000;
  background: var(--ink);
  opacity: 0;
  pointer-events: none;
  animation: page-in .3s var(--ease-out) both;
}
@keyframes page-in { from { opacity: 1; } to { opacity: 0; } }
/* leaving: made by JS on click; blocks a second click while it covers the page */
.page-fade {
  position: fixed; inset: 0;
  z-index: 1000;
  background: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s var(--ease-in-out);
}
.page-fade.is-on { opacity: 1; pointer-events: auto; }
@media (prefers-reduced-motion: reduce) {
  html.is-arriving::after, .page-fade { display: none; }
}

/* ---------- consent line under the forms (js/ui/consent-note.js, loyalty.html) ---------- */
.consent-note { margin-top: .875rem; font-size: .8125rem; line-height: 1.45; color: var(--mute); }
.consent-note .link { display: inline; color: var(--ink-2); padding-bottom: 0; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }
.consent-note .link::after { display: none; }
.bk-actions .consent-note { margin-top: .125rem; font-size: .75rem; line-height: 1.35; } /* under the sticky button: two short lines */

/* ---------- cookie notice (js/ui/cookie-notice.js): one quiet line, above the phone action bar ---------- */
.cookie {
  position: fixed; left: var(--gutter); bottom: calc(1.25rem + var(--safe-b));
  z-index: calc(var(--z-header) - 3);
  display: flex; align-items: center; gap: .75rem 1.5rem;
  max-width: min(36rem, calc(100vw - 2 * var(--gutter)));
  padding: .875rem 1rem .875rem 1.25rem;
  background: rgba(243, 243, 242, .94);
  -webkit-backdrop-filter: blur(.75rem); backdrop-filter: blur(.75rem);
  border: 1px solid var(--line);
  box-shadow: 0 .5rem 1.5rem rgba(28, 28, 28, .08);
  font-size: .9375rem; line-height: 1.35; color: var(--ink);
  transition: opacity var(--dur-fast) linear, transform var(--dur-fast) linear;
}
.cookie.is-gone { opacity: 0; transform: translateY(.5rem); }
.cookie__text { flex: 1 1 auto; min-width: 0; }
.cookie__actions { display: flex; align-items: center; gap: 1.25rem; flex: none; }
.cookie__ok { min-height: 2.5rem; padding-inline: 1.125rem; }
.cookie__more { font-size: .9375rem; }
html.is-locked .cookie { visibility: hidden; }
.has-order-bar .cookie { bottom: calc(1.25rem + 3.25rem + .75rem + var(--safe-b)); } /* desktop menu: above «В заказе …» */
@media (max-width: 899px) {
  .cookie { left: var(--gutter); right: var(--gutter); max-width: none; bottom: calc(1rem + var(--safe-b)); }
  .has-abar .cookie { bottom: calc(var(--abar-h) + .625rem); } /* above the action bar */
}
@media (max-width: 559px) {
  .cookie { flex-direction: column; align-items: stretch; gap: .5rem; padding: .75rem 1rem; font-size: .875rem; }
  .cookie__actions { justify-content: space-between; }
  .cookie__ok { min-height: 2.25rem; }
}
@media (prefers-reduced-motion: reduce) { .cookie { transition: none; } }
@media print { .cookie { display: none !important; } }

/* ---------- toast (js/ui/toast.js): one quiet line at a time — «Добавлено: … · Отменить» ---------- */
.toast {
  position: fixed; right: var(--gutter); bottom: calc(1.25rem + var(--safe-b));
  z-index: calc(var(--z-header) - 2);
  display: flex; align-items: center; gap: 1.25rem;
  max-width: min(28rem, calc(100vw - 2 * var(--gutter)));
  min-height: 3.25rem;
  padding: .5rem 1.125rem;
  background: var(--ink); color: var(--paper);
  font-size: 1rem; line-height: 1.3;
  box-shadow: 0 .625rem 1.875rem rgba(28, 28, 28, .18);
  --focus: var(--paper);
  opacity: 1; transform: none; visibility: visible;
  transition: opacity var(--dur-fast) linear, transform var(--dur) var(--ease-out), visibility 0s;
}
.toast:not(.is-on) { opacity: 0; transform: translateY(.5rem); visibility: hidden; transition: opacity var(--dur-fast) linear, transform var(--dur-fast) linear, visibility 0s var(--dur-fast); }
.toast__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.toast__action { flex: none; font-size: .9375rem; color: var(--paper); }
.has-order-bar .toast { bottom: calc(1.25rem + 3.25rem + .75rem + var(--safe-b)); } /* desktop menu: above «В заказе …» */
@media (max-width: 899px) {
  .toast { left: var(--gutter); right: var(--gutter); max-width: none; justify-content: space-between; }
  .has-abar .toast { bottom: calc(var(--abar-h) + .75rem); } /* above the action bar */
}
html.is-locked .toast { visibility: hidden; opacity: 0; }

/* ---------- skeletons: quiet blocks in the shape of what is loading (news, season, menu index, dishes) ---------- */
/* in index.html / menu.html; the page scripts replace them with the real content, so nothing jumps */
.skel__line { display: block; height: .875rem; margin-top: .625rem; background: var(--paper-2); }
.skel__line--s { width: 38%; }
.skel__line--m { width: 62%; }
.skel__line--l { width: 86%; height: 1.25rem; }
.skel .news-card__media, .skel .dish__media, .skel .ko__media { background: var(--paper-2); }
.is-dark .skel__line, .is-dark .skel .ko__media { background: rgba(255, 255, 255, .06); }
html:not(.js) .skel, html:not(.js) .menu-skel { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .skel, .menu-skel { animation: skel-pulse 1.6s ease-in-out infinite; }
}
@keyframes skel-pulse { 50% { opacity: .55; } }
