/* Theme character for product screens (chat, diary panel, sign-in), the landing and the media center.
   Each theme differs in type, shape and texture, not only in colour:
   care  "Розовая"  — нежная и женственная: розовый с сиренью, округлый Nunito, мягкие тени без рамок, сердечко на активной вкладке;
   light "Светлая"  — нейтральная и универсальная: графит, белые карточки с тонкой рамкой, один тёплый акцент на данных;
   dark  "Тёмная"   — спортивная: графит и неоновый лайм, Oswald заглавными, рубленые углы, сегментные шкалы.
   Theme names describe appearance and never an account's gender. The rules live in docs/design/theme-character.md.
   Selectors are prefixed with the page class so they win over the older per-theme details without !important. */

@font-face { font-family: "Nunito"; src: url("/fonts/nunito-variable.ttf") format("truetype"); font-style: normal; font-weight: 200 1000; font-display: swap; }

:root[data-theme] :is(body.web-chat-page, body.web-auth-page, body.web-landing-page, body.web-media-page) {
  --ch-font-head: "Manrope", ui-sans-serif, system-ui, sans-serif;
  --ch-font-num: "Manrope", ui-sans-serif, system-ui, sans-serif;
  --ch-head-transform: none;
  --ch-head-spacing: -0.02em;
  --ch-head-weight: 800;
  --ch-radius: 16px;
  --ch-radius-sm: 12px;
  --ch-radius-button: 12px;
  --ch-card-border: var(--line);
  --ch-card-shadow: none;
  --ch-card-fill: var(--paper);
  --ch-primary-fill: var(--primary);
  --ch-primary-glow: none;
  --ch-ring-from: var(--accent);
  --ch-ring-to: var(--accent);
  --ch-ring-track: var(--surface-strong);
  --ch-ring-hole: var(--paper);
  --ch-tab-mark: "";
  --ch-tab-mark-width: 18px;
  --ch-tab-mark-height: 3px;
  --ch-tab-mark-fill: var(--accent);
  --ch-page-bg: var(--cream);
  --ch-chat-bg: var(--cream);
}

