/* Сытый Япончик — стили сайта.
   Токены один в один из дизайн-системы бренда: цвет, типографика, шаг отступов,
   скругления. Правки цвета и размеров делать здесь, а не по месту. */

/* ---------- шрифты ---------- */
@font-face {
  font-family: Ramona;
  src: url("../fonts/ramona-bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: Cygre;
  src: url("../fonts/cygre-regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Cygre;
  src: url("../fonts/cygre-semibold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: Denistina;
  src: url("../fonts/denistina-dlya-rukopisnyh-nadpisey.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

/* ---------- токены ---------- */
:root {
  --brand-red: #a91916;
  --brand-cream: #f6edba;
  --brand-orange: #e56628;
  --brand-olive: #a29934;
  --brand-blue: #a6bcd0;
  --brand-sand: #f9e9d7;

  --surface-base: var(--brand-cream);
  --surface-raised: var(--brand-sand);
  --surface-inverse: var(--brand-red);
  --surface-cool: var(--brand-blue);

  --ink: var(--brand-red);
  --ink-inverse: var(--brand-cream);

  --accent-appetite: var(--brand-orange);
  --accent-calm: var(--brand-olive);

  --font-display: Ramona, Georgia, serif;
  --font-text: Cygre, -apple-system, "Segoe UI", sans-serif;
  --font-script: Denistina, cursive;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;
  --space-24: 96px;

  --radius-s: 8px;
  --radius-m: 16px;
  --radius-l: 28px;
  --radius-pill: 999px;

  --page: 1240px;
}

/* ---------- основа ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Атрибут hidden должен побеждать display из классов: иначе скрытые блоки
   (пустая корзина, экран «Заказ принят») остаются на экране. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--surface-base);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 24px;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}
a:hover {
  color: #7d1210;
}

img {
  display: block;
  max-width: 100%;
}

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.wrap {
  max-width: var(--page);
  margin: 0 auto;
  padding-inline: var(--space-8);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- типографика ---------- */
.display-xl,
.display-l,
.display-m,
.display-s {
  font-family: var(--font-display);
  font-weight: 700;
  margin: 0;
}
.display-xl {
  font-size: clamp(40px, 7vw, 72px);
  line-height: 0.95;
  letter-spacing: -0.01em;
}
.display-l {
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1;
}
.display-m {
  font-size: clamp(26px, 3.2vw, 32px);
  line-height: 1.06;
}
.display-s {
  font-size: 22px;
  line-height: 26px;
}

.script-l {
  font-family: var(--font-script);
  font-size: clamp(32px, 4.4vw, 44px);
  line-height: 1.1;
  margin: 0;
}
.script-s {
  font-family: var(--font-script);
  font-size: 26px;
  line-height: 30px;
  margin: 0;
}

.body-l {
  font-size: 19px;
  line-height: 28px;
}
.body-s {
  font-size: 14px;
  line-height: 20px;
}

.label {
  font-size: 13px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.num {
  font-variant-numeric: tabular-nums;
}

/* ---------- поверхности ---------- */
.panel {
  border-radius: var(--radius-l);
  padding: clamp(28px, 4vw, 64px);
}
.panel--red {
  position: relative;
  overflow: hidden;
  background: var(--surface-inverse);
  color: var(--ink-inverse);
}
.panel--sand {
  background: var(--surface-raised);
}
/* Текст на голубом — только красный и от 24px: светлые цвета дают на нём 1,65:1. */
.panel--cool {
  background: var(--surface-cool);
  color: var(--ink);
}
.panel--cool .body-s,
.panel--cool .label {
  color: var(--ink);
}

/* Паттерн-креветка: фактура, а не рисунок — держим на низкой непрозрачности. */
.pattern {
  position: absolute;
  inset: 0;
  background-image: url("../img/pattern-shrimp-beige.svg");
  background-size: 150px auto;
  opacity: 0.13;
  pointer-events: none;
}
.panel--red > *:not(.pattern) {
  position: relative;
}

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 52px;
  padding: 14px 28px;
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  font-family: var(--font-text);
  font-size: 17px;
  line-height: 24px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.btn:hover {
  color: inherit;
}
.btn--primary {
  background: var(--brand-red);
  border-color: var(--brand-red);
  color: var(--brand-cream);
}
.btn--primary:hover {
  background: #8c1512;
  border-color: #8c1512;
  color: var(--brand-cream);
}
.btn--ghost {
  background: transparent;
  border-color: var(--brand-red);
  color: var(--brand-red);
}
.btn--ghost:hover {
  background: var(--brand-red);
  color: var(--brand-cream);
}
.btn--inverse {
  background: var(--brand-cream);
  border-color: var(--brand-cream);
  color: var(--brand-red);
}
.btn--inverse-ghost {
  background: transparent;
  border-color: var(--brand-cream);
  color: var(--brand-cream);
}
.btn--inverse-ghost:hover {
  background: var(--brand-cream);
  color: var(--brand-red);
}
.btn--block {
  width: 100%;
}
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- шапка ---------- */
.header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-6) var(--space-8);
  padding-block: var(--space-6);
}
.header__logo img {
  height: 56px;
  width: auto;
}
.header__nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  flex: 999 1 240px;
}
.header__phone {
  font-size: 19px;
  font-weight: 600;
  white-space: nowrap;
}

.cart-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  background: var(--brand-red);
  color: var(--brand-cream);
  font-weight: 600;
  white-space: nowrap;
}
.cart-link:hover {
  background: #8c1512;
  color: var(--brand-cream);
}
.cart-link__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding-inline: 6px;
  border-radius: var(--radius-pill);
  background: var(--brand-cream);
  color: var(--brand-red);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------- секции ---------- */
.section {
  padding-top: var(--space-24);
}
.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6);
}
.section__intro {
  flex: 1 1 420px;
  min-width: 0;
}
.lettering {
  width: clamp(200px, 24vw, 280px);
  height: auto;
}

