/* STUDIO ASX: Discord Templates (catalogue + detail). Loaded only on /templates pages.
   Uses the site's theme tokens, so light and dark mode both work. */

.tpl-hero { padding-bottom: 8px; }
.tpl-hero .section-head { margin-bottom: 28px; }
.tpl-hero h1 { font-size: clamp(28px, 5vw, 42px); color: var(--color-heading); }
.tpl-free-pill {
  display: inline-block; margin-bottom: 12px; padding: 4px 12px; border-radius: 20px;
  font-size: 12.5px; font-weight: 700; letter-spacing: .03em;
  background: var(--color-success-bg); color: var(--color-success); border: 1px solid var(--color-success-border);
}

/* Search + chips */
.tpl-search { display: flex; gap: 10px; max-width: 560px; margin: 0 auto 18px; }
.tpl-search input { flex: 1; min-width: 0; }
.tpl-search .btn { flex-shrink: 0; padding: 12px 20px; }
.tpl-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.tpl-chip {
  padding: 7px 16px; border-radius: 20px; font-size: 14px; font-weight: 600;
  border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text-body);
}
.tpl-chip:hover { border-color: var(--color-secondary); }
.tpl-chip.is-active { background: var(--color-secondary); border-color: var(--color-secondary); color: var(--color-on-primary); }
.tpl-chip:focus-visible, .tpl-card-title a:focus-visible { outline: 2px solid var(--color-secondary); outline-offset: 2px; }

/* Results */
.tpl-results { padding-top: 24px; }
.tpl-count { color: var(--color-text-muted); font-size: 14.5px; margin-bottom: 18px; }
.tpl-count a, .tpl-back, .tpl-breadcrumb a { color: var(--color-secondary); font-weight: 600; }
.tpl-grid { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 640px)  { .tpl-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .tpl-grid { grid-template-columns: repeat(3, 1fr); } }

.tpl-card {
  display: flex; flex-direction: column; gap: 10px; padding: 20px; min-width: 0;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.tpl-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tpl-free, .tpl-featured {
  font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 20px; border: 1px solid;
}
.tpl-free { color: var(--color-success); border-color: var(--color-success-border); background: var(--color-success-bg); }
.tpl-featured { color: var(--color-text-muted); border-color: var(--color-border); }
.tpl-card-title { font-size: 19px; margin: 2px 0 0; overflow-wrap: anywhere; }
.tpl-card-title a { color: var(--color-heading); }
.tpl-card-title a:hover { color: var(--color-secondary); }
.tpl-card-summary { color: var(--color-text-muted); font-size: 14.5px; margin: 0; overflow-wrap: anywhere; }
.tpl-card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tpl-clicks { font-size: 13px; color: var(--color-text-muted); }
.tpl-card-btn { padding: 9px 18px; font-size: 14px; }

/* Discord-style channel list (cards and detail) */
.tpl-mini, .tpl-preview {
  background: var(--color-surface-alt); border: 1px solid var(--color-border); border-radius: 12px;
}
.tpl-mini { padding: 10px 12px; max-height: 210px; overflow: hidden; }
.tpl-tree, .tpl-chans, .tpl-roles { list-style: none; margin: 0; padding: 0; }
.tpl-cat + .tpl-cat { margin-top: 10px; }
.tpl-cat-name {
  display: block; margin-bottom: 3px; font-size: 11.5px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--color-text-muted); overflow-wrap: anywhere;
}
.tpl-chan { display: flex; align-items: baseline; gap: 8px; padding: 3px 6px; border-radius: 6px; font-size: 14.5px; color: var(--color-text-body); }
.tpl-chan-icon { width: 16px; flex-shrink: 0; text-align: center; color: var(--color-text-muted); font-weight: 700; }
.tpl-chan-name { min-width: 0; overflow-wrap: anywhere; }
.tpl-mini .tpl-chan { font-size: 13.5px; padding: 2px 4px; }

