/**
 * brand-kit.css
 * Styles for Brand Kit & templates (Phase 3): the "My templates" headings in
 * the template list, the tool's panel and dialogs, and the bundled
 * Atkinson Hyperlegible and Lexend fonts so they work offline. Selectors
 * target ts-* classes only; the @font-face rules add fonts but change no
 * existing element's font.
 */

/* ============================================
   BUNDLED FONTS (assets/fonts, SIL Open Font License)
   ============================================ */
@font-face {
  font-family: 'Atkinson Hyperlegible';
  src: url('../assets/fonts/AtkinsonHyperlegible-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Atkinson Hyperlegible';
  src: url('../assets/fonts/AtkinsonHyperlegible-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Lexend';
  src: url('../assets/fonts/Lexend-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Lexend';
  src: url('../assets/fonts/Lexend-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ============================================
   TEMPLATE LIST HEADINGS (only shown when user templates exist)
   ============================================ */
.ts-template-group-label {
  padding: 0.5rem 0.9rem 0.3rem;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8a8f8c;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: default;
  user-select: none;
}

body.light-mode .ts-template-group-label {
  color: #6b716e;
  background: rgba(0, 0, 0, 0.03);
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

/* ============================================
   PANEL LISTS
   ============================================ */
.ts-brand-list {
  list-style: none;
  margin: 0.4rem 0 0.6rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.ts-brand-item {
  padding: 0.55rem 0.65rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.ts-brand-item .ts-study-actions {
  margin-top: 0.45rem;
  gap: 0.35rem;
}

.ts-brand-item .ts-study-actions button {
  padding: 0.3rem 0.55rem;
  font-size: 0.78rem;
}

.ts-brand-item-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.ts-brand-item-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.ts-brand-item-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ts-brand-item-desc {
  font-size: 0.76rem;
  opacity: 0.7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ts-brand-swatches {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  max-width: 120px;
}

.ts-brand-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.ts-brand-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  background: #ffffff;
  border-radius: 6px;
}

/* ============================================
   DIALOGS
   ============================================ */
.ts-brand-subhead {
  margin: 1rem 0 0.35rem;
  font-size: 0.9rem;
}

.ts-brand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0 1rem;
}

.ts-brand-extras {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.ts-brand-extra {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.ts-brand-extra-remove {
  padding: 0.1rem 0.35rem;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  cursor: pointer;
}

.ts-brand-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.ts-brand-icon {
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  font-size: 1.1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  cursor: pointer;
}

.ts-brand-icon[aria-checked="true"] {
  background: rgba(34, 197, 94, 0.25);
  border-color: #22c55e;
}

.ts-brand-preview {
  margin: 0.8rem 0;
  padding: 0.6rem 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

.ts-brand-preview p {
  margin: 0.2rem 0;
}

.ts-brand-logo-preview {
  display: block;
  max-width: 240px;
  max-height: 96px;
  margin: 0.3rem 0;
  padding: 0.4rem;
  background: #ffffff;
  border-radius: 8px;
}

.ts-brand-errors {
  margin: 0.4rem 0 0.8rem;
  padding-left: 1.2rem;
}

/* ============================================
   LIGHT MODE
   ============================================ */
body.light-mode .ts-brand-item,
body.light-mode .ts-brand-preview,
body.light-mode .ts-brand-icon {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.12);
}

body.light-mode .ts-brand-swatch,
body.light-mode .ts-brand-extra-remove {
  border-color: rgba(0, 0, 0, 0.25);
}
