/* ============================================================
 * 照片 · 极简静态站
 * 明暗主题跟随系统，也可用右上角按钮手动切换（记忆在浏览器里）
 * ============================================================ */

:root {
  --bg: #faf9f7;
  --bg-soft: #f1efe9;
  --ink: #1c1b19;
  --ink-soft: #6f6c66;
  --line: #e3e0d8;
  --card: #fffefb;
  --shadow: 0 18px 50px rgba(28, 27, 25, 0.22);
}

html[data-theme="dark"] {
  --bg: #131312;
  --bg-soft: #1c1b1a;
  --ink: #e9e7e2;
  --ink-soft: #9b988f;
  --line: #2c2b28;
  --card: #1c1b1a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  line-height: 1.9;
  transition: background 0.35s ease, color 0.35s ease;
}

/* ---------- 顶栏 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 1.1rem clamp(1.2rem, 4vw, 2.5rem);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
}

.brand {
  font-size: 0.95rem;
  letter-spacing: 0.5em;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
}

.theme-toggle {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  width: 2.2rem;
  height: 2.2rem;
  cursor: pointer;
  font-size: 0.8rem;
  transition: color 0.2s;
}

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

html[data-theme="dark"] .theme-icon-light { display: none; }
html:not([data-theme="dark"]) .theme-icon-dark { display: none; }

/* ---------- 短文栏（说说流） ---------- */
.words-section {
  padding-bottom: 0.5rem;
}

.words-section .view-all,
.words-section .view-all:visited {
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.2s;
}

.words-section .view-all:hover {
  color: var(--ink);
}

.words-feed {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.word-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.w-avatar {
  flex: 0 0 2.4rem;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 8px;
  object-fit: cover;
  background: var(--ink);
  color: var(--bg);
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  letter-spacing: 0;
}

.w-main {
  flex: 1;
  min-width: 0;
}

.w-head {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  margin-bottom: 0.3rem;
}

.w-name {
  font-size: 0.83rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.w-date {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
}

.w-body {
  background: var(--bg-soft);
  border-radius: 10px;
  padding: 0.75rem 0.95rem;
}

.w-body p {
  font-size: 0.8rem;
  line-height: 1.85;
  color: var(--ink);
  margin-bottom: 0.5em;
}

.w-body p:last-child {
  margin-bottom: 0;
}

/* 短文列表页的容器 */
.words-page {
  padding-top: 2rem;
}

/* ---------- 影像区块 ---------- */
.gallery-section {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem clamp(1.2rem, 4vw, 2.5rem) 4rem;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.8rem;
}

.section-title {
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.22em;
}

.section-title-en {
  font-size: 0.66rem;
  letter-spacing: 0.3em;
  color: var(--ink-soft);
  margin-left: 0.6rem;
}

.section-count {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--ink-soft);
}

/* 等高网格：三张一行，整齐对齐 */
.masonry {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 640px) {
  .masonry { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
}

.frame {
  aspect-ratio: 4 / 5;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  background: var(--bg-soft);
}

.frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease, filter 0.5s ease;
}

.frame:hover img {
  transform: scale(1.025);
  filter: brightness(0.92);
}

/* 实况视频层：悬停时覆盖在静图上播放 */
.frame-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.frame.playing .frame-video {
  opacity: 1;
}

.frame.playing:hover img {
  transform: none;
  filter: none;
}

.live-badge {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.24rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  color: #3a3a3c;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 0.66rem;
  line-height: 1;
  letter-spacing: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(8px);
}

.live-badge svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.live-icon {
  width: 0.82rem;
  height: 0.82rem;
}

.frame-caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 2rem 0.9rem 0.8rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent);
  color: #f4f2ee;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.frame:hover .frame-caption {
  opacity: 1;
  transform: translateY(0);
}

@media (hover: none) {
  /* 触屏设备常显标题 */
  .frame-caption { opacity: 1; transform: none; }
}

.empty-tip {
  text-align: center;
  color: var(--ink-soft);
  letter-spacing: 0.14em;
  padding: 3rem 0;
  font-size: 0.85rem;
}

