/* ============================================================
   style.css —— 网站前台全局样式（和风手帐风）
   米黄纸底 + 墨色文字 + 朱红点缀，衬线标题，像一本日式手帐
   ============================================================ */

:root {
  --paper: #f6f1e7;        /* 纸底：暖米黄 */
  --paper-deep: #efe7d8;   /* 深一档的纸色（页脚、占位块） */
  --card: #fffdf8;         /* 卡片：暖白 */
  --border: #e2d8c4;       /* 细边框：浅茶色 */
  --ink: #3f3a33;          /* 正文：墨色 */
  --muted: #8a8072;        /* 次要文字：灰茶 */
  --accent: #b8502e;       /* 主色：朱红 */
  --accent-dark: #9a3f22;
  --accent-soft: #f6e5dc;  /* 朱红的浅色底 */
  --accent-pink: #f9e8e2;  /* 便签粉（日语按钮用） */
  --radius: 10px;
  --shadow: 0 1px 4px rgba(90, 70, 40, 0.05);
  --shadow-hover: 0 8px 18px rgba(90, 70, 40, 0.12);
  --font-serif: Georgia, "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background-color: var(--paper);
  /* 纸面细点纹理，很淡，模拟和纸颗粒 */
  background-image: radial-gradient(rgba(140, 120, 90, 0.06) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--ink);
  line-height: 1.7;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }
img { display: block; max-width: 100%; }

h1, h2, h3 { font-family: var(--font-serif); font-weight: 700; }

.page-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

/* ============ 导航栏（固定在顶部，纸底细线） ============ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(246, 241, 231, 0.93);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.logo { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.logo:hover { color: var(--ink); }
/* 像一枚朱红印章 */
.logo-icon {
  width: 40px; height: 40px;
  border-radius: 6px;
  background: var(--accent);
  color: #fffdf8;
  font-family: var(--font-serif);
  font-size: 24px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 2px rgba(255, 253, 248, 0.4);
}
.logo-text { font-family: var(--font-serif); font-size: 19px; font-weight: 700; display: flex; flex-direction: column; line-height: 1.2; }
.logo-text small { font-family: sans-serif; font-size: 11px; font-weight: 400; color: var(--muted); letter-spacing: 1px; }

.nav-links { display: flex; gap: 4px; margin-left: 8px; }
.nav-links a {
  padding: 8px 14px;
  border-radius: 6px;
  color: var(--ink);
  font-size: 15px;
  transition: all 0.15s;
}
.nav-links a:hover { background: var(--accent-soft); color: var(--accent-dark); }
.nav-links a.active { background: var(--accent); color: #fffdf8; }

/* 右上角固定入口：日语学习系统（像一张便签贴纸） */
.jp-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 6px;
  background: var(--accent-pink);
  border: 1px dashed #d9a48f;
  color: #a8482c !important;
  font-size: 13px;
  font-weight: 600;
  transition: transform 0.15s;
}
.jp-btn:hover { transform: translateY(-1px); }
.jp-badge {
  font-size: 11px;
  background: rgba(255, 255, 255, 0.7);
  color: #a8482c;
  padding: 0 7px;
  border-radius: 8px;
  font-weight: 400;
}

/* ============ 轮播图（全宽，自动播放） ============ */
.carousel {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--paper-deep);
  height: clamp(220px, 38vw, 430px);
  margin-bottom: 28px;
}
.carousel-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}
.carousel-slide.active { opacity: 1; pointer-events: auto; }
.carousel-slide img { width: 100%; height: 100%; object-fit: cover; }
.carousel-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 48px 24px 20px;
  background: linear-gradient(transparent, rgba(50, 40, 30, 0.55));
  color: #fffdf8;
}
.carousel-caption h2 { font-size: clamp(18px, 2.6vw, 28px); }

