/* ============================================================
   BURDS NERDS — Template Gallery  (bn-templates.css)
   Styles for /tools-and-templates/page-templates.php
   ============================================================ */


/* ── Hero ──────────────────────────────────────────────────── */

.tpl-hero {
  padding: 120px 24px 48px;
  text-align: center;
}

.tpl-hero__inner {
  max-width: 720px;
  margin: 0 auto;
}

.tpl-hero .rule {
  margin: 0 auto 20px;
}

.tpl-breadcrumb {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--bn-font-body);
  font-size: var(--bn-fs-caption);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--bn-text-muted);
  margin-bottom: 24px;
}

.tpl-breadcrumb a {
  color: var(--bn-text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.tpl-breadcrumb a:hover { color: var(--bn-acc); }

.tpl-hero__title {
  font-family: var(--bn-font-display);
  font-size: var(--bn-fs-h1);
  font-weight: var(--bn-fw-h1);
  line-height: var(--bn-lh-h1);
  letter-spacing: var(--bn-ls-h1);
  color: var(--bn-text);
  margin-bottom: 16px;
}

.tpl-hero__sub {
  font-family: var(--bn-font-body);
  font-size: var(--bn-fs-body);
  line-height: 1.6;
  color: var(--bn-text-muted);
  margin-bottom: 12px;
}

.tpl-hero__count {
  font-family: var(--bn-font-body);
  font-size: var(--bn-fs-body-sm);
  color: var(--bn-text-faint);
}


/* ── Filter Tabs ───────────────────────────────────────────── */

.tpl-tabs {
  position: sticky;
  top: 72px;               /* below fixed nav */
  z-index: 50;
  background: var(--bn-bg);
  border-bottom: 1px solid var(--bn-bdr);
  padding: 0 24px;
}

.tpl-tabs__scroll {
  max-width: 1200px;
  margin: 0 auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--bn-bdr-strong) transparent;
}

.tpl-tabs__scroll::-webkit-scrollbar { height: 4px; }
.tpl-tabs__scroll::-webkit-scrollbar-track { background: transparent; }
.tpl-tabs__scroll::-webkit-scrollbar-thumb { background: var(--bn-bdr-strong); border-radius: 2px; }

.tpl-tabs__list {
  display: flex;
  gap: 4px;
  list-style: none;
  padding: 0;
  margin: 0;
  white-space: nowrap;
}

.tpl-tabs__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 14px 16px;
  font-family: var(--bn-font-body);
  font-size: var(--bn-fs-body-sm);
  font-weight: 500;
  color: var(--bn-text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}

.tpl-tabs__btn:hover {
  color: var(--bn-text);
}

.tpl-tabs__btn.is-active {
  color: var(--bn-acc-text);
  border-bottom-color: var(--bn-acc);
}

.tpl-tabs__btn:focus-visible {
  outline: 2px solid var(--bn-acc);
  outline-offset: -2px;
  border-radius: 4px;
}

.tpl-tabs__count {
  font-size: 11px;
  font-weight: 600;
  background: var(--bn-surf);
  color: var(--bn-text-faint);
  padding: 1px 6px;
  border-radius: 10px;
  line-height: 1.5;
}

.tpl-tabs__btn.is-active .tpl-tabs__count {
  background: var(--bn-acc);
  color: var(--bn-acc-on);
}


/* ── Gallery Grid ──────────────────────────────────────────── */

.tpl-gallery {
  padding: 40px 24px 64px;
  max-width: 1248px;        /* 1200 + 24*2 */
  margin: 0 auto;
}

.tpl-gallery__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.tpl-gallery__empty {
  text-align: center;
  padding: 80px 24px;
  color: var(--bn-text-muted);
  font-family: var(--bn-font-body);
  font-size: var(--bn-fs-body);
}


/* ── Template Card ─────────────────────────────────────────── */

.tpl-card {
  background: var(--bn-surf);
  border: 1px solid var(--bn-bdr);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.tpl-card:hover {
  transform: translateY(-4px);
  border-color: var(--bn-bdr-strong);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
}

.tpl-card[hidden] { display: none; }

/* Thumbnail (is a <button>) */
.tpl-card__thumb {
  display: block;
  width: 100%;
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bn-surf-2);
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.tpl-card__thumb:focus-visible {
  outline: 2px solid var(--bn-acc);
  outline-offset: -2px;
}

.tpl-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  transition: transform 0.3s ease;
}

.tpl-card:hover .tpl-card__thumb img {
  transform: scale(1.03);
}

/* Hover overlay */
.tpl-card__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(26, 24, 24, 0.6);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.tpl-card:hover .tpl-card__overlay,
.tpl-card__thumb:focus-within .tpl-card__overlay {
  opacity: 1;
}

.tpl-card__preview-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  font-family: var(--bn-font-body);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 6px;
  background: var(--bn-acc);
  color: var(--bn-acc-on);
  pointer-events: none;
  transition: transform 0.15s ease;
}

