/*
Theme Name: 印尼王掌柜 Indowangrui
Theme URI: https://www.indowangrui.com/
Author: 印尼王掌柜
Description: 印尼商业资讯响应式主题。移动端优先，PC 自适应扩展。白色为主、红色装饰。含首页、列表页、详情页、自定义页面模板。
Version: 1.1.3
Requires at least: 6.0
Tested up to: 6.6
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: indowangrui
*/

/* ============================================================
   设计令牌 —— 白底红饰
   ============================================================ */
:root {
  --red: #c8102e;
  --red-dark: #a50d26;
  --ink: #221c1a;
  --muted: #7a706c;
  --line: #e6e2e0;
  --bg: #ffffff;
  --bg-soft: #f6f4f3;
  --accent: #fbeceb;
  --radius: 10px;
  --maxw: 1160px;   /* PC 主体最大宽度 */
  --readw: 768px;   /* 手机版沿用的窄栏宽度 */
  --font-serif: "Noto Serif SC", ui-serif, Georgia, "Songti SC", serif;
  --font-sans: "Noto Sans SC", ui-sans-serif, system-ui, "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

/* ============================================================
   基础重置
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
}
img {
  max-width: 100%;
  height: auto;
  display: block;
}
a {
  color: inherit;
  text-decoration: none;
}
a:hover {
  color: var(--red);
}
h1,
h2,
h3,
h4 {
  font-family: var(--font-serif);
  font-weight: 800;
  line-height: 1.35;
  color: var(--ink);
  margin: 0 0 0.5em;
  text-wrap: balance;
}
p {
  margin: 0 0 1.1em;
}
.wrap {
  width: 100%;
  max-width: var(--readw);
  margin: 0 auto;
  padding: 0 16px;
}

/* 屏幕阅读器专用 */
.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ============================================================
   顶部 Header + 导航
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--red);
  color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}
.header-bar {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.header-bar a:hover {
  color: #fff;
}
.menu-toggle,
.search-toggle {
  background: transparent;
  border: 0;
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.menu-toggle:hover,
.search-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
}
.menu-toggle svg,
.search-toggle svg {
  width: 22px;
  height: 22px;
}
.site-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.05;
  text-align: center;
}
.site-brand .brand-name {
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: 20px;
  letter-spacing: 0.04em;
}
.site-brand .brand-slogan {
  margin-top: 3px;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.82);
}

/* PC 主导航（位于顶栏右侧） */
.primary-nav {
  display: none;
}
.primary-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.primary-nav a {
  display: block;
  padding: 10px 14px;
  font-size: 14.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
}
.primary-nav a:hover,
.primary-nav .current-menu-item > a {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* 移动端抽屉菜单 */
.mobile-drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
}
.mobile-drawer.open {
  display: block;
}
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}
.drawer-panel {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 280px;
  max-width: 82vw;
  background: var(--bg);
  color: var(--ink);
  box-shadow: 2px 0 18px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--red);
  color: #fff;
  padding: 12px 16px;
}
.drawer-head .brand-name {
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: 16px;
}
.drawer-panel nav ul {
  list-style: none;
  margin: 0;
  padding: 6px 0;
}
.drawer-panel nav a {
  display: block;
  padding: 13px 20px;
  font-size: 15px;
  border-bottom: 1px solid var(--line);
}
.drawer-panel nav a:hover {
  background: var(--accent);
  color: var(--red);
}
.drawer-section-title {
  padding: 16px 20px 6px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

/* ============================================================
   区块标题
   ============================================================ */
.section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 26px 0 14px;
}
.section-heading::before {
  content: "";
  width: 5px;
  height: 20px;
  background: var(--red);
  border-radius: 2px;
}
.section-heading h2 {
  margin: 0;
  font-size: 19px;
}
.section-heading .more {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-weight: 400;
}

/* ============================================================
   焦点大图 (front page)
   ============================================================ */
.hero-row {
  margin-top: 16px;
}

/* ============================================================
   焦点幻灯：CSS scroll-snap + 显式高度（不用 aspect-ratio，
   避免 WordPress 图片宽高属性导致容器塌陷 / 幻灯消失）。
   幻灯完全依赖主题自身 CSS，不依赖 Tailwind CDN 生成类。
   ============================================================ */
