/* ================================================================
   CNZX-202208 · 同学录
   一本被翻旧的班级相册：牛皮纸、装订孔、胶带、铅笔字。
   ================================================================ */

:root {
  /* 纸与墨 */
  --paper: #eae4d6;
  --paper-2: #ded6c3;
  --paper-3: #f5f1e6;
  --ink: #23262a;
  --ink-2: #5c5a52;
  --ink-3: #8b867a;

  /* 钢笔墨蓝：全站的主色，来自同学录上的圆珠笔 */
  --blue: #2a4a63;
  --blue-soft: #3f6480;

  /* 印章红：只在“做记号”的地方出现 */
  --seal: #a83a2c;

  --kraft: #c9b892;
  --board: #2c3b33;

  --rule: rgba(35, 38, 42, 0.14);
  --hole: rgba(35, 38, 42, 0.26);

  --f-display: "Kaiti SC", "KaiTi", "STKaiti", "楷体", "Noto Serif SC", serif;
  --f-body: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --f-mono: ui-monospace, "SFMono-Regular", Consolas, "Courier New", monospace;

  --shadow-photo: 0 1px 1px rgba(35, 38, 42, 0.1), 0 12px 22px -16px rgba(35, 38, 42, 0.75);

  --spine: 68px;
  --maxw: 1160px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--paper);
  background-image: radial-gradient(rgba(35, 38, 42, 0.055) 1px, transparent 1px);
  background-size: 20px 20px;
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--blue);
  text-decoration: none;
  text-underline-offset: 0.25em;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

.mono {
  font-family: var(--f-mono);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ---------- 书脊：贯穿全站的装订孔 ---------- */

.page {
  position: relative;
  overflow-x: clip;
}

.page::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: max(0px, calc((100% - var(--maxw)) / 2));
  width: var(--spine);
  border-right: 1px solid var(--rule);
  background-image: radial-gradient(
    circle at 50% 32px,
    var(--hole) 0 5px,
    rgba(255, 255, 255, 0.55) 5px 6px,
    transparent 6px
  );
  background-size: 100% 64px;
  background-repeat: repeat-y;
  opacity: 0.85;
  pointer-events: none;
}

/* ---------- 页眉 ---------- */

.masthead {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px 28px 18px calc(var(--spine) + 28px);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--rule);
}

