/* RASIK AI — «Галерея»: главная #/home («Чистый лист»: композер, «Можно начать с этого», «Ролик под ключ», «Продолжить»).
   Owner: home screen agent. Loaded after gallery.css; build on the .g-* components and --g-* tokens (docs/DESIGN_GALLERY.md).
   Markup: js/home.js. One centred 760 px column, like previews/desktop.png; the settings side sheet (.hm-set) lives in #drawer. */

.hm [hidden], .hm-set [hidden] { display: none !important; }

.hm { max-width: 760px; margin: 0 auto; }

/* ---------- head: eyebrow → Prata h1 → lead (centred) ---------- */
.hm-head { margin: clamp(0px, 1.4vw, 12px) auto clamp(24px, 3vw, 32px); text-align: center; }
.hm-head .g-eyebrow { margin-bottom: 14px; }
.hm-title { margin: 0 0 14px; font-size: clamp(34px, 4.4vw, 52px); }
.hm-head .g-lead { margin-inline: auto; max-width: 64ch; }

/* ---------- composer panel ---------- */
.hm-composer { display: grid; gap: 18px; padding: 20px; transition: border-color var(--g-dur), box-shadow var(--g-dur); }
.hm-composer.is-drop { border-color: var(--g-accent); box-shadow: 0 0 0 3px var(--g-accent-soft); }
.hm-kinds { display: flex; width: 100%; }
.hm-kinds > button { padding-inline: 16px; }
.hm-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-width: 0; }
.hm-count { flex: none; font-size: 12px; color: var(--g-muted); font-variant-numeric: tabular-nums; }
.hm-ta { min-height: 140px; font-size: 15px; line-height: 1.7; }
.hm-pair.is-single { grid-template-columns: minmax(0, 1fr); }
/* «Модель» · «Версия» · «Формат» in one row when the family has versions (home.js paintVersion) */
.hm-pair.has-ver:not(.no-prim) { grid-template-columns: minmax(0, .95fr) minmax(0, 1.25fr) minmax(0, .9fr); }
.hm-ver .g-select { font-variant-numeric: tabular-nums; }
.hm-note { margin-top: -8px; max-width: 70ch; }
.hm-note .g-link { font-size: inherit; font-weight: 600; }
.hm-note-price { color: var(--g-ink); font-weight: 600; white-space: nowrap; }
.hm-note-ver { color: var(--g-ink); font-weight: 600; }
.hm-note-tok { color: var(--g-ink); font-variant-numeric: tabular-nums; }

/* attached files: chips with preview and a 44 px remove button */
.hm-slots { display: grid; gap: 12px; }
.hm-slots:empty, #hmDrop:empty { display: none; }
.hm-slot, .hm-drop-wrap { display: grid; gap: 8px; min-width: 0; }
.hm-slot .g-hint b { font-weight: 600; color: var(--g-ink); }
.hm-files { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.hm-file { display: inline-flex; align-items: center; gap: 10px; max-width: 100%; min-height: 50px; padding: 4px 0 4px 4px; border: 1px solid var(--g-line); border-radius: var(--g-r-xs); background: var(--g-paper); }
.hm-file.is-up { padding-right: 14px; border-style: dashed; }
.hm-file-th { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--g-r-xs); object-fit: cover; background: var(--g-soft); color: var(--g-accent); }
.hm-file-th svg { width: 18px; height: 18px; }
.hm-file-t { display: grid; gap: 2px; min-width: 0; }
.hm-file-t b { max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 13px/1.3 var(--g-font-ui); }
.hm-file-t small { font-size: 12px; line-height: 1.35; color: var(--g-muted); font-variant-numeric: tabular-nums; }
.hm-file-t .g-progress { width: 96px; margin-top: 3px; }
.hm-file-x { flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--g-r-xs); background: none; color: var(--g-muted); cursor: pointer; transition: background-color var(--g-dur), color var(--g-dur); }
.hm-file-x:hover { background: var(--g-soft); color: var(--g-ink); }
.hm-file-x svg { width: 16px; height: 16px; }

