/*
 * jingdianmovie – GeneratePress 子主题
 * global.css：全站通用样式（清理重复 + 修复：站名菜单不显示、内容不居中、链接发虚看不清、导航色块、首页文案居中、页脚导航换行、相关推荐标题/布局）
 */

:root {
  --jd-bg: #f5f5f5;
  --jd-surface: #ffffff;
  --jd-header-bg: #212d3b;
  --jd-nav-bg: #28354a;
  --jd-brand: #ffd700;
  --jd-text-main: #222222;
  --jd-text-muted: #5b6475;
  --jd-border-soft: #e2e6f0;
  --jd-radius-lg: 18px;
  --jd-shadow-soft: 0 15px 30px rgba(15, 23, 42, 0.08);
}

/* ========= 基础 ========= */

html, body { height: 100%; }

body {
  background: var(--jd-bg);
  color: var(--jd-text-main);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

/* 通用宽度容器（首页模板/全站复用） */
.cv-auto,
.jd-container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 18px;
}

/* ========= 头部 & 导航（GeneratePress） ========= */

.site-header {
  background: var(--jd-header-bg);
  border-bottom: 1px solid rgba(15, 23, 42, 0.6);
}

.inside-header {
  max-width: 1160px;
  margin: 0 auto;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* 站名可见 */
.site-header .site-title,
.site-header .main-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  color: #ffffff;
}

.site-header .site-title a,
.site-header .main-title a {
  color: #ffffff !important;
  text-decoration: none;
}

/* 描述隐藏 */
.site-branding .site-description { display: none; }

