
/* === DARK THEME (default) === */
:root,
[data-theme="dark"] {
  --bg:            #12131b;
  --bg-2:          #181923;
  --bg-card:       #1e2030;
  --bg-card-hover: #252840;
  --text:          #ffffff;
  --text-muted:    #7a7d9e;
  --text-dim:      #4a4d66;
  --accent:        #00d26a;
  --accent-2:      #00ff87;
  --accent-text:   #000000;
  --border:        #2a2d42;
  --shadow:        0 4px 20px rgba(0,0,0,0.4);
}

/* === LIGHT THEME === */
[data-theme="light"] {
  --bg:            #f4f5fb;
  --bg-2:          #eaecf7;
  --bg-card:       #ffffff;
  --bg-card-hover: #f0f2ff;
  --text:          #1a1b2e;
  --text-muted:    #6b6e8a;
  --text-dim:      #b0b3cc;
  --accent:        #00a854;
  --accent-2:      #00cc66;
  --accent-text:   #ffffff;
  --border:        #d8daea;
  --shadow:        0 4px 20px rgba(0,0,0,0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  background-color: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* === LAYOUT === */
.site-wrapper { min-height: 100vh; display: flex; flex-direction: column; }
.site-main { flex: 1; width: 100%; max-width: 1500px; margin: 0 auto; padding: 0 24px 56px; }

/* === HEADER === */
.site-header { width: 100%; max-width: 1500px; margin: 0 auto; padding: 16px 24px 0; }
.header-inner { display: flex; flex-direction: column; gap: 4px; }
.header-top { display: flex; align-items: center; gap: 10px; }
.search-wrapper { position: relative; flex: 1; }

/* === THEME TOGGLE === */
.theme-toggle-btn {
  flex-shrink: 0;
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
  padding: 0;
}
.theme-toggle-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Show moon on dark, sun on light */
[data-theme="dark"] .theme-toggle-btn .icon-sun  { display: none; }
[data-theme="dark"] .theme-toggle-btn .icon-moon { display: block; }
[data-theme="light"] .theme-toggle-btn .icon-moon { display: none; }
[data-theme="light"] .theme-toggle-btn .icon-sun  { display: block; }

/* === SEARCH === */
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--accent); pointer-events: none; }
.search-input { width: 100%; background: var(--bg-2); border: 1.5px solid var(--border); color: var(--text); font-family: inherit; font-size: 14px; padding: 11px 16px 11px 40px; border-radius: 8px; outline: none; transition: border-color 0.2s ease, background 0.2s ease; }
.search-input::placeholder { color: var(--accent); opacity: 0.75; }
.search-input:focus { border-color: var(--accent); }

