/**
 * Dearthwood Templates Showcase — grid styles
 * All rules are scoped under .dw-templates so the plugin never touches the rest
 * of the page. Fonts ('Syne' / 'Inter') are provided by the active Dearthwood
 * theme (self-hosted @font-face in the theme's main.css); we just reference them.
 */

.dw-templates {
  --bg-base:        #0c0d0f;
  --bg-surface:     #141519;
  --bg-elevated:    #1e2028;
  --accent:         #7fff00;
  --accent-hover:   #5acc00;
  --accent-wash:    rgba(127,255,0,0.06);
  --text-primary:   #f0ece4;
  --text-secondary: #8a8a96;
  --text-muted:     #4a4a54;
  --border:         #2a2c38;
  --card-grey:        #c2c2cc;
  --card-grey-hover:  #d6d6de;
  --card-grey-wash:   rgba(194,194,204,0.08);
  --dwfont-display: 'Syne', sans-serif;
  --dwfont-body:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  font-family: var(--dwfont-body);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.65;
}
.dw-templates *, .dw-templates *::before, .dw-templates *::after { box-sizing: border-box; }
.dw-templates a { color: var(--accent); text-decoration: none; }
.dw-templates a:hover { color: var(--accent-hover); }

/* ── category / filter bar ── */
.dw-templates .dw-filter-wrap {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.dw-templates .dw-filter-inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; align-items: stretch;
}
.dw-templates .filter-bar {
  flex: 1 1 auto; min-width: 0;
  padding: 0 1.5rem;
  display: flex; align-items: center; gap: 0;
  overflow-x: auto; scroll-behavior: smooth;
  scrollbar-width: none;          /* Firefox: hide scrollbar */
  -ms-overflow-style: none;       /* IE/Edge */
}
.dw-templates .filter-bar::-webkit-scrollbar { display: none; }   /* WebKit: hide scrollbar */

/* left / right scroll arrows */
.dw-templates .dw-filter-arrow {
  flex: 0 0 auto; width: 2.75rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-surface); color: var(--text-secondary);
  border: none; cursor: pointer;
  font-family: var(--dwfont-body); font-size: 1.5rem; line-height: 1;
  transition: color 0.2s, opacity 0.2s;
}
.dw-templates .dw-filter-prev { box-shadow: 12px 0 12px -8px rgba(0,0,0,0.45); }
.dw-templates .dw-filter-next { box-shadow: -12px 0 12px -8px rgba(0,0,0,0.45); }
.dw-templates .dw-filter-arrow:hover { color: var(--accent); }
.dw-templates .dw-filter-arrow:disabled { opacity: 0.25; cursor: default; color: var(--text-secondary); }
.dw-templates .dw-filter-arrow[hidden] { display: none; }
.dw-templates .filter-tab {
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-secondary);
  padding: 1.1rem 1.2rem; white-space: nowrap;
  border-bottom: 2px solid transparent;
  cursor: pointer; transition: color 0.2s, border-color 0.2s;
  background: none; border-top: none; border-left: none; border-right: none;
  font-family: var(--dwfont-body);
}
.dw-templates .filter-tab:hover { color: var(--text-primary); }
.dw-templates .filter-tab.active { color: var(--text-primary); border-bottom-color: var(--accent); }

/* ── grid ── */
.dw-templates .container { max-width: 1400px; margin: 0 auto; padding: 4rem 2rem; }
.dw-templates .templates-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }

