/* Палитра сайта ПловРФ: три светлые схемы + панель выбора в шапке.
   Тема ставится атрибутом html[data-theme="ocean|sky|emerald"], выбор хранится в localStorage.
   В каждой схеме три оттенка: основной акцент, светлый (лазурь/мята) и третий (изумруд/лес). */

/* ---------- значения по умолчанию (Океан) ---------- */
:root,
html[data-theme="ocean"] {
  --primary: #005f96;
  --primary-hover: #004f7d;
  --on-primary: #ffffff;
  --primary-soft: #d3e6f5;
  --primary-rgb: 0, 95, 150;
  --primary-ink: #004a75;
  --primary-ink-soft: #005f96;

  --accent2: #5aa9d6;
  --accent2-ink: #0f5a80;
  --accent2-soft: #dceffa;
  --accent2-rgb: 90, 169, 214;

  --accent3: #0f7048;
  --accent3-ink: #0b5a3a;
  --accent3-soft: #d3ecdd;
  --accent3-rgb: 15, 112, 72;

  --bg: #eaf3fc;
  --surface: #ffffff;
  --border: #a8c8e0;
  --border-strong: #8fb6d2;
  --ink: #071a29;
  --muted: #3a5567;
  --link: #004a75;

  --danger: #a72f1f;
  --ok: #0f5a3a;
  --media-bg: #d3e4f2;
  --input-bg: #ffffff;
  --footer-bg: #d9e8f6;
  --hdr-bg: rgba(255, 255, 255, .95);
  --hdr-bg-solid: rgba(255, 255, 255, .99);
  --inverse-bg: #071a29;
  --inverse-ink: #ffffff;
  --ripple: rgba(6, 30, 48, .2);
  --ripple-accent: rgba(255, 255, 255, .6);
  color-scheme: light;
}

/* ---------- 1. Светлая лазурь контрастная: бирюза на светлом ---------- */
html[data-theme="sky"] {
  --primary: #0b6374;
  --primary-hover: #095868;
  --primary-rgb: 11, 99, 116;
  --primary-ink: #08505f;
  --primary-ink-soft: #0b6374;
  --primary-soft: #d2eef4;

  --accent2: #4fb6cd;
  --accent2-ink: #0a5c70;
  --accent2-soft: #dcf3f8;
  --accent2-rgb: 79, 182, 205;

  --accent3: #0f7048;
  --accent3-ink: #0b5a3a;
  --accent3-soft: #d3ecdd;
  --accent3-rgb: 15, 112, 72;

  --bg: #eefafc;
  --surface: #ffffff;
  --border: #a9d2dd;
  --border-strong: #8cc3d1;
  --ink: #06222b;
  --muted: #35545e;
  --link: #08505f;
  --media-bg: #d5eef3;
  --input-bg: #ffffff;
  --footer-bg: #dcf1f6;
  --hdr-bg: rgba(255, 255, 255, .95);
  --hdr-bg-solid: rgba(255, 255, 255, .99);
  --inverse-bg: #06222b;
  --inverse-ink: #ffffff;
}

/* ---------- 2. Изумруд контрастный ---------- */
html[data-theme="emerald"] {
  --primary: #116342;
  --primary-hover: #0e583a;
  --primary-rgb: 17, 99, 66;
  --primary-ink: #0c4d33;
  --primary-ink-soft: #116342;
  --primary-soft: #d0ece0;

  --accent2: #4fbf8f;
  --accent2-ink: #0c5940;
  --accent2-soft: #d9f2e6;
  --accent2-rgb: 79, 191, 143;

  --accent3: #0d4f36;
  --accent3-ink: #093c29;
  --accent3-soft: #cbe7d8;
  --accent3-rgb: 13, 79, 54;

  --bg: #ecf8f1;
  --surface: #ffffff;
  --border: #aacfba;
  --border-strong: #8fc0a6;
  --ink: #081f16;
  --muted: #2f5545;
  --link: #0c4d33;
  --media-bg: #d5eddf;
  --input-bg: #ffffff;
  --footer-bg: #dcefe4;
  --hdr-bg: rgba(255, 255, 255, .95);
  --hdr-bg-solid: rgba(255, 255, 255, .99);
  --inverse-bg: #081f16;
  --inverse-ink: #ffffff;
}