.hero-carousel {
  position: relative;
  width: 100%;
  height: 240px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--muted);
}
.hero-track {
  display: flex;
  flex-wrap: nowrap;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.hero-track::-webkit-scrollbar {
  display: none;
}
.hero-slide {
  position: relative;
  flex: 0 0 100%;
  width: 100%;
  min-width: 100%;
  height: 100%;
  display: block;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}
.hero-slide .hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hero-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.15) 55%, transparent);
}
.hero-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 18px 16px;
}
.hero-cat {
  display: inline-block;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 4px;
  margin-bottom: 8px;
}
.hero-heading {
  color: #fff;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 900;
  line-height: 1.3;
  margin: 0;
}
.hero-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
}
.hero-arrow:hover {
  background: var(--red);
}
.hero-arrow--prev { left: 10px; }
.hero-arrow--next { right: 10px; }
.hero-dots {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  display: flex;
  gap: 6px;
}
.hero-dots button {
  width: 12px;
  height: 6px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.2s;
}
.hero-dots button.active {
  width: 24px;
  background: #fff;
}

/* 右侧最新更新 */
.hero-latest {
  margin-top: 24px;
}
.hero-latest .card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 掌柜速递：每条��个带描述的卡片，宽屏两列、窄屏一列 */
.express-section {
  margin-top: 40px;
}
.express-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  align-items: stretch;
}
.express-item {
  display: flex;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--card, #fff);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.express-item:hover {
  border-color: var(--red);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.express-thumb {
  display: block;
  flex: 0 0 104px;
  width: 104px;
  height: 72px;
  overflow: hidden;
  border-radius: 6px;
  background: #f1efee;
}
.express-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.express-item:hover .express-thumb img {
  transform: scale(1.05);
}
.express-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.express-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}
.express-meta .cat {
  color: var(--red);
}
.express-title {
  margin: 6px 0 0;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 900;
  line-height: 1.375;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.express-item:hover .express-title {
  color: var(--red);
}
.express-excerpt {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* ============================================================
   文章卡片 / 信息流
   ============================================================ */
.article-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card, #fff);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.article-card:hover {
  border-color: var(--red);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.article-card .thumb {
  flex: 0 0 104px;
  width: 104px;
  height: 68px;
  border-radius: 6px;
  overflow: hidden;
}
.article-card .thumb img {
  width: 100%;
  height: 68px;
  object-fit: cover;
}
.article-card .body {
  min-width: 0;
}
.article-card .meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: 11px;
  color: var(--muted);
}
.article-card .cat-tag {
  color: var(--red);
  font-size: 11px;
  font-weight: 600;
}
.article-card h3 {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.375;
  margin: 4px 0 0;
  font-family: var(--font-sans);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.article-card .excerpt {
  display: none;
  color: var(--muted);
  font-size: 13.5px;
  margin: 0;
}

/* 卡片网格（列表页 / PC 首页分栏） */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

/* ============================================================
   单篇文章详情
   ============================================================ */
.article-header {
  margin-top: 20px;
}
.article-header .cat-tag {
  display: inline-block;
  background: var(--accent);
  color: var(--red);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 4px;
}
.article-header h1 {
  font-size: 26px;
  margin: 12px 0 10px;
}
.article-header .meta {
  color: var(--muted);
  font-size: 13px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}
.article-hero {
  margin: 18px 0;
  border-radius: var(--radius);
  overflow: hidden;
}
.article-hero img {
  width: 100%;
  object-fit: cover;
}
.article-content {
  font-size: 16.5px;
  line-height: 1.95;
}
.article-content p {
  margin: 0 0 1.25em;
}
.article-content img {
  border-radius: 8px;
  margin: 1.2em 0;
}
.article-content h2 {
  font-size: 20px;
  margin: 1.4em 0 0.6em;
}
.article-content blockquote {
  margin: 1.2em 0;
  padding: 4px 16px;
  border-left: 4px solid var(--red);
  background: var(--bg-soft);
  color: var(--muted);
}
.copyright-note {
  margin: 24px 0;
  padding: 14px 16px;
  background: var(--accent);
  border-radius: 8px;
  font-size: 13px;
  color: var(--red-dark);
}

/* 相关阅读（移动端：位于正文下方，居中） */
.single-aside {
  margin-top: 32px;
}
.single-aside-inner {
  margin: 0 auto;
  max-width: 680px;
}
.single-aside .card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ============================================================
   自定义页面
   ============================================================ */
.page-hero {
  background: var(--red);
  color: #fff;
  padding: 30px 0;
  text-align: center;
}
.page-hero h1 {
  color: #fff;
  margin: 0;
  font-size: 26px;
}
.page-body {
  font-size: 16.5px;
  line-height: 1.95;
  padding: 26px 0;
}

/* ============================================================
   分页
   ============================================================ */
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin: 28px 0;
}
.pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
}
.pagination .page-numbers.current,
.pagination .page-numbers:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

/* ============================================================
   页脚
   ============================================================ */
