/* 2512 班 — 主题变量 */
:root {
  /* 纸感底色（暖白，非纯白） */
  --paper: #f6f3ec;
  --paper-deep: #efeade;
  --ink: #26241f;          /* 近黑墨色 */
  --ink-soft: #55524a;
  --ink-faint: #8a8578;
  --accent: #a4342a;       /* 朱砂红 —— 印章/重点 */
  --accent-deep: #7d2620;
  --gold: #9a7b3f;         /* 旧金 —— 细节点缀 */
  --line: #d8d2c2;         /* 分隔线 */

  --serif: "Noto Serif SC", "Anthropic Serif", "Songti SC", serif;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --wenkai: "LXGW WenKai", "Noto Serif SC", serif;
  --anth-serif: "Anthropic Serif", "Noto Serif SC", serif;
  --anth-mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;

  --max-w: 980px;
  --pad: clamp(1.2rem, 4vw, 2.5rem);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  /* 纸张噪点纹理 */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.035 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--accent); }

::selection { background: rgba(164, 52, 42, 0.18); }

/* ---------- 版式骨架 ---------- */

.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header .wrap {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.06em;
}
.brand .num {
  font-family: var(--anth-serif);
  color: var(--accent);
}
.brand .space {
  font-size: 0.72em;
  color: var(--ink-faint);
  letter-spacing: 0.28em;
  margin-left: 0.3em;
}

.nav { display: flex; gap: 1.4rem; margin-left: auto; flex-wrap: wrap; align-items: center; }
.nav a {
  font-size: 0.92rem;
  color: var(--ink-soft);
  letter-spacing: 0.12em;
  transition: color 0.15s;
  position: relative;
}
.nav a:hover { color: var(--accent); }
.nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -0.55em;
  height: 2px;
  background: var(--accent);
}

/* 语言切换器：三格横排 */
.lang-switcher {
  display: flex;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  margin-left: 0.8rem;
}
.lang-switcher button {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  padding: 0.4em 0.7em;
  background: transparent;
  color: var(--ink-soft);
  border: none;
  border-right: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.18s;
}
.lang-switcher button:last-child { border-right: none; }
.lang-switcher button:hover { background: var(--paper-deep); color: var(--ink); }
.lang-switcher button.active {
  background: var(--accent);
  color: var(--paper);
}
.lang-switcher button.active:hover {
  background: var(--accent-deep, #7d2620);
  color: var(--paper);
}

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 4rem;
  padding: 1.8rem 0 2.5rem;
  color: var(--ink-faint);
  font-size: 0.85rem;
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ---------- 通用组件 ---------- */

.section { margin-top: 3.5rem; }

.sec-head { display: flex; align-items: baseline; gap: 0.9rem; margin-bottom: 1.3rem; }
.sec-head h2 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.08em;
}
.sec-head .en {
  font-family: var(--anth-serif);
  font-style: italic;
  color: var(--ink-faint);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}
.sec-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--line), transparent);
}

/* 朱砂印章式标签 */
.stamp {
  display: inline-block;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 0.78rem;
  color: #f6f3ec;
  background: var(--accent);
  padding: 0.15em 0.5em;
  letter-spacing: 0.2em;
  border-radius: 2px;
  transform: rotate(-1.5deg);
}

.btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.92rem;
  letter-spacing: 0.1em;
  padding: 0.55em 1.5em;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.18s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-deep, #7d2620); border-color: var(--accent-deep, #7d2620); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

input[type="text"], input[type="email"], textarea, select {
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--ink);
  background: #fffef9;
  border: 1px solid var(--line);
  padding: 0.6em 0.8em;
  width: 100%;
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--gold);
}
textarea { resize: vertical; min-height: 6.5em; }

.field { margin-bottom: 1rem; }
.field label {
  display: block;
  font-size: 0.82rem;
  letter-spacing: 0.15em;
  color: var(--ink-soft);
  margin-bottom: 0.35em;
}
.field .hint { font-size: 0.78rem; color: var(--ink-faint); }

