/*
 * Tang Luck Builder: the Splash theme step (wizard/steps/theme.mjs), its
 * colours editor (widgets/palette-ui.mjs) and the ad-break mock
 * (widgets/ad-break-mock.mjs). Colours of the previews are set by the
 * widgets through the CSSOM; this file only lays them out.
 */

/* step layout: the stage (previews) next to the colours and the theme cards */
.theme-layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 22px; align-items: start; margin-top: 12px; }
.td-head h3 { margin-bottom: .2em; }
.td-head p { margin: 0 0 .3em; }
.td-previews { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.td-previews figure { margin: 0; min-width: 0; }
.td-previews .wide { grid-column: 1 / -1; }
.td-capture img { display: block; width: 100%; height: auto; aspect-ratio: 9 / 19; object-fit: cover; border-radius: 14px; border: 2px solid #2a2440; }
.theme-side h4 { margin-top: 18px; }
/* the previews stay in view while the colours are edited: beside them, or (one column, a screen tall enough) over them */
@media (min-width: 1000px) {
  .theme-stage { position: sticky; top: 72px; max-height: calc(100vh - 156px); overflow-y: auto; scrollbar-width: thin; }
}
@media (max-width: 999px) {
  .theme-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 999px) and (min-height: 700px) {
  .theme-stage { display: contents; }
  .td-previews {
    position: sticky; top: 60px; z-index: 5; grid-template-columns: repeat(2, 88px); justify-content: center; margin: 0 -8px; padding: 6px 8px;
    background: rgba(24, 12, 56, .94); border-radius: 12px;
  }
  .td-previews .td-capture, .td-previews .wide, .td-previews figcaption { display: none; }
}
@media (max-width: 860px) and (min-height: 700px) {
  .td-previews { top: 104px; } /* under the top bar's two rows */
}

/* colours editor (a fieldset, so lock() disables every control at once) */
fieldset.pal-editor { display: block; min-width: 0; margin: 0; padding: 0; border: 0; border-radius: 0; }
fieldset.pal-editor:disabled { opacity: .55; cursor: progress; }
fieldset.pal-editor:disabled * { cursor: progress; }
.pal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.pal-head h4 { margin: 0 0 4px; }
.save-state { font-size: .8rem; }
.pal-status { display: flex; align-items: center; gap: 6px; }
.pal-legacy p { margin: 0 0 8px; }
.pal-colours { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 8px; }
.pal-colour {
  display: grid; grid-template-columns: 46px minmax(0, 1fr) 6.6em; align-items: center; gap: 8px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .03);
}
.pal-name { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.pal-name small { font-size: .78rem; }
.pal-colour .hex { font-family: var(--mono); padding: 7px 9px; }
.pal-colour .hex.bad { border-color: var(--bad); box-shadow: 0 0 0 3px rgba(255, 90, 122, .18); }
.pal-swap { margin-top: 8px; }
.pal-group { margin-top: 16px; }
.pal-group h5 { margin: 0 0 8px; font-size: .95rem; }
.pal-direction { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0 0 8px; }
.pal-direction .seg { flex-wrap: wrap; }
.pal-direction > span, .pal-label { color: var(--muted); font-size: .9rem; font-weight: 600; }
.pal-label { margin-top: 14px; }
.pal-power { display: grid; grid-template-columns: 9.5em minmax(0, 1fr) 3.2em; align-items: center; gap: 10px; margin-top: 8px; font-size: .86rem; }
.pal-percent { text-align: right; }
.pal-note { grid-column: 1 / -1; color: var(--muted); }
.pal-note.err { color: var(--bad); }
.pal-proposals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 6px; }
.pal-proposal { width: 100%; }
.pal-proposal.on { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(255, 213, 74, .3); }
.pal-proposal-strip { display: block; min-height: 22px; }
.pal-strip i.grad { flex: 2; }

/* theme cards: a mini splash in the draft's colours and the name, in one row that scrolls sideways */
.theme-grid { display: grid; grid-auto-flow: column; grid-auto-columns: 112px; gap: 10px; margin-top: 8px; padding: 3px 3px 10px; overflow-x: auto; scrollbar-width: thin; }
/* a click always lands on the button: its splash may be drawn again between the press and the release */
.theme-card > * { pointer-events: none; }
.theme-card {
  display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 6px; padding: 6px; border-radius: 14px;
  border-color: var(--line); background: rgba(255, 255, 255, .03); text-align: left; font-size: .84rem;
}
.theme-card.on { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(255, 213, 74, .35); }
.theme-card .mock { border-width: 1px; border-radius: 10px; }

/* ad-break mock (widgets/ad-break-mock.mjs, res/layout/ad_break_overlay.xml) */
.admock {
  position: relative; container-type: size; width: 100%; aspect-ratio: 9 / 19; border-radius: 14px; overflow: hidden; border: 2px solid #2a2440; display: flex;
  flex-direction: column; align-items: center; justify-content: center; font-family: system-ui, sans-serif; text-align: center;
}
.admock .mock-ewrap { width: 30cqmin; margin: 6.7cqmin 0; }
.admock .mock-halo { width: 43.3cqmin; opacity: 1; }
.admock-title {
  position: relative; margin-top: -2.2cqmin; min-width: 52.8cqmin; padding: 2cqmin 6cqmin; border-radius: 4cqmin; border: max(1px, .6cqmin) solid; font-size: 7.2cqmin;
  font-weight: 900;
  letter-spacing: .1em; white-space: nowrap;
}
.admock-title.p-pill, .admock-title.p-neon { border-radius: 99px; }
.admock-sub { max-width: 87cqmin; margin-top: 3.3cqmin; font-size: 3.6cqmin; font-weight: 500; }
.admock .mock-bar { flex: none; width: 66.7cqmin; margin-top: 5cqmin; }
.admock-count { margin-top: 2.5cqmin; font-size: 3.6cqmin; font-weight: 900; letter-spacing: .1em; }

@media (max-width: 520px) {
  .td-previews { gap: 6px; }
  .pal-colour { grid-template-columns: 46px minmax(0, 1fr); }
  .pal-colour .hex { grid-column: 1 / -1; }
  .pal-power { grid-template-columns: 8em minmax(0, 1fr) 3em; }
  .theme-grid { grid-auto-columns: 96px; gap: 8px; }
}
