/* ============================================
   晋城七中 · 四十一班 纪念网站
   ============================================ */

:root {
  --color-bg: #fbfaf7;
  --color-bg-soft: #f1eee8;
  --color-ink: #211f1b;
  --color-ink-soft: #625b51;
  --color-muted: #91887b;
  --color-line: rgba(54, 47, 38, 0.13);
  --color-accent: #a55f24;
  --color-accent-dark: #7a4217;
  --color-white: #ffffff;
  --shadow-soft: 0 18px 55px rgba(42, 35, 25, 0.12);
  --shadow-hover: 0 26px 70px rgba(42, 35, 25, 0.2);
  --font-serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --max-width: 1180px;
  --nav-height: 68px;
  --radius: 8px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-width: 320px;
  font-family: var(--font-sans);
  color: var(--color-ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0) 360px),
    var(--color-bg);
  line-height: 1.65;
}

img {
  max-width: 100%;
  display: block;
}

a,
button {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 14px;
  left: 50%;
  z-index: 100;
  width: min(calc(100% - 32px), 980px);
  min-height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 12px 10px 18px;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(28, 24, 19, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transform: translateX(-50%);
}

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

.nav-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}

.nav-brand span {
  font-family: var(--font-serif);
  font-size: 15px;
}

.nav-brand strong {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.62);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.03em;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--color-white);
  background: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
  outline: none;
}

/* --- Hero --- */
.hero {
  position: relative;
  scroll-margin-top: 0;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 120px 24px 88px;
  overflow: hidden;
  color: var(--color-white);
  text-align: center;
  background: #17120e;
}

.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: saturate(0.88) contrast(1.04);
  transform: scale(1.02);
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero::before {
  z-index: 1;
  background:
    radial-gradient(circle at 50% 42%, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.56) 74%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0.16) 38%, rgba(0, 0, 0, 0.72));
}

.hero::after {
  z-index: 2;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0) 26%, rgba(0, 0, 0, 0) 74%, rgba(0, 0, 0, 0.42)),
    linear-gradient(180deg, transparent 78%, var(--color-bg));
}

.hero-content {
  position: relative;
  z-index: 3;
  width: min(760px, 100%);
  padding-top: 28px;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(58px, 9vw, 118px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: 0.09em;
  text-shadow: 0 12px 45px rgba(0, 0, 0, 0.42);
  animation: fadeInUp 0.9s ease-out both;
}

.hero-subtitle {
  margin-top: 22px;
  color: rgba(255, 255, 255, 0.78);
  font-size: clamp(15px, 2.1vw, 21px);
  font-weight: 500;
  letter-spacing: 0.28em;
  animation: fadeInUp 0.9s ease-out 0.12s both;
}

.hero-motto {
  margin-top: 18px;
  font-family: var(--font-serif);
  color: rgba(255, 255, 255, 0.64);
  font-size: clamp(15px, 1.7vw, 18px);
  letter-spacing: 0.18em;
  animation: fadeInUp 0.9s ease-out 0.22s both;
}

.hero-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  margin-top: 38px;
  padding: 0 24px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  color: var(--color-white);
  background: rgba(255, 255, 255, 0.1);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-decoration: none;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  animation: fadeInUp 0.9s ease-out 0.34s both;
}

.hero-action:hover,
.hero-action:focus-visible {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.78);
  outline: none;
  transform: translateY(-2px);
}

.hero-scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 34px;
  z-index: 3;
  width: 1px;
  height: 56px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.2);
  transform: translateX(-50%);
}