.form-ok {
  display: none;
  margin-top: 0.8rem;
  padding: 0.7em 1em;
  border-left: 3px solid var(--accent);
  background: var(--paper-deep);
  font-size: 0.92rem;
}
.form-ok.show { display: block; }
.form-err { color: var(--accent); font-size: 0.85rem; margin-top: 0.6rem; display: none; }
.form-err.show { display: block; }

/* ---------- 首页 Hero ---------- */

.hero { padding: 4.5rem 0 3.5rem; position: relative; overflow: hidden; }

.hero h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2.4rem, 6.5vw, 4.2rem);
  line-height: 1.18;
  letter-spacing: 0.04em;
  max-width: 14em;
}
.hero h1 .yr {
  font-family: var(--anth-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
  font-size: 0.55em;
  display: block;
  letter-spacing: 0.02em;
  margin-top: 0.4em;
}
.hero p.sub {
  margin-top: 1.4rem;
  font-family: var(--wenkai);
  font-size: 1.08rem;
  color: var(--ink-soft);
  max-width: 34em;
}
.hero .cta { margin-top: 2rem; display: flex; gap: 1rem; flex-wrap: wrap; }

/* 装饰：背景超大 2512 数字 */
.hero .bg-num {
  position: absolute;
  right: -0.06em;
  bottom: -0.32em;
  font-family: var(--anth-serif);
  font-style: italic;
  font-size: clamp(11rem, 26vw, 19rem);
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px var(--line);
  user-select: none;
  pointer-events: none;
  z-index: -1;
}

/* ---------- 时间线 ---------- */

.tl { position: relative; padding-left: 2.2rem; }
.tl::before {
  content: "";
  position: absolute;
  left: 0.45rem; top: 0.4rem; bottom: 0.4rem;
  width: 1px;
  background: var(--line);
}
.tl-item { position: relative; padding-bottom: 2.2rem; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: "";
  position: absolute;
  left: calc(-2.2rem + 0.09rem); top: 0.5rem;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--accent);
}
.tl-date {
  font-family: var(--anth-serif);
  font-style: italic;
  font-size: 0.88rem;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.tl-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.12rem;
  margin: 0.15em 0 0.3em;
}
.tl-body { color: var(--ink-soft); font-size: 0.96rem; max-width: 42em; }

/* ---------- 加载占位（灰块） ---------- */
/* skel-core 开始 —— 这一段 main.css 和 forum/assets/forum.css 各有一份，必须一字不差（npm test 查） */
.skel { display: block; }
.skel-line {
  display: block;
  height: var(--h, 0.9em);
  width: var(--w, 100%);
  max-width: 100%;
  border-radius: 3px;
  /* 比纸色深一档（约 --line 和 --paper 各半），浅了在纸色背景上几乎看不见 */
  background: linear-gradient(90deg, #e5e1d5 0%, #efebe1 45%, #e5e1d5 90%);
  background-size: 220% 100%;
  animation: skel-shine 1.4s ease-in-out infinite;
}
@keyframes skel-shine {
  from { background-position: 120% 0; }
  to { background-position: -120% 0; }
}
/* 「加载中」字样只给读屏软件，眼睛看灰块 */
.skel-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
@media (prefers-reduced-motion: reduce) {
  .skel-line { animation: none; background: #e5e1d5; }
}
/* skel-core 结束 */

/* 时间线：竖线由外层 .tl 画，这里补上圆点 */
.skel-tl-item { position: relative; padding-bottom: 2.2rem; }
.skel-tl-item:last-child { padding-bottom: 0; }
.skel-tl-item::before {
  content: "";
  position: absolute;
  left: calc(-2.2rem + 0.09rem); top: 0.35rem;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--paper-deep);
}
.skel-tl-item .skel-line + .skel-line { margin-top: 0.55rem; }
.skel-tl-item .skel-line:nth-child(1) { --w: 6em; --h: 0.85em; }
.skel-tl-item .skel-line:nth-child(2) { --w: 13em; --h: 1.15em; }
.skel-tl-item .skel-line:nth-child(3) { --w: 26em; }
.skel-tl-item:nth-child(2) .skel-line:nth-child(2) { --w: 10em; }
.skel-tl-item:nth-child(3) .skel-line:nth-child(3) { --w: 19em; }

/* 同学名单：字母 + 一格格名字 */
.skel-group { margin-bottom: 3.2rem; }
.skel-group .skel-letter { --w: 2.6rem; --h: clamp(3.2rem, 8vw, 5.5rem); margin-bottom: 0.5rem; opacity: 0.7; }
.skel-names {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(5.5rem, 15vw, 7.5rem), 1fr));
  gap: clamp(1.2rem, 3vw, 2rem);
}
.skel-names .skel-line { --w: 4.6em; --h: 1.3em; margin: 0.6em auto; }