.masthead__brand {
  font-family: var(--f-display);
  font-size: 1.18rem;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.masthead__brand:hover {
  text-decoration: none;
  color: var(--blue);
}

.masthead__nav {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}

.masthead__nav a {
  font-size: 0.86rem;
  color: var(--ink-2);
  letter-spacing: 0.04em;
}

.masthead__nav a:hover,
.masthead__nav a[aria-current="page"] {
  color: var(--blue);
  text-decoration: none;
  box-shadow: inset 0 -1px 0 var(--blue);
}

/* ---------- 首页：同学录封面 ---------- */

.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 64px 28px 40px calc(var(--spine) + 28px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 56px;
  align-items: center;
}

.hero__kicker {
  display: inline-block;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  color: var(--seal);
  border: 1px solid currentColor;
  border-radius: 2px;
  padding: 3px 10px;
  transform: rotate(-1.2deg);
}

.hero__title {
  font-family: var(--f-display);
  font-size: clamp(2.1rem, 4.4vw, 3.35rem);
  line-height: 1.22;
  letter-spacing: 0.02em;
  margin: 22px 0 0;
  font-weight: 400;
  text-wrap: balance;
}

.hero__title em {
  font-style: normal;
  color: var(--blue);
}

.hero__lede {
  margin: 20px 0 0;
  max-width: 30em;
  color: var(--ink-2);
  font-size: 1.02rem;
}

.hero__stats {
  display: flex;
  gap: 30px;
  margin: 30px 0 0;
  padding: 0;
  list-style: none;
  flex-wrap: wrap;
}

.hero__stats div {
  font-family: var(--f-mono);
  font-size: 1.5rem;
  color: var(--ink);
  line-height: 1.1;
}

.hero__stats span {
  display: block;
  font-family: var(--f-body);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  margin-top: 6px;
}

/* 封面本：一张牛皮纸卡 + 胶带标签 */
.cover {
  position: relative;
  aspect-ratio: 4 / 4.6;
  background: linear-gradient(160deg, #d3c3a0, var(--kraft));
  border-radius: 3px;
  box-shadow: 0 26px 50px -30px rgba(35, 38, 42, 0.9), 0 2px 0 rgba(255, 255, 255, 0.35) inset;
  transform: rotate(1.4deg);
  padding: 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.cover::after {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(35, 38, 42, 0.22);
  border-radius: 2px;
  pointer-events: none;
}

.cover__label {
  position: relative;
  margin: 24% 0 auto;
  background: var(--paper-3);
  padding: 22px 20px 26px;
  transform: rotate(-2.2deg);
  box-shadow: 0 6px 14px -10px rgba(35, 38, 42, 0.8);
}

.cover__label::before {
  content: "";
  position: absolute;
  top: -11px;
  left: 50%;
  width: 92px;
  height: 22px;
  transform: translateX(-50%) rotate(-3deg);
  background: repeating-linear-gradient(
    90deg,
    rgba(222, 206, 168, 0.72) 0 6px,
    rgba(210, 193, 155, 0.72) 6px 12px
  );
}

.cover__label b {
  display: block;
  font-family: var(--f-display);
  font-size: clamp(1.25rem, 3vw, 1.7rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1.35;
}

.cover__label small {
  display: block;
  margin-top: 10px;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--ink-3);
}

.cover__foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: rgba(35, 38, 42, 0.55);
  padding: 0 4px 4px;
}

/* ---------- 通用区块 ---------- */

.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 44px 28px 20px calc(var(--spine) + 28px);
}

.section + .section {
  padding-top: 52px;
}

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 12px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.section__title {
  font-family: var(--f-display);
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-weight: 400;
  letter-spacing: 0.05em;
  margin: 0;
}

.section__note {
  font-size: 0.84rem;
  color: var(--ink-3);
  margin: 0;
}

/* ---------- 相册封面墙 ---------- */

.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 34px 30px;
  padding: 4px 0 12px;
}

.album {
  position: relative;
  display: block;
  color: inherit;
  padding-top: 26px;
}

.album:hover {
  text-decoration: none;
}

.album__cover {
  position: relative;
  aspect-ratio: 5 / 4;
  background: var(--paper-2);
  border: 1px solid rgba(35, 38, 42, 0.12);
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6), 0 14px 26px -20px rgba(35, 38, 42, 0.9);
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.3, 1), box-shadow 0.35s ease;
}

.album__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.92) contrast(1.02);
}

.album__no {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--paper-3);
  border-radius: 50%;
  border: 1px solid var(--seal);
  color: var(--seal);
  font-family: var(--f-mono);
  font-size: 0.86rem;
  box-shadow: 0 2px 6px -3px rgba(35, 38, 42, 0.8);
}

.album__tape {
  position: absolute;
  top: 16px;
  right: 22px;
  width: 76px;
  height: 20px;
  transform: rotate(4deg);
  background: repeating-linear-gradient(
    90deg,
    rgba(222, 206, 168, 0.76) 0 7px,
    rgba(206, 189, 151, 0.76) 7px 14px
  );
  z-index: 2;
  pointer-events: none;
}

.album__body {
  padding: 14px 2px 0;
}

.album__title {
  font-family: var(--f-display);
  font-size: 1.24rem;
  letter-spacing: 0.05em;
  margin: 0;
  font-weight: 400;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.album__count {
  font-family: var(--f-mono);
  font-size: 0.74rem;
  color: var(--ink-3);
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.album__meta {
  margin: 4px 0 0;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--ink-3);
}

.album:hover .album__cover {
  transform: translateY(-6px) rotate(-0.6deg);
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.6), 0 26px 40px -26px rgba(35, 38, 42, 0.95);
}

.album:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 6px;
  border-radius: 2px;
}

/* ---------- 相册内页：拍立得照片墙 ---------- */

.album-head {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 46px 28px 8px calc(var(--spine) + 28px);
}

