/* ===== 学科知识分享网站 · 全站样式 ===== */
:root {
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --card-bg: #ffffff;
  --accent: #1f2937;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  background: #ffffff;               /* 背景以白色为主 */
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }

/* ===== 首页 Hero ===== */
.hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 56px 20px 24px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 32px;
  align-items: center;
}

.hero-text { text-align: left; }

.site-title {
  font-family: "SimHei", "Heiti SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: clamp(42px, 6.5vw, 68px);
  font-weight: 900;
  color: #000000;                     /* 又大又黑的标题 */
  letter-spacing: 0.03em;
  line-height: 1.15;
}

.site-subtitle {
  margin-top: 18px;
  font-size: clamp(15px, 2.2vw, 19px);
  color: var(--muted);
}

.hero-art {
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-art img {
  width: 100%;
  max-width: 520px;
  height: auto;
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(17, 24, 39, .10);
}

/* ===== 学科卡片区 ===== */
.subjects {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 20px 72px;
}

.section-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  margin-bottom: 20px;
  letter-spacing: .08em;
}

.subjects-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(4, 1fr);
}

.subject-card {
  display: flex;
  flex-direction: column;
  min-height: 196px;
  padding: 18px 18px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card-bg);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  cursor: pointer;
}

.subject-card:hover,
.subject-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .10);
  border-color: var(--line);
  outline: none;
}

.subject-card .art {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 108px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 10px;
  background: #fafafa;
}

.subject-card .name {
  margin-top: 2px;
  font-family: "SimHei", "Heiti SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: #000;
}

.subject-card .desc {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.subject-card .enter {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--subject-color, #000);
}

/* ===== 通用容器 ===== */
.wrap {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== 学科分享页 ===== */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.topnav .back {
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.topnav .back:hover { color: var(--ink); }

.topnav .subject-tag {
  font-size: 15px;
  font-weight: 700;
  color: var(--subject-color, #000);
}

.page-head {
  padding: 28px 0 8px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.page-head .head-art {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
}

.page-head h1 {
  font-family: "SimHei", "Heiti SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  color: #000;
}

.page-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 15px;
}

/* ===== 分享表单 ===== */
.share-form {
  margin: 20px 0 8px;
  padding: 26px 24px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.share-form h2 {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 16px;
}

.share-form label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin: 12px 0 6px;
}

.share-form input,
.share-form textarea {
  width: 100%;
  padding: 11px 13px;
  font-size: 16px;                    /* 移动端输入不小于16px */
  font-family: inherit;
  color: var(--ink);
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: border-color .15s ease, background .15s ease;
}

.share-form input:focus,
.share-form textarea:focus {
  outline: none;
  border-color: var(--subject-color, var(--accent));
  background: #fff;
}

.share-form textarea { resize: vertical; min-height: 120px; }

.share-form .count {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  margin-top: 4px;
}

.share-form .submit {
  margin-top: 18px;
  padding: 12px 30px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: var(--subject-color, #000);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity .15s ease;
  min-height: 44px;
}

.share-form .submit:hover { opacity: .85; }
.share-form .submit:disabled { opacity: .5; cursor: not-allowed; }

.form-msg {
  margin-top: 12px;
  font-size: 14px;
  min-height: 20px;
}

.form-msg.ok { color: #2f7d46; }
.form-msg.err { color: #c0392b; }

/* ===== 分享列表 ===== */
.post-list { padding: 18px 0 72px; }

.post-list h2 {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 14px;
}

.post-card {
  padding: 20px 22px;
  margin-bottom: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.post-card .meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.post-card .title {
  font-size: 17px;
  font-weight: 700;
  color: #000;
}

.post-card .author {
  font-size: 13px;
  color: var(--muted);
}

.post-card .body {
  margin-top: 8px;
  font-size: 15px;
  color: #1f2937;
  white-space: pre-wrap;
  word-break: break-word;
}

.post-card .time {
  margin-top: 10px;
  font-size: 12px;
  color: #9ca3af;
}

/* ===== 点赞与评论 ===== */
.post-card .actions {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
}

.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s ease;
  min-height: 36px;
}

.like-btn:hover { border-color: #e07b7b; color: #c0392b; }

.like-btn.liked {
  color: #c0392b;
  border-color: #e07b7b;
  background: #fdf0f0;
}

.like-btn .heart {
  font-size: 15px;
  line-height: 1;
}

.comment-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 14px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  min-height: 36px;
  transition: color .15s ease;
}

.comment-toggle:hover { color: var(--ink); }

.post-card .comments {
  margin-top: 12px;
  display: none;
}

.post-card .comments.open { display: block; }

.comment-item {
  padding: 10px 14px;
  margin-bottom: 8px;
  background: #fafafa;
  border-radius: 8px;
  font-size: 14px;
}

.comment-item .c-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}

.comment-item .c-author { font-weight: 600; font-size: 13px; }
.comment-item .c-time { font-size: 11px; color: #9ca3af; }
.comment-item .c-body { margin-top: 4px; color: #1f2937; white-space: pre-wrap; word-break: break-word; }

.comment-form {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.comment-form input {
  flex: 1;
  padding: 10px 13px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.comment-form input:focus {
  outline: none;
  border-color: var(--subject-color, var(--accent));
}

.comment-form button {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: var(--subject-color, #000);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  min-height: 42px;
}

.comment-form button:hover { opacity: .85; }
.comment-form button:disabled { opacity: .5; cursor: not-allowed; }

.comment-msg { font-size: 12px; margin-top: 6px; }
.comment-msg.ok { color: #2f7d46; }
.comment-msg.err { color: #c0392b; }

.empty-tip {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 12px;
}

/* ===== 页脚 ===== */
.footer {
  margin-top: auto;
  padding: 26px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

/* ===== 响应式：先窄屏，桌面扩展 ===== */
@media (max-width: 1080px) {
  .subjects-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 24px;
    text-align: center;
  }
  .hero-text { text-align: center; }
  .hero-art img { max-width: 420px; }
}

@media (max-width: 720px) {
  .subjects-grid { grid-template-columns: repeat(2, 1fr); }
  .hero { padding: 40px 16px 20px; }
}

@media (max-width: 420px) {
  .subjects-grid { grid-template-columns: 1fr; }
  .subject-card { min-height: 150px; }
  .subject-card .art { max-height: 150px; }
  .comment-form { flex-direction: column; }
}
