/*
Theme Name: VAULTtube
Theme URI: https://example.com/vaulttube
Author: priton
Author URI: https://example.com
Description: A lightweight, dark-mode video tube theme. Responsive CSS-Grid card gallery with hover/overlay CTA and live AJAX search of post titles.
Version: 1.3.0
Requires at least: 5.6
Tested up to: 6.5
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: vaulttube
*/

/* ============================================================
   THEME TOKENS
   ============================================================ */
:root {
  --bg:          #0f0f0f;
  --surface:     #181818;
  --surface-2:   #1f1f1f;
  --border:      #2a2a2a;
  --text:        #ffffff;
  --text-dim:    #9a9a9a;
  --text-faint:  #707070;
  --accent:      #ff3b6b;   /* brand pink/red */
  --accent-2:    #ff6a3d;
  --radius:      14px;
  --shadow:      0 8px 28px rgba(0,0,0,.55);
  --maxw:        1320px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Roboto', system-ui, -apple-system, Segoe UI, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.4;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ============================================================
   HEADER / NAV + SEARCH
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(15,15,15,.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -.02em;
  flex-shrink: 0;
}
.brand .dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 14px var(--accent);
}
.brand span.accent { color: var(--accent); }

/* ---- Search box with autocomplete ---- */
.search-wrap {
  position: relative;
  flex: 1;
  max-width: 560px;
  margin: 0 auto;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 16px;
  height: 44px;
  transition: border-color .15s, box-shadow .15s;
}
.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,59,107,.15);
}
.search-box svg { flex-shrink: 0; color: var(--text-dim); }
.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 15px;
  width: 100%;
  font-family: inherit;
}
.search-box input::placeholder { color: var(--text-faint); }

.suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: none;
  z-index: 60;
}
.suggestions.open { display: block; }
.suggestion {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  cursor: pointer;
  font-size: 14.5px;
  transition: background .12s;
}
.suggestion:hover,
.suggestion.active {
  background: var(--surface-2);
}
.suggestion .avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
}
.suggestion mark {
  background: transparent;
  color: var(--accent);
  font-weight: 700;
}
.suggestion .muted { color: var(--text-faint); font-size: 12.5px; margin-left: auto; }
.suggestion .no-result { color: var(--text-dim); }

.nav-links {
  display: flex;
  gap: 20px;
  font-size: 14px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.nav-links a:hover { color: var(--text); }

/* ============================================================
   PAGE / GRID
   ============================================================ */
.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 30px 22px 80px;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: 4px;
}
.page-sub {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 26px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);  /* 3 across desktop — larger cards */
  gap: 22px;
}
@media (max-width: 1024px) {
  .grid { grid-template-columns: repeat(2, 1fr); }  /* tablet */
}
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }             /* mobile */
}

/* ============================================================
   VIDEO CARD
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: #3a3a3a;
}

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-2);
}
.thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .45s ease;
}
.thumb .thumb-fallback {
  width: 100%; height: 100%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 20px;
  color: rgba(255,255,255,.18);
  transition: transform .45s ease;
}
.card:hover .thumb img,
.card:hover .thumb .thumb-fallback { transform: scale(1.08); }  /* zoom in */

/* duration badge top-right */
.duration {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(0,0,0,.72);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 6px;
  letter-spacing: .02em;
  backdrop-filter: blur(2px);
}

/* hover overlay with CTA */
.overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.1), rgba(0,0,0,.62));
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .22s ease;
}
.card:hover .overlay { opacity: 1; }
.cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 13.5px;
  padding: 9px 16px;
  border-radius: 999px;
  transform: translateY(8px);
  transition: transform .22s ease, background .15s;
  box-shadow: 0 6px 18px rgba(255,59,107,.4);
}
.card:hover .cta { transform: translateY(0); }
.cta:hover { background: #ff5781; }

/* card footer */
.card-body {
  display: flex;
  gap: 12px;
  padding: 12px 13px 14px;
}
.card-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
}
.card-meta { min-width: 0; flex: 1; }
.card-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-sub {
  color: var(--text-dim);
  font-size: 13px;
  margin: 1px 0 7px;
}
.card-stats {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text-faint);
  font-size: 12.5px;
}
.card-stats span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.card-stats svg { opacity: .85; }

/* ============================================================
   SINGLE POST
   ============================================================ */
.single-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 34px 22px 90px;
}
.single-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 6px;
}
.single-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text-faint);
  font-size: 13px;
  margin-bottom: 22px;
}
.single-meta span { display: inline-flex; align-items: center; gap: 5px; }
.single-content {
  font-size: 15.5px;
  color: var(--text-dim);
  line-height: 1.7;
}
.single-content img {
  border-radius: 10px;
  margin: 14px auto;
  border: 1px solid var(--border);
}
.single-content a { color: var(--accent); }
.single-content p { margin: 0 0 14px; }

.download-bar {
  margin-top: 30px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.download-bar .dl-label { font-weight: 600; font-size: 15px; }
.download-bar .dl-label small { display: block; color: var(--text-faint); font-weight: 400; font-size: 12.5px; margin-top: 2px; }
.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 13px 26px;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(255,59,107,.4);
  transition: background .15s, transform .15s;
}
.btn-download:hover { background: #ff5781; transform: translateY(-1px); }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 18px;
}
.back-link:hover { color: var(--text); }

footer.site-footer {
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 13px;
  text-align: center;
  padding: 26px 20px 40px;
}
