/* The help as a chat (js/help.js): in a sheet on the order and film pages (a bottom sheet on phones, a dialog on
   computers), inline on /komek/. The conversation is the site's chat pack v1.2 (css/chat.css, the order chat on
   /yarat/): its message, panel and pill rules are mirrored here under .hp-chat, because chat.css restyles site-wide
   classes (.icon-btn, .ic) the order and film pages use. Change them together. Built from the brand tokens
   (css/tokens.css). */

/* ---------- the sheet ---------- */
.hp-scrim { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center;
  background: color-mix(in srgb, var(--c-ink) 0%, transparent); transition: background .24s ease; }
.hp-scrim.on { background: color-mix(in srgb, var(--c-ink) 40%, transparent); }
.hp-open, .hp-open body { overflow: hidden; }
.hp-sheet { position: relative; width: 100%; max-width: 560px; height: min(92dvh, 92vh); display: flex; flex-direction: column;
  overflow: hidden; border-radius: 28px 28px 0 0; background: var(--c-surface);
  box-shadow: 0 10px 30px color-mix(in srgb, var(--c-ink) 10%, transparent);
  transform: translateY(100%); transition: transform .24s ease; }
.hp-scrim.on .hp-sheet { transform: none; }
.hp-grab { position: absolute; left: 50%; top: 6px; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px;
  background: color-mix(in srgb, var(--c-ink) 18%, transparent); }
.hp-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 16px 10px 10px 16px;
  border-bottom: 1px solid var(--c-line); background: var(--c-surface); }
.hp-avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.hp-who { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.hp-who b { font-size: 16px; color: var(--c-ink); }
.hp-who small { overflow: hidden; font-size: 13px; color: var(--c-muted); white-space: nowrap; text-overflow: ellipsis; }
.hp-icon-btn { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: transparent; color: var(--c-ink); cursor: pointer; }
.hp-icon-btn:hover { background: color-mix(in srgb, var(--c-brand) 7%, transparent); }
.hp-icon-btn svg { width: 22px; height: 22px; }
.hp-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px 24px; }
.hp-body:focus { outline: none; }
@media (min-width: 768px) {
  .hp-scrim { align-items: center; padding: 16px; }
  .hp-sheet { max-width: 520px; height: min(86vh, 760px); border-radius: var(--radius-lg, 24px); transform: translateY(12px); opacity: 0;
    transition: transform .24s ease, opacity .24s ease; }
  .hp-scrim.on .hp-sheet { opacity: 1; }
  .hp-grab { display: none; }
  .hp-head { padding-top: 14px; }
}
@media (prefers-reduced-motion: reduce) { .hp-scrim, .hp-sheet { transition: none; } }

.hp-loading { display: grid; place-items: center; min-height: 160px; }
.hp-answer { margin: 16px 0; font-size: 16px; line-height: 1.6; }

/* ---------- the chat frame: in the sheet the conversation scrolls above the answer panel ---------- */
.hp-chat {
  --chat-tint: color-mix(in srgb, var(--c-brand) 7%, transparent);
  --chat-tint-hover: color-mix(in srgb, var(--c-brand) 12%, transparent);
  --chat-soft: 0 1px 2px color-mix(in srgb, var(--c-ink) 6%, transparent), 0 4px 14px color-mix(in srgb, var(--c-ink) 4%, transparent);
  --chat-float: 0 10px 30px color-mix(in srgb, var(--c-ink) 10%, transparent);
}
.hp-body.hp-chat { display: flex; flex-direction: column; overflow: hidden; padding: 0; background: var(--c-bg); }
.hp-chat .hp-log { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain;
  padding: 16px 14px 36px; scrollbar-width: thin; }
.hp-chat .hp-log > * { flex-shrink: 0; }
.hp-chat .hp-log > :first-child { margin-top: auto; }       /* a short chat sits at the bottom, by the answers */
.hp-chat .hp-log > * + * { margin-top: 10px; }
.hp-chat .hp-log > .cb-santa + .cb-santa, .hp-chat .hp-log > .cb-me + .cb-me { margin-top: 4px; }
.hp-chat .hp-log > .cb-santa + .cb-card { margin-top: 6px; }
.hp-chat .hp-bottom { flex: none; position: relative; z-index: 2; margin-top: -30px;
  padding: 30px 10px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(to bottom, transparent, var(--c-bg) 30px); }