.hero-scroll-hint::after {
  content: "";
  position: absolute;
  left: 0;
  top: -60%;
  width: 100%;
  height: 60%;
  background: rgba(255, 255, 255, 0.72);
  animation: scrollLine 2s ease-in-out infinite;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scrollLine {
  to {
    top: 100%;
  }
}

/* --- Sections --- */
.section {
  scroll-margin-top: 108px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 112px 24px;
}

.section-alt {
  position: relative;
  max-width: none;
  background:
    linear-gradient(180deg, rgba(251, 250, 247, 0), rgba(241, 238, 232, 0.86) 12%, rgba(241, 238, 232, 0.86) 88%, rgba(251, 250, 247, 0));
  padding-left: max(24px, calc((100% - var(--max-width)) / 2 + 24px));
  padding-right: max(24px, calc((100% - var(--max-width)) / 2 + 24px));
}

.section-heading {
  width: min(720px, 100%);
  margin: 0 auto 62px;
  text-align: center;
}

.section-title {
  font-family: var(--font-serif);
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: 0.08em;
}

.section-subtitle {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
  color: var(--color-muted);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.22em;
}

.section-subtitle::before,
.section-subtitle::after {
  content: "";
  width: 34px;
  height: 1px;
  background: var(--color-line);
}

/* --- Photo Groups --- */
.photo-group {
  margin-bottom: 76px;
}

.photo-group:last-child {
  margin-bottom: 0;
}

.photo-group-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  font-family: var(--font-serif);
  color: var(--color-accent-dark);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.photo-group-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--color-line), transparent);
}

/* --- Photo Grid --- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
}

.photo-grid img {
  width: 100%;
  height: 260px;
  grid-column: span 4;
  object-fit: cover;
  border: 8px solid var(--color-white);
  border-radius: var(--radius);
  background: #e5e0d7;
  box-shadow: var(--shadow-soft);
  cursor: zoom-in;
  transition: transform 0.24s ease, box-shadow 0.24s ease, filter 0.24s ease;
}

.photo-grid img:nth-child(7n + 1),
.photo-grid img:nth-child(7n + 5) {
  grid-column: span 6;
  height: 340px;
}

.photo-grid img:nth-child(7n + 3) {
  height: 340px;
}

.photo-grid img:hover,
.photo-grid img:focus-visible {
  filter: saturate(1.04) contrast(1.02);
  box-shadow: var(--shadow-hover);
  outline: none;
  transform: translateY(-5px);
}

.lazy {
  opacity: 0;
}

.lazy.loaded,
.photo-grid img:not(.lazy),
.classmate-photo:not(.lazy) {
  opacity: 1;
}

/* --- Placeholder --- */
.placeholder-text {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px dashed rgba(122, 66, 23, 0.28);
  border-radius: var(--radius);
  color: var(--color-muted);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.34)),
    rgba(255, 255, 255, 0.42);
  font-size: 16px;
  letter-spacing: 0.08em;
}

/* --- Classmate Cards --- */
.classmate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
  gap: 34px 28px;
  justify-items: center;
}

.classmate-card {
  width: 100%;
  max-width: 220px;
  padding: 18px 16px 16px;
  text-align: center;
  border: 1px solid rgba(54, 47, 38, 0.09);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.56);
  box-shadow: 0 14px 44px rgba(42, 35, 25, 0.08);
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}

.classmate-card:hover,
.classmate-card:focus-within {
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-soft);
  transform: translateY(-5px);
}

.classmate-photo {
  width: 150px;
  height: 150px;
  object-fit: cover;
  margin: 0 auto 15px;
  border: 7px solid var(--color-white);
  border-radius: 999px;
  background: #e5e0d7;
  box-shadow: 0 12px 30px rgba(42, 35, 25, 0.14);
  cursor: pointer;
  transition: transform 0.24s ease;
}

.classmate-card:hover .classmate-photo {
  transform: scale(1.03);
}

