/*
Theme Name: Asmr1
Theme URI: https://www.asmr1.cc/
Description: YouTube 风格深色卡片式博客主题，首页卡片网格，点击加载更多文章。
Author: Asmr1
Version: 1.0.2
License: GNU General Public License v2 or later
Text Domain: asmr1
*/

/* ============================================
   YouTube 风格 · 深色卡片式博客
   顶栏 + 左侧栏 + 主区网格，点击加载更多
   ============================================ */

:root {
  --bg-header: #212121;
  --bg-sidebar: #212121;
  --bg-main: #0f0f0f;
  --bg-card-hover: #272727;
  --bg-input: #121212;

  --text-primary: #f1f1f1;
  --text-secondary: #aaaaaa;
  --text-muted: #717171;

  --border-subtle: rgba(255, 255, 255, 0.1);
  --accent: #ff0000;
  --accent-dim: #cc0000;

  --header-height: 56px;
  --sidebar-width: 240px;
  --card-min-width: 280px;
  --thumb-ratio: 16 / 9;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  height: 100%;
  overflow: hidden;
}

/* 自定义滚动条：深色主题，分别控制 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* 滚动条1：左侧栏 - 仅 .sidebar.scrollbar1-show 时显示 */
.sidebar::-webkit-scrollbar-thumb {
  background: transparent !important;
  border-radius: 4px;
}

.sidebar.scrollbar1-show::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2) !important;
}

.sidebar.scrollbar1-show::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35) !important;
}

.sidebar.scrollbar1-show::-webkit-scrollbar-thumb:active {
  background: rgba(255, 255, 255, 0.45) !important;
}

/* 滚动条2：主内容区 .main（与 demo 一致） */
.main::-webkit-scrollbar-thumb {
  background: transparent !important;
  border-radius: 4px;
}

.main.scrollbar2-show::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2) !important;
}

.main.scrollbar2-show::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35) !important;
}

.main.scrollbar2-show::-webkit-scrollbar-thumb:active {
  background: rgba(255, 255, 255, 0.45) !important;
}

.main {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.main.scrollbar2-show {
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}


body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: "Roboto", "Noto Sans SC", -apple-system, sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ========== 顶部栏 ========== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-height);
  padding: 0 1rem;
  background: var(--bg-header);
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 1px 0 var(--border-subtle);
}