/* ---------- распределение оттенков по ролям ---------- */
.badge { background: var(--accent2-soft); color: var(--accent2-ink); border-color: rgba(var(--accent2-rgb), .55); }
.hdr-cats button[aria-pressed="true"],
.chips button[aria-pressed="true"],
.catbar-pills button[aria-pressed="true"] {
  background: var(--accent2-soft);
  border-color: var(--accent2);
  color: var(--accent2-ink);
}
.chips button[aria-pressed="true"] span { color: var(--accent2-ink); }

/* изумруд заметен с первого экрана: плашка «Хит», статус «принимаем заказы», цифры преимуществ */
.badge { background: var(--accent3); color: #ffffff; border-color: var(--accent3); }
.live .dot { background: var(--accent3); box-shadow: 0 0 0 4px rgba(var(--accent3-rgb), .18); }
.info-stats div b { color: var(--accent3); }
.dish-tag.hot { background: var(--accent3); color: #ffffff; }
.cart-badge { background: var(--accent3); color: #ffffff; }
.success .tick { background: var(--accent3); color: #ffffff; }
.tl-step.done .tl-dot { background: var(--accent3); border-color: var(--accent3); color: #ffffff; }

/* тонкая полоска палитры под шапкой */
.hdr { position: sticky; }
.hdr::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg,
    var(--primary) 0%, var(--primary) 38%,
    var(--accent2) 38%, var(--accent2) 70%,
    var(--accent3) 70%, var(--accent3) 100%);
  opacity: .9;
  pointer-events: none;
}

/* мягкие тени */
.card-dish:hover, .promo:hover { box-shadow: 0 14px 30px rgba(12, 60, 90, .14); }
.btn:not(.btn-ghost):hover { box-shadow: 0 10px 24px rgba(var(--primary-rgb), .32); }
.theme-pop { box-shadow: 0 22px 50px rgba(12, 60, 90, .18); }
.dish-tag { box-shadow: 0 2px 8px rgba(10, 40, 60, .18); }


/* ---------- режим повышенного контраста (html[data-contrast="1"]) ---------- */
html[data-contrast="1"][data-theme="ocean"] {
  --primary: #00456e;
  --primary-hover: #003a5e;
  --primary-rgb: 0, 69, 110;
  --primary-ink: #003857;
  --primary-ink-soft: #00456e;
  --border: #7aa6c4;
  --border-strong: #6b9aba;
  --ink: #00131f;
  --muted: #2c4757;
  --link: #003857;
  --accent2: #3f95c7;
  --accent2-ink: #0a4f74;
  --accent3: #0d5539;
}
html[data-contrast="1"][data-theme="sky"] {
  --primary: #085766;
  --primary-hover: #074956;
  --primary-rgb: 8, 87, 102;
  --primary-ink: #06404c;
  --primary-ink-soft: #085766;
  --border: #8fc4d3;
  --border-strong: #78b1c2;
  --ink: #031820;
  --muted: #294751;
  --link: #06404c;
  --accent2: #35a6c2;
  --accent3: #0d5539;
}
html[data-contrast="1"][data-theme="emerald"] {
  --primary: #0d5539;
  --primary-hover: #0b4a32;
  --primary-rgb: 13, 85, 57;
  --primary-ink: #083f2b;
  --primary-ink-soft: #0d5539;
  --border: #96c4a9;
  --border-strong: #7fb494;
  --ink: #04140e;
  --muted: #244536;
  --link: #083f2b;
  --accent2: #35a97c;
  --accent3: #0b4a32;
}
html[data-contrast="1"] .card-dish,
html[data-contrast="1"] .promo,
html[data-contrast="1"] .info-card,
html[data-contrast="1"] .theme-card { border-width: 2px; }
html[data-contrast="1"] .btn { border-width: 2px; }
html[data-contrast="1"] .hdr-cats button,
html[data-contrast="1"] .chips button,
html[data-contrast="1"] input,
html[data-contrast="1"] select,
html[data-contrast="1"] textarea,
html[data-contrast="1"] .qty-box,
html[data-contrast="1"] .theme-btn { border-width: 2px; }
html[data-contrast="1"] .card-dish:hover,
html[data-contrast="1"] .promo:hover { box-shadow: 0 0 0 2px var(--primary), 0 16px 34px rgba(4, 26, 42, .24); }

/* переключатель контраста в панели */
.theme-contrast {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 12px 0 2px; padding: 10px 12px;
  border: 1.5px solid var(--border-strong); border-radius: 12px; background: var(--bg);
  cursor: pointer; font: inherit; color: var(--ink); text-align: left; width: 100%;
}
.theme-contrast b { font-size: 13.5px; font-weight: 600; }
.theme-contrast small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.theme-switch {
  position: relative; width: 42px; height: 24px; border-radius: 999px; flex: none;
  background: var(--border-strong); transition: background .2s;
}
.theme-switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
  transition: transform .22s cubic-bezier(.2,.8,.2,1);
}
.theme-contrast[aria-pressed="true"] .theme-switch { background: var(--primary); }
.theme-contrast[aria-pressed="true"] .theme-switch::after { transform: translateX(18px); }

/* ---------- кнопка палитры в шапке ---------- */
.theme-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  cursor: pointer; font: inherit; font-size: 14px; line-height: 1;
  transition: border-color .2s, background .2s, color .2s;
}
.theme-btn:hover { border-color: var(--primary); color: var(--primary); background: rgba(var(--primary-rgb), .08); }
.theme-btn svg { width: 18px; height: 18px; flex: none; }
.theme-btn .theme-dots { display: inline-flex; gap: 2px; margin-left: 2px; }
.theme-btn .theme-dots i { width: 7px; height: 7px; border-radius: 50%; display: block; transition: transform .28s cubic-bezier(.2,.8,.2,1); }
.theme-btn:hover .theme-dots i:nth-child(1) { transform: translateX(-2px) scale(1.15); }
.theme-btn:hover .theme-dots i:nth-child(3) { transform: translateX(2px) scale(1.15); }
.theme-btn[aria-expanded="true"] { border-color: var(--primary); color: var(--primary); }
@media (max-width: 720px) {
  .theme-btn { padding: 0 8px; height: 38px; }
  .theme-btn .theme-label { display: none; }
}

/* ---------- панель выбора ---------- */
.theme-pop {
  position: fixed; z-index: 120;
  width: min(360px, calc(100vw - 24px));
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
}
.theme-pop[hidden] { display: none; }
.theme-pop h3 { margin: 0 0 2px; font-size: 17px; font-family: var(--font-display); font-weight: var(--w-display); }
.theme-pop p.theme-sub { margin: 0 0 12px; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.theme-list { display: grid; gap: 8px; }
.theme-card {
  display: block; width: 100%; padding: 0; cursor: pointer; text-align: left;
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg);
  overflow: hidden; color: var(--ink); font: inherit;
  transition: border-color .18s, transform .18s;
}
.theme-card:hover { border-color: var(--muted); transform: translateY(-1px); }
.theme-card[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.theme-strip { display: grid; grid-template-columns: repeat(5, 1fr); height: 34px; transition: height .25s ease; }
.theme-card:hover .theme-strip { height: 40px; }
.theme-strip i { display: block; }
.theme-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; }
.theme-meta b { font-size: 14px; font-weight: 600; }
.theme-meta small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; font-weight: 400; }
.theme-check { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 1px solid var(--border); display: grid; place-items: center; }
.theme-card[aria-pressed="true"] .theme-check { border-color: var(--primary); background: var(--primary); color: #fff; }
.theme-check svg { width: 11px; height: 11px; }
.theme-card[aria-pressed="false"] .theme-check svg { display: none; }
.theme-backdrop { position: fixed; inset: 0; z-index: 110; background: rgba(12, 40, 60, .28); }
.theme-backdrop[hidden] { display: none; }

/* ---------- повышенный контраст: рамки, кнопки, hover ---------- */
.card-dish, .promo, .info-card, .theme-card, .qty-box,
input, select, textarea, .hdr-cats button, .chips button, .theme-btn {
  border-color: var(--border-strong);
}
.theme-card { border-width: 2px; }
.btn { border-width: 2px; }
.btn-ghost { border-width: 2px; border-color: var(--border-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--primary); background: var(--primary); color: var(--on-primary); }

.card-dish:hover { border-color: var(--primary); box-shadow: 0 16px 34px rgba(6, 32, 52, .18); }
.promo:hover { border-color: var(--primary); box-shadow: 0 14px 30px rgba(6, 32, 52, .18); }
.hdr-cats button:hover, .chips button:hover { border-color: var(--primary); }
.hdr-cats button[aria-pressed="true"], .chips button[aria-pressed="true"] { border-width: 2px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .18); }
.qty-box { border-width: 1.5px; }
.footer-social a { border-color: var(--border-strong); }
.footer-social a:hover { border-color: var(--primary); }

/* на узком экране у кнопки палитры остаются только цветные точки — название бренда не обрезается */
@media (max-width: 460px) {
  .theme-btn .theme-label { display: none; }
  .theme-btn { padding: 8px 10px; }
}