.hp-chat .chat-composer { display: grid; gap: 6px; }
.hp-chat .chat-composer:empty { display: none; }
.hp-chat .chat-composer > .cb-err { margin: 0; padding: 0 14px; font-size: 13px; color: var(--c-error); }
.hp-ts:empty { display: none; }

/* the help page /komek/: the page scrolls; the panel stays at the bottom of the screen */
.hp-page .hp-inline { max-width: 640px; margin: 0 auto; padding: 0 0 8px; }
.hp-page .hp-chat .hp-log { overflow: visible; padding: 4px 0 20px; }
.hp-page .hp-chat .hp-log > :first-child { margin-top: 0; }    /* on the page the talk starts under the heading */
.hp-page .hp-chat .hp-bottom { position: sticky; bottom: 0; margin-top: 0; padding: 24px 0 calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--c-bg) 24px); }

/* ---------- the messages (pack §2): arzumvar on the left under one avatar, the parent on the right ---------- */
.hp-chat .cb-row { display: flex; align-items: flex-end; gap: 8px; }
.hp-chat .cb-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none; visibility: hidden; }
.hp-chat .cb-santa.last .cb-avatar { visibility: visible; }
.hp-chat .cb { display: grid; gap: 2px; margin: 0; max-width: min(85%, 560px); padding: 10px 15px; border-radius: var(--radius);
  font-size: 16px; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.hp-chat .cb-santa .cb { border-bottom-left-radius: 6px; background: var(--c-surface); color: var(--c-ink); box-shadow: var(--chat-soft); }
.hp-chat .cb-me { justify-content: flex-end; }
.hp-chat .cb-me .cb { border-bottom-right-radius: 6px; background: var(--c-brand); color: var(--c-on-brand); font-weight: 500; }
/* the owner's own reply: the same side, a warm tint, with its time */
.hp-chat .hp-us .cb { background: color-mix(in srgb, var(--c-gold) 16%, var(--c-surface)); }
.hp-chat .hp-tag { font-size: 12px; font-weight: 700; color: var(--c-muted); }
.hp-chat .hp-time { font-size: 11px; color: var(--c-muted); }
.hp-chat .cb-typing { display: inline-flex; gap: 4px; padding: 15px; }
.hp-chat .cb-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--c-muted); opacity: .35; animation: hp-dot 1s infinite; }
.hp-chat .cb-typing span:nth-child(2) { animation-delay: .15s; }
.hp-chat .cb-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes hp-dot { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }

/* the parent's requests: a card whose rows are buttons (pack §7) */
.hp-chat .cb-card { margin-left: 36px; max-width: 560px; overflow: hidden; border-radius: var(--radius); background: var(--c-surface); box-shadow: var(--chat-soft); }
.hp-chat .cb-srow { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 16px;
  border: 0; border-top: 1px solid var(--c-line); background: none; color: var(--c-ink); font: inherit; text-align: left; cursor: pointer;
  transition: background-color .15s; }
.hp-chat .cb-card > .cb-srow:first-child { border-top: 0; }
@media (hover: hover) { .hp-chat .cb-srow:hover { background: color-mix(in srgb, var(--c-brand) 4%, transparent); } }
.hp-chat .cb-srow:focus-visible { outline: 2px solid var(--c-focus); outline-offset: -3px; }
.hp-chat .cb-srow-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.hp-chat .cb-k { font-size: 13px; color: var(--c-muted); }
.hp-chat .cb-v { font-size: 16px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.hp-chat .cb-pen-i { display: grid; flex: none; color: var(--c-muted); opacity: .75; }
.hp-chat .cb-pen-i svg { width: 18px; height: 18px; }
.hp-chat .hp-fresh .cb-v::after { content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 8px; border-radius: 50%;
  background: var(--c-brand); vertical-align: middle; }

/* ---------- the bottom: one floating panel of tonal pills, or the field being typed (pack §3–§5) ---------- */
.hp-chat .cb-panel { display: grid; gap: 8px; max-height: 50vh; overflow-y: auto; padding: 8px;
  border: 1px solid var(--c-line); border-radius: var(--radius-lg); background: var(--c-surface); box-shadow: var(--chat-float);
  transition: border-color .15s, box-shadow .15s; }
.hp-chat .cb-panel:has(.cb-input:focus) { border-color: color-mix(in srgb, var(--c-brand) 45%, transparent);
  box-shadow: var(--chat-float), 0 0 0 4px color-mix(in srgb, var(--c-brand) 10%, transparent); }
.hp-chat .cb-panel:has(.cb-input[aria-invalid="true"]) { border-color: var(--c-error); }
.hp-chat .hp-group { margin: 6px 8px -2px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--c-muted); }
.hp-chat .cb-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.hp-chat .cb-chip { flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 8px 18px;
  border: 0; border-radius: var(--radius-pill); background: var(--chat-tint); color: var(--c-brand);
  font: 500 16px/1.25 var(--font-body); text-align: center; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background-color .15s, color .15s, transform .1s; }