.search-dropdown { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; z-index: 200; max-height: 420px; overflow-y: auto; display: none; box-shadow: var(--shadow); }
.search-dropdown.open { display: block; }
.search-result-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer; transition: background 0.2s; border-bottom: 1px solid var(--border); text-decoration: none; }
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-card); }
.search-result-thumb { width: 44px; height: 60px; object-fit: cover; border-radius: 4px; flex-shrink: 0; background: var(--bg-card); }
.search-result-thumb-ph { width: 44px; height: 60px; background: var(--bg-card); border-radius: 4px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--text-dim); }
.search-result-title { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-date { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.search-no-results { padding: 20px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* === SITE TITLE === */
.site-title { font-size: clamp(1.75rem, 3.5vw, 2.8rem); font-weight: 800; text-align: center; padding: 20px 0 28px; letter-spacing: -0.03em; }
.site-title a { color: var(--text); transition: color 0.2s; }
.site-title a:hover { color: var(--accent); }

/* === SECTION HEADER === */
.video-section { margin-top: 4px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.section-title { font-size: 1.1rem; font-weight: 700; }
.section-menu-btn { background: transparent; border: 1.5px solid var(--border); color: var(--text-muted); border-radius: 8px; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: border-color 0.2s, color 0.2s; padding: 0; }
.section-menu-btn:hover { border-color: var(--accent); color: var(--accent); }

/* === VIDEO GRID === */
.video-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }

/* === VIDEO CARD === */
.video-card { background: var(--bg-card); border-radius: 12px; overflow: hidden; transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease; }
.video-card:hover { transform: translateY(-5px); background: var(--bg-card-hover); box-shadow: var(--shadow); }
.card-link { display: block; }
.card-thumb { position: relative; aspect-ratio: 2/3; overflow: hidden; background: var(--bg-2); }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s ease; }
.video-card:hover .card-thumb img { transform: scale(1.06); }
.card-thumb-ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--text-dim); }
.card-thumb-ph svg { width: 36px; height: 36px; }
.card-play-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0); display: flex; align-items: center; justify-content: center; transition: background 0.25s; }
.video-card:hover .card-play-overlay { background: rgba(0,0,0,0.4); }
.play-btn { width: 48px; height: 48px; background: rgba(0,210,106,0.9); border-radius: 50%; display: flex; align-items: center; justify-content: center; opacity: 0; transform: scale(0.8); transition: opacity 0.25s, transform 0.25s; }
.play-btn svg { width: 22px; height: 22px; color: #000; margin-left: 3px; }
.video-card:hover .play-btn { opacity: 1; transform: scale(1); }
.card-tag { position: absolute; top: 8px; left: 8px; background: rgba(0,210,106,0.9); color: #000; font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 20px; text-transform: uppercase; }
.card-body { padding: 10px 11px 12px; }
.card-title { font-size: 0.82rem; font-weight: 600; color: var(--text); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 7px; }
.card-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.meta-views, .meta-date { display: flex; align-items: center; gap: 4px; font-size: 0.7rem; font-weight: 500; }
.meta-views { color: var(--text); }
.meta-date { color: var(--accent); }
.meta-icon { width: 13px; height: 13px; flex-shrink: 0; }

/* === PAGINATION === */
.pagination { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 44px; padding: 16px 0; }
.pagination a, .pagination .page-number { padding: 8px 18px; border-radius: 8px; border: 1px solid var(--border); font-size: 0.85rem; color: var(--text-muted); transition: background 0.2s, border-color 0.2s, color 0.2s; }
.pagination a:hover { background: var(--bg-card); border-color: var(--accent); color: var(--accent); }
.pagination .page-number { background: var(--bg-card); color: var(--text); }

/* === TAG PAGE === */
.tag-header { text-align: center; padding: 32px 0 28px; }
.tag-name { font-size: 2rem; font-weight: 800; margin-bottom: 8px; }
.tag-description { color: var(--text-muted); max-width: 480px; margin: 0 auto 10px; font-size: 0.9rem; }

/* === POST PAGE === */
.post-wrapper { max-width: 960px; margin: 0 auto; padding: 0 8px; }
.post-header { margin-bottom: 28px; }
.post-back { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 0.85rem; margin-bottom: 18px; transition: color 0.2s; }
.post-back:hover { color: var(--accent); }
.post-primary-tag { display: inline-block; background: var(--accent); color: var(--accent-text); font-size: 0.72rem; font-weight: 700; padding: 4px 12px; border-radius: 20px; text-transform: uppercase; margin-bottom: 14px; }
.post-title { font-size: clamp(1.5rem, 3vw, 2.4rem); font-weight: 800; line-height: 1.25; letter-spacing: -0.03em; margin-bottom: 16px; }
.post-meta { display: flex; align-items: center; gap: 18px; color: var(--text-muted); font-size: 0.85rem; flex-wrap: wrap; }
.post-meta-item { display: flex; align-items: center; gap: 6px; }
.post-meta-item svg { width: 15px; height: 15px; }
.post-view-item { color: var(--text); }
.post-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.post-tag { background: var(--bg-card); color: var(--text-muted); font-size: 0.75rem; padding: 5px 14px; border-radius: 20px; border: 1px solid var(--border); transition: color 0.2s, border-color 0.2s; }
.post-tag:hover { color: var(--accent); border-color: var(--accent); }
.post-feature-image { border-radius: 12px; overflow: hidden; margin-bottom: 32px; }
.post-feature-image img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }

/* === POST CONTENT === */
.post-content, .gh-content { color: var(--text); font-size: 1rem; line-height: 1.85; }
[data-theme="dark"] .post-content, [data-theme="dark"] .gh-content { color: #c5c8dc; }
.gh-content p { margin-bottom: 18px; }
.gh-content h2 { font-size: 1.5rem; font-weight: 700; color: var(--text); margin: 36px 0 16px; }
.gh-content h3 { font-size: 1.2rem; font-weight: 600; color: var(--text); margin: 28px 0 12px; }
.gh-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.gh-content blockquote { border-left: 3px solid var(--accent); margin: 24px 0; padding: 14px 20px; background: var(--bg-2); border-radius: 0 8px 8px 0; font-style: italic; color: var(--text-muted); }
.gh-content code { background: var(--bg-2); padding: 2px 7px; border-radius: 4px; font-size: 0.875em; color: var(--accent); }
.gh-content pre { background: var(--bg-2); padding: 20px; border-radius: 8px; overflow-x: auto; margin-bottom: 22px; border: 1px solid var(--border); }
.gh-content pre code { background: none; padding: 0; color: var(--text); }
.gh-content img { border-radius: 8px; margin: 24px 0; }
.gh-content .kg-embed-card { margin: 0 0 28px; }
.gh-content video { width: 100% !important; aspect-ratio: 16/9 !important; height: auto !important; max-height: 80vh; border-radius: 8px; display: block; background: #000; object-fit: contain; }
.gh-content .kg-embed-card iframe,
.gh-content iframe[src*="youtube"],
.gh-content iframe[src*="youtu.be"],
.gh-content iframe[src*="vimeo"],
.gh-content iframe[src*="dailymotion"] { width: 100%; aspect-ratio: 16/9; height: auto; border: none; border-radius: 8px; display: block; }
.gh-content figure.kg-image-card { margin: 24px 0; }
.gh-content figure.kg-image-card img { width: 100%; border-radius: 8px; }
.gh-content .kg-width-wide { margin-left: -10%; margin-right: -10%; }

/* === ERROR PAGE === */
.error-wrapper { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; text-align: center; padding: 40px 24px; }
.error-code { font-size: 7rem; font-weight: 900; color: var(--accent); line-height: 1; margin-bottom: 18px; }
.error-message { font-size: 1.1rem; color: var(--text-muted); margin-bottom: 32px; }
.btn { display: inline-flex; align-items: center; gap: 8px; background: var(--accent); color: var(--accent-text); font-weight: 700; font-size: 0.875rem; padding: 12px 24px; border-radius: 8px; transition: background 0.2s; }
.btn:hover { background: var(--accent-2); }

/* === FOOTER === */
.site-footer { border-top: 1px solid var(--border); padding: 22px 24px; text-align: center; color: var(--text-muted); font-size: 0.8rem; }
.site-footer a { color: var(--accent); }

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* === LIST VIEW === */
.video-grid.list-view { grid-template-columns: 1fr; gap: 10px; }
.video-grid.list-view .video-card { display: flex; }
.video-grid.list-view .card-link { display: flex; flex: 1; }
.video-grid.list-view .card-thumb { aspect-ratio: 16/9; width: 200px; flex-shrink: 0; border-radius: 12px 0 0 12px; }
.video-grid.list-view .card-body { padding: 14px 16px; display: flex; flex-direction: column; justify-content: center; }
.video-grid.list-view .card-title { font-size: 0.95rem; -webkit-line-clamp: 3; }

/* === RESPONSIVE === */
@media (max-width: 1300px) { .video-grid { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 1024px) { .video-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 768px) {
  .video-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .site-main { padding: 0 16px 40px; }
  .site-header { padding: 14px 16px 0; }
  .gh-content .kg-width-wide { margin-left: 0; margin-right: 0; }
  .video-grid.list-view .card-thumb { width: 130px; }
}
@media (max-width: 480px) {
  .video-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .card-title { font-size: 0.75rem; }
}

/* === KOENIG CARD WIDTH CLASSES === */
.kg-width-wide { margin-left: -8vw; margin-right: -8vw; }
.kg-width-full { margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); width: 100vw; }