/* models without a prompt (upscale, background removal): the file is the whole request */
.hm-drop { display: grid; justify-items: center; align-content: center; gap: 10px; width: 100%; min-height: 172px; padding: 24px 16px; border: 1px dashed var(--g-line-strong); border-radius: var(--g-r-xs); background: var(--g-paper); color: var(--g-ink); font: inherit; text-align: center; cursor: pointer; transition: border-color var(--g-dur), background-color var(--g-dur); }
.hm-drop:hover, .hm-composer.is-drop .hm-drop { border-color: var(--g-accent); background: var(--g-accent-soft); }
.hm-drop-ic { display: grid; place-items: center; color: var(--g-accent); }
.hm-drop-ic svg { width: 24px; height: 24px; }
.hm-drop-t { display: grid; gap: 4px; }
.hm-drop-t b { font: 600 15px/1.35 var(--g-font-ui); }
.hm-drop-t span { font-size: 13.5px; line-height: 1.5; color: var(--g-muted); }

/* actions: file buttons + settings on the left, price + «Создать» on the right */
.hm-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-top: 8px; }
.hm-tools { display: flex; flex: 0 1 auto; flex-wrap: wrap; align-items: center; gap: 0 2px; min-width: 0; margin-left: -10px; }
.hm-tools:empty { display: none; }
.hm-tool { padding-inline: 10px; }
.hm-tool[aria-disabled="true"] { opacity: 1; color: var(--g-muted); }
.hm-badge { display: inline-block; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--g-accent-soft); color: var(--g-accent); font: 700 11.5px/20px var(--g-font-ui); text-align: center; font-variant-numeric: tabular-nums; }
.hm-sum { max-width: 24ch; margin-left: -2px; overflow: hidden; font-size: 12.5px; line-height: 1.4; color: var(--g-muted); text-overflow: ellipsis; white-space: nowrap; }
.hm-sum:empty { display: none; }
.hm-go { display: flex; flex: 1 1 340px; align-items: center; justify-content: flex-end; gap: 10px 16px; min-width: 0; margin-left: auto; }
.hm-cost { flex: 0 1 auto; min-width: 0; margin: 0; max-width: 46ch; text-align: right; text-wrap: balance; }
.hm-cost > span { white-space: nowrap; }
.hm-cost > .hm-cost-demo { display: block; white-space: normal; }
.hm-create { flex: none; }
.hm-cost-err, .hm-short { color: var(--g-danger); font-weight: 600; }
.hm-create { min-width: 136px; }
.hm-form-err { margin-top: -6px; }