/* ---------- 分页加载 ---------- */
.load-more-wrap {
  text-align: center;
  padding: 1.6rem 0 0.4rem;
}

#load-more {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.3em;
  padding: 0.7rem 2.2rem 0.7rem 2.5rem;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

#load-more:hover {
  color: var(--ink);
  border-color: var(--ink-soft);
}

.end-tip {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.78rem;
  letter-spacing: 0.24em;
  padding: 1.6rem 0 0.4rem;
}

.frame-enter {
  animation: frame-in 0.5s ease both;
}

@keyframes frame-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 页脚 ---------- */
.site-footer {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2.6rem 1.2rem 3rem;
  color: var(--ink-soft);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
}

.site-footer .beian {
  font-size: 0.72rem;
}

.site-footer .beian a {
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.2s;
}

.site-footer .beian a:hover {
  color: var(--ink);
}

/* ---------- 灯箱 ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(12, 11, 10, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.8rem, 3vw, 2.5rem);
  animation: lb-fade 0.25s ease;
}

/* hidden 属性必须显式生效，否则会被上面的 display:flex 覆盖 */
.lightbox[hidden] {
  display: none;
}

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

.lb-body {
  display: flex;
  gap: clamp(1rem, 2.5vw, 2.2rem);
  align-items: center;
  max-width: 1240px;
  width: 100%;
  max-height: 92vh;
}

.lb-figure {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-figure img,
.lb-figure video {
  max-width: 100%;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: var(--shadow);
}

/* 灯箱内的 EXIF 信息 */
.lb-info {
  flex: 0 0 16rem;
  max-height: 88vh;
  overflow-y: auto;
  padding: 0.3rem 0.2rem 2rem;
  color: rgba(244, 242, 238, 0.82);
  font-size: 0.72rem;
  line-height: 1.85;
}

.lb-info-title {
  color: #f4f2ee;
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  padding-bottom: 0.6rem;
  margin-bottom: 0.7rem;
  border-bottom: 1px solid rgba(244, 242, 238, 0.18);
}

.lb-info-row {
  display: grid;
  grid-template-columns: 6.2rem 1fr;
  gap: 0.5rem;
}

.lb-info-key {
  text-align: right;
  white-space: nowrap;
  color: rgba(244, 242, 238, 0.5);
}

.lb-info-val {
  word-break: break-word;
  color: rgba(244, 242, 238, 0.92);
}

/* 灯箱内的序号小字 */
.lb-index {
  position: absolute;
  bottom: 0.9rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  color: rgba(244, 242, 238, 0.75);
}

/* 移动端 */
@media (max-width: 760px) {
  .lb-body {
    flex-direction: column;
    align-items: stretch;
    max-height: 94vh;
  }
  .lb-figure { flex: none; }
  .lb-figure img,
  .lb-figure video { max-height: 38vh; }
  .lb-info {
    flex: none;
    width: 100%;
    max-height: none;
    overflow: visible;
    padding-bottom: 1.2rem;
  }
  .lb-info-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 0.8rem;
  }
  .lb-info-row {
    grid-template-columns: 4.8rem 1fr;
    gap: 0.35rem;
    font-size: 0.66rem;
  }
}

/* 灯箱控制按钮 */
.lb-close,
.lb-nav {
  position: fixed;
  z-index: 60;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: #f4f2ee;
  cursor: pointer;
  transition: background 0.2s;
}

.lb-close {
  top: 1.1rem;
  right: 1.2rem;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 999px;
  font-size: 1.5rem;
  line-height: 1;
}

.lb-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 999px;
  font-size: 1.7rem;
  line-height: 1;
}

.lb-prev { left: 1rem; }
.lb-next { right: 1rem; }

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

@media (max-width: 760px) {
  .lb-nav { top: auto; bottom: 1rem; transform: none; width: 2.5rem; height: 2.5rem; }
  .lb-prev { left: 1rem; }
  .lb-next { right: 1rem; }
}

body.lb-open {
  overflow: hidden;
}