/* ---------- hero ---------- */
.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-12);
}
.hero__text {
  flex: 999 1 420px;
  min-width: 0;
}
.hero__mascot {
  flex: 1 1 260px;
  display: flex;
  justify-content: center;
}
.hero__mascot img {
  width: 100%;
  max-width: 340px;
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-8);
}

/* ---------- плитки фактов ---------- */
.facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-top: var(--space-4);
}
.fact {
  flex: 1 1 240px;
  min-width: 0;
  background: var(--surface-raised);
  border-radius: var(--radius-m);
  padding: var(--space-6);
}
.fact__value {
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 34px;
  font-weight: 700;
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.fact p + p {
  margin: var(--space-2) 0 0;
}

/* ---------- навигация по категориям ---------- */
.catnav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-8);
}
.catnav__item {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 9px 21px;
  border: 1.5px solid var(--brand-red);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--brand-red);
  font-family: var(--font-text);
  cursor: pointer;
}
.catnav__item:hover {
  background: var(--surface-raised);
  color: var(--brand-red);
}
.catnav__item[aria-current="true"],
.catnav__item.is-active {
  background: var(--brand-red);
  border-color: var(--brand-red);
  color: var(--brand-cream);
}

.catnav--sticky {
  position: sticky;
  top: 0;
  z-index: 5;
  margin-top: 0;
  padding-block: var(--space-4);
  background: var(--surface-base);
}

/* ---------- карточки меню ---------- */
.cards {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  margin-top: var(--space-6);
}
.card {
  flex: 1 1 320px;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface-raised);
  border-radius: var(--radius-m);
  overflow: hidden;
}
.card__media {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
/* Позиции, которых нет в фотобанке бренда, — фирменная заглушка, не серый квадрат. */
.card__media--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-cream);
  background-image: url("../img/pattern-shrimp-beige.svg");
  background-size: 110px auto;
}
.card__media--empty span {
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  background: var(--surface-raised);
  color: var(--ink);
}
.card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6);
  flex-grow: 1;
}
.card__title {
  font-family: var(--font-display);
  font-size: clamp(24px, 2.4vw, 32px);
  line-height: 1.06;
  font-weight: 700;
  margin: 0;
}
.card__composition,
.card__meta {
  margin: 0;
}
.card__prices {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  margin-top: auto;
  padding-top: var(--space-3);
}
.card__price {
  font-size: 22px;
  line-height: 24px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.card__price-was {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}
.card__saving {
  margin: 0;
}

/* Метка уровня: цвет несёт точка, текст всегда красный — так он читается. */
.level {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 14px;
  border: 1.5px solid var(--brand-red);
  border-radius: var(--radius-pill);
}
.level__dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-pill);
}
.level--legkiy .level__dot {
  background: var(--brand-blue);
}
.level--vkusnyy .level__dot {
  background: var(--accent-calm);
}
.level--premium .level__dot {
  background: var(--accent-appetite);
}

