/* Бодрый Кофе — v2.
   Идея: эмалированная посуда. Кобальт + фарфор, золото крема только для цен.
   Одно движение при загрузке (фото «наливается» снизу вверх), остальное — только в ответ на действия. */

:root {
  --porcelain: #f3f4f0;
  --milk: #ffffff;
  --cobalt: #1f43b5;
  --cobalt-deep: #132b7a;
  --cobalt-wash: #e3e8f7;
  --ink: #1d1a17;
  --muted: #5c6067;
  --line: #d9dbd3;
  --crema: #e5a43b;
  --ok: #1f7a4a;
  --err: #b4321c;

  --display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --text: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;

  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.75rem;
  --step-3: 2.5rem;

  --ease-pour: cubic-bezier(.2, .7, 0, 1);
  --gutter: clamp(16px, 4vw, 40px);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--porcelain);
  color: var(--ink);
  font: 400 var(--step-0)/1.55 var(--text);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: var(--cobalt); text-underline-offset: .18em; }
a:hover { color: var(--cobalt-deep); }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.1; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.75rem, 3.5vw, 2.5rem); }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--crema); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* ---------- Кнопки и поля ---------- */
.btn, button {
  font: 600 var(--step-0)/1 var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: .95em 1.5em;
  border: 0; border-radius: 999px;
  background: var(--cobalt); color: #fff;
  text-decoration: none; cursor: pointer;
  transition: background-color .15s, transform .1s;
}
.btn:hover, button:hover { background: var(--cobalt-deep); color: #fff; }
.btn:active, button:active { transform: translateY(1px); }
.btn-small { padding: .7em 1.1em; }
button.danger { background: var(--err); }
button.danger:hover { background: #8d2614; }
button.ok { background: var(--ok); }

input, select, textarea {
  font: inherit; color: var(--ink);
  background: var(--milk);
  border: 1.5px solid var(--line); border-radius: 12px;
  padding: .7em .9em;
  transition: border-color .15s;
  min-width: 0;
}
input:hover, select:hover, textarea:hover { border-color: #b9bcb2; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cobalt); }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: var(--step--1); }

/* ---------- Шапка ---------- */
.site-bar { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--porcelain) 88%, transparent); backdrop-filter: blur(10px); }
.site-bar-in { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { font: 800 1.05rem/1 var(--display); color: var(--cobalt); text-decoration: none; }
.site-nav { display: flex; gap: 28px; }
.site-nav a { color: var(--ink); text-decoration: none; font-weight: 500; }
.site-nav a:hover { color: var(--cobalt); }

/* ---------- Hero: единственный «момент» при загрузке ---------- */
.hero { padding: clamp(16px, 4vw, 48px) 0 clamp(48px, 8vw, 96px); overflow: hidden; }
.hero-in { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(24px, 4vw, 56px); align-items: end; }
.wordmark {
  font: 800 clamp(3rem, 8.3vw, 7.6rem)/.88 var(--display);
  color: var(--cobalt);
  letter-spacing: -0.045em;
  margin-left: -0.04em;
}
.wordmark span { display: block; }
.lede { font-size: var(--step-1); max-width: 30ch; margin: clamp(24px, 3vw, 40px) 0 28px; color: var(--ink); }
.hero-photo { margin: 0; aspect-ratio: 4 / 5; border-radius: 28px 28px 28px 120px; overflow: hidden; background: var(--cobalt-wash); }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; }

@media (prefers-reduced-motion: no-preference) {
  .hero-photo { animation: pour 1.2s var(--ease-pour) .1s both; }
  .hero-photo img { animation: settle 1.6s var(--ease-pour) .1s both; }
  .wordmark span { animation: rise .9s var(--ease-pour) both; }
  .wordmark span:nth-child(1) { animation-delay: .25s; }
  .wordmark span:nth-child(2) { animation-delay: .37s; }
  .lede, .hero-text .btn { animation: fade .6s ease-out .7s both; }
}
@keyframes pour   { from { clip-path: inset(100% 0 0 0 round 28px 28px 28px 120px); } to { clip-path: inset(0 0 0 0 round 28px 28px 28px 120px); } }
@keyframes settle { from { transform: scale(1.12); } to { transform: none; } }
@keyframes rise   { from { transform: translateY(.35em); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade   { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Меню ---------- */
.menu { padding: clamp(40px, 6vw, 72px) 0; background: var(--milk); border-radius: 40px 40px 0 0; }
.menu-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.status { color: var(--muted); }
.status.error { color: var(--err); }

.filters { display: flex; flex-direction: column; gap: 16px; margin-bottom: 36px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; margin: 0; }
.chip { display: inline-flex; flex-direction: row; font-size: var(--step-0); cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  padding: .55em 1.1em; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--milk);
  transition: background-color .18s, color .18s, border-color .18s;
}
.chip:hover span { border-color: var(--cobalt); }
.chip input:checked + span { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }
.chip input:focus-visible + span { outline: 3px solid var(--crema); outline-offset: 2px; }

.filter-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.field { flex-direction: row; align-items: center; gap: 8px; color: var(--muted); font-weight: 400; font-size: var(--step-0); }
.field-q { flex: 1 1 260px; }
.field-q input { width: 100%; }
.field-num input { width: 6.5em; }
.reset { color: var(--muted); margin-left: auto; }
.js .js-hide { display: none; }

.dishes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: clamp(20px, 3vw, 36px) clamp(16px, 2.4vw, 28px); }
.dishes-3 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.dishes.is-updating { opacity: .35; transition: opacity .12s; }
.dish-link { display: block; color: inherit; text-decoration: none; }
.dish-photo { aspect-ratio: 4 / 5; border-radius: 20px; overflow: hidden; background: var(--cobalt-wash); }
.dish-photo img { width: 100%; height: 100%; object-fit: cover; }
.is-empty { display: grid; place-items: center; background: var(--cobalt); }
.is-empty span { font: 800 clamp(3rem, 7vw, 5rem)/1 var(--display); color: var(--porcelain); opacity: .9; }
.dish-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 14px; }
.dish-title { font: 600 var(--step-1)/1.25 var(--text); letter-spacing: 0; }
.dish-link:hover .dish-title { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .2em; }
.dish-price { flex: none; font-weight: 600; background: var(--crema); padding: .15em .6em; border-radius: 999px; font-variant-numeric: tabular-nums; }
.dish-meta { color: var(--muted); font-size: var(--step--1); margin-top: 4px; }
.empty { color: var(--muted); grid-column: 1 / -1; padding: 24px 0; }

/* Результат фильтра появляется в ответ на действие пользователя */
@media (prefers-reduced-motion: no-preference) {
  .dish.is-new { animation: dish-in .38s var(--ease-pour) both; animation-delay: calc(var(--i, 0) * 35ms); }
}
@keyframes dish-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.pager { display: flex; gap: 6px; margin-top: 40px; }
.pager a { min-width: 42px; height: 42px; display: grid; place-items: center; border-radius: 999px; text-decoration: none; color: var(--ink); border: 1.5px solid var(--line); }
.pager a:hover { border-color: var(--cobalt); }
.pager a[aria-current] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- Отзывы ---------- */
.reviews { background: var(--cobalt); color: #fff; padding: clamp(56px, 8vw, 104px) 0; }
.reviews h2 { color: #fff; margin-bottom: 32px; }
.reviews-in { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(32px, 5vw, 72px); align-items: start; }
.review { margin: 0 0 32px; max-width: 46ch; }
.review p { font: 500 var(--step-1)/1.45 var(--text); }
.review p::before { content: "«"; } .review p::after { content: "»"; }
.review footer { margin-top: 10px; color: #c9d3f4; font-size: var(--step--1); }
.reviews .empty { color: #c9d3f4; }
.review-form { background: var(--milk); color: var(--ink); border-radius: 28px; padding: clamp(20px, 3vw, 32px); display: flex; flex-direction: column; gap: 16px; }
.review-form h3 { font-size: var(--step-1); }
.review-form label { color: var(--ink); }
.hint { color: var(--muted); font-size: var(--step--1); }
.note { padding: 10px 14px; border-radius: 12px; font-size: var(--step--1); }
.note.ok { background: #e2f2e8; color: var(--ok); }
.note.err { background: #fbe4df; color: var(--err); }

/* ---------- Страница товара ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; padding: 20px 0 28px; font-size: var(--step--1); color: var(--muted); }
.crumbs > * + *::before { content: "/"; margin-right: 6px; color: var(--line); }
.product { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: clamp(24px, 5vw, 72px); align-items: center; }
.product-photo { margin: 0; aspect-ratio: 4 / 5; border-radius: 28px; overflow: hidden; background: var(--cobalt-wash); }
.product-photo img { width: 100%; height: 100%; object-fit: cover; }
.product-text h1 { font-size: clamp(2.2rem, 5vw, 4rem); letter-spacing: -0.03em; color: var(--cobalt); }
.product-meta { color: var(--muted); margin-top: 12px; }
.product-desc { font-size: var(--step-1); max-width: 34ch; margin-top: 24px; }
.product-price { display: inline-block; margin-top: 28px; font: 700 var(--step-2)/1 var(--display); background: var(--crema); padding: .35em .6em; border-radius: 999px; }
.back { display: block; margin-top: 28px; }
.similar { margin: clamp(56px, 8vw, 96px) 0 clamp(56px, 8vw, 96px); }
.similar h2 { font-size: var(--step-2); margin-bottom: 24px; }
.notfound { padding: 64px var(--gutter) 96px; display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }

/* ---------- Подвал ---------- */
.foot { background: var(--ink); color: #b9b6b1; padding: 40px 0; font-size: var(--step--1); }
.site .menu + .foot, .site .reviews + .foot { margin-top: 0; }
.foot-in { display: flex; flex-wrap: wrap; gap: 8px 32px; align-items: baseline; }
.foot-brand { font: 800 1rem/1 var(--display); color: #fff; margin-right: auto; }
.foot a { color: #fff; }

@media (max-width: 820px) {
  .hero-in, .reviews-in, .product { grid-template-columns: 1fr; }
  .wordmark { font-size: clamp(3rem, 16vw, 6rem); }
  .hero-photo { aspect-ratio: 4 / 3; border-radius: 24px 24px 24px 72px; order: -1; }
  @keyframes pour { from { clip-path: inset(100% 0 0 0 round 24px 24px 24px 72px); } to { clip-path: inset(0 0 0 0 round 24px 24px 24px 72px); } }
  .menu { border-radius: 28px 28px 0 0; }
  .reset { margin-left: 0; }
  .dishes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dish-row { flex-direction: column; gap: 6px; }
}

/* =================== Админка =================== */
.admin { background: var(--porcelain); }
.topbar { background: var(--cobalt-deep); color: #fff; }
.topbar-in { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding: 14px var(--gutter); max-width: 1180px; margin: 0 auto; }
.topbar a { color: #fff; text-decoration: none; }
.topbar .logo { font: 800 1rem/1 var(--display); margin-right: auto; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: var(--step--1); }
.topbar nav a { opacity: .8; } .topbar nav a:hover { opacity: 1; }
.who { display: flex; gap: 10px; align-items: center; font-size: var(--step--1); }
.admin main.wrap { padding-top: 8px; padding-bottom: 64px; }
.admin h1 { font-size: var(--step-3); margin: 32px 0 20px; color: var(--cobalt); letter-spacing: -0.02em; }
.admin h2 { font-size: var(--step-1); margin: 36px 0 14px; }
.narrow { max-width: 560px; padding-top: 48px; }

.role { font-size: .75rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.role-admin { background: var(--crema); color: var(--ink); }
.role-editor { background: #fff; color: var(--cobalt-deep); }

.alert { padding: 12px 16px; border-radius: 12px; margin: 16px 0; }
.alert.ok { background: #e2f2e8; color: var(--ok); }
.alert.err { background: #fbe4df; color: var(--err); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.tile { background: var(--milk); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; color: inherit; text-decoration: none; }
.tile b { font: 700 var(--step-3)/1 var(--display); color: var(--ink); font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: var(--step--1); }
a.tile:hover b { color: var(--cobalt); }
.tile.warn b { color: var(--err); }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.panel { background: var(--milk); border-radius: 20px; padding: 20px; }
.panel h2 { margin: 0 0 14px; font-size: var(--step-0); font-family: var(--text); font-weight: 600; }
.top { margin: 0; padding: 0 0 0 1.4em; }
.top li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.top li span { float: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 170px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.bar-fill { width: 100%; background: var(--cobalt); border-radius: 8px 8px 2px 2px; min-height: 3px; }
.bar-n, .bar-d { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.table { width: 100%; border-collapse: collapse; background: var(--milk); border-radius: 20px; overflow: hidden; }
.table th, .table td { padding: 10px 14px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.table th { font-size: var(--step--1); font-weight: 600; color: var(--muted); }
.table tr:last-child td { border-bottom: 0; }
.table button { padding: .5em .9em; font-size: var(--step--1); }
.table form { margin: 0; }
.actions { display: flex; gap: 14px; align-items: center; }
.mini { width: 44px; height: 55px; object-fit: cover; border-radius: 8px; }

.form { background: var(--milk); border-radius: 24px; padding: 24px; display: flex; flex-direction: column; gap: 16px; max-width: 760px; }
.row { display: flex; flex-wrap: wrap; gap: 14px; }
.row label { flex: 1 1 180px; }
.img-row { align-items: center; }
.thumb-preview { width: 96px; border-radius: 12px; }
.btn-link { color: var(--muted); align-self: flex-start; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.table .inline-form { margin: 0; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tabs a { padding: .5em 1em; border-radius: 999px; text-decoration: none; border: 1.5px solid var(--line); color: var(--ink); background: var(--milk); }
.tabs a.active { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }
.review-mod { background: var(--milk); border-radius: 16px; padding: 16px 18px; margin-bottom: 12px; border-left: 5px solid var(--crema); }
.review-mod.status-approved { border-left-color: var(--ok); }
.review-mod.status-rejected { border-left-color: var(--err); }
.review-mod p { margin: 8px 0; }
.import-errors { color: var(--err); }
code { background: var(--cobalt-wash); padding: 1px 6px; border-radius: 6px; font-size: .92em; }

.login-page { min-height: 100vh; display: grid; place-items: center; background: var(--cobalt); padding: 16px; }
.login-box { background: var(--milk); border-radius: 28px; padding: 32px; width: min(380px, 100%); }
.login-box h1 { font-size: var(--step-2); color: var(--cobalt); margin: 0 0 20px; }
.login-box form { display: flex; flex-direction: column; gap: 14px; }
.login-box > p { margin-top: 18px; font-size: var(--step--1); }

@media (max-width: 820px) {
  .cols { grid-template-columns: 1fr; }
  .table { display: block; overflow-x: auto; }
}
