/* ============================================================
   Telfair Photography — 瀑布流摄影作品集
   纯 CSS，无依赖。主题色变量在 :root 与 [data-theme="dark"] 里。
   ============================================================ */

:root {
  --bg: #fafaf7;
  --bg-soft: #efeeea;
  --card: #ffffff;
  --text: #1d1c1a;
  --muted: #8b887f;
  --border: #e5e3dc;
  --chip-hover: #ecebe6;
  --shadow: 0 14px 34px rgba(20, 18, 12, 0.14);
  --header-bg: rgba(250, 250, 247, 0.86);
  --radius: 10px;
  --serif: Georgia, "Times New Roman", "Songti SC", "STSong", SimSun, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #121212;
  --bg-soft: #1c1c1c;
  --card: #1b1b1b;
  --text: #eceae5;
  --muted: #918f88;
  --border: #2b2b29;
  --chip-hover: #262624;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
  --header-bg: rgba(18, 18, 18, 0.86);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  transition: background-color 0.3s, color 0.3s;
}

a { color: inherit; }

section { scroll-margin-top: 84px; }

/* ---------------- 顶栏 ---------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
}

.brand-name {
  font-family: var(--serif);
  font-size: 1.35rem;
  letter-spacing: 0.04em;
}

.brand-sub {
  font-size: 0.68rem;
  letter-spacing: 0.32em;
  color: var(--muted);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.site-nav a {
  text-decoration: none;
  font-size: 0.95rem;
  color: var(--text);
  opacity: 0.85;
  transition: opacity 0.2s;
}

.site-nav a:hover { opacity: 1; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.2s;
}

.icon-btn:hover { background: var(--chip-hover); }

/* 主题按钮：浅色模式显示月亮，深色模式显示太阳 */
.icon-btn .icon-sun { display: none; }
[data-theme="dark"] .icon-btn .icon-sun { display: block; }
[data-theme="dark"] .icon-btn .icon-moon { display: none; }

/* ---------------- 首屏标题 ---------------- */

.hero {
  text-align: center;
  padding: 72px 20px 44px;
}

.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(3rem, 8vw, 5rem);
  letter-spacing: 0.06em;
}

.tagline {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  letter-spacing: 0.12em;
}

/* ---------------- 瀑布流 ---------------- */

.gallery-section {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 72px;
}

.masonry {
  columns: 240px;
  column-gap: 16px;
}

.photo {
  position: relative;
  margin: 0 0 16px;
  break-inside: avoid;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: zoom-in;
  background: var(--bg-soft);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.25s, transform 0.25s;
}

.photo:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.photo img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.35s ease;
}

.photo img.loaded { opacity: 1; }

.photo:hover img,
.photo:focus-visible img { transform: scale(1.03); }

.photo-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding: 26px 14px 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.62), transparent);
  color: #fff;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.photo:hover .photo-overlay,
.photo:focus-visible .photo-overlay { opacity: 1; }

.po-title {
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.photo.broken {
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------------- 关于 ---------------- */

.about {
  max-width: 760px;
  margin: 0 auto;
  padding: 30px 24px 80px;
}

.about h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.8rem;
  letter-spacing: 0.08em;
  text-align: center;
  margin: 0 0 26px;
}

.about-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 34px 36px;
}

.about-card p { margin: 0 0 14px; }

.about-card p:last-child { margin-bottom: 0; }

.about-links {
  display: flex;
  gap: 14px;
  align-items: center;
  color: var(--muted);
}

.about-links a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
  transition: border-color 0.2s;
}

.about-links a:hover { border-color: var(--text); }

/* ---------------- 页脚 ---------------- */

.site-footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 36px 20px;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

/* ---------------- 灯箱 ---------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(10, 10, 10, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: lb-in 0.25s ease;
}

.lightbox[hidden] { display: none; }

@keyframes lb-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lb-stage {
  display: flex;
  flex-direction: column;
  max-width: 100%;
  margin: 0;
}

.lb-stage img {
  max-width: min(92vw, 1500px);
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.lb-stage img.ready { opacity: 1; }

.lb-caption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 18px;
  color: #d9d7d1;
  padding: 14px 4px 0;
  font-size: 0.95rem;
}

#lbMeta {
  flex: none;
  color: #97958e;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
}

.lb-btn {
  position: fixed;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background-color 0.2s;
}

.lb-btn:hover { background: rgba(255, 255, 255, 0.22); }

.lb-close { top: 20px; right: 24px; }

.lb-arrow { top: 50%; transform: translateY(-50%); }

.lb-prev { left: 18px; }

.lb-next { right: 18px; }

/* 窄屏：隐藏左右箭头，用滑动手势翻页 */
@media (max-width: 640px) {
  .lb-arrow { display: none; }
  .lb-caption { flex-direction: column; gap: 2px; align-items: flex-start; }
  .header-inner { padding: 0 16px; gap: 12px; }
  .gallery-section { padding-left: 14px; padding-right: 14px; }
  .masonry { column-gap: 12px; }
  .photo { margin-bottom: 12px; }
  .about-card { padding: 26px 22px; }
  .site-nav { gap: 14px; }
  .brand-sub { display: none; }
}

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

/* 键盘可达性 */
.photo:focus-visible,
.icon-btn:focus-visible,
.lb-btn:focus-visible,
.site-nav a:focus-visible,
.about-links a:focus-visible {
  outline: 2px solid var(--muted);
  outline-offset: 2px;
}