.album-head__no {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  color: var(--seal);
}

.album-head__title {
  font-family: var(--f-display);
  font-size: clamp(2rem, 5vw, 3.1rem);
  font-weight: 400;
  letter-spacing: 0.04em;
  margin: 10px 0 0;
  line-height: 1.2;
}

.album-head__meta {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
  margin: 16px 0 0;
  font-family: var(--f-mono);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  color: var(--ink-3);
}

.album-head__back {
  display: inline-block;
  margin-top: 22px;
  font-size: 0.86rem;
  color: var(--ink-2);
}

.sheet {
  columns: 4;
  column-gap: 24px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 34px 28px 20px calc(var(--spine) + 28px);
}

.photo {
  break-inside: avoid;
  margin: 0 0 24px;
  background: var(--paper-3);
  padding: 9px 9px 0;
  box-shadow: var(--shadow-photo);
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.3, 1), box-shadow 0.3s ease;
  cursor: zoom-in;
  border: 0;
  width: 100%;
  display: block;
  text-align: left;
  font: inherit;
  color: inherit;
  position: relative;
}

.photo::after {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  width: 62px;
  height: 16px;
  transform: translateX(-50%) rotate(-2deg);
  background: repeating-linear-gradient(
    90deg,
    rgba(226, 211, 175, 0.62) 0 6px,
    rgba(210, 194, 156, 0.62) 6px 12px
  );
  opacity: 0;
  transition: opacity 0.25s ease;
}

.photo__frame {
  position: relative;
  display: block;
  background: var(--paper-2);
  overflow: hidden;
}

.photo__frame img {
  width: 100%;
  height: auto;
  display: block;
}

.photo__cap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 3px 9px;
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.09em;
  color: var(--ink-3);
  min-height: 30px;
}

.photo:hover,
.photo:focus-visible {
  transform: rotate(0deg) translateY(-3px) scale(1.012);
  box-shadow: 0 2px 2px rgba(35, 38, 42, 0.1), 0 20px 32px -20px rgba(35, 38, 42, 0.85);
  z-index: 2;
}

.photo:hover::after,
.photo:focus-visible::after {
  opacity: 1;
}

.photo:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 4px;
}

/* ---------- 按钮 ---------- */

.btn {
  display: inline-block;
  margin-top: 26px;
  padding: 11px 24px;
  background: var(--blue);
  color: var(--paper-3);
  border-radius: 2px;
  font-size: 0.92rem;
  letter-spacing: 0.1em;
  box-shadow: 0 12px 22px -16px rgba(35, 38, 42, 0.95);
  transition: background 0.2s ease, transform 0.2s ease;
}

.btn:hover {
  background: #223d52;
  text-decoration: none;
  transform: translateY(-1px);
}

.btn:focus-visible {
  outline: 2px solid var(--seal);
  outline-offset: 3px;
}

/* ---------- 首页：最近拍的 ---------- */

.recent {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
}

.photo--mini {
  margin: 0;
  --tilt: 0deg;
}

.photo--mini .photo__cap {
  font-size: 0.6rem;
  min-height: 24px;
  padding: 6px 2px 7px;
}

.album-head__meta b {
  font-weight: 400;
  color: var(--ink);
}

/* ---------- 灯箱 ---------- */

.lightbox {
  border: 0;
  padding: 0;
  margin: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  background: transparent;
  color: var(--paper-3);
  overflow: hidden;
}

.lightbox::backdrop {
  background: rgba(18, 21, 20, 0.97);
}

.lightbox__stage {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  align-items: center;
  gap: 8px;
  width: 100vw;
  height: 100vh;
  padding: 26px 10px 12px;
}

.lightbox__figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.lightbox__figure img {
  max-width: 100%;
  max-height: calc(100vh - 120px);
  width: auto;
  object-fit: contain;
  background: #1a1d1c;
}

.lightbox__bar {
  display: flex;
  gap: 20px;
  align-items: center;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: rgba(245, 241, 230, 0.62);
}

.lightbox__close {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 3;
}