/* ---------- корзина ---------- */
.cart-layout {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  align-items: flex-start;
  margin-top: var(--space-12);
}
.cart-main {
  flex: 999 1 420px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.cart-side {
  flex: 1 1 360px;
  min-width: 0;
}

.cart-item {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5, 20px);
  align-items: center;
}
.cart-item + .cart-item {
  border-top: 1.5px solid var(--accent-calm);
  padding-top: var(--space-6);
}
.cart-item__media {
  width: 104px;
  height: 104px;
  object-fit: cover;
  border-radius: var(--radius-m);
  flex: 0 0 auto;
}
.cart-item__info {
  flex: 999 1 220px;
  min-width: 0;
}
.cart-item__title {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 26px;
  font-weight: 700;
  margin: 0;
}
.cart-item__sum {
  flex: 0 0 auto;
  min-width: 110px;
  text-align: right;
  font-size: 22px;
  line-height: 24px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stepper {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 0 0 auto;
}
.stepper__btn {
  width: 44px;
  height: 44px;
  border: 1.5px solid var(--brand-red);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--brand-red);
  font-family: var(--font-text);
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
}
.stepper__btn:hover {
  background: var(--brand-red);
  color: var(--brand-cream);
}
.stepper__value {
  min-width: 28px;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.summary dl {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  font-variant-numeric: tabular-nums;
}
.summary dl > div {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
}
.summary dd {
  margin: 0;
}
.summary__rule {
  border: none;
  border-top: 1.5px solid currentColor;
  opacity: 0.5;
  margin: 0;
}
.summary__total {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2) var(--space-4);
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 34px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Подпись и сумма переносятся целиком, а не разрываются по слогам. */
.summary__total > * {
  white-space: nowrap;
}

/* ---------- формы ---------- */
.field {
  flex: 1 1 240px;
  min-width: 0;
}
.field label {
  display: block;
  margin-bottom: var(--space-2);
}
.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}
input[type="text"],
input[type="tel"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--brand-red);
  border-radius: var(--radius-s);
  background: var(--surface-base);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 24px;
}
input::placeholder,
textarea::placeholder {
  color: var(--ink);
  opacity: 0.75;
}
fieldset {
  margin: 0;
  padding: 0;
  border: none;
}
legend {
  padding: 0;
  margin-bottom: var(--space-3);
}
.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.choice {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 24px;
  border: 1.5px solid var(--brand-red);
  border-radius: var(--radius-pill);
  background: var(--surface-base);
  font-weight: 600;
  cursor: pointer;
}
.choice input {
  width: 22px;
  height: 22px;
  accent-color: var(--brand-red);
  flex: 0 0 auto;
}
.choice:has(input:checked) {
  background: var(--brand-red);
  color: var(--brand-cream);
}
.choice:has(input:checked) input {
  accent-color: var(--brand-cream);
}
.consent {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  cursor: pointer;
}
.consent input {
  width: 22px;
  height: 22px;
  accent-color: currentColor;
  flex: 0 0 auto;
}
.promo {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.promo input {
  flex: 999 1 160px;
  width: auto;
  border-color: var(--brand-cream);
}

/* ---------- отправка заказа ---------- */
/* Заказ не ушёл: рамка в фирменном красном, без своих цветов «ошибки». */
.order-error {
  margin: 0;
  padding: var(--space-4) var(--space-6);
  border: 2px solid var(--brand-red);
  border-radius: var(--radius-m);
  background: var(--surface-base);
}
.order-error a {
  font-weight: 600;
  white-space: nowrap;
}
/* Пока заказ уходит: кнопка заблокирована, подпись меняет app.js. */
.btn[aria-busy="true"] {
  cursor: progress;
}

/* ---------- пустое состояние ---------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-6);
  padding-block: var(--space-16);
}
.empty img {
  width: 190px;
}
.empty p {
  margin: 0;
  max-width: 440px;
}

/* ---------- подвал ---------- */
.footer {
  margin-top: var(--space-24);
  padding-bottom: var(--space-12);
}
.footer__grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-12);
  align-items: flex-start;
}
.footer__col {
  flex: 1 1 220px;
}
.footer__logo {
  height: 72px;
  width: auto;
}
.footer ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* ---------- мелочи ---------- */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.mt-3 {
  margin-top: var(--space-3);
}
.mt-6 {
  margin-top: var(--space-6);
}
.row-baseline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-4);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(120%);
  z-index: 20;
  padding: 14px 28px;
  border-radius: var(--radius-pill);
  background: var(--brand-red);
  color: var(--brand-cream);
  font-weight: 600;
  transition: transform 0.25s ease;
}
.toast.is-shown {
  transform: translateX(-50%) translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
  html {
    scroll-behavior: auto;
  }
}

html {
  scroll-behavior: smooth;
}