.tpl-card__thumb:hover .tpl-card__preview-label {
  transform: scale(1.04);
}

/* Card body */
.tpl-card__body {
  padding: 18px 20px 20px;
}

.tpl-card__cat {
  font-family: var(--bn-font-body);
  font-size: var(--bn-fs-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--bn-acc-text);
  margin-bottom: 6px;
}

.tpl-card__name {
  font-family: var(--bn-font-display);
  font-size: var(--bn-fs-h3);
  font-weight: var(--bn-fw-h3);
  line-height: var(--bn-lh-h3);
  letter-spacing: var(--bn-ls-h3);
  color: var(--bn-text);
  margin-bottom: 6px;
}

.tpl-card__desc {
  font-family: var(--bn-font-body);
  font-size: var(--bn-fs-body-sm);
  line-height: 1.5;
  color: var(--bn-text-muted);
  margin-bottom: 12px;
}

.tpl-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tpl-card__tag {
  display: inline-block;
  font-family: var(--bn-font-body);
  font-size: 11px;
  font-weight: 500;
  color: var(--bn-text-faint);
  background: var(--bn-surf-2);
  border: 1px solid var(--bn-bdr);
  padding: 2px 8px;
  border-radius: 4px;
}


/* ── Coming Soon ───────────────────────────────────────────── */

.tpl-coming {
  padding: 64px 24px 80px;
  text-align: center;
  background: var(--bn-acc-subtle);
}

.tpl-coming__inner {
  max-width: 560px;
  margin: 0 auto;
}

.tpl-coming .rule {
  margin: 0 auto 20px;
}

.tpl-coming__title {
  font-family: var(--bn-font-display);
  font-size: var(--bn-fs-h2);
  font-weight: var(--bn-fw-h2);
  line-height: var(--bn-lh-h2);
  letter-spacing: var(--bn-ls-h2);
  color: var(--bn-text);
  margin-bottom: 12px;
}

.tpl-coming__sub {
  font-family: var(--bn-font-body);
  font-size: var(--bn-fs-body);
  line-height: 1.6;
  color: var(--bn-text-muted);
  margin-bottom: 28px;
}


/* ── Lightbox ──────────────────────────────────────────────── */

/* Backdrop -- semi-transparent so gallery shows through */
.tpl-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(26, 24, 24, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.tpl-lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

/* Modal container */
.tpl-lightbox__modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1280px;
  height: 100%;
  max-height: 90vh;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.08);
  background: var(--bn-bg);
}

/* Toolbar header -- prominent */
.tpl-lightbox__header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 24px;
  height: 60px;
  border-bottom: 1px solid var(--bn-bdr);
  flex-shrink: 0;
  background: var(--bn-surf);
  border-radius: 14px 14px 0 0;
  position: relative;
}

/* Nav: prev / name / next — always centered regardless of action button states */
.tpl-lightbox__nav-left {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none; /* let clicks pass through to backdrop where not interactive */
}

.tpl-lightbox__nav-left > * {
  pointer-events: auto; /* re-enable on actual buttons/text */
}

.tpl-lightbox__arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: none;
  border: 1px solid var(--bn-bdr-strong);
  color: var(--bn-text-muted);
  cursor: pointer;
  border-radius: 6px;
  flex-shrink: 0;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.tpl-lightbox__arrow:hover {
  color: var(--bn-acc-on);
  background: var(--bn-acc);
  border-color: var(--bn-acc);
}

.tpl-lightbox__arrow:disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

.tpl-lightbox__arrow:focus-visible {
  outline: 2px solid var(--bn-acc);
  outline-offset: 2px;
}