.lightbox__nav {
  background: transparent;
  border: 1px solid rgba(245, 241, 230, 0.28);
  color: rgba(245, 241, 230, 0.8);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.lightbox__nav:hover,
.lightbox__close:hover {
  background: rgba(245, 241, 230, 0.12);
  border-color: rgba(245, 241, 230, 0.6);
}

.lightbox__nav:focus-visible,
.lightbox__close:focus-visible {
  outline: 2px solid var(--paper-3);
  outline-offset: 3px;
}

/* ---------- 同学名录 ---------- */

.roster {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 2px 22px;
  font-family: var(--f-display);
  font-size: 1.02rem;
}

.roster li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dotted rgba(35, 38, 42, 0.16);
}

.roster b {
  font-family: var(--f-mono);
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  min-width: 1.8em;
}

.roster a {
  color: var(--ink);
}

.roster a:hover {
  color: var(--blue);
}

/* ---------- 页脚 ---------- */

.foot {
  margin-top: 64px;
  background: var(--board);
  color: #d8d3c4;
}

.foot__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 46px 28px 42px calc(var(--spine) + 28px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 30px;
  align-items: end;
}

.foot__title {
  font-family: var(--f-display);
  font-size: 1.5rem;
  margin: 0 0 10px;
  font-weight: 400;
  color: #efece1;
}

.foot__line {
  margin: 2px 0;
  font-size: 0.88rem;
  color: rgba(216, 211, 196, 0.76);
  overflow-wrap: anywhere;
}

.foot a {
  color: #cfd9d1;
}

.foot .mono {
  color: rgba(216, 211, 196, 0.5);
}

/* ---------- 状态 ---------- */

.state {
  padding: 60px 0;
  color: var(--ink-3);
  font-size: 0.94rem;
}

.state a {
  color: var(--blue);
}

/* ---------- 入场：极轻的一次翻页 ---------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
}

.reveal.is-in {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.3, 1);
}

/* ---------- 断点 ---------- */

@media (max-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
    padding-top: 44px;
  }

  .cover {
    max-width: 380px;
    aspect-ratio: 4 / 4.4;
  }

  .sheet {
    columns: 2;
    column-gap: 18px;
  }

  .recent {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .foot__inner {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  :root {
    --spine: 26px;
  }

  .page::before {
    background-size: 100% 52px;
    background-image: radial-gradient(
      circle at 50% 26px,
      var(--hole) 0 4px,
      rgba(255, 255, 255, 0.55) 4px 5px,
      transparent 5px
    );
  }

  .masthead,
  .hero,
  .section,
  .album-head,
  .sheet,
  .foot__inner {
    padding-left: calc(var(--spine) + 16px);
    padding-right: 16px;
  }

  .masthead {
    padding-top: 16px;
    padding-bottom: 14px;
  }

  .masthead__nav {
    gap: 16px;
  }

  .hero {
    padding-top: 34px;
  }

  .hero__stats {
    gap: 22px;
  }

  .shelf {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 22px 16px;
  }

  .album__title {
    font-size: 1rem;
  }

  .album-head__title {
    font-size: clamp(1.6rem, 7vw, 2.2rem);
  }

  .album-head__meta {
    gap: 6px 18px;
    margin-top: 12px;
    font-size: 0.68rem;
  }

  .album-head__back {
    margin-top: 16px;
  }

  .sheet {
    columns: 2;
    column-gap: 12px;
    padding-top: 26px;
  }

  .recent {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .photo {
    margin-bottom: 14px;
    padding: 6px 6px 0;
  }

  .photo--mini {
    margin-bottom: 0;
  }

  .photo__cap,
  .photo--mini .photo__cap {
    font-size: 0.58rem;
    min-height: 22px;
    padding: 5px 2px 6px;
  }

  .lightbox__stage {
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    padding: 40px 4px 10px;
  }

  .lightbox__nav {
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
  }
}

/* ---------- 无障碍 ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  .photo,
  .album__cover {
    transform: none !important;
  }
}

@media print {
  .masthead,
  .foot,
  .lightbox {
    display: none;
  }

  .sheet {
    columns: 3;
  }
}
