/*
 * admin/css/pages/branding.css — Branding (pages/event/branding.js, logo-size.js,
 * accents.js). Loaded with ensureStylesheet. Reads tokens only (tokens.css);
 * the event's accent colours reach the swatches and the Live preview inline,
 * never the admin chrome (spec §6).
 */

/* ── Disclosures: logo-size Advanced, accent Advanced ───────────────────── */
.logo-size-adv > summary,
.brand-advanced > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}

.logo-size-adv > summary::-webkit-details-marker,
.brand-advanced > summary::-webkit-details-marker {
  display: none;
}

.logo-size-adv > summary::before,
.brand-advanced > summary::before {
  content: "▸";
  display: inline-block;
  transition: transform var(--dur) var(--ease);
}

.logo-size-adv[open] > summary::before,
.brand-advanced[open] > summary::before {
  transform: rotate(90deg);
}

.logo-size-adv > summary:focus-visible,
.brand-advanced > summary:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-btn);
}

/* ── Logo size control ──────────────────────────────────────────────────── */
.logo-size {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

/* Slider and preview on one row at every width. */
.logo-size-main {
  display: flex;
  align-items: center;
  gap: 18px;
}

.logo-size-fields {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.logo-size-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}

.logo-size-range {
  flex: 1;
  min-width: 0;
  height: 6px;
  margin: 0;
  border-radius: var(--radius-pill);
  background: var(--surface-hi);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.logo-size-range::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.logo-size-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.logo-size-range:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 6px;
}

.logo-size-out {
  flex: 0 0 auto;
  min-width: 56px;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--text);
}

.logo-size-out small {
  margin-left: 1px;
  font-weight: 400;
  color: var(--text-dim);
}

.logo-size-out.is-auto {
  font-weight: 400;
  font-style: italic;
  color: var(--text-dim);
}

.logo-size-adv-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 6px;
}

.logo-size-preview {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 124px;
}

.logo-size-preview-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 124px;
  height: 124px;
  overflow: hidden;
  border-radius: var(--radius-btn);
}

.logo-size-preview-box img {
  display: block;
  object-fit: contain;
}

.logo-size-preview-empty {
  padding: 0 6px;
  font-size: 11px;
  text-align: center;
  color: var(--text-faint);
}

.logo-size-preview-cap {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* Phone: a 72px preview tile and a tighter gap give the slider most of the
   row, so a range of several hundred px can still be dragged finely. The
   preview image is sized in percent of the tile (logo-size.js). */
@media (max-width: 640px) {
  .logo-size-main {
    gap: 12px;
  }

  .logo-size-preview,
  .logo-size-preview-box {
    width: 72px;
  }

  .logo-size-preview-box {
    height: 72px;
  }
}

/* ── Accent rows: the kit control (ui/accent-row.js, base.css) ──────────── */
.derive-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.derive-status:empty {
  display: none;
}

.brand-advanced {
  display: flex;
  flex-direction: column;
}

.brand-advanced[open] > .accent-rows {
  padding-top: 8px;
}

/* ── Live preview (aside) ───────────────────────────────────────────────── */
.brand-preview-canvas-wrap {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--surface-hi);
}

.brand-preview-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* SVG fractal noise, as the kiosk's .grain-overlay. */
.brand-preview-grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 180px 180px;
}

.brand-preview-overlay {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.brand-preview-badge {
  align-self: flex-start;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--warm);
  color: var(--warm-fg);
  font-size: 11px;
  font-weight: 600;
}

.brand-preview-cards {
  display: flex;
  gap: 6px;
}

.brand-preview-card {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
  min-height: 52px;
  padding: 8px;
  border-radius: var(--radius-btn);
  background: var(--surface-hi);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
}

.brand-preview-card small {
  display: block;
  margin-top: 2px;
  font-weight: 400;
  opacity: 0.75;
}

.brand-preview-card.is-selected {
  background: var(--warm-tint);
  box-shadow: inset 0 0 0 2px var(--warm);
  color: var(--warm-tint-fg);
}

.brand-preview-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.brand-preview-btn {
  padding: 8px 14px;
  border-radius: var(--radius-btn);
  background: var(--warm);
  color: var(--warm-fg);
  font-size: 12px;
  font-weight: 600;
}

.brand-preview-link {
  font-size: 12px;
  text-decoration: underline;
  color: var(--cool);
}