/* 主导航链接（颜色/加粗） */
.main-navigation .main-nav > ul > li > a,
.main-navigation .menu-bar-item > a {
  color: var(--jd-brand) !important;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.main-navigation .main-nav > ul > li > a:hover,
.main-navigation .main-nav > ul > li.current-menu-item > a,
.main-navigation .main-nav > ul > li.current-menu-ancestor > a {
  color: #ffffff !important;
}

/* 移动端菜单按钮 */
.main-navigation .menu-toggle {
  border-radius: 999px;
  border: 1px solid rgba(255, 215, 0, 0.7);
  color: var(--jd-brand) !important;
}

/* ========= FIX：导航中间“色块/盒子感” ========= */
/* 目标：背景只属于整条 nav；inside-navigation 不当盒子（取消 max-width + 透明） */

.main-navigation { background: var(--jd-nav-bg) !important; }

.main-navigation .inside-navigation,
.main-navigation .inside-navigation.grid-container {
  background: transparent !important;
  box-shadow: none !important;
  max-width: none !important; /* 关键：去掉中间盒子宽度 */
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.main-navigation .main-nav {
  max-width: 1160px !important;
  margin: 0 auto !important;
  padding: 0 18px !important;
}

.main-navigation .inside-navigation::before,
.main-navigation .inside-navigation::after {
  background: transparent !important;
  box-shadow: none !important;
}

/* ========= 首页模板灰色块兜底修复（top-bar 类名撞车） ========= */
body.home header .top-bar { background: var(--jd-header-bg) !important; }

/* ========= 首页：隐藏长标题 + 文案居中 ========= */
body.home .intro-wrap h2 { display: none !important; }

body.home .intro-wrap .intro-text { text-align: center !important; }

body.home .intro-wrap .intro-text p {
  max-width: 980px;
  margin: 0 auto !important;
  line-height: 1.8;
}

/* ========= 文章/栏目/归档：布局居中修复 ========= */
body.single .site-content,
body.page .site-content,
body.category .site-content,
body.archive .site-content {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 18px;
}

body.single .content-area,
body.page .content-area,
body.category .content-area,
body.archive .content-area {
  float: none !important;
  width: 100% !important;
  margin: 0 auto !important;
}

.single .page-header,
.page .page-header,
.archive .page-header {
  background: transparent;
  box-shadow: none;
  border: 0;
  padding: 0;
  margin: 1.5rem auto 0;
}

.single .entry-title,
.page .entry-title,
.archive .page-title {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.4;
  color: #1a1a1a;
  margin: 0 0 16px 0;
}

.separate-containers .inside-article {
  background: var(--jd-surface);
  border-radius: var(--jd-radius-lg);
  box-shadow: var(--jd-shadow-soft);
  padding: 32px 28px 36px;
}

.single .entry-content,
.page .entry-content {
  font-size: 17px;
  line-height: 1.9;
  color: var(--jd-text-main);
}

.single .entry-content p,
.page .entry-content p { margin: 0 0 1.3em; }

.single .entry-content h2,
.page .entry-content h2 {
  font-size: 26px;
  font-weight: 800;
  color: #1a1a1a;
  margin-top: 2em;
  margin-bottom: 0.8em;
  padding-bottom: 0.5em;
  border-bottom: 2px solid #f0f0f0;
  position: relative;
}

.single .entry-content h2::before,
.page .entry-content h2::before {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, #ffd700, #ff9f1a);
}

.single .entry-content h3,
.page .entry-content h3 {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
  margin-top: 1.8em;
  margin-bottom: 0.6em;
}

/* 正文链接：用更稳的蓝，hover 再变金（避免黄色发虚） */
.separate-containers .inside-article a,
.jd-copyright a,
.jd-related-block a {
  color: #1a4d9b;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
}

.separate-containers .inside-article a:hover,
.jd-copyright a:hover,
.jd-related-block a:hover {
  color: var(--jd-brand);
}

.single .entry-content img,
.page .entry-content img {
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  margin: 1.5em auto;
}

/* ========= 面包屑 ========= */
.jd-breadcrumb {
  max-width: 860px;
  margin: 1.1rem auto 0.5rem;
  padding: 0 18px;
  font-size: 13px;
  color: var(--jd-text-muted);
}

.jd-breadcrumb a {
  color: #1a4d9b;
  text-decoration: none;
}
.jd-breadcrumb a:hover {
  color: var(--jd-brand);
  text-decoration: underline;
}

/* ========= 版权声明 ========= */
.jd-copyright {
  margin: 32px 0 0;
  padding: 20px 24px;
  background: linear-gradient(135deg, #fffbf0 0%, #fff9e6 100%);
  border: 1px solid #ffe8a3;
  border-left: 4px solid var(--jd-brand);
  border-radius: 10px;
  color: #555;
  line-height: 1.8;
  font-size: 14px;
}

.jd-copyright strong {
  color: #1a1a1a;
  font-weight: 800;
}

/* ========= 通用区块标题（首页/专题/排行等） ========= */
.section-title {
  font-size: 24px;
  font-weight: 800;
  margin: 28px 0 20px;
  color: #1a1a1a;
  position: relative;
  padding-left: 12px;
}

.section-title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 24px;
  background: linear-gradient(180deg, #ffd700, #ff9f1a);
  border-radius: 2px;
}

.section-title a {
  color: inherit;
  text-decoration: none;
}
.section-title a:hover { color: var(--jd-brand); }

/* ========= 相关推荐 ========= */
.jd-related-block {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 2px solid #f0f0f0;
}

/* ✅相关推荐标题缩小，和首页卡片区更协调 */
.jd-related-block .section-title {
  font-size: 20px !important;
  margin: 20px 0 16px !important;
}
.jd-related-block .section-title::before { height: 18px !important; }

/* 默认：电脑端 3 列（配合 functions.php 的 3 篇） */
.jd-related-block .film-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* ========= 页脚 ========= */
.footer-wrap {
  border-top: 1px solid var(--jd-border-soft);
  background: #ffffff;
  padding: 32px 0 24px;
}

.footer-wrap-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 18px;
}

.footer-links {
  font-size: 14px;
  margin-bottom: 16px;
  text-align: center;
}

.footer-links strong {
  color: #1a1a1a;
  margin-right: 12px;
}

.footer-links a {
  margin: 0 10px;
  color: #1a4d9b;
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--jd-brand);
  text-decoration: underline;
}

.footer-copy {
  font-size: 13px;
  color: var(--jd-text-muted);
  text-align: center;
  line-height: 1.6;
}

/* ========= 响应式 ========= */
@media (max-width: 768px) {
  .inside-header { flex-wrap: wrap; }

  .separate-containers .inside-article { padding: 24px 20px 28px; }

  .single .entry-title,
  .page .entry-title,
  .archive .page-title { font-size: 26px; }

  /* ✅手机端相关推荐：2列（配合 4 篇=2x2） */
  .jd-related-block .film-list {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
  }

  /* ✅手机端页脚快速导航：两行换行，不要一行一个 */
  .footer-links {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 10px 14px !important;
    text-align: center !important;
  }
  .footer-links strong {
    width: 100% !important;
    margin: 0 0 6px 0 !important;
  }
  .footer-links a {
    margin: 0 !important;
    white-space: nowrap;
  }
}


/* ========= 无障碍与阅读体验 ========= */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #0b57d0;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  html:focus-within { scroll-behavior: auto; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========= 全站统一自定义头部 ========= */
.jd-site-header {
  position: relative;
  z-index: 1000;
  width: 100%;
  background: var(--jd-header-bg);
  border-bottom: 1px solid rgba(15, 23, 42, 0.65);
}

.jd-site-header__top {
  max-width: 1160px;
  min-height: 58px;
  margin: 0 auto;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.jd-site-brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--jd-brand) !important;
  font-size: 22px;
  line-height: 1.15;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-decoration: none !important;
}