/* 没有轮播图时的欢迎占位 */
.welcome-slide {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
  background: var(--paper-deep);
  color: var(--ink);
}
.welcome-slide h2 { font-size: clamp(26px, 4vw, 44px); }
.welcome-slide p { font-size: clamp(14px, 2vw, 18px); color: var(--muted); }
.welcome-slide::before {
  content: "こ";
  width: 72px; height: 72px;
  border-radius: 8px;
  background: var(--accent);
  color: #fffdf8;
  font-family: var(--font-serif);
  font-size: 40px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 6px;
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px; height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(63, 58, 51, 0.45);
  color: #fffdf8;
  font-size: 24px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
  z-index: 5;
}
.carousel-arrow:hover { background: rgba(63, 58, 51, 0.7); }
.carousel-arrow.prev { left: 12px; }
.carousel-arrow.next { right: 12px; }

.carousel-dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 5;
}
.carousel-dots .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: rgba(255, 253, 248, 0.55);
  cursor: pointer;
  transition: all 0.2s;
}
.carousel-dots .dot.active { background: var(--accent); width: 22px; border-radius: 5px; }

/* ============ 首页布局：主体 + 侧边栏 ============ */
.home-layout, .list-layout, .detail-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  align-items: start;
}
.sidebar { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 80px; }

/* ============ 区块标题 ============ */
.section { margin-bottom: 32px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title {
  font-size: 22px;
  font-weight: 700;
  padding-left: 12px;
  border-left: 4px solid var(--accent);
  line-height: 1.3;
}
.more-link { color: var(--muted); font-size: 14px; }
.more-link:hover { color: var(--accent); }

/* ============ 卡片 ============ */
.article-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.article-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  color: var(--ink);
  display: flex;
  flex-direction: column;
}
.article-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: #d9c4a8;
  color: var(--ink);
}
.card-cover { aspect-ratio: 16 / 9; overflow: hidden; background: var(--paper-deep); }
.card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.article-card:hover .card-cover img { transform: scale(1.04); }
.cover-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper-deep);
  color: var(--accent);
  font-family: var(--font-serif);
  font-size: 36px;
}
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { font-size: 16px; font-weight: 700; line-height: 1.45; }
.card-summary { font-size: 13px; color: var(--muted); flex: 1; }
.card-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.tag {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border: 1px solid #ecd3c5;
  padding: 1px 9px;
  border-radius: 9px;
  font-size: 12px;
}