/* 留言墙：几张卡片 */
.skel-msg {
  background: #fffef9;
  border: 1px solid var(--line);
  padding: 1rem 1.2rem 0.85rem;
}
.skel-msg + .skel-msg { margin-top: 0.9rem; }
.skel-msg .skel-line:nth-child(1) { --w: 5em; --h: 0.8em; margin-bottom: 0.7rem; }
.skel-msg .skel-line:nth-child(2) { --w: 85%; }
.skel-msg:nth-child(2) .skel-line:nth-child(2) { --w: 60%; }

/* ---------- 照片墙 ---------- */

.photos-wrapper { position: relative; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1.1rem; }
.ph {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
  font-size: 0.82rem;
  overflow: hidden;
  cursor: pointer;
}
/* 卡片本身的悬停（上浮 + 阴影）在 fx.css，只有那一份 */
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.4s ease; }
.ph:hover img { transform: scale(1.05); }
.ph .cap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 1.4em 0.8em 0.5em;
  background: linear-gradient(transparent, rgba(20, 18, 14, 0.65));
  color: #f4f1e8;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
}

/* 折叠状态：只显示前几张 */
.photos-collapsed .ph:nth-child(n+6) { display: none; }
@media (max-width: 767px) {
  .photos-collapsed .ph:nth-child(n+4) { display: none; }
}

/* 占位符样式（未加载的图片） */
.ph-placeholder {
  background: var(--paper-deep);
}
.ph-placeholder::after {
  content: "";
  width: 2rem;
  height: 2rem;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ph-spin 0.8s linear infinite;
}
@keyframes ph-spin {
  to { transform: rotate(360deg); }
}

/* 展开按钮 */
.photos-expand-btn {
  display: block;
  margin: 1.2rem auto 0;
  padding: 0.6em 1.8em;
  font-family: var(--wenkai);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s ease;
}
.photos-expand-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(164, 52, 42, 0.04);
}
.photos-expand-btn .count {
  font-family: var(--anth-serif);
  font-style: italic;
  font-weight: 700;
  color: var(--accent);
}

/* ---------- 相册分区 ---------- */

.album-section { margin-bottom: 3.5rem; }
.album-section:last-child { margin-bottom: 0; }

.album-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 0.1em;
  margin-bottom: 1.2rem;
  padding-left: 0.8em;
  border-left: 3px solid var(--accent);
}

.sub-album { margin-bottom: 2.5rem; margin-left: 1rem; }
.sub-album:last-child { margin-bottom: 0; }

.sub-album-title {
  font-family: var(--wenkai);
  font-weight: 500;
  font-size: 1.05rem;
  color: var(--ink-soft);
  letter-spacing: 0.08em;
  margin-bottom: 0.9rem;
}

