/* CA_Banner: the banner maker. Uses the site's tokens when they exist, with fallbacks so it also looks right on its own (light and dark). */
/* the page is wider than the site's normal reading width (like the admin pages): a banner is long, the settings sit side by side */
.site-main:has(.cb-tabs), .container:has(> .cb-tabs) { max-width: 1240px; }

/* the result (facts, preview, download) on top over the full width, the settings below in blocks side by side */
.cb-app { display: flex; flex-direction: column; gap: 1.1rem; }

.cb-panel { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: .9rem; align-items: start; }
.cb-panel > .cb-text, .cb-panel > .cb-hint-tight { grid-column: 1 / -1; }
.cb-panel > .cb-hint-tight { margin-top: -.6rem; }
.cb-group { border: 1px solid var(--border, #dee2e6); border-radius: var(--radius, 10px); background: var(--bg-elevated, #fff); padding: .5rem .9rem .8rem; margin: 0; min-width: 0; }
.cb-group legend { font-weight: 600; padding: 0 .3rem; }
.cb-field { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; min-width: 0; }
.cb-field > span, .cb-range > span, .cb-colour > span { color: var(--text-muted, #646464); }
.cb-field input, .cb-field select { font: inherit; padding: .45rem .6rem; border: 1px solid var(--border, #dee2e6); border-radius: .5rem; background: var(--bg, #fff); color: var(--text, #212121); min-height: 40px; min-width: 0; }
.cb-text input, .cb-text textarea { font: inherit; font-size: 1.25rem; font-weight: 600; padding: .6rem .75rem; border: 1px solid var(--border, #dee2e6); border-radius: .5rem; background: var(--bg, #fff); color: var(--text, #212121); resize: vertical; line-height: 1.3; }
.cb-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .6rem; align-items: end; }
.cb-row .cb-field { flex: 1 1 7rem; }
.cb-grow { flex: 1 1 8rem; }

.cb-choices { display: flex; flex-wrap: wrap; gap: .45rem; }
.cb-choice { font: inherit; font-size: .9rem; display: inline-flex; align-items: center; gap: .45rem; min-height: 40px; padding: .35rem .7rem; border-radius: 999px; cursor: pointer;
             border: 1px solid var(--border, #cbd5e1); background: var(--bg, #fff); color: var(--text, #212121); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-choice.on { border-color: var(--accent, #2980b9); box-shadow: 0 0 0 2px var(--accent-soft, #e8f4fd); font-weight: 600; }
.cb-choice:focus-within, .cb-choice:focus-visible { outline: 2px solid var(--accent, #2980b9); outline-offset: 2px; }
.cb-sw { width: 1.1rem; height: 1.1rem; border-radius: .25rem; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 700; }
.cb-sw-blocks { background: linear-gradient(90deg, currentColor 33%, transparent 33% 66%, currentColor 66%); }
.cb-sw-dots { background: radial-gradient(circle, currentColor 35%, transparent 38%) 0 0 / 50% 50%; }
.cb-sw-file { border: 1px solid currentColor; }
.cb-sw-rainbow { background: linear-gradient(90deg, #e11d48, #f97316, #eab308, #16a34a, #2563eb, #7c3aed); }
.cb-sw-outline { border: 2px solid currentColor; }
.cb-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }

.cb-range { display: flex; flex-direction: column; gap: .2rem; font-size: .9rem; margin-top: .6rem; }
.cb-range input { width: 100%; accent-color: var(--accent, #2980b9); }
.cb-colour { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; }
.cb-colour input { width: 3.2rem; height: 40px; padding: 0; border: 1px solid var(--border, #dee2e6); border-radius: .5rem; background: none; cursor: pointer; }
.cb-more { margin-top: .7rem; font-size: .9rem; }
.cb-more summary { cursor: pointer; color: var(--accent, #2980b9); }
.cb-check { display: flex; gap: .5rem; align-items: center; margin-top: .7rem; }

.cb-result { order: -1; display: flex; flex-direction: column; gap: .8rem; min-width: 0; }
/* a banner preview is low: it stays in view while the settings below are changed (a poster preview is too tall for that) */
.cb-app-banner .cb-preview svg { max-height: 26vh; }   /* it stays in view: never so tall that it hides the settings */
.cb-app-banner > .cb-result { position: sticky; top: 0; z-index: 2; background: var(--bg, #fafafa); padding: .5rem 0 .6rem; box-shadow: 0 6px 8px -8px rgba(0, 0, 0, .25); }
.cb-facts { display: flex; gap: .6rem; flex-wrap: wrap; }
.cb-facts > div { max-width: 16rem; }
.cb-facts > div { flex: 1 1 6rem; background: var(--bg-elevated, #fff); border: 1px solid var(--border, #dee2e6); border-radius: var(--radius, 10px); padding: .5rem .8rem; }
.cb-facts b { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.cb-facts span { color: var(--text-muted, #646464); font-size: .85rem; }
.cb-preview { background: var(--bg-elevated, #fff); border: 1px solid var(--border, #dee2e6); border-radius: var(--radius, 10px); padding: .6rem; overflow-x: auto; }
.cb-preview svg { display: block; width: 100%; height: auto; max-height: 22rem; min-height: 4rem; }
.cb-preview .cb-paper { fill: #fff; }
.cb-preview .cb-sheet { fill: none; stroke: #94a3b8; stroke-width: 1; stroke-dasharray: 3 3; }
.cb-preview .cb-sheet.b { fill: rgba(148, 163, 184, .10); }
.cb-preview .cb-label { fill: #64748b; font-family: system-ui, sans-serif; font-weight: 700; }
.cb-actions { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.cb-btn { font: inherit; border-radius: .55rem; cursor: pointer; padding: .6rem 1.2rem; min-height: 44px; border: 1px solid var(--accent, #2980b9); }
.cb-primary { background: var(--accent, #2980b9); color: #fff; font-weight: 600; }
.cb-primary:hover:not(:disabled) { background: var(--accent-hover, #1f6391); }
.cb-primary:disabled { opacity: .65; cursor: progress; }
.cb-tip { color: var(--text-muted, #646464); font-size: .9rem; }
.cb-empty { color: var(--text-muted, #646464); background: var(--bg-elevated, #fff); border: 1px dashed var(--border, #dee2e6); border-radius: var(--radius, 10px); padding: 2rem 1rem; text-align: center; }
.cb-error { color: var(--soft-error-text, #8a1f27); background: var(--soft-error, #f8d7da); border-radius: .5rem; padding: .5rem .75rem; margin: .5rem 0 0; font-size: .9rem; }

.cb-hint { color: var(--text-muted, #646464); font-size: .85rem; margin: .45rem 0 0; }
.cb-amount { flex: 1 1 5rem !important; max-width: 8rem; }
.cb-times { align-self: end; padding-bottom: .55rem; font-weight: 700; color: var(--text-muted, #646464); }

.cb-range b { font-weight: 600; color: var(--text, #212121); margin-left: .3rem; }

/* tabs: text banner / photo poster */
.cb-tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.1rem; }
.cb-tab { font: inherit; font-weight: 600; display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; padding: .5rem 1rem; border-radius: .6rem; cursor: pointer;
          border: 1px solid var(--border, #cbd5e1); background: var(--bg-elevated, #fff); color: var(--text, #212121); }
.cb-tab.on { border-color: var(--accent, #2980b9); background: var(--accent, #2980b9); color: #fff; }
.cb-tab:focus-visible { outline: 2px solid var(--accent, #2980b9); outline-offset: 2px; }
[role=tabpanel][hidden] { display: none; }

/* the shared paper and sheets bar under the tabs: one wrapping row */
.cb-sheetbar { display: flex; flex-wrap: wrap; align-items: end; gap: .6rem 1rem; padding: .7rem .9rem; margin: .9rem 0 0;
               border: 1px solid var(--border, #dee2e6); border-radius: var(--radius, 10px); background: var(--bg-elevated, #fff); }
.cb-sheetbar .cb-row { display: contents; }
.cb-sheetbar .cb-field { flex: 0 1 11rem; }
.cb-sheetbar .cb-check { margin: 0 0 .55rem; }
.cb-sheetbar-title { flex: 1 0 100%; font-weight: 600; }

/* the fonts on this computer: a search box and a list, each name in its own font */
.cb-fontpick { display: flex; flex-direction: column; gap: .5rem; margin-top: .7rem; }
.cb-fontsearch { font: inherit; padding: .45rem .6rem; border: 1px solid var(--border, #dee2e6); border-radius: .5rem; background: var(--bg, #fff); color: var(--text, #212121); min-height: 40px; }
.cb-fontlist { max-height: 15rem; overflow-y: auto; border: 1px solid var(--border, #dee2e6); border-radius: .5rem; background: var(--bg, #fff); padding: .25rem; }
.cb-fontitem { display: block; width: 100%; text-align: left; font-size: 1.15rem; padding: .35rem .55rem; border: 0; border-radius: .35rem; background: none;
               color: var(--text, #212121); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-fontitem:hover { background: var(--accent-soft, #e8f4fd); }
.cb-fontitem.on { background: var(--accent, #2980b9); color: #fff; }

/* poster */
.cb-pick { display: inline-flex; align-items: center; justify-content: center; position: relative; background: var(--bg, #fff); color: var(--accent, #2980b9); font-weight: 600; }
.cb-pick:focus-within { outline: 2px solid var(--accent, #2980b9); outline-offset: 2px; }
.cb-crop { display: block; width: 100%; height: auto; max-height: 20rem; margin-top: .7rem; border-radius: .4rem; background: #e2e8f0; touch-action: none; cursor: crosshair; user-select: none; }
.cb-crop-shade { fill: rgba(15, 23, 42, .55); pointer-events: none; }
.cb-crop-rect { fill: transparent; stroke: #fff; stroke-width: 2; stroke-dasharray: 6 4; cursor: move; }
.cb-crop-used { fill: none; stroke: #facc15; stroke-width: 2.5; pointer-events: none; }
.cb-used-key { display: inline-block; width: .9rem; height: .6rem; border: 2px solid #facc15; border-radius: 2px; margin-right: .4rem; vertical-align: middle; }
.cb-choice:disabled { opacity: .5; cursor: default; }
.cb-sw-photo { background: linear-gradient(135deg, #38bdf8, #22c55e 55%, #a16207); }
.cb-sw-grey { background: linear-gradient(90deg, #111, #eee); }
.cb-sw-bw { background: linear-gradient(90deg, #111 50%, #fff 50%); border: 1px solid #111; }
.cb-sw-cdots { background: radial-gradient(circle, #e11d48 35%, transparent 38%) 0 0 / 50% 50%, radial-gradient(circle, #2563eb 35%, transparent 38%) 25% 50% / 50% 50%; }
.cb-poster-svg { max-height: min(55vh, 34rem) !important; }
.cb-preview .cb-sheet-over { fill: none; stroke: rgba(255, 255, 255, .9); stroke-width: 1.5; stroke-dasharray: 4 3; }
.cb-preview .cb-label-over { fill: #fff; paint-order: stroke; stroke: rgba(0, 0, 0, .55); stroke-width: .6; }
.cb-sharp b { display: flex !important; align-items: center; gap: .45rem; font-size: 1.05rem !important; }
.cb-light { width: .8rem; height: .8rem; border-radius: 50%; flex: none; }
.cb-sharp-Sharp .cb-light { background: #16a34a; }
.cb-sharp-FromADistance .cb-light { background: #f59e0b; }
.cb-sharp-Blurry .cb-light { background: #dc2626; }

/* narrow screens: one column, the preview first and not sticky (it would slide over the settings) */
@media (max-width: 760px) { .cb-app-banner > .cb-result { position: static; box-shadow: none; padding: 0; } .cb-app-banner .cb-preview svg { max-height: 22rem; } }