.header-menu {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  margin: -4px 0 -4px -4px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.header-menu:hover {
  background: var(--bg-card-hover);
  transition: background var(--transition);
}

.icon-menu {
  position: relative;
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

.icon-menu::before,
.icon-menu::after {
  content: "";
  position: absolute;
  left: 0;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

.icon-menu::before {
  top: -6px;
}

.icon-menu::after {
  top: 6px;
}

.header-logo {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  flex-shrink: 0;
  margin-right: 0.5rem;
  letter-spacing: -0.02em;
}

.header-logo:hover {
  color: var(--text-primary);
}

.header-search {
  flex: 1;
  max-width: 640px;
  min-width: 0;
  display: flex;
  align-items: center;
  margin: 0 auto;
}

.search-form {
  display: flex;
  width: 100%;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 40px;
  overflow: hidden;
  background: var(--bg-input);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 1rem;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 1rem;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.search-input::-webkit-search-cancel-button,
.search-input::-webkit-search-decoration {
  appearance: none;
  -webkit-appearance: none;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-form:focus-within {
  border-color: #1a73e8;
  box-shadow: 0 0 0 1px #1a73e8;
}

.search-btn {
  width: 56px;
  height: 40px;
  padding: 0;
  border: none;
  border-left: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.search-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.icon-search {
  width: 20px;
  height: 20px;
  border: 2px solid currentColor;
  border-radius: 50%;
  position: relative;
}

.icon-search::after {
  content: "";
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 8px;
  height: 2px;
  background: currentColor;
  transform: rotate(45deg);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.header-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 1.25rem;
  border-radius: 50%;
}

.header-icon:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ========== 左侧栏 ========== */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background: var(--bg-sidebar);
  overflow-y: auto;
  padding: 0.75rem 0;
  z-index: 90;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-nav {
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.6rem 1.5rem;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background var(--transition);
  border-radius: 0 24px 24px 0;
  margin: 0 0.75rem;
}

.sidebar-item:hover {
  background: var(--bg-card-hover);
}

.sidebar-item--active {
  background: var(--bg-card-hover);
  font-weight: 500;
}

.sidebar-icon {
  width: 24px;
  text-align: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.sidebar-section {
  padding: 0.5rem 0 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-section:last-child {
  border-bottom: none;
}

.sidebar-title {
  margin: 0;
  padding: 0.5rem 1.5rem 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ========== 主内容区（可滚动，与 demo 一致） ========== */
.main {
  flex: 1;
  margin-top: var(--header-height);
  margin-left: 0;
  padding: 1.5rem 1.5rem 2rem;
  min-height: 0;
  overflow-y: auto;
}

/* 首页主区留白 */
.home .main {
  padding-top: 0.5rem;
  padding-bottom: 1rem;
}

/* ========== 卡片网格 ========== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-min-width), 1fr));
  gap: 1.5rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.card {
  margin: 0;
  padding: 0;
}

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  border-radius: var(--radius-md);
  padding: 4px;
  margin: -4px;
  transition: transform var(--transition), box-shadow var(--transition);
  transform: translateY(0);
}

.card-link:hover,
.card-link:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  outline: none;
}

.card-link:active {
  transform: translateY(0);
}

.card-thumb {
  position: relative;
  aspect-ratio: var(--thumb-ratio);
  background: #282828;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.card-link:hover .card-thumb img,
.card-link:focus-visible .card-thumb img {
  transform: scale(1.05);
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-thumb-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #383838 0%, #282828 100%);
}

.card-duration {
  position: absolute;
  bottom: 6px;
  right: 6px;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.9);
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
}

.card-info {
  display: flex;
  gap: 0.75rem;
  padding: 0 4px;
}

.card-text {
  flex: 1;
  min-width: 0;
}

.card-title {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* 加载更多：深灰默认，悬停白底黑字 */
.load-more-line {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0;
  padding: 0.4rem 0;
  font-size: 0.8rem;
  color: var(--text-primary);
  background: var(--bg-card-hover);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}

.load-more-line:hover {
  background: #fff;
  color: #0f0f0f;
}

.load-more-line-text {
  color: inherit;
}

.load-more-line:hover .load-more-line-text {
  color: inherit;
}

.load-more-line:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 加载更多栏：卡片与按钮之间留适度空隙，更舒展 */
.load-more-wrap {
  margin-top: 1.25rem;
  margin-bottom: 0;
  padding: 0.5rem 0 0.75rem;
}

/* 分页仅用于“加载更多”取下一页链接，不展示 */
.load-more-wrap .asmr1-pagination-wrap {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.footer {
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

.footer p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ========== 单篇资源页（左视频+右推荐，隐藏左侧栏） ========== */
.single .sidebar,
.single .header-menu {
  display: none;
}

.single .footer {
  display: none;
}

.single .main {
  margin-left: 0;
}

.main--single,
.single .main {
  padding: 1.5rem 1.5rem 2rem;
}

.single-wrap {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  max-width: 100%;
}

.single-content {
  flex: 1;
  min-width: 0;
}

.video-player {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 1rem;
}

.video-player-inner {
  position: relative;
  width: 100%;
  height: 100%;
}

.video-player-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-embed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.video-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #282828 0%, #1a1a1a 100%);
}

.video-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 68px;
  height: 48px;
  padding: 0;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.video-play-btn:hover {
  background: #fff;
}

.play-icon {
  width: 0;
  height: 0;
  margin-left: 4px;
  border-style: solid;
  border-width: 10px 0 10px 18px;
  border-color: transparent transparent transparent #212121;
}

.video-info {
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.video-title {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-primary);
}

.video-meta-row {
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.video-robot-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.video-robot-lead {
  margin-right: 0.25rem;
  color: var(--accent);
  font-weight: 600;
}

.btn-robot {
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  color: var(--text-primary);
  background: var(--bg-card-hover);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background var(--transition);
}

.btn-robot:hover {
  background: #3f3f3f;
}

.video-channel-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.video-channel-info {
  flex: 1;
  min-width: 0;
}

.video-channel-name {
  display: inline-block;
  font-weight: 500;
  color: var(--text-primary);
  width: fit-content;
}

a.video-channel-name {
  text-decoration: none;
  transition: color 0.2s;
}

a.video-channel-name:hover {
  color: var(--text-secondary);
}

.btn-subscribe {
  padding: 0.5rem 1.25rem;
  border: none;
  border-radius: 2px;
  background: #cc0000;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  text-decoration: none;
  display: inline-block;
}

.btn-subscribe:hover {
  background: #ff0000;
  color: #fff;
}

.video-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border: none;
  border-radius: 18px;
  background: var(--bg-card-hover);
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background var(--transition);
}

.btn-action:hover {
  background: #3f3f3f;
}

.video-description {
  padding: 1rem 0;
}

.video-description-title {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.video-description-text.entry-content {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.video-description-text.entry-content p {
  margin: 0 0 0.5rem;
}

.video-comments {
  padding: 1rem 0;
}

/* 广告位 */
.ad-slot {
  margin-bottom: 1rem;
  min-height: 50px;
}

.ad-slot--sidebar {
  width: 100%;
}

/* 单篇页图片广告：简介下方、右侧栏 */
.ad-banner-link {
  display: block;
  width: 100%;
  line-height: 0;
}

.ad-banner-img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  vertical-align: top;
  border-radius: var(--radius-md);
}

.ad-slot--bottom {
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
  padding-top: 0.25rem;
  min-height: 0;
  border-top: 1px solid var(--border-subtle);
}

.ad-slot--home-top {
  margin-bottom: 0.25rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border-subtle);
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.ad-slot--home-top > * {
  max-width: 100%;
  box-sizing: border-box;
}

/* 首页广告：图片+链接形式 */
.ad-home-banner-link {
  display: block;
  width: 100%;
  line-height: 0;
}

.ad-home-banner-img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  vertical-align: top;
  border-radius: var(--radius-md);
}

/* 自适应：图片+链接形式广告随浏览器宽度缩放 */
.ad-slot--home-top img {
  max-width: 100%;
  height: auto;
  display: block;
  vertical-align: top;
}

.ad-slot--home-top a {
  display: block;
  width: fit-content;
  max-width: 100%;
}

.ad-slot--home-top .ad-home-banner-link {
  width: 100%;
}

/* iframe 广告自适应 */
.ad-slot--home-top iframe {
  max-width: 100%;
}

.sidebar-right {
  width: 402px;
  flex-shrink: 0;
}

.sidebar-right-title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.recommended-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.recommended-card {
  display: flex;
  gap: 0.75rem;
  padding: 0.25rem 0;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.recommended-card:hover {
  background: var(--bg-card-hover);
}

.recommended-thumb {
  position: relative;
  width: 168px;
  aspect-ratio: 16 / 9;
  background: #282828;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.recommended-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.recommended-thumb-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #383838 0%, #282828 100%);
}

.recommended-duration {
  position: absolute;
  bottom: 4px;
  right: 4px;
  padding: 2px 4px;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 500;
  border-radius: 2px;
}

.recommended-info {
  flex: 1;
  min-width: 0;
}

.recommended-title {
  margin: 0 0 0.25rem;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recommended-meta {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ========== 响应式 ========== */
/* 侧栏：任意宽度均可通过菜单按钮切换 */
.sidebar {
  transform: translateX(-100%);
  transition: transform var(--transition);
}

.sidebar.is-open {
  transform: translateX(0);
}

/* 主内容区：侧栏展开时留出空间 */
.main {
  transition: margin-left var(--transition);
}

.layout.sidebar-open .main {
  margin-left: var(--sidebar-width);
}

.layout:not(.sidebar-open) .main {
  margin-left: 0;
}

/* 单篇页无侧栏，主区不缩进 */
.single .layout .main {
  margin-left: 0;
}

@media (max-width: 1024px) {
  .layout.sidebar-open .main,
  .main {
    margin-left: 0;
  }
}

@media (max-width: 768px) {
  .header-search {
    display: none;
  }

  /* 小屏下广告栏始终占满宽度，避免溢出 */
  .ad-slot--home-top {
    width: 100% !important;
    min-width: 0;
  }

  .cards-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .single-wrap {
    flex-direction: column;
  }

  .sidebar-right {
    width: 100%;
  }
}