:root[data-theme="care"] :is(body.web-chat-page, body.web-auth-page, body.web-landing-page, body.web-media-page) {
  --ink: #3f1f3a;
  --ink-soft: #85667e;
  --cream: #fff3f7;
  --paper: #fffcfd;
  --surface-soft: #fff0f6;
  --surface-strong: #f9dbe8;
  --line: #f6dfe9;
  --line-strong: #ebc6d8;
  --primary: #cf3a78;
  --on-primary: #ffffff;
  --accent: #b8306a;
  --accent-soft: #fde6f0;
  --accent-second: #9a5bd6;
  --hero-wash: #fbe0ef;
  --hero-warm: #f3e6ff;
  --message-user: #f1e4ff;
  --message-user-ink: #55316f;
  --macro-protein: #a46be8;
  --macro-fat: #ef8a8f;
  --macro-carbs: #3fae8f;
  --shadow: 0 22px 60px -30px #d9558f55;
  /* Legacy aliases resolve on :root, so product pages re-point them here. */
  --pink: var(--accent);
  --purple: var(--accent);
  --orange: var(--accent-second);

  --ch-font-head: "Nunito", "Manrope", ui-rounded, system-ui, sans-serif;
  --ch-font-num: "Nunito", "Manrope", ui-rounded, system-ui, sans-serif;
  --ch-head-spacing: -0.015em;
  --ch-radius: 24px;
  --ch-radius-sm: 16px;
  --ch-radius-button: 999px;
  --ch-card-border: transparent;
  --ch-card-shadow: 0 10px 28px -16px #e0558f80;
  --ch-card-fill: linear-gradient(180deg, #ffffff, #fff6fa);
  /* Both gradient ends keep white button text at 4.5:1 or better. */
  --ch-primary-fill: linear-gradient(120deg, #cf3a78, #9257d2);
  --ch-primary-glow: 0 10px 22px -10px #e5559499;
  --ch-ring-from: #f2669f;
  --ch-ring-to: #b67ae9;
  --ch-ring-track: #fbe1ed;
  --ch-ring-hole: #fffafd;
  --ch-tab-mark: "\2665";
  --ch-tab-mark-width: auto;
  --ch-tab-mark-height: auto;
  --ch-tab-mark-fill: transparent;
  --ch-page-bg: radial-gradient(ellipse 520px 460px at 4% 8%, #ffd9e8, transparent), radial-gradient(ellipse 520px 460px at 98% 94%, #ecdcff, transparent), #fff3f7;
  --ch-chat-bg: radial-gradient(ellipse at 100% 85%, #f3e6ff80, transparent 50%), #fffafd;
}

:root[data-theme="light"] :is(body.web-chat-page, body.web-auth-page, body.web-landing-page, body.web-media-page) {
  --ink: #1d1f23;
  --ink-soft: #5d636b;
  --cream: #f5f5f3;
  --paper: #ffffff;
  --surface-soft: #f2f2ef;
  --surface-strong: #e6e6e2;
  --line: #e3e4e6;
  --line-strong: #c9cbcf;
  --primary: #1d1f23;
  --on-primary: #ffffff;
  --accent: #b8492a;
  --accent-soft: #f2f1ee;
  --accent-second: #b8492a;
  --hero-wash: #efeeea;
  --hero-warm: #fbefe9;
  --message-user: #eceef1;
  --message-user-ink: #1d1f23;
  --macro-protein: #4f6bed;
  --macro-fat: #e3902c;
  --macro-carbs: #1f9a83;
  --shadow: 0 1px 2px #0000000d, 0 14px 40px -24px #00000033;
  --pink: var(--accent);
  --purple: var(--primary);
  --orange: var(--accent);

  --ch-card-shadow: 0 1px 2px #0000000a;
  --ch-ring-from: #e0603a;
  --ch-ring-to: #e0603a;
  --ch-ring-track: #ebecee;
  --ch-tab-mark-fill: #e0603a;
  --ch-page-bg: #f5f5f3;
  --ch-chat-bg: #fafaf9;
}

:root[data-theme="dark"] :is(body.web-chat-page, body.web-auth-page, body.web-landing-page, body.web-media-page) {
  --ch-font-head: "Oswald", "Arial Narrow", Impact, sans-serif;
  --ch-font-num: "Oswald", "Arial Narrow", Impact, sans-serif;
  --ch-head-transform: uppercase;
  --ch-head-spacing: 0.02em;
  --ch-head-weight: 600;
  --ch-radius: 10px;
  --ch-radius-sm: 8px;
  --ch-radius-button: 6px;
  --ch-card-fill: var(--paper);
  --ch-primary-glow: 0 0 22px #d7ff3f33;
  --ch-tab-mark-width: 22px;
  --ch-page-bg: repeating-linear-gradient(135deg, #ffffff05 0 2px, transparent 2px 16px), #070708;
  --ch-chat-bg: #09090b;
}

/* ---------- Type ---------- */
:root[data-theme] .web-chat-page :is(.chat-brand__name, .chat-empty h1, .workspace-section-heading h2, .energy-ledger__heading h3, .profile-appearance h3, .workspace-list-heading h3),
:root[data-theme] .web-chat-page .chat-workspace__header span,
:root[data-theme] .web-auth-page :is(.web-auth__card h1, .web-auth__brand) {
  font-family: var(--ch-font-head);
  font-weight: var(--ch-head-weight);
  letter-spacing: var(--ch-head-spacing);
  text-transform: var(--ch-head-transform);
}
:root[data-theme] .web-chat-page :is(.nutrition-card__main strong, .nutrition-progress__value, .energy-ledger__result strong, .nutrition-macros strong) {
  font-family: var(--ch-font-num);
}

/* ---------- Page and chat ---------- */
:root[data-theme] .web-chat-page, :root[data-theme] .web-auth-page { background: var(--ch-page-bg); }
:root[data-theme] .web-chat-page .chat-main { background: var(--ch-chat-bg); }
:root[data-theme] .web-chat-page .chat-workspace { background: var(--cream); }
:root[data-theme] .web-chat-page :is(.chat-header, .chat-composer-wrap, .chat-workspace__header, .workspace-tabs) { background: var(--paper); border-color: var(--line); }
:root[data-theme] .web-chat-page .chat-message__bubble { background: var(--ch-card-fill); border-color: var(--ch-card-border); box-shadow: var(--ch-card-shadow); border-radius: 6px var(--ch-radius) var(--ch-radius); }
:root[data-theme] .web-chat-page .chat-message--user .chat-message__bubble { color: var(--message-user-ink); background: var(--message-user); border-color: transparent; box-shadow: none; border-radius: var(--ch-radius) 6px var(--ch-radius) var(--ch-radius); }
:root[data-theme] .web-chat-page .chat-message--user :is(.chat-message__time, .chat-message__processing) { color: var(--ink-soft); }
:root[data-theme] .web-chat-page .chat-message--assistant .chat-message__actions { background: var(--surface-soft); border-color: var(--line); border-radius: var(--ch-radius-sm); box-shadow: none; }
:root[data-theme] .web-chat-page .chat-action-button { color: var(--accent); background: var(--paper); border-color: var(--line-strong); border-radius: var(--ch-radius-button); }
:root[data-theme] .web-chat-page :is(.chat-action-button--primary, .chat-send, .chat-recorder__send, .chat-new-messages) { color: var(--on-primary); background: var(--ch-primary-fill); border-color: transparent; box-shadow: var(--ch-primary-glow); }
:root[data-theme] .web-chat-page .chat-action-button--primary:hover { box-shadow: var(--ch-primary-glow); filter: brightness(1.05); }
:root[data-theme] .web-chat-page .chat-send { border-radius: var(--ch-radius-button); }
:root[data-theme] .web-chat-page .chat-composer { background: var(--paper); border-color: var(--line); border-radius: var(--ch-radius); box-shadow: var(--ch-card-shadow); }
:root[data-theme] .web-chat-page .chat-composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
:root[data-theme] .web-chat-page .chat-composer__tool:hover { color: var(--accent); background: var(--accent-soft); }
:root[data-theme] .web-chat-page :is(.chat-tool-trace__item, .chat-agent-activity, .chat-history-loader) { color: var(--ink-soft); background: var(--paper); border-color: var(--line); border-radius: var(--ch-radius-sm); box-shadow: none; }
:root[data-theme] .web-chat-page .chat-tool-trace__item--running { color: var(--accent); background: var(--accent-soft); }
:root[data-theme] .web-chat-page .chat-agent-activity__orb { color: var(--accent); background: var(--accent-soft); border-radius: var(--ch-radius-sm); }
:root[data-theme] .web-chat-page .chat-agent-activity__orb i { background: var(--accent); }
:root[data-theme] .web-chat-page .chat-agent-activity__tools span { color: var(--ink-soft); }
:root[data-theme] .web-chat-page .chat-suggestions button { color: var(--accent); background: var(--paper); border-color: var(--line-strong); border-radius: var(--ch-radius-button); box-shadow: none; }
:root[data-theme] .web-chat-page .chat-suggestions button:hover { background: var(--accent-soft); }
:root[data-theme] .web-chat-page :is(.chat-header__button, .theme-picker--compact summary) { color: var(--ink); background: var(--paper); border-color: var(--line); border-radius: var(--ch-radius-sm); box-shadow: none; }
:root[data-theme] .web-chat-page .chat-header__button--quiet { color: var(--ink-soft); background: transparent; }
:root[data-theme] .web-chat-page .chat-empty > .chat-empty__eyebrow { color: var(--accent); }
:root[data-theme] .web-chat-page .theme-handnote { color: var(--accent); }

/* ---------- Diary panel ---------- */
:root[data-theme] .web-chat-page .workspace-tab { border-radius: var(--ch-radius-sm); }
:root[data-theme] .web-chat-page .workspace-tab.is-active { position: relative; color: var(--ink); background: var(--surface-soft); box-shadow: none; }
:root[data-theme] .web-chat-page .workspace-tab.is-active::after {
  content: var(--ch-tab-mark);
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: var(--ch-tab-mark-width);
  height: var(--ch-tab-mark-height);
  transform: translateX(-50%);
  color: var(--accent);
  background: var(--ch-tab-mark-fill);
  border-radius: 2px;
  font-size: 8px;
  line-height: 1;
}
:root[data-theme] .web-chat-page .workspace-eyebrow { color: var(--accent); }
:root[data-theme] .web-chat-page :is(.workspace-discuss, .diary-day > header button) { color: var(--accent); background: var(--paper); border-color: var(--line-strong); border-radius: var(--ch-radius-button); }
:root[data-theme] .web-chat-page .workspace-scene { background: var(--surface-soft); border-color: var(--ch-card-border); border-radius: var(--ch-radius); box-shadow: var(--ch-card-shadow); }
:root[data-theme] .web-chat-page .workspace-scene .theme-handnote { color: var(--accent); }

:root[data-theme] .web-chat-page :is(.nutrition-card, .energy-ledger, .meal-row, .diary-day, .workout-card, .memory-row, .profile-facts, .profile-appearance, .profile-email, .profile-telegram) {
  background: var(--ch-card-fill);
  border-color: var(--ch-card-border);
  border-radius: var(--ch-radius);
  box-shadow: var(--ch-card-shadow);
}
:root[data-theme] .web-chat-page .nutrition-card__main strong { color: var(--ink); }
:root[data-theme] .web-chat-page .nutrition-macros > div { background: var(--surface-soft); border-color: var(--ch-card-border); border-radius: var(--ch-radius-sm); }
:root[data-theme] .web-chat-page .nutrition-macros > div:first-child { border-top-color: var(--macro-protein); }
:root[data-theme] .web-chat-page .nutrition-macros > div:nth-child(2) { border-top-color: var(--macro-fat); }
:root[data-theme] .web-chat-page .nutrition-macros > div:nth-child(3) { border-top-color: var(--macro-carbs); }

/* Plain progress ring for care and light: a clean circle, no bite or decoration. */
:root[data-theme="care"] .web-chat-page .nutrition-progress,
:root[data-theme="light"] .web-chat-page .nutrition-progress {
  background: conic-gradient(from -90deg, var(--ch-ring-from), var(--ch-ring-to) var(--nutrition-progress), var(--ch-ring-track) var(--nutrition-progress));
  box-shadow: none;
}
:root[data-theme="care"] .web-chat-page .nutrition-progress::before,
:root[data-theme="light"] .web-chat-page .nutrition-progress::before { inset: 8px; background: var(--ch-ring-hole); }
:root[data-theme="care"] .web-chat-page .nutrition-progress__value,
:root[data-theme="light"] .web-chat-page .nutrition-progress__value { color: var(--ink); }

/* Sport: a scoreboard bar made of segments. */
:root[data-theme="dark"] .web-chat-page .nutrition-progress { height: 9px; border-radius: 2px; background: var(--surface-strong); }
:root[data-theme="dark"] .web-chat-page .nutrition-progress > span {
  border-radius: 0;
  background: var(--accent);
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 10px, transparent 10px 13px);
  mask: repeating-linear-gradient(90deg, #000 0 10px, transparent 10px 13px);
  box-shadow: none;
}

:root[data-theme] .web-chat-page .workspace-quick-actions button { color: var(--ink); background: var(--paper); border-color: var(--line); border-radius: var(--ch-radius-button); box-shadow: var(--ch-card-shadow); }
:root[data-theme] .web-chat-page .workspace-quick-actions button:first-child { color: var(--on-primary); background: var(--ch-primary-fill); border-color: transparent; box-shadow: var(--ch-primary-glow); }
:root[data-theme] .web-chat-page .workspace-quick-actions button:last-child { color: var(--accent); background: var(--accent-soft); border-color: transparent; }

:root[data-theme] .web-chat-page .energy-ledger__result { background: var(--surface-soft); border-color: transparent; border-radius: var(--ch-radius-sm); }
:root[data-theme] .web-chat-page .energy-ledger__row { border-radius: var(--ch-radius-sm); }
:root[data-theme] .web-chat-page .diary-subtabs { background: var(--surface-soft); border-radius: var(--ch-radius-sm); }
:root[data-theme] .web-chat-page .diary-subtab { border-radius: calc(var(--ch-radius-sm) - 3px); }
:root[data-theme] .web-chat-page .diary-subtab.is-active { color: var(--ink); background: var(--paper); box-shadow: var(--ch-card-shadow); }
:root[data-theme] .web-chat-page .workspace-empty { background: var(--surface-soft); border-radius: var(--ch-radius); }
:root[data-theme] .web-chat-page .meal-row time, :root[data-theme] .web-chat-page .diary-day__meal time { color: var(--ink-soft); }

/* Profile: one primary style for every "connect" and "link e-mail" action. */
:root[data-theme] .web-chat-page :is(.profile-email__form input[type=submit], .profile-connection__action:not(.profile-connection__action--quiet), .profile-connection-link a, .profile-connection-link button) {
  color: var(--on-primary);
  background: var(--ch-primary-fill);
  border-radius: var(--ch-radius-button);
  box-shadow: var(--ch-primary-glow);
}
:root[data-theme] .web-chat-page .profile-email__form input[type=email] { background: var(--paper); border-color: var(--line-strong); border-radius: var(--ch-radius-sm); }
:root[data-theme] .web-chat-page .profile-connection-link { background: var(--surface-soft); border-color: var(--line); border-radius: var(--ch-radius-sm); }

/* Dark: uppercase labels on the primary buttons, like a gym scoreboard. */
:root[data-theme="dark"] .web-chat-page :is(.chat-action-button--primary, .workspace-quick-actions button:first-child) { font-family: var(--ch-font-head); text-transform: uppercase; letter-spacing: 0.06em; }

/* ---------- Sign-in ---------- */
:root[data-theme] .web-auth-page .web-auth__card { background: var(--ch-card-fill); border-color: var(--ch-card-border); border-radius: calc(var(--ch-radius) + 4px); box-shadow: var(--shadow); }
:root[data-theme] .web-auth-page .web-auth__form input[type=submit] { color: var(--on-primary); background: var(--ch-primary-fill); border-radius: var(--ch-radius-button); box-shadow: var(--ch-primary-glow); }
:root[data-theme] .web-auth-page .web-auth__form input:not([type=submit]) { background: var(--paper); border-radius: var(--ch-radius-sm); }
:root[data-theme] .web-auth-page .web-auth__eyebrow, :root[data-theme] .web-auth-page .web-auth__foot a { color: var(--accent); }

/* ---------- Landing and media center ----------
   The palette tokens above also apply here, so public pages match the product screenshots they show.
   Only the few signature elements need explicit rules. */
:root[data-theme] .web-landing-page .landing-start,
:root[data-theme] .web-media-page :is(.media-button, .media-button--capture, .media-header__cta) {
  color: var(--on-primary);
  background: var(--ch-primary-fill);
  box-shadow: var(--ch-primary-glow);
}
:root[data-theme="care"] .web-landing-page .landing-start { border-color: transparent; }
:root[data-theme] .web-media-page .media-button--secondary { color: var(--ink); background: var(--paper); box-shadow: none; }
:root[data-theme="care"] .web-landing-page .landing-hero h1 em,
:root[data-theme="care"] .web-media-page .media-hero h1 em {
  background-image: linear-gradient(100deg, #e0498a, #9d5ce0);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
/* Nunito runs wider than Manrope: keep each heading's own tight tracking and trim the hero a little. */
:root[data-theme="care"] :is(.web-landing-page, .web-media-page) :is(h1, h2, h3) { font-family: var(--ch-font-head); }
:root[data-theme="care"] .web-landing-page .landing-hero h1 { font-size: clamp(38px, 3.9vw, 54px); letter-spacing: -.045em; }
@media (min-width: 900px) { :root[data-theme="care"] .web-landing-page .landing-hero h1 em { white-space: nowrap; } }
