/* ==================================================================== *
 *  Brand Kit > Video (dashboard only, public/index.html .bkv2).          *
 *  Built on the Brand Kit's bk2 tokens (css/builder-style.css .bk2) and  *
 *  the Storyraise color convention: slate buttons, the selection blue    *
 *  (#3b98e3) for chosen options, focus and checkboxes; green for status. *
 *  The live preview is the renderer's own document in a scaled iframe    *
 *  (js/video-brand-preview.js).                                          *
 * ==================================================================== */
.bkv2{
    --bkv2-sel: #3b98e3;
    --bkv2-sel-tint: rgba(59, 152, 227, 0.2);
    --bkv2-tile: rgba(0, 0, 0, 0.22);
    /* secondary text: 4.5:1 or better on the cards, the selected tint and the sidebar art behind them */
    --bkv2-muted: #b6bec9;
    /* a filled selection (white text) uses the Brand Kit's AA blue, as its buttons do */
    --bkv2-sel-fill: #1e6fbd;
    max-width: 78rem;
}
.bkv2 .bk2-lede{ max-width: 46rem; margin-top: 6px; }
.bkv2-sr{ position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.bkv2-lock-note{
    display: flex; gap: 8px; align-items: flex-start;
    margin: 0 0 16px; padding: 10px 14px;
    border-radius: 8px;
    background: rgba(242, 187, 85, 0.12);
    color: var(--bk-text);
    font-size: 13.5px;
    .material-symbols-outlined{ color: var(--bk-warn); }
}

/* ---- layout: settings left, preview right (kept in view); one column below 1100px ---- */
.bkv2-layout{
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 27rem);
    gap: 24px;
    align-items: start;
}
.bkv2-side{
    grid-column: 2; grid-row: 1;
    align-self: stretch;
    display: flex; flex-direction: column; gap: 14px;
    min-width: 0;
}
/* the preview stays in view under the page's sticky header while the settings scroll; the
   summary under it scrolls away behind it */