/* ── card ── */
.dw-templates .template-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--card-grey);
  border-radius: 0; overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  display: flex; flex-direction: column;
}
.dw-templates .template-card:hover {
  border-color: var(--card-grey);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  transform: translateY(-3px);
}
.dw-templates .template-thumb {
  aspect-ratio: 1919 / 913; overflow: hidden;
  background: var(--bg-elevated); position: relative;
}
.dw-templates .template-thumb img {
  width: 100%; height: 100%; object-fit: cover; object-position: top center;
  transition: transform 0.5s ease; filter: brightness(0.92); cursor: zoom-in;
}
.dw-templates .template-card:hover .template-thumb img { transform: scale(1.03); filter: brightness(1); }
.dw-templates .template-thumb-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem; color: var(--text-muted);
}
.dw-templates .template-category-badge {
  position: absolute; top: 0.8rem; left: 0.8rem;
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; padding: 0.25rem 0.6rem;
  background: var(--bg-base); color: var(--text-secondary);
  border: 1px solid var(--border);
}
.dw-templates .template-body { padding: 1.5rem; flex: 1; display: flex; flex-direction: column; gap: 0.5rem; }
.dw-templates .template-name {
  font-family: var(--dwfont-display);
  font-size: 1.15rem; font-weight: 700;
  color: var(--text-primary); letter-spacing: -0.01em;
}
.dw-templates .template-brand {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--card-grey);
}
.dw-templates .template-desc {
  color: var(--text-secondary); font-size: 0.83rem; line-height: 1.6;
  font-weight: 400; flex: 1;
}
.dw-templates .template-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.5rem; }
.dw-templates .tag {
  font-size: 0.62rem; font-weight: 600; letter-spacing: 0.06em;
  padding: 0.2rem 0.55rem; border: 1px solid var(--border); color: var(--text-muted);
}
.dw-templates .template-footer {
  padding: 1rem 1.5rem; border-top: 1px solid var(--border);
  display: flex; gap: 0.6rem; align-items: center;
}
.dw-templates .btn-preview {
  flex: 1; text-align: center;
  background: var(--card-grey); color: var(--bg-base);
  font-family: var(--dwfont-body); font-size: 0.78rem; font-weight: 700;
  padding: 0.6rem 1rem; border: 1px solid var(--card-grey);
  transition: background 0.2s, border-color 0.2s; cursor: pointer;
}
.dw-templates .btn-preview:hover { background: var(--card-grey-hover); border-color: var(--card-grey-hover); color: var(--bg-base); }
.dw-templates .btn-enquire {
  flex: 1; text-align: center;
  background: transparent; color: var(--card-grey);
  font-family: var(--dwfont-body); font-size: 0.78rem; font-weight: 700;
  padding: 0.6rem 1rem; border: 1px solid var(--card-grey);
  transition: background 0.2s; cursor: pointer;
}
.dw-templates .btn-enquire:hover { background: var(--card-grey-wash); }

/* ── lightbox (full preview image) ── */
.dw-templates .lightbox {
  position: fixed; inset: 0; z-index: 100000;
  display: none; background: rgba(6,7,9,0.92); backdrop-filter: blur(4px);
  padding: 4.5rem 3rem 3rem; overflow: auto;
  -webkit-overflow-scrolling: touch; cursor: zoom-out;
}
.dw-templates .lightbox.open { display: flex; align-items: flex-start; justify-content: center; }
.dw-templates .lightbox img {
  max-width: 1400px; width: 100%; height: auto; margin: auto 0;
  border: 1px solid var(--border); box-shadow: 0 24px 80px rgba(0,0,0,0.6); cursor: default;
}
.dw-templates .lightbox-close {
  position: fixed; top: 1rem; right: 1rem; z-index: 100001;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-surface); color: var(--text-primary);
  border: 1px solid var(--border);
  font-size: 1.4rem; line-height: 1; cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.dw-templates .lightbox-close:hover { background: var(--bg-elevated); border-color: var(--accent); color: var(--accent); }

/* ── responsive ── */
@media (max-width: 1024px) { .dw-templates .templates-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px)  { .dw-templates .lightbox { padding: 4rem 1.5rem 1.5rem; } }
@media (max-width: 600px)  {
  .dw-templates .templates-grid { grid-template-columns: 1fr; }
  .dw-templates .container { padding: 2.5rem 1rem; }
  .dw-templates .filter-bar { padding: 0 0.5rem; }
  .dw-templates .dw-filter-arrow { width: 2.25rem; font-size: 1.3rem; }
  .dw-templates .lightbox { padding: 3.75rem 0.75rem 0.75rem; }
  .dw-templates .lightbox-close { width: 40px; height: 40px; font-size: 1.25rem; }
}