/* ============ 文章列表页的横排条目 ============ */
.article-row {
  display: flex;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 14px;
  color: var(--ink);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.article-row:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: #d9c4a8;
  color: var(--ink);
}
.row-cover { width: 180px; flex-shrink: 0; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: var(--paper-deep); }
.row-cover img { width: 100%; height: 100%; object-fit: cover; }
.row-body { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.row-title { font-size: 17px; font-weight: 700; }
.row-summary { font-size: 13px; color: var(--muted); flex: 1; }
.author { color: var(--muted); }

/* ============ 视频卡片 ============ */
.video-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.video-card { cursor: pointer; }
.video-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--paper-deep);
}
.video-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.video-card:hover .video-cover img { transform: scale(1.05); }
.play-overlay {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(50, 40, 30, 0.2);
  color: #fffdf8;
  font-size: 20px;
  opacity: 0;
  transition: opacity 0.2s;
}
.video-card:hover .play-overlay { opacity: 1; }
.play-overlay::before {
  content: "";
  width: 52px; height: 52px;
  border-radius: 50%;
  background: rgba(50, 40, 30, 0.55);
  position: absolute;
}
.video-title { margin-top: 10px; font-family: var(--font-serif); font-size: 15px; font-weight: 700; }
.video-desc { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ============ 侧边栏小部件 ============ */
.widget {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.widget-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
}
.widget-text { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.widget-list { list-style: none; }
.widget-list li { padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.widget-list li:last-child { border-bottom: none; }
.widget-list a { color: var(--ink); display: block; }
.widget-list a:hover { color: var(--accent); }
.widget-list a.current { color: var(--accent); font-weight: 700; }

/* ============ 按钮 ============ */
.btn {
  display: inline-block;
  padding: 9px 20px;
  border-radius: 6px;
  border: none;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary { background: var(--accent); color: #fffdf8; }
.btn-primary:hover { background: var(--accent-dark); color: #fffdf8; }
.btn-outline { background: var(--card); color: var(--accent); border: 1px solid var(--accent); }
.btn-outline:hover { background: var(--accent-soft); }
.btn-block { display: block; text-align: center; }

/* ============ 分页 ============ */
.pagination {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin-top: 24px;
  flex-wrap: wrap;
}
.pagination .page, .pagination .page-nav {
  padding: 6px 13px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ink);
  font-size: 14px;
}
.pagination .page:hover, .pagination .page-nav:hover { border-color: var(--accent); color: var(--accent); }
.pagination .page.current { background: var(--accent); border-color: var(--accent); color: #fffdf8; }
.pagination .page-dots { color: var(--muted); }

/* ============ 文章详情 ============ */
.article-detail {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
}
.detail-title { font-size: 26px; font-weight: 700; line-height: 1.5; margin-bottom: 12px; }
.detail-meta { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.detail-cover {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 20px;
  aspect-ratio: 16 / 7;
  object-fit: cover;
}
.article-content { font-size: 15px; line-height: 1.9; word-break: break-word; }
.article-content h1, .article-content h2, .article-content h3 { margin: 22px 0 12px; }
.article-content h2 { padding-left: 10px; border-left: 4px solid var(--accent); }
.article-content p { margin: 10px 0; }
.article-content ul, .article-content ol { margin: 10px 0 10px 22px; }
.article-content img { max-width: 100%; border-radius: 8px; margin: 10px 0; }
.article-content pre {
  background: #f4eddf;
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 13px;
  margin: 12px 0;
}
.article-content code {
  background: #f1ead9;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 13px;
  color: #9a3f22;
}
.article-content pre code { background: none; padding: 0; color: var(--ink); }
.article-content blockquote {
  border-left: 4px solid #d9c4a8;
  padding: 6px 14px;
  color: var(--muted);
  margin: 12px 0;
  background: #faf6ec;
}
.detail-back { margin-top: 28px; }

/* ============ 空状态 / 错误提示 ============ */
.empty-box {
  background: var(--card);
  border: 1px dashed #d9c4a8;
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.empty-box.big { padding: 70px 20px; }
.empty-box a { color: var(--accent); }
.empty-box .btn { margin-top: 14px; }

.api-error {
  background: #fbf3d9;
  border: 1px solid #e8d491;
  color: #7d6520;
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 20px;
}
.api-error code { background: #f3e7b8; padding: 2px 6px; border-radius: 4px; }

/* ============ 视频播放弹窗 ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(45, 36, 25, 0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
  background: var(--card);
  border-radius: var(--radius);
  position: relative;
  max-width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.video-modal-box { width: min(860px, 94vw); }
.modal-title { padding: 14px 48px 0 20px; font-family: var(--font-serif); font-size: 16px; font-weight: 700; }
.modal-close {
  position: absolute;
  top: 8px; right: 10px;
  width: 34px; height: 34px;
  border: none;
  background: var(--paper-deep);
  border-radius: 50%;
  font-size: 20px;
  color: var(--ink);
  cursor: pointer;
  z-index: 5;
}
.modal-close:hover { background: var(--border); }
.video-player-wrap { padding: 14px 20px 20px; }
.video-player-wrap iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  border-radius: 8px;
  background: #000;
}
.video-player-wrap video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: #000;
}

/* ============ 日语学习入口页 ============ */
.jp-page {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.jp-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 56px 48px;
  text-align: center;
  max-width: 520px;
}
.jp-icon { font-size: 56px; margin-bottom: 12px; }
.jp-title { font-size: 26px; margin-bottom: 10px; }
.jp-status {
  display: inline-block;
  background: var(--accent-pink);
  border: 1px dashed #d9a48f;
  color: #a8482c;
  padding: 5px 18px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
}
.jp-sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }

/* ============ 底部 ============ */
.site-footer {
  background: var(--paper-deep);
  border-top: 1px solid var(--border);
  padding: 26px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-top: 40px;
}
.footer-sub { margin-top: 4px; font-size: 12px; }
.footer-sub a { color: var(--muted); text-decoration: underline; }

/* ============ 响应式（手机） ============ */
@media (max-width: 900px) {
  .home-layout, .list-layout, .detail-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .video-grid { grid-template-columns: repeat(2, 1fr); }
  .article-grid { grid-template-columns: 1fr; }
  .article-detail { padding: 20px; }
}
@media (max-width: 560px) {
  .video-grid { grid-template-columns: 1fr; }
  .row-cover { width: 120px; }
  .nav-links { order: 3; width: 100%; justify-content: center; margin-left: 0; }
  .jp-btn { margin-left: auto; }
  .row-summary { display: none; }
  .detail-title { font-size: 21px; }
}

/* ============ 文章附件（文档查阅区） ============ */
.doc-viewer {
  margin-top: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 18px;
}
.doc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.doc-label {
  background: var(--primary);
  color: #fffdf8;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 4px;
  font-weight: 600;
}
.doc-name { font-weight: 600; word-break: break-all; }
.doc-download {
  margin-left: auto;
  color: var(--primary);
  font-size: 13px;
  text-decoration: underline;
}
.doc-download:hover { color: var(--primary-dark); }

.doc-toolbar { display: flex; gap: 8px; margin-bottom: 10px; }
.doc-btn {
  background: var(--paper);
  border: 1px solid var(--border);
  color: var(--ink);
  border-radius: 6px;
  padding: 5px 14px;
  font-size: 13px;
  cursor: pointer;
}
.doc-btn:hover { background: var(--paper-deep); border-color: #d9c4a8; }

.doc-scroll {
  overflow: auto;
  max-height: 70vh;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f0eae0;
}
.doc-frame {
  display: block;
  width: 100%;
  height: 640px;
  border: none;
  transform-origin: top left;
  background: #fff;
}

.doc-docx {
  background: var(--card);
  min-height: 300px;
  width: 100%;
  transform-origin: top left;
}
.doc-loading { text-align: center; color: var(--muted); padding: 40px 0; font-size: 14px; }
.doc-docx-paper {
  background: #fffdf8;
  max-width: 720px;
  margin: 0 auto;
  padding: 36px 40px;
  line-height: 1.9;
}
.doc-docx-paper img { max-width: 100%; }

.doc-audio, .doc-video { width: 100%; margin-top: 8px; }
.doc-image-wrap { text-align: center; }
.doc-image { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); }

.doc-download-card {
  background: var(--paper);
  border: 1px dashed #d9c4a8;
  border-radius: 8px;
  padding: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.doc-download-card p { margin-bottom: 14px; }

/* ============ 文章搜索框 ============ */
.search-form { display: flex; align-items: center; margin-left: auto; margin-right: 12px; }
.search-form input {
  background: var(--card);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 6px 0 0 6px;
  padding: 6px 12px;
  font-size: 13px;
  width: 170px;
  color: var(--ink);
  outline: none;
}
.search-form input:focus { border-color: #d9c4a8; }
.search-form button {
  background: var(--primary);
  color: #fffdf8;
  border: 1px solid var(--primary);
  border-radius: 0 6px 6px 0;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
}
.search-form button:hover { background: var(--primary-dark); }
@media (max-width: 560px) {
  .search-form input { width: 110px; }
  .search-form { margin-right: 6px; }
}