.bkv2-stagecard{ position: sticky; top: 88px; z-index: 2; box-shadow: 0 10px 24px rgb(0 0 0 / 0.35); }
#dashboard [data-dashboard-main].has-announcement .bkv2-stagecard{ top: calc(88px + 54px); }
.bkv2-summary{ order: 2; }
.bkv2-main{ grid-column: 1; grid-row: 1; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (max-width: 1099px){
    .bkv2-layout{ grid-template-columns: minmax(0, 1fr); }
    .bkv2-side, .bkv2-main{ grid-column: 1; grid-row: auto; }
    .bkv2-side{ display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
    .bkv2-stagecard{ position: static; box-shadow: none; }
}
@media (max-width: 760px){
    .bkv2-side{ display: flex; align-items: stretch; }
    .bkv2-summary{ display: none !important; }
}

/* ---- preview ---- */
.bkv2-stagecard, .bkv2-summary, .bkv2-card{
    /* the Brand Kit card tint, laid on the page color so text contrast never depends on what is behind */
    background: linear-gradient(var(--bk-card), var(--bk-card)), var(--bk-surface);
    border-radius: var(--bk-radius);
}
.bkv2-stagecard{ padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.bkv2-stagehead{ display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.bkv2-frames{
    display: inline-flex; padding: 3px; gap: 2px;
    border-radius: 8px; background: rgba(0, 0, 0, 0.28);
    button{
        min-height: 30px; padding: 0 11px; border: 0; border-radius: 6px;
        background: transparent; color: var(--bk-muted);
        font-size: 12.5px; font-weight: 700; cursor: pointer;
        &:hover:not(:disabled){ color: var(--bk-text); }
        &[aria-pressed="true"]{ background: var(--bkv2-sel-fill); color: #fff; }
        &:disabled{ opacity: 0.45; cursor: not-allowed; }
    }
}
.bkv2-stage{
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 8px;
    background: #0e1116;
    &[data-loading]{ background: linear-gradient(110deg, #1a1f26 30%, #232a33 50%, #1a1f26 70%); }
}
.bkv2-frame{
    position: absolute; top: 0; left: 0;
    width: 1920px; height: 1080px;
    border: 0;
    transform-origin: 0 0;
    transform: scale(var(--bkv-scale, 0.2));
    pointer-events: none;
}
.bkv2-stage-msg{ position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--bk-muted); font-size: 13px; padding: 12px; text-align: center; }
.bkv2-stagefoot{ display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bkv2-stagefoot .bk2-fine{ margin-left: auto; }

.bkv2-summary{ padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.bkv2-summary .bk2-meta-row{ grid-template-columns: 70px minmax(0, 1fr); padding-block: 10px; }
.bkv2-summary .bk2-meta-val{ font-size: 13.5px; }
.bkv2-summary .bk2-meta-val small, .bkv2-summary .bk2-meta-row > span:first-child{ color: var(--bkv2-muted); }
.bkv2-summary .bk2-fine{ margin-top: 8px; }
.bkv2-sum-sw{ display: inline-flex; flex: none; i{ width: 18px; height: 18px; border-radius: 999px; box-shadow: 0 0 0 2px var(--bk-surface); & + i{ margin-left: -5px; } } }

/* ---- setting cards ---- */
.bkv2-card{ padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 16px; }
#dashboard [data-dashboard-main] .bkv2 h3,
.bkv2 h3{ margin: 0; font-family: inherit; font-size: 15.5px; font-weight: 700; color: var(--bk-text); line-height: 1.3; letter-spacing: 0; }
.bkv2-card > h3 + .bkv2-help{ margin-top: -10px; }
.bkv2-field{ display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.bkv2-label{ font-size: 13px; font-weight: 700; color: var(--bk-text); }
.bkv2-opt{ font-weight: 600; color: var(--bkv2-muted); margin-left: 4px; font-size: 12px; }
.bkv2-help{ font-size: 12.5px; line-height: 1.45; color: var(--bkv2-muted); }
.bkv2 .bk2-fine{ color: var(--bkv2-muted); }
.bkv2-warn{ color: var(--bk-warn); }
.bkv2-error{ color: var(--bk-bad); font-weight: 600; }
.bkv2 .bk2-input{ font-weight: 500; font-size: 14px; }
.bkv2 .bk2-input[aria-invalid="true"]{ border-color: var(--bk-bad); }
.bkv2 .bk2-input:disabled{ opacity: 0.6; cursor: not-allowed; }
.bkv2-select{ max-width: 28rem; appearance: auto; }
.bkv2 .bkv2-field .bk2-input:not(select){ max-width: 28rem; }

/* radios drawn as chips, tiles, swatches and logos: the input stays (focus, arrow keys, screen readers) */
.bkv2-seg label, .bkv2-tile, .bkv2-swatch, .bkv2-logo{ position: relative; cursor: pointer; }
.bkv2-seg input, .bkv2-tile input, .bkv2-swatch input, .bkv2-logo input{
    position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit;
}
.bkv2-seg{
    display: flex; flex-wrap: wrap; gap: 6px;
    span{
        display: inline-flex; align-items: center;
        min-height: 36px; padding: 0 14px;
        border-radius: 8px; border: 2px solid var(--bk-line);
        background: var(--bkv2-tile);
        font-size: 13.5px; font-weight: 600; color: var(--bk-text);
    }
    input:checked + span{ border-color: var(--bkv2-sel); background: var(--bkv2-sel-tint); }
    input:focus-visible + span{ outline: 2px solid var(--bk-link); outline-offset: 2px; }
    input:disabled + span{ opacity: 0.5; cursor: not-allowed; }
    label:hover input:not(:disabled):not(:checked) + span{ border-color: var(--bk-field); }
}

.bkv2-tiles{ display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; max-width: 34rem; }
.bkv2-tiles-4{ grid-template-columns: repeat(4, minmax(0, 1fr)); }
.bkv2-tile{
    display: flex; flex-direction: column; gap: 7px;
    padding: 7px 7px 9px;
    border-radius: 10px; border: 2px solid var(--bk-line);
    background: var(--bkv2-tile);
    &:has(input:checked){ border-color: var(--bkv2-sel); background: var(--bkv2-sel-tint); }
    &:has(input:focus-visible){ outline: 2px solid var(--bk-link); outline-offset: 2px; }
    &:has(input:disabled){ opacity: 0.55; cursor: not-allowed; }
    &:hover:has(input:not(:disabled):not(:checked)){ border-color: var(--bk-field); }
}
.bkv2-tile-l{
    font-size: 13px; font-weight: 700; color: var(--bk-text); line-height: 1.25; padding: 0 2px;
    small{ display: block; font-weight: 500; font-size: 11.5px; color: var(--bkv2-muted); margin-top: 2px; }
}
/* the tiny frames: what each option does, in the org's own colors */
.bkv2-mini{
    position: relative; display: block;
    aspect-ratio: 16 / 9;
    border-radius: 5px; overflow: hidden;
    background: linear-gradient(180deg, #a7b0bc, #5f6a78);
    i, b{ position: absolute; display: block; }
    &[data-lt] i{ left: 7%; bottom: 12%; width: 50%; height: 25%; background: var(--bkv2-card, #243b75); box-shadow: inset 3px 0 0 var(--bkv2-accent, #42b2e4); border-radius: 2px; }
    &[data-lt="card"] i{ border-radius: 5px; box-shadow: inset 0 3px 0 var(--bkv2-accent, #42b2e4); }
    &[data-lt="clear"] i{ left: 0; bottom: 0; width: 100%; height: 48%; border-radius: 0; box-shadow: none; background: linear-gradient(180deg, transparent, rgb(0 0 0 / 0.6)); }
    &[data-lt="clear"]::after{ content: ""; position: absolute; left: 7%; bottom: 16%; width: 40%; height: 9%; background: #fff; border-left: 3px solid var(--bkv2-accent, #42b2e4); border-radius: 1px; }
    &[data-bug] b{ width: 22%; height: 15%; border-radius: 3px; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.35); }
    &[data-bug="off"] b{ display: none; }
    &[data-bug="top-left"] b{ top: 9%; left: 6%; }
    &[data-bug="top-right"] b{ top: 9%; right: 6%; }
    &[data-bug="bottom-right"] b{ bottom: 9%; right: 6%; }
}

.bkv2-swatches{ display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.bkv2-swatch{ display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; }
.bkv2-sw{ display: block; width: 34px; height: 34px; border-radius: 999px; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.18); }
.bkv2-swatch:has(input:checked) .bkv2-sw{ outline: 3px solid var(--bkv2-sel); outline-offset: 2px; }
.bkv2-swatch:has(input:focus-visible) .bkv2-sw{ outline: 3px solid var(--bk-link); outline-offset: 2px; }
.bkv2-swatch:has(input:disabled){ cursor: not-allowed; opacity: 0.6; }
.bkv2-swatch-auto{ padding-right: 12px; border: 2px solid var(--bk-line); background: var(--bkv2-tile); }
.bkv2-swatch-auto .bkv2-sw{ width: 30px; height: 30px; }
.bkv2-swatch-auto:has(input:checked){ border-color: var(--bkv2-sel); background: var(--bkv2-sel-tint); }
.bkv2-swatch-auto:has(input:checked) .bkv2-sw{ outline: 0; }
.bkv2-sw-l{ font-size: 13px; font-weight: 700; color: var(--bk-text); }

.bkv2-logos{ display: flex; flex-wrap: wrap; gap: 8px; }
.bkv2-logo{
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px; border-radius: 10px; border: 2px solid var(--bk-line);
    background: var(--bkv2-tile);
    &:has(input:checked){ border-color: var(--bkv2-sel); background: var(--bkv2-sel-tint); }
    &:has(input:focus-visible){ outline: 2px solid var(--bk-link); outline-offset: 2px; }
    &:has(input:disabled){ opacity: 0.6; cursor: not-allowed; }
}
.bkv2-logo-img{
    display: grid; place-items: center;
    width: 84px; height: 52px; border-radius: 7px;
    background: #fff;
    img{ max-width: 74px; max-height: 42px; object-fit: contain; }
}
.bkv2-logo-none{ padding-right: 12px; }
.bkv2-logo-none .bkv2-logo-img{ width: 40px; background: rgba(255, 255, 255, 0.08); color: var(--bk-muted); }

/* checkboxes: the selection blue, 22 px (with the row, a 44 px target) */
.bkv2-check{
    display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; align-items: start;
    cursor: pointer; min-height: 32px;
    input{ width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--bkv2-sel); cursor: inherit; }
    input:disabled{ cursor: not-allowed; }
    b{ display: block; font-size: 13.5px; font-weight: 700; color: var(--bk-text); line-height: 1.35; }
    small{ display: block; font-size: 12.5px; color: var(--bkv2-muted); line-height: 1.45; margin-top: 2px; }
}
.bkv2-check:has(input:disabled){ cursor: not-allowed; }
.bkv2-switch-row{ display: flex; flex-direction: column; gap: 12px; }
.bkv2-sub{
    display: flex; flex-direction: column; gap: 14px;
    margin-left: 34px; padding-left: 16px;
    border-left: 2px solid var(--bk-line);
}
.bkv2-social-body{ border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.bkv2-social-body:disabled{ opacity: 0.55; }
#bkv2-social-body{ display: flex; flex-direction: column; gap: 16px; }

/* the Social versions disclosure */
.bkv2-disclose-h{ margin: 0; }
.bkv2-disclose{
    display: flex; align-items: center; gap: 10px; width: 100%;
    min-height: 44px; margin: -6px 0; padding: 0;
    background: none; border: 0; color: inherit; text-align: left; cursor: pointer;
    font: inherit;
    .material-symbols-outlined{ font-size: 22px; color: var(--bk-muted); }
}
.bkv2-disclose-t{
    margin-right: auto; font-size: 15.5px; font-weight: 700; color: var(--bk-text);
    small{ display: block; font-size: 12.5px; font-weight: 500; color: var(--bkv2-muted); }
}
.bkv2-off{ font-size: 11.5px; font-weight: 700; color: var(--bkv2-muted); padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); }

/* ---- save bar: always in reach ---- */
.bkv2-savebar{
    position: sticky; bottom: 0; z-index: 6;
    display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
    margin-top: 4px; padding: 12px 16px;
    border-radius: var(--bk-radius);
    background: var(--bk-surface);
    border: 1px solid var(--bk-line);
    box-shadow: 0 -8px 24px rgb(0 0 0 / 0.35);
}
.bkv2-save-msg{
    margin-right: auto; display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; color: var(--bkv2-muted);
    .material-symbols-outlined{ color: var(--bk-warn); font-size: 18px; }
}
.bkv2-savebar:not([data-dirty]){ position: static; box-shadow: none; }
.bkv2-savebar[data-dirty] .bkv2-save-msg{ color: var(--bk-text); font-weight: 600; }

/* ---- phone ---- */
@media (max-width: 640px){
    .bkv2-card{ padding: 16px; }
    .bkv2-tiles{ gap: 6px; }
    .bkv2-tile{ padding: 5px 5px 7px; }
    .bkv2-tile-l{ font-size: 12px; }
    .bkv2-seg span{ min-height: 44px; }
    .bkv2-frames button{ min-height: 36px; }
    .bkv2-sub{ margin-left: 10px; padding-left: 14px; }
    .bkv2-savebar{ margin-inline: -4px; padding: 10px 12px; }
    .bkv2-savebar .bk2-btn{ flex: 1 1 auto; justify-content: center; height: 44px; }
    .bkv2-save-msg{ flex: 1 0 100%; }
}
@media (pointer: coarse){
    .bkv2-seg span{ min-height: 44px; }
}