/* ---------- «Можно начать с этого» ---------- */
.hm-sugs { margin-top: 28px; }
.hm-sugs .g-eyebrow { margin-bottom: 12px; }
.hm-chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- «Ролик под ключ» ---------- */
.hm-tk { display: grid; grid-template-columns: 104px minmax(0, 1fr); align-items: start; gap: 24px; margin-top: 42px; padding-top: 28px; border-top: 1px solid var(--g-line); }
.hm-tk-media { position: relative; }
.hm-tk-link { display: block; border-radius: var(--g-r-xs); }
.hm-tk-art { width: 104px; }
/* the real pause / play toggle replaces the decorative play mark of the poster (one play symbol, and it works) */
.hm-tk-art .g-art-play { display: none; }
/* pause / play toggle of the preview (WCAG 2.2.2), the landing's .lp-vid-btn: 34 px disc, 44 px hit area */
.hm-tk-btn { position: absolute; z-index: 4; top: 6px; left: 6px; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid transparent; border-radius: 50%; background: var(--g-media-chip); color: var(--g-media-chip-ink); cursor: pointer; box-shadow: 0 2px 10px rgba(0, 0, 0, .18); transition: transform var(--g-dur) var(--g-ease); }
.hm-tk-btn::before { content: ""; position: absolute; inset: -6px; }   /* 34 + 12 = 46 px зона нажатия */
.hm-tk-btn svg { width: 14px; height: 14px; }
.hm-tk-btn .i-play { display: none; margin-left: 2px; }
.hm-tk-btn[aria-pressed="true"] .i-play { display: block; }
.hm-tk-btn[aria-pressed="true"] .i-pause { display: none; }
.hm-tk-btn:hover { transform: scale(1.06); }
.hm-tk-btn:focus-visible { outline: 2px solid var(--g-accent); outline-offset: 2px; border-radius: 50%; }
.hm-tk-art > video { opacity: 0; transition: opacity .5s var(--g-ease); }
.hm-tk .hm-tk-art > img, .hm-tk-art .g-art-play { transition: opacity .5s var(--g-ease), transform .5s var(--g-ease); }
.hm-tk-art.is-playing > video { opacity: 1; }
.hm-tk-art.is-playing > img, .hm-tk-art.is-playing .g-art-play { opacity: 0; }
.hm-tk-body { display: grid; align-content: start; gap: 10px; min-width: 0; }
.hm-tk-body .g-eyebrow { margin: 0; }
.hm-tk-title { margin: 0; font: 400 clamp(22px, 2.6vw, 27px)/1.25 var(--g-font-display); letter-spacing: -.02em; color: var(--g-ink); text-wrap: balance; }
.hm-tk-text { margin: 0; max-width: 56ch; font-size: 14.5px; line-height: 1.6; color: var(--g-muted); }
.hm-tk-act { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 6px; }
.hm-tk-act .g-caption { max-width: 34ch; }
#hmResume:empty { display: none; }
.hm-resume { display: flex; align-items: center; gap: 10px 16px; margin-top: 8px; padding: 14px 16px; border: 1px solid var(--g-line); border-radius: var(--g-r-md); background: var(--g-paper); color: var(--g-ink); text-decoration: none; transition: border-color var(--g-dur); }
.hm-resume:hover { border-color: var(--g-accent); }
.hm-resume-t { display: grid; flex: 1 1 auto; gap: 3px; min-width: 0; }
.hm-resume-t .g-eyebrow { margin: 0; font-size: 11px; }
.hm-resume-t b { font: 600 14.5px/1.35 var(--g-font-ui); overflow-wrap: anywhere; }
.hm-resume-t small { font-size: 12.5px; line-height: 1.45; color: var(--g-muted); }
.hm-resume-th { position: relative; flex: none; width: 44px; aspect-ratio: 4 / 5; overflow: hidden; border-radius: var(--g-r-xs); background: var(--g-soft-2); }
.hm-resume-th > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hm-resume-go { flex: none; display: grid; place-items: center; width: 20px; color: var(--g-accent); }
.hm-resume-go.g-arr::after { width: 15px; height: 15px; }
.hm-resume:hover .hm-resume-go.g-arr::after { transform: translate(2px, -2px); }