.classmate-name {
  font-family: var(--font-serif);
  color: var(--color-ink);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.classmate-name::after {
  content: "查看相册";
  display: block;
  margin-top: 4px;
  font-family: var(--font-sans);
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

/* --- Footer --- */
.footer {
  position: relative;
  padding: 58px 24px 54px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.82);
  text-align: center;
  background:
    linear-gradient(135deg, rgba(165, 95, 36, 0.16), rgba(165, 95, 36, 0)),
    #211f1b;
}

.footer p {
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.18em;
}

.footer-note {
  color: rgba(255, 255, 255, 0.46);
  font-family: var(--font-serif);
  font-size: 13px !important;
  font-weight: 400 !important;
}

/* --- Lightbox --- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 28px;
  background: rgba(18, 15, 12, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.lightbox.active {
  display: flex;
}

#lightbox-img {
  max-width: min(92vw, 1180px);
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.76);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.lightbox-close {
  position: absolute;
  top: 22px;
  right: 24px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  font-size: 28px;
  line-height: 1;
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  transform: translateY(-50%);
}

/* Inline SVG arrows for perfect centering */
.lightbox-prev::after {
  content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M10.5 3L5.5 8l5 5' stroke='rgba(255,255,255,0.76)' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  display: flex;
  margin-left: 2px;
}

.lightbox-next::after {
  content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M5.5 3l5 5-5 5' stroke='rgba(255,255,255,0.76)' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  display: flex;
  margin-right: 2px;
}

.lightbox-prev {
  left: 24px;
}

.lightbox-next {
  right: 24px;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover,
.lightbox-close:focus-visible,
.lightbox-prev:focus-visible,
.lightbox-next:focus-visible {
  color: var(--color-white);
  background: rgba(255, 255, 255, 0.15);
  outline: none;
}

.lightbox-prev:hover::after,
.lightbox-next:hover::after {
  filter: brightness(1.4);
}

.lightbox-prev:hover,
.lightbox-next:hover {
  transform: translateY(-50%) scale(1.04);
}

#lightbox-caption {
  margin-top: 18px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 14px;
  letter-spacing: 0.1em;
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .nav {
    width: min(calc(100% - 24px), 760px);
    top: 10px;
    padding-left: 14px;
  }

  .nav-links a {
    padding: 0 12px;
    font-size: 12px;
  }

  .photo-grid {
    gap: 14px;
  }

  .photo-grid img,
  .photo-grid img:nth-child(n) {
    grid-column: span 6;
    height: 250px;
  }
}

@media (max-width: 640px) {
  :root {
    --nav-height: 58px;
  }

  body {
    background: var(--color-bg);
  }

  .nav {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    width: calc(100% - 20px);
    min-height: 0;
    padding: 11px;
    border-radius: 18px;
  }

  .nav-brand {
    justify-content: center;
  }

  .nav-links {
    width: 100%;
    justify-content: center;
    overflow-x: auto;
  }

  .nav-links a {
    flex: 1;
    justify-content: center;
    min-width: max-content;
    min-height: 34px;
    padding: 0 10px;
    font-size: 11px;
  }

  .hero {
    min-height: 92svh;
    padding: 138px 18px 74px;
  }

  .hero-title {
    font-size: clamp(44px, 16vw, 72px);
    letter-spacing: 0.04em;
  }

  .hero-subtitle {
    letter-spacing: 0.16em;
  }

  .hero-motto {
    letter-spacing: 0.1em;
  }

  .section,
  .section-alt {
    scroll-margin-top: 132px;
    padding: 72px 16px;
  }

  .section-heading {
    margin-bottom: 42px;
  }

  .section-title {
    letter-spacing: 0.04em;
  }

  .section-subtitle {
    letter-spacing: 0.12em;
  }

  .section-subtitle::before,
  .section-subtitle::after {
    width: 22px;
  }

  .photo-group {
    margin-bottom: 58px;
  }

  .photo-group-title {
    font-size: 19px;
  }

  .photo-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .photo-grid img,
  .photo-grid img:nth-child(n) {
    grid-column: auto;
    height: 168px;
    border-width: 5px;
    border-radius: 7px;
  }

  .classmate-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .classmate-card {
    padding: 14px 10px 13px;
  }

  .classmate-photo {
    width: 112px;
    height: 112px;
    border-width: 5px;
  }

  .lightbox {
    padding: 16px;
  }

  .lightbox-close {
    top: 14px;
    right: 14px;
  }

  .lightbox-prev,
  .lightbox-next {
    top: auto;
    bottom: 24px;
    width: 46px;
    height: 46px;
    transform: none;
  }

  .lightbox-prev:hover,
  .lightbox-next:hover {
    transform: scale(1.04);
  }

  .lightbox-prev {
    left: calc(50% - 58px);
  }

  .lightbox-next {
    right: calc(50% - 58px);
  }

  #lightbox-img {
    max-height: 72vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