.site-footer {
  margin-top: 40px;
  border-top: 4px solid var(--red);
  background: var(--bg-soft);
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 30px 16px;
}
.footer-brand {
  text-align: center;
}
.footer-brand .brand-name {
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: 22px;
  color: var(--red);
}
.footer-brand .brand-slogan {
  margin-top: 4px;
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--muted);
}
/* 单一导航位置，下方平铺居中 */
.footer-nav {
  margin-top: 24px;
}
.footer-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 24px;
}
.footer-nav-list li {
  margin: 0;
}
.footer-nav-list a {
  color: var(--muted);
  font-size: 14px;
}
.footer-nav-list a:hover {
  color: var(--red);
}
.footer-bottom {
  margin-top: 28px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* ============================================================
   搜索框
   ============================================================ */
.search-panel {
  background: var(--red-dark);
  display: none;
}
.search-panel.open {
  display: block;
}
.search-panel form {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  gap: 8px;
}
.search-panel input[type="search"] {
  flex: 1;
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
}
.search-panel button {
  background: #fff;
  color: var(--red);
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  font-weight: 600;
  cursor: pointer;
}

/* ============================================================
   响应式：≥ 768px 平板 / PC
   ============================================================ */
@media (min-width: 768px) {
  .wrap {
    max-width: var(--maxw);
    padding: 0 24px;
  }
  .menu-toggle {
    display: none;
  }
  .site-brand {
    align-items: flex-start;
    text-align: left;
    max-width: 220px;
    flex-shrink: 0;
  }
  .site-brand .custom-logo {
    max-height: 44px;
    width: auto;
  }
  .site-brand .brand-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }
  .header-bar {
    padding: 12px 24px;
  }
  .primary-nav {
    display: block;
    margin-left: auto;
  }
  .primary-nav ul {
    justify-content: flex-end;
  }

  /* 首页顶部：左 70% 幻灯 + 右 30% 最新更新（Flexbox 显式宽度，
     不用 grid fr，避免 Tailwind Preflight 干扰导致比例异常） */
  .hero-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 24px;
    align-items: stretch;
  }
  .hero-row > .hero-carousel {
    flex: 0 0 70%;
    width: 70%;
    max-width: 70%;
    min-width: 0;
    height: 460px;
  }
  .hero-row > .hero-latest {
    flex: 0 0 calc(30% - 24px);
    width: calc(30% - 24px);
    max-width: calc(30% - 24px);
    min-width: 0;
  }
  .hero-heading {
    font-size: 30px;
  }
  .hero-latest {
    margin-top: 0;
  }

  /* 列表 / 分栏卡片变两列，并显示摘要 */
  .card-grid {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: stretch;
  }
  .article-card .thumb {
    flex: 0 0 150px;
    width: 150px;
  }
  .article-card .thumb img {
    height: 100px;
  }
  .article-card h3 {
    font-size: 17px;
  }
  .article-card .excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 4px 0 6px;
  }

  /* 详情页两栏：正文在左，相关阅读在右侧栏 */
  .single-wrap {
    display: flex;
    align-items: flex-start;
    gap: 32px;
  }
  .single-col {
    flex: 0 0 60%;
    width: 60%;
    max-width: 60%;
    min-width: 0;
  }
  .single-aside {
    flex: 0 0 calc(40% - 32px);
    width: calc(40% - 32px);
    max-width: calc(40% - 32px);
    min-width: 0;
    margin-top: 0;
  }
  .single-aside-inner {
    max-width: none;
    position: sticky;
    top: 88px;
  }
  .article-header h1 {
    font-size: 32px;
  }
  .article-hero img {
    max-height: 460px;
  }
}

/* ============================================================
   响应式：≥ 1024px 桌面增强
   ============================================================ */
@media (min-width: 1024px) {
  .home-columns {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    align-items: start;
  }
  .home-columns .card-grid {
    grid-template-columns: 1fr;
  }
  .home-columns .article-card {
    display: flex;
    flex-direction: column;
    height: 100%;
  }
  .home-columns .article-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    padding: 0;
    transition: box-shadow 0.2s ease;
  }
  .home-columns .article-card:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  }
  .home-columns .article-card .thumb {
    width: 100%;
    flex: none;
    margin-bottom: 0;
    border-radius: 0;
  }
  .home-columns .article-card .thumb img {
    height: auto;
    aspect-ratio: 16 / 10;
  }
  .home-columns .article-card .body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex: 1;
  }
  .home-columns .article-card h3 {
    font-family: var(--font-serif);
    font-size: 16px;
    font-weight: 900;
    line-height: 1.375;
    margin: 4px 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .home-columns .article-card .excerpt {
    font-size: 12px;
    line-height: 1.6;
    margin: 6px 0 0;
  }
}