.hp-chat .cb-chip:active { transform: scale(.97); }
.hp-chat .cb-chip:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.hp-chat .cb-chip.quiet { background: transparent; color: var(--c-muted); }
.hp-chat .cb-chip.on, .hp-chat .cb-chip.cb-main { background: var(--c-brand); color: var(--c-on-brand); }
@media (hover: hover) {
  .hp-chat .cb-chip:hover { background: var(--chat-tint-hover); }
  .hp-chat .cb-chip.quiet:hover { background: color-mix(in srgb, var(--c-ink) 5%, transparent); }
  .hp-chat .cb-chip.on:hover, .hp-chat .cb-chip.cb-main:hover { background: var(--c-brand-hover); }
}
.hp-chat .cb-wide { flex: none; width: 100%; min-height: 50px; font-weight: 600; }
.hp-chat .cb-form { display: flex; align-items: center; gap: 8px; }
.hp-chat .cb-input { flex: 1; min-width: 0; height: 48px; padding: 0 12px; border: 0; background: transparent; color: var(--c-ink);
  font: 400 17px var(--font-body); }
.hp-chat .cb-input::placeholder { color: var(--c-muted); opacity: .85; }
.hp-chat .cb-input:focus, .hp-chat .cb-input:focus-visible { outline: none; }
.hp-chat .cb-send { flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%;
  background: var(--c-brand); color: var(--c-on-brand); cursor: pointer; transition: background-color .15s, color .15s; }
.hp-chat .cb-send svg { width: 22px; height: 22px; }
.hp-chat .cb-send:disabled { background: color-mix(in srgb, var(--c-ink) 7%, transparent); color: color-mix(in srgb, var(--c-ink) 35%, transparent); cursor: default; }
.hp-chat .cb-send:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }

/* ---------- motion (pack §11) ---------- */
.hp-chat .cb-in { animation: hp-in .25s ease-out both; }
@keyframes hp-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) {
  .hp-chat .cb-in { animation: none; }
  .hp-chat .cb-chip, .hp-chat .cb-send { transition: none; }
  .hp-chat .cb-typing span { animation: none; opacity: .6; }
}
@media (min-width: 900px) { .hp-chat .cb { font-size: 17px; } }

/* ---------- the help link: a dot when the owner has answered; a flash on the page's own button ---------- */
.hp-has-reply { position: relative; }
.hp-has-reply::after { content: ""; position: absolute; top: 6px; right: 8px; width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid var(--c-surface); background: var(--c-brand); }
.hp-flash { outline: 3px solid transparent; outline-offset: 3px; animation: hp-flash 1.6s ease 1; }
@keyframes hp-flash { 0%, 100% { outline-color: transparent; } 25%, 70% { outline-color: var(--c-gold-on-light); } }

/* the film page's help line (that page has no footer of its own) */
.hp-open-line { margin-top: 28px; text-align: center; }
.hp-open-line .hp-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: var(--radius-pill, 999px); background: var(--c-surface); color: var(--c-ink); font-size: 15px; font-weight: 600;
  text-decoration: none; box-shadow: 0 1px 2px color-mix(in srgb, var(--c-ink) 6%, transparent); }
.hp-open-line .hp-link svg { width: 17px; height: 17px; }

/* the help page's footer */
.hp-foot { display: grid; justify-items: center; gap: 8px; margin-top: 16px; padding: 28px 16px calc(28px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--c-line); color: var(--c-muted); font-size: 14px; text-align: center; }
.hp-foot p { margin: 0; line-height: 1.8; }
.hp-foot a { color: inherit; text-decoration: none; }
.hp-foot a:hover { color: var(--c-ink); text-decoration: underline; }
.hp-foot-seller { max-width: 36em; font-size: 12.5px; }
.hp-foot-copy { font-size: 12px; }
.hp-chat > .hp-answer { margin: 20px; }