/* ---------- «Продолжить» ---------- */
.hm-cont { margin-top: 42px; }
.hm-cont .g-section-head { align-items: center; margin-bottom: 12px; }
.hm-cont .g-eyebrow { margin: 0; }
.hm-cont .g-section-head .g-link { margin-right: -10px; }
.hm-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px 14px; }
.hm-cell { display: grid; min-width: 0; }
.hm-card { display: grid; align-content: start; gap: 10px; min-width: 0; color: var(--g-ink); text-decoration: none; border-radius: var(--g-r-xs); }
.hm-card:focus-visible { outline-offset: 4px; }
.hm-card-t { display: grid; gap: 3px; min-width: 0; }
.hm-card-t b { display: -webkit-box; overflow: hidden; font: 600 13.5px/1.35 var(--g-font-ui); -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; transition: color var(--g-dur); }
.hm-card-t small { display: -webkit-box; overflow: hidden; font-size: 12.5px; line-height: 1.4; color: var(--g-muted); -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.hm-card:hover .hm-card-t b { color: var(--g-accent); }
.hm-card .g-art--text:has(.g-art-tag) .g-art-text { padding-top: 38px; }

/* ---------- settings side sheet (#drawer) ---------- */
.hm-set { display: grid; gap: 20px; }
.hm-set-sep { margin: 4px 0 -6px; padding-top: 18px; border-top: 1px solid var(--g-line); }
.hm-set .g-check { min-height: 44px; padding: 10px 0 4px; font-weight: 600; font-size: 14px; }
.hm-range { width: 100%; min-height: 44px; margin: 0; cursor: pointer; }
.hm-out { font: 700 13px/1.35 var(--g-font-ui); color: var(--g-accent); font-variant-numeric: tabular-nums; }
.hm-set-add { justify-self: start; }
.hm-set .g-seg > [aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.hm-set-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; }
.hm-set-foot .g-cost { flex: 1 1 220px; margin: 0; }
.hm-set-foot .g-btn { min-width: 120px; }

/* ---------- responsive ---------- */
/* «Модель» + «Формат»: side by side only where «Nano Banana Pro» and «1:1 · квадрат» fit whole (the shared
   .g-field-pair stacks below 360 px only) */
@media (max-width: 767px) {
  /* model and version side by side, the format under them */
  .hm-pair.has-ver:not(.no-prim) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .hm-pair.has-ver:not(.no-prim) > #hmPrimF { grid-column: 1 / -1; }
}
@media (max-width: 479px) {
  .hm-pair, .hm-pair.has-ver:not(.no-prim) { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  .hm-head { margin-bottom: 22px; }
  .hm-title { font-size: clamp(30px, 8.8vw, 38px); }
  .hm-composer { gap: 16px; padding: 16px; }
  .hm-kinds > button { flex: 1 1 auto; padding-inline: 10px; }
  .hm-ta { min-height: 132px; }
  .hm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 12px; }
  .hm-sugs, .hm-tk, .hm-cont { margin-top: 32px; }
  .hm-tk { padding-top: 24px; }
}
@media (max-width: 599px) {
  .hm-actions { gap: 12px; }
  .hm-go { width: 100%; flex-direction: column; align-items: stretch; margin-left: 0; }
  .hm-cost { max-width: none; text-align: left; }
  .hm-create { width: 100%; }
  .hm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hm-cell:nth-child(n+7) { display: none; }
  .hm-tk { grid-template-columns: 76px minmax(0, 1fr); gap: 16px; }
  .hm-tk-art { width: 76px; }
  .hm-tk-act { flex-direction: column; align-items: stretch; }
  .hm-tk-act .g-caption { max-width: none; }
  /* phone: thumbnail · text · arrow on one row, the status chip under the text */
  .hm-resume { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "t go"; align-items: center; gap: 8px 12px; }
  .hm-resume:has(.g-status) { grid-template-areas: "t go" "st go"; }
  .hm-resume:has(.hm-resume-th) { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "th t go" "th st go"; }
  .hm-resume-th { grid-area: th; align-self: start; }
  .hm-resume-t { grid-area: t; }
  .hm-resume .g-status { grid-area: st; justify-self: start; }
  .hm-resume-go { grid-area: go; }
  .hm-file-t b { max-width: 14ch; }
}
@media (max-width: 379px) {
  .hm-kinds > button { padding-inline: 8px; font-size: 13.5px; }
  .hm-kinds:has(> :nth-child(4)) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hm-cost > span { white-space: normal; }
  .hm-tk { grid-template-columns: minmax(0, 1fr); }
  .hm-tk-media { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .hm-tk-btn:hover { transform: none; }
}
@media (forced-colors: active) {
  .hm-tk-btn { border-color: ButtonText; background: ButtonFace; color: ButtonText; }
}