.tpl-lightbox__name {
  font-family: var(--bn-font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--bn-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

.tpl-lightbox__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* Device toggle buttons -- larger, grouped */
.tpl-lightbox__device-group {
  display: inline-flex;
  border: 1px solid var(--bn-bdr-strong);
  border-radius: 8px;
  overflow: hidden;
}

.tpl-lightbox__device {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 36px;
  background: var(--bn-bg);
  border: none;
  border-right: 1px solid var(--bn-bdr);
  color: var(--bn-text-muted);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.tpl-lightbox__device:last-child { border-right: none; }

.tpl-lightbox__device:hover {
  color: var(--bn-text);
  background: var(--bn-surf-2);
}

.tpl-lightbox__device.is-active {
  color: var(--bn-acc-on);
  background: var(--bn-acc);
}

.tpl-lightbox__device:focus-visible {
  outline: 2px solid var(--bn-acc);
  outline-offset: -2px;
}

.tpl-lightbox__sep {
  display: block;
  width: 1px;
  height: 28px;
  background: var(--bn-bdr);
  margin: 0 10px;
}

/* Open Full Page button -- prominent gold outline */
.tpl-lightbox__newtab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  font-family: var(--bn-font-body);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bn-acc-text);
  text-decoration: none;
  border: 2px solid var(--bn-acc);
  border-radius: 8px;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.tpl-lightbox__newtab:hover {
  color: var(--bn-acc-on);
  background: var(--bn-acc);
  border-color: var(--bn-acc);
}

/* Close button -- larger, more visible */
.tpl-lightbox__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: 2px solid var(--bn-bdr-strong);
  color: var(--bn-text);
  cursor: pointer;
  border-radius: 8px;
  margin-left: 8px;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.tpl-lightbox__close:hover {
  color: var(--bn-acc-on);
  background: var(--bn-text);
  border-color: var(--bn-text);
}

.tpl-lightbox__close:focus-visible {
  outline: 2px solid var(--bn-acc);
  outline-offset: 2px;
}

/* Lightbox body / iframe */
.tpl-lightbox__body {
  flex: 1;
  display: flex;
  justify-content: center;
  background: var(--bn-surf-2);
  overflow: hidden;
  padding: 0;
  border-radius: 0 0 14px 14px;
}

.tpl-lightbox__frame-wrap {
  width: 100%;
  height: 100%;
  max-width: 100%;
  transition: max-width 0.3s ease;
  background: #fff;
}

.tpl-lightbox__iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}


/* ── Responsive ────────────────────────────────────────────── */

@media (max-width: 1024px) {
  .tpl-gallery__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }
}

@media (max-width: 700px) {
  .tpl-hero { padding: 100px 20px 36px; }
  .tpl-hero__title { font-size: clamp(24px, 6vw, 32px); }

  .tpl-tabs { top: 72px; padding: 0 16px; }
  .tpl-tabs__btn { padding: 12px 12px; font-size: 13px; }

  .tpl-gallery { padding: 28px 16px 48px; }
  .tpl-gallery__grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .tpl-card__body { padding: 14px 16px 16px; }

  /* Lightbox: tighter padding, hide device switcher */
  .tpl-lightbox { padding: 12px; }
  .tpl-lightbox__modal { max-height: 95vh; border-radius: 10px; }
  .tpl-lightbox__header { padding: 0 12px; height: 52px; border-radius: 10px 10px 0 0; }
  .tpl-lightbox__body { border-radius: 0 0 10px 10px; }
  .tpl-lightbox__name { font-size: 13px; }
  .tpl-lightbox__device-group { display: none; }
  .tpl-lightbox__sep { display: none; }
  .tpl-lightbox__arrow { width: 30px; height: 30px; }
  .tpl-lightbox__nav-left { gap: 4px; }
}

@media (max-width: 480px) {
  .tpl-lightbox { padding: 8px; }
  .tpl-lightbox__newtab {
    font-size: 0;
    padding: 8px 10px;
  }
  .tpl-lightbox__newtab svg { width: 16px; height: 16px; }
}


/* ── Reduced motion ────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .tpl-card,
  .tpl-card__thumb img,
  .tpl-card__overlay,
  .tpl-lightbox,
  .tpl-lightbox__frame-wrap {
    transition-duration: 0s !important;
  }
}
