/*
Theme Name: Total Games
Theme URI: https://allgamedown.blog
Author: Total Games
Description: Dark gaming archive theme — genre sidebar, weekly top ranking, neon purple accent. Built for game introduction & download sites.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: totalgames
*/

:root {
  --tg-bg: #0b0c10;
  --tg-card: #111318;
  --tg-card2: #13151c;
  --tg-line: rgba(255, 255, 255, 0.08);
  --tg-text: #e8e9ee;
  --tg-muted: #8b8fa3;
  --tg-dim: #565b6e;
  --tg-faint: #3c4050;
  --tg-accent: #7c5cff;
  --tg-accent-soft: #a894ff;
  --tg-green: #4ad395;
  --tg-mono: ui-monospace, Menlo, Consolas, monospace;
  --tg-display: 'Rajdhani', 'Noto Sans KR', sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--tg-bg);
  color: var(--tg-text);
  font-family: 'Noto Sans KR', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--tg-accent-soft); text-decoration: none; }
a:hover { color: #c4b5ff; }

img { max-width: 100%; height: auto; }

/* ---------- Layout ---------- */
.tg-layout { display: flex; min-height: 100vh; }

.tg-main {
  flex: 1;
  min-width: 0;
  padding: 24px 28px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---------- Sidebar ---------- */
.tg-sidebar {
  width: 230px;
  flex: none;
  border-right: 1px solid var(--tg-line);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.tg-logo {
  font-family: var(--tg-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.08em;
  color: #fff;
  line-height: 1.2;
}
.tg-logo a { color: #fff; }
.tg-logo .tg-logo-accent { color: var(--tg-accent); }
.tg-tagline {
  font: 500 10px var(--tg-mono);
  color: var(--tg-dim);
  letter-spacing: 0.14em;
  margin-top: 2px;
  text-transform: uppercase;
}

.tg-search-form { display: flex; }
.tg-search-form input[type="search"] {
  width: 100%;
  background: var(--tg-card2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px 0 0 4px;
  border-right: none;
  padding: 9px 12px;
  color: var(--tg-text);
  font: 400 13px 'Noto Sans KR', sans-serif;
  outline: none;
}
.tg-search-form input[type="search"]::placeholder { color: var(--tg-dim); }
.tg-search-form input[type="search"]:focus { border-color: var(--tg-accent); }
.tg-search-form button {
  background: var(--tg-card2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0 4px 4px 0;
  color: var(--tg-dim);
  padding: 0 12px;
  cursor: pointer;
  font-size: 14px;
}
.tg-search-form button:hover { color: #fff; }

.tg-genres { display: flex; flex-direction: column; gap: 2px; }
.tg-label {
  font: 500 11px var(--tg-mono);
  color: var(--tg-dim);
  letter-spacing: 0.14em;
  margin-bottom: 8px;
  text-transform: uppercase;
}
.tg-genre-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 10px;
  border-radius: 4px;
  border-left: 2px solid transparent;
  color: #b9bccb;
  font-weight: 500;
  font-size: 13px;
}
.tg-genre-item:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.tg-genre-item .tg-count { font: 500 11px var(--tg-mono); color: var(--tg-dim); }
.tg-genre-item.is-active {
  background: rgba(124, 92, 255, 0.14);
  border-left-color: var(--tg-accent);
  color: #fff;
  font-weight: 700;
}
.tg-genre-item.is-active .tg-count { color: var(--tg-accent-soft); }

.tg-sidebar-foot {
  margin-top: auto;
  font-size: 11px;
  color: var(--tg-faint);
  line-height: 1.6;
}

/* ---------- Page header ---------- */
.tg-breadcrumb {
  font: 500 12px var(--tg-mono);
  color: var(--tg-dim);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tg-breadcrumb a { color: var(--tg-dim); }
.tg-breadcrumb a:hover { color: #fff; }
.tg-breadcrumb .tg-sep { color: var(--tg-faint); padding: 0 4px; }
.tg-breadcrumb .tg-here { color: var(--tg-accent-soft); }

.tg-page-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--tg-line);
  padding-bottom: 18px;
}
.tg-page-head h1 {
  margin: 0;
  font-family: var(--tg-display);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: 0.04em;
  color: #fff;
  text-transform: uppercase;
}
.tg-page-head .tg-meta { font: 500 12px var(--tg-mono); color: var(--tg-dim); }
.tg-page-head .tg-desc { margin-left: auto; font-size: 12px; color: var(--tg-muted); }

/* ---------- Weekly top ---------- */
.tg-top {
  border: 1px solid var(--tg-line);
  border-radius: 6px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.tg-top-head { display: flex; align-items: center; gap: 10px; }
.tg-top-head .tg-top-title {
  font-family: var(--tg-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--tg-accent);
}
.tg-top-head .tg-top-sub { font-size: 12px; color: var(--tg-dim); }
.tg-top-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.tg-top-item { display: flex; gap: 12px; align-items: center; min-width: 0; }
.tg-top-item:hover { transform: translateX(2px); }
.tg-rank {
  font-family: var(--tg-display);
  font-weight: 700;
  font-size: 30px;
  color: var(--tg-accent);
  text-shadow: 0 0 14px rgba(124, 92, 255, 0.6);
  flex: none;
}
.tg-top-thumb {
  width: 88px;
  height: 52px;
  flex: none;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  background: var(--tg-card2);
}
.tg-top-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tg-top-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tg-top-info .tg-top-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--tg-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tg-top-info .tg-top-name:hover { color: var(--tg-accent-soft); }
.tg-top-info .tg-top-tags { font-size: 11px; color: var(--tg-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Sort tabs ---------- */
.tg-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tg-sort { display: flex; gap: 8px; }
.tg-sort-tab {
  font-size: 12px;
  font-weight: 500;
  color: var(--tg-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 6px 14px;
}
.tg-sort-tab:hover { color: #fff; }
.tg-sort-tab.is-active {
  font-weight: 700;
  color: #fff;
  background: #1d2029;
  border-color: var(--tg-accent);
}
.tg-toolbar .tg-result-count { margin-left: auto; font: 500 11px var(--tg-mono); color: var(--tg-dim); letter-spacing: 0.06em; }

/* ---------- Card grid ---------- */
.tg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.tg-card {
  background: var(--tg-card);
  border: 1px solid var(--tg-line);
  border-radius: 6px;
  overflow: hidden;
}
.tg-card:hover { border-color: var(--tg-accent); }
.tg-card-thumb {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  position: relative;
  background: repeating-linear-gradient(135deg, #171a23 0px, #171a23 14px, #1c2030 14px, #1c2030 28px);
  overflow: hidden;
}
.tg-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; position: absolute; inset: 0; }
.tg-thumb-ph { font: 500 10px var(--tg-mono); color: rgba(255, 255, 255, 0.3); letter-spacing: 0.08em; }
.tg-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 10px;
  font-weight: 700;
  color: #0d0f14;
  padding: 2px 7px;
  border-radius: 2px;
  z-index: 1;
}
.tg-badge-hot { background: var(--tg-accent); }
.tg-badge-new { background: var(--tg-green); }
.tg-card-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.tg-card-title { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.4; }
.tg-card-title a { color: var(--tg-text); }
.tg-card-title a:hover { color: var(--tg-accent-soft); }
.tg-card-tags { font: 500 11px var(--tg-mono); letter-spacing: 0.02em; display: flex; gap: 6px; flex-wrap: wrap; }
.tg-card-tags .tg-tag-cat { color: var(--tg-accent-soft); }
.tg-card-tags .tg-tag-tag { color: var(--tg-dim); }
.tg-card-tags a:hover { color: #fff; }

.tg-empty { color: var(--tg-muted); padding: 40px 0; text-align: center; }

/* ---------- Pagination ---------- */
.tg-pagination { display: flex; justify-content: center; padding: 8px 0 12px; }
.tg-pagination .nav-links { display: flex; gap: 6px; font: 500 13px var(--tg-mono); }
.tg-pagination .page-numbers {
  color: var(--tg-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 7px 12px;
}
.tg-pagination .page-numbers:hover { color: #fff; }
.tg-pagination .page-numbers.current {
  color: #0d0f14;
  background: var(--tg-accent);
  border-color: var(--tg-accent);
}
.tg-pagination .page-numbers.dots { border: none; color: var(--tg-dim); }

/* ---------- Single post ---------- */
.tg-single { max-width: 860px; }
.tg-single-head { display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--tg-line); padding-bottom: 18px; }
.tg-single-head h1 {
  margin: 0;
  font-family: var(--tg-display);
  font-weight: 700;
  font-size: 32px;
  letter-spacing: 0.02em;
  color: #fff;
  line-height: 1.25;
}
.tg-single-meta { font: 500 12px var(--tg-mono); color: var(--tg-dim); display: flex; gap: 14px; flex-wrap: wrap; }
.tg-single-meta a { color: var(--tg-accent-soft); }
.tg-single-thumb { margin: 20px 0 0; border-radius: 6px; overflow: hidden; border: 1px solid var(--tg-line); }
.tg-single-thumb img { display: block; width: 100%; }
.tg-content { margin-top: 20px; font-size: 15px; color: #c9cbe0; }
.tg-content h2, .tg-content h3 { color: #fff; font-family: var(--tg-display); letter-spacing: 0.02em; }
.tg-content a { text-decoration: underline; text-underline-offset: 3px; }
.tg-content img { border-radius: 6px; }
.tg-content blockquote {
  margin: 1.2em 0;
  padding: 12px 18px;
  border-left: 2px solid var(--tg-accent);
  background: var(--tg-card2);
  color: var(--tg-muted);
}
.tg-single-tags { margin-top: 28px; display: flex; gap: 8px; flex-wrap: wrap; }
.tg-single-tags a {
  font-size: 12px;
  font-weight: 500;
  color: var(--tg-muted);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 5px 14px;
}
.tg-single-tags a:hover { color: #fff; border-color: rgba(255, 255, 255, 0.3); }

/* ---------- Footer ---------- */
.tg-footer {
  margin-top: auto;
  border-top: 1px solid var(--tg-line);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font: 500 11px var(--tg-mono);
  color: var(--tg-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.tg-footer a { color: var(--tg-accent-soft); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .tg-grid { grid-template-columns: repeat(2, 1fr); }
  .tg-top-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .tg-layout { flex-direction: column; }
  .tg-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--tg-line);
    padding: 20px;
  }
  .tg-sidebar-foot { display: none; }
  .tg-genres { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .tg-genres .tg-label { width: 100%; }
  .tg-genre-item { border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 999px; padding: 6px 12px; gap: 8px; }
  .tg-genre-item.is-active { border-color: var(--tg-accent); }
  .tg-main { padding: 20px 16px 32px; }
  .tg-grid { grid-template-columns: 1fr; }
  .tg-top-grid { grid-template-columns: 1fr; }
  .tg-page-head .tg-desc { margin-left: 0; }
}
