/* Channel customization (owner: views/channel.js). Tokens come from styles.css :root.
   Avatars carry no border or ring: the only depth on the avatar is a soft shadow. */

.ch-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
.ch-side { display: grid; gap: 16px; min-width: 0; }
@media (min-width: 1024px) {
  .ch-layout { grid-template-columns: minmax(0, 1fr) 360px; }
  .ch-side { position: sticky; top: 16px; }
}

/* Form card: the tab bar spans the card, so the card has no padding of its own. */
.ch-form-card { padding: 0; min-width: 0; }
.ch-form-card .form { min-width: 0; }

/* Section tabs (sectionTabsHTML, in-page tablist): the card edge is the tab bar, so the card has no padding. */
.ch-form-card .tabs { margin: 0; padding: 0 12px; }
.ch-form-card .tab { min-height: var(--hit); align-items: center; }

.ch-panel { display: flex; flex-direction: column; gap: 18px; padding: var(--card-pad); min-width: 0; }
.ch-panel[hidden] { display: none; }
.ch-panel .field { margin: 0; }

.ch-about-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ch-about-foot .hint { margin: 0; }
.ch-counter { flex: 0 0 auto; font-variant-numeric: tabular-nums; }

/* Image fields (avatar row, banner frame) */
.ch-file { min-width: 0; }
.ch-file-row { display: flex; align-items: flex-start; gap: 20px; min-width: 0; }
.ch-file-thumb { flex: 0 0 auto; }
/* The track is minmax(0, 1fr): a native file input must not push the column wider than the card. */
.ch-file-ctrl { flex: 1 1 auto; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.ch-file-ctrl > * { min-width: 0; }
.ch-file-ctrl .hint { margin: 0; }
.ch-file-ctrl input[type="file"] { width: 100%; max-width: 100%; }
/* Native file buttons take the secondary button look (the browser default ignores the button system). */
.ch-form-card input[type="file"]::file-selector-button {
  min-height: 40px;
  margin-right: 12px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: 600 var(--fs-base)/1.2 var(--font);
  cursor: pointer;
}
.ch-form-card input[type="file"]::file-selector-button:hover { background: var(--surface-2); }
/* Touch: the native file button meets the 44px target like the other buttons. */
@media (pointer: coarse) {
  .ch-form-card input[type="file"]::file-selector-button { min-height: var(--hit); }
}
.ch-file-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ch-file-actions:empty { display: none; }
/* Ghost buttons carry 12px padding; pull them back so their label lines up with the hints. */
.ch-file-actions .btn-ghost { margin-left: -12px; }
.ch-pending { margin: 0; color: var(--text-2); font-size: var(--fs-sm); font-weight: 600; }
.ch-pending:empty { display: none; }

.ch-banner-frame {
  width: 100%;
  aspect-ratio: 16 / 5;
  border-radius: var(--radius-sm);
  background: var(--primary-tint);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.ch-banner-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ch-banner-empty { margin: 0; padding: 12px; color: var(--muted); font-size: var(--fs-sm); text-align: center; }
.ch-file-wide .ch-banner-frame { margin-bottom: 4px; }
.ch-file-wide > input[type="file"] { width: 100%; max-width: 100%; min-width: 0; }

.ch-actions { margin: 0; padding: 16px var(--card-pad); border-top: 1px solid var(--line); }

/* Preview: the channel as the app shows it (banner, round avatar overlapping it, name, video count) */
.ch-preview { padding: var(--card-pad); min-width: 0; }
.ch-preview-title { margin: 0; font-size: var(--fs-md); font-weight: 700; color: var(--text); text-wrap: balance; }
.ch-preview .meta { margin: 4px 0 0; }
.ch-frame {
  margin-top: 14px;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.ch-prev-banner { aspect-ratio: 16 / 5; background: var(--primary-tint); display: grid; place-items: center; overflow: hidden; }
.ch-prev-banner .ch-banner-img { width: 100%; height: 100%; }
.ch-prev-banner .ch-banner-empty { font-size: var(--fs-xs); }
.ch-prev-body { position: relative; padding: 0 16px 16px; min-width: 0; }
.ch-prev-avatar {
  width: 80px;
  height: 80px;
  margin-top: -40px;
  border-radius: 50%;
}
/* Avatars (preview and branding tab): a soft shadow on the picture only. No ring, and no tinted disc behind a
   transparent image: the global .avatar sets one, so it is cleared for the picture here. */
.ch-layout .avatar { box-shadow: 0 6px 16px rgba(16, 24, 40, 0.16); }
.ch-layout img.avatar { background: none; }
.ch-prev-avatar .avatar { display: block; width: 80px; height: 80px; }
.ch-prev-avatar .avatar-empty { font-size: var(--fs-xl); }
.ch-prev-name { margin: 10px 0 0; font-size: var(--fs-lg); font-weight: 700; color: var(--text); overflow-wrap: anywhere; }
.ch-prev-count { margin: 2px 0 0; color: var(--muted); font-size: var(--fs-sm); }
.ch-prev-about {
  margin: 10px 0 0;
  color: var(--text-2);
  font-size: var(--fs-base);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.ch-prev-about:empty { display: none; }

@media (max-width: 699px) {
  .ch-form-card .tabs { padding: 0 8px; }
  .ch-form-card .tab { flex: 1 1 0; justify-content: center; padding: 0 6px; font-size: var(--fs-sm); }
  .ch-actions { padding: 12px var(--card-pad); }
  /* Phone: the avatar sits above its controls, so the file name has the full width */
  .ch-file-row { flex-direction: column; gap: 12px; }
  .ch-file-ctrl { width: 100%; }
}