/* Empty / notices / CTA */
.tpl-empty {
  max-width: 620px; margin: 0 auto; text-align: center; padding: 36px 24px;
  background: var(--color-surface); border: 1px dashed var(--color-border-strong); border-radius: var(--radius);
}
.tpl-empty h1, .tpl-empty h2 { font-size: 22px; color: var(--color-heading); }
.tpl-empty p { color: var(--color-text-muted); }
.tpl-empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 8px; }
.tpl-note, .tpl-muted { color: var(--color-text-muted); font-size: 14px; }
.tpl-note { margin-top: 22px; text-align: center; }
.tpl-small { font-size: 13px; margin: 0; }
.tpl-pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 26px; flex-wrap: wrap; color: var(--color-text-muted); }
.tpl-cta {
  display: flex; flex-direction: column; gap: 14px; align-items: flex-start; margin-top: 40px; padding: 26px;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
}
.tpl-cta h2 { font-size: 21px; color: var(--color-heading); margin-bottom: 4px; }
.tpl-cta p { margin: 0; color: var(--color-text-muted); }
@media (min-width: 760px) { .tpl-cta { flex-direction: row; align-items: center; justify-content: space-between; } }
.tpl-alert {
  margin-bottom: 18px; padding: 12px 16px; border-radius: 12px;
  background: var(--color-danger-bg); border: 1px solid var(--color-danger-border); color: var(--color-danger);
}

/* Detail page */
.tpl-detail { padding-top: 32px; }
.tpl-breadcrumb ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 22px; padding: 0; font-size: 14px; color: var(--color-text-muted); }
.tpl-breadcrumb li + li::before { content: '/'; margin-right: 6px; color: var(--color-text-faint); }
.tpl-breadcrumb li:last-child { overflow-wrap: anywhere; }
.tpl-detail-grid { display: grid; gap: 28px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) { .tpl-detail-grid { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; } .tpl-detail-side { position: sticky; top: 96px; } }
.tpl-detail-head h1 { font-size: clamp(26px, 4.5vw, 38px); color: var(--color-heading); margin: 10px 0 8px; overflow-wrap: anywhere; }
.tpl-detail-head .lead { color: var(--color-text-soft); font-size: 17px; overflow-wrap: anywhere; }
.tpl-tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0 0 6px; }

.tpl-preview { margin-top: 18px; padding: 18px; }
.tpl-tabs { display: flex; gap: 6px; margin: -4px 0 14px; border-bottom: 1px solid var(--color-border); }
.tpl-tabs [role="tab"] {
  padding: 10px 14px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: none;
  font: inherit; font-weight: 600; color: var(--color-text-muted); cursor: pointer;
}
.tpl-tabs [role="tab"][aria-selected="true"] { color: var(--color-heading); border-bottom-color: var(--color-secondary); }
.tpl-tabs [role="tab"]:focus-visible, .tpl-panel:focus-visible { outline: 2px solid var(--color-secondary); outline-offset: 2px; }
.tpl-tab-n { font-size: 12.5px; color: var(--color-text-muted); margin-left: 2px; }
.tpl-panel-title { font-size: 17px; color: var(--color-heading); }
.tpl-preview:not(.has-tabs) .tpl-panel + .tpl-panel { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--color-border); }
.tpl-roles { display: flex; flex-direction: column; gap: 4px; }
.tpl-role { display: flex; align-items: center; gap: 10px; padding: 5px 6px; font-weight: 600; color: var(--color-text-body); overflow-wrap: anywhere; }
.tpl-role-dot { width: 12px; height: 12px; flex-shrink: 0; border-radius: 50%; background: var(--role-color, var(--color-text-faint)); box-shadow: 0 0 0 1px var(--color-border); }

.tpl-block { margin-top: 34px; }
.tpl-block h2 { font-size: 21px; color: var(--color-heading); }
.tpl-desc { color: var(--color-text-body); overflow-wrap: anywhere; }
.tpl-incl { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .tpl-incl { grid-template-columns: 1fr 1fr; } }
.tpl-list { list-style: none; margin: 0 0 12px; padding: 0; }
.tpl-list li { position: relative; padding: 4px 0 4px 26px; color: var(--color-text-body); }
.tpl-list li::before { position: absolute; left: 2px; top: 4px; font-weight: 700; }
.tpl-list-yes li::before { content: '\2713'; color: var(--color-success); }
.tpl-list-no li::before { content: '\2715'; color: var(--color-danger); }
.tpl-steps { margin: 0 0 12px; padding-left: 22px; color: var(--color-text-body); }
.tpl-steps li { margin-bottom: 8px; }

.tpl-use-card {
  padding: 22px; margin-bottom: 16px;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.tpl-use-btn { font-size: 16px; padding: 14px 24px; }
.tpl-use-note { font-size: 13.5px; color: var(--color-text-muted); margin: 10px 0 14px; }
.tpl-clicks-big { margin: 0 0 4px; color: var(--color-text-body); }
.tpl-clicks-big strong { font-size: 22px; color: var(--color-heading); }
.tpl-custom h2 { font-size: 18px; color: var(--color-heading); }
.tpl-custom p { font-size: 14.5px; color: var(--color-text-muted); }