.jd-site-brand img {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  object-fit: cover;
  border-radius: 6px;
}

.jd-primary-nav {
  width: 100%;
  background: var(--jd-nav-bg) !important;
}

.jd-primary-nav__inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 18px;
}

.jd-site-header .jd-primary-nav ul {
  display: flex;
  align-items: stretch;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.jd-site-header .jd-primary-nav li {
  margin: 0;
  padding: 0;
  list-style: none;
}

.jd-site-header .jd-primary-nav a {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 10px 15px;
  color: var(--jd-brand) !important;
  font-weight: 800;
  line-height: 1.35;
  text-decoration: none !important;
  transition: color .2s ease, background-color .2s ease;
}

.jd-site-header .jd-primary-nav a:hover,
.jd-site-header .jd-primary-nav a:focus-visible,
.jd-site-header .jd-primary-nav .is-current > a {
  color: #fff !important;
  background: rgba(255,255,255,.08);
}

.jd-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  padding: 8px 13px;
  border: 1px solid rgba(255, 215, 0, .72);
  border-radius: 999px;
  background: transparent;
  color: var(--jd-brand);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.jd-menu-toggle__icon {
  width: 19px;
  display: grid;
  gap: 4px;
}

.jd-menu-toggle__icon i {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform .2s ease, opacity .2s ease;
}

/* 通用电影卡片样式也放到全站，分类页与专题页共用。 */
.film-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.film-item {
  min-width: 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  overflow: hidden;
}

.film-item > a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.film-item picture,
.film-item img {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
}

.film-item .film-title {
  min-height: 42px;
  margin: 0;
  padding: 12px 14px 6px;
  color: #1a1a1a;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.film-item .film-meta {
  padding: 0 14px 4px;
  color: #4b5563;
  font-size: 13px;
}

.film-item .film-desc {
  padding: 0 14px 12px;
  color: #4b5563;
  font-size: 13px;
  line-height: 1.5;
}

/* 自定义模板由模板自身控制宽度，避免主题容器再套一层。 */
body.page-template-page-sample-page .site-content,
body.page-template-page-eu-cult-films .site-content,
body.page-template-page-hk-restricted-top10 .site-content,
body.page-template-page-kr-teen-romance .site-content,
body.page-template-page-topic .site-content {
  max-width: none;
  padding-left: 0;
  padding-right: 0;
}

@media (max-width: 768px) {
  .jd-site-header__top {
    min-height: 56px;
    padding: 8px 14px;
  }

  .jd-site-brand {
    font-size: 18px;
    letter-spacing: 0;
  }

  .jd-menu-toggle { display: inline-flex; }

  /*
   * 手机端从首帧开始隐藏折叠菜单，不能等待 JavaScript 再隐藏。
   * Cloudflare Rocket Loader、缓存插件或网络延迟即使推迟脚本执行，
   * 也不会先渲染完整菜单后突然收起，从而避免首页大幅 CLS。
   */
  .jd-primary-nav { display: none; }
  .jd-site-header.is-menu-open .jd-primary-nav { display: block; }

  .jd-primary-nav__inner { padding: 0 12px 12px; }

  .jd-site-header .jd-primary-nav ul {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 12px;
    background: rgba(255,255,255,.04);
  }

  .jd-site-header .jd-primary-nav a {
    min-height: 44px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,.09);
  }

  .jd-site-header .jd-primary-nav li:last-child a { border-bottom: 0; }

  .jd-site-header.is-menu-open .jd-menu-toggle__icon i:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }
  .jd-site-header.is-menu-open .jd-menu-toggle__icon i:nth-child(2) { opacity: 0; }
  .jd-site-header.is-menu-open .jd-menu-toggle__icon i:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  /* 手机端每行一个文章卡片。 */
  .film-list,
  .jd-related-block .film-list {
    grid-template-columns: 1fr !important;
    gap: 18px !important;
  }

  /* 去掉 GeneratePress/主题外层的白色框、圆角与重复留白。 */
  body:not(.home) #page,
  body:not(.home) #content,
  body:not(.home) .site-content,
  body:not(.home) .content-area,
  body:not(.home) .site-main {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  body.single .site-content,
  body.page .site-content,
  body.category .site-content,
  body.archive .site-content {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .separate-containers .inside-article,
  body.single .inside-article {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 20px 15px 28px !important;
  }

  /* About 与其他自定义页面只保留自身一层内边距。 */
  .jd-about-page,
  .jd-forbidden-page,
  .jd-article-page,
  .jd-korean-page {
    width: 100%;
    max-width: none;
    margin: 0;
    padding-left: 15px;
    padding-right: 15px;
  }

  .jd-about-hero {
    margin-bottom: 32px;
    padding: 34px 20px;
    border-radius: 12px;
    box-shadow: none;
  }
}