/* ---------- Lightbox（图片查看器） ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s cubic-bezier(0.25, 0.6, 0.3, 1),
              visibility 0.35s;
}
.lightbox.open {
  opacity: 1;
  visibility: visible;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 18, 14, 0.92);
  backdrop-filter: blur(12px);
}

.lightbox-content {
  position: relative;
  max-width: 92vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-img-wrap {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
}

.lightbox-img-wrap img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  display: block;
  border-radius: 2px;
  box-shadow: 0 12px 48px -12px rgba(0, 0, 0, 0.5);
  transition: opacity 0.28s ease, transform 0.35s cubic-bezier(0.25, 0.6, 0.3, 1);
}

.lightbox-img-wrap img.transitioning {
  opacity: 0;
  transform: scale(0.96);
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: none;
  border: none;
  color: rgba(246, 243, 236, 0.8);
  cursor: pointer;
  transition: color 0.2s, transform 0.2s;
  z-index: 10;
}
.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  color: #f6f3ec;
}

.lightbox-close {
  top: -3rem;
  right: 0;
  font-size: 2.5rem;
  font-weight: 300;
  line-height: 1;
}
.lightbox-close:hover { transform: rotate(90deg); }

.lightbox-prev,
.lightbox-next {
  top: 50%;
  transform: translateY(-50%);
  font-size: 3.5rem;
  font-weight: 300;
  line-height: 1;
  padding: 0.5rem;
}
.lightbox-prev { left: -4rem; }
.lightbox-next { right: -4rem; }
.lightbox-prev:hover { transform: translateY(-50%) translateX(-4px); }
.lightbox-next:hover { transform: translateY(-50%) translateX(4px); }

.lightbox-counter {
  position: absolute;
  bottom: -2.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--anth-serif);
  font-style: italic;
  font-size: 0.9rem;
  color: rgba(246, 243, 236, 0.7);
  letter-spacing: 0.15em;
}

@media (max-width: 768px) {
  .lightbox-prev { left: 0.5rem; font-size: 2.5rem; }
  .lightbox-next { right: 0.5rem; font-size: 2.5rem; }
  .lightbox-close { top: 0.5rem; right: 0.5rem; font-size: 2rem; }
  .lightbox-counter { bottom: 1rem; }
}

/* ---------- 留言墙 ---------- */

.msgs { display: grid; gap: 0.9rem; }
.msg {
  background: #fffef9;
  border: 1px solid var(--line);
  padding: 1rem 1.2rem 0.85rem;
  position: relative;
}
.msg .meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--ink-faint);
  margin-bottom: 0.4em;
}
.msg .meta .who {
  font-family: var(--wenkai);
  color: var(--ink-soft);
  font-size: 0.92rem;
}
.msg .body { font-size: 0.95rem; white-space: pre-wrap; word-break: break-word; }

/* ---------- 同学名单（按字母分组） ---------- */

.letter-group {
  margin-bottom: 3.2rem;
  opacity: 0;
  animation: letter-group-in 0.7s cubic-bezier(0.22, 0.68, 0.26, 1) forwards;
  animation-delay: calc(var(--group-i, 0) * 0.06s);
}

.letter-group .letter {
  font-family: var(--anth-serif);
  font-style: italic;
  font-size: clamp(3.2rem, 8vw, 5.5rem);
  line-height: 1;
  letter-spacing: -0.02em;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--line);
  margin-bottom: 0.5rem;
  user-select: none;
}

.letter-group .names {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(5.5rem, 15vw, 7.5rem), 1fr));
  gap: clamp(1.2rem, 3vw, 2rem);
}

.letter-group .name {
  font-family: "LXGW WenKai", var(--serif);
  font-size: clamp(1.05rem, 2.5vw, 1.3rem);
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--ink);
  text-align: center;
  padding: 0.6em 0.3em;
  position: relative;
  display: block;
  transition: all 0.32s cubic-bezier(0.25, 0.6, 0.3, 1);
  text-decoration: none;
  cursor: pointer;
}

.letter-group .name::before {
  content: "";
  position: absolute;
  left: 50%; bottom: 0.2em;
  width: 0; height: 1.5px;
  background: var(--accent);
  transform: translateX(-50%);
  transition: width 0.32s cubic-bezier(0.25, 0.6, 0.3, 1);
}

.letter-group .name:hover {
  color: var(--accent);
  transform: translateY(-2px);
}

.letter-group .name:hover::before {
  width: 2.2em;
}

.letter-group .name .status-badge {
  display: block;
  font-size: 0.65em;
  color: var(--ink-faint);
  font-weight: 400;
  letter-spacing: 0.08em;
  margin-top: 0.3em;
}

@keyframes letter-group-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 移动端 ---------- */

@media (max-width: 640px) {
  .hero { padding: 4rem 0 3.2rem; }
  .nav { margin-left: 0; gap: 0.9rem; width: 100%; }
  .section { margin-top: 3.2rem; }
  /* 语言切换器在手机上独占一行、靠右，不挤占导航 */
  .lang-switcher {
    margin-left: auto;
    margin-top: 0.35rem;
  }
  .lang-switcher button {
    padding: 0.45em 0.85em;
    font-size: 0.8rem;
  }
}
