/* 样式来自参考稿 minimalist-story-gallery.html，把 Tailwind 工具类逐条落成了手写 CSS */

:root {
  --bg: #FAF8F5;
  --story-bg: #F2EFE9;
  --fg: #18181B;
  --muted: #71717A;
  --border: rgba(24, 24, 27, 0.1);
}
.dark {
  --bg: #0D0D0D;
  --story-bg: #151517;
  --fg: #F4F3EF;
  --muted: #A1A1AA;
  --border: rgba(244, 243, 239, 0.12);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: 6rem;
  background-color: var(--bg);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, "PingFang SC", "Segoe UI", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}
body.is-locked { overflow: hidden; }
h1, p { margin: 0; }
button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
[hidden] { display: none !important; }

.serif { font-family: Georgia, "Noto Serif SC", "Songti SC", serif; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.muted { color: var(--muted); }
.btn-outline { padding: 0.25rem 0.625rem; border: 1px solid var(--border); }

/* ── 抬头 ─────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  background-color: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.site-header__inner {
  max-width: 64rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.brand { display: flex; align-items: baseline; gap: 0.75rem; min-width: 0; }
.brand__title { font-size: 1rem; line-height: 1.5rem; font-weight: 400; letter-spacing: -0.025em; white-space: nowrap; }
.brand__tag { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.controls { display: flex; align-items: center; gap: 0.75rem; font-size: 0.75rem; line-height: 1rem; flex-shrink: 0; }
.theme-toggle { display: flex; padding: 0.3125rem; opacity: 0.75; transition: opacity 0.15s ease; }
.theme-toggle:hover { opacity: 1; }
.theme-toggle svg {
  width: 0.9375rem;
  height: 0.9375rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.theme-toggle__sun, .dark .theme-toggle__moon { display: none; }
.dark .theme-toggle__sun { display: block; }

/* ── 无缝主图流 ───────────────────────────────────── */
.stream-wrap { max-width: 64rem; margin: 0 auto; }
/* dense：故事行前一行没排满时，用后面的普通图回填，保证没有空格子 */
.stream { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; grid-auto-flow: dense; }
.stream-status { padding: 6rem 1rem; text-align: center; font-size: 0.75rem; color: var(--muted); letter-spacing: 0.025em; }

.cell { display: block; width: 100%; aspect-ratio: 1 / 1; overflow: hidden; cursor: pointer; }
.frame { width: 100%; height: 100%; overflow: hidden; }
.photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
}
.photo.is-loaded { opacity: 1; }
.cell:hover .photo, .story:hover .photo { transform: scale(1.03); }

.story {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  background-color: var(--story-bg);
  cursor: pointer;
}
.story__art { order: 1; aspect-ratio: 1 / 1; overflow: hidden; }
.story__text {
  order: 2;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
  min-width: 0;
}
.story.is-reversed .story__art { order: 2; }
.story.is-reversed .story__text { order: 1; }
.story__date { font-size: 11px; color: var(--muted); letter-spacing: 0.025em; }
.story__desc { font-size: 0.75rem; line-height: 1.625; opacity: 0.9; }

/* ── 底部胶囊导航 ─────────────────────────────────── */
.pill-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 1.5rem;
  z-index: 30;
  display: flex;
  justify-content: center;
  padding: 0 1rem env(safe-area-inset-bottom);
  pointer-events: none;
}
.pill {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
  padding: 0.375rem;
  overflow-x: auto;
  scrollbar-width: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9999px;
  background-color: rgba(34, 34, 38, 0.88);
  -webkit-backdrop-filter: blur(40px);
  backdrop-filter: blur(40px);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  font-size: 0.75rem;
  line-height: 1rem;
}
.pill::-webkit-scrollbar { display: none; }
.pill:empty { display: none; }
.pill__btn {
  flex-shrink: 0;
  padding: 0.375rem 1rem;
  border-radius: 9999px;
  color: rgba(255, 255, 255, 0.75);
  white-space: nowrap;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.pill__btn:hover { color: #fff; }
.pill__btn.is-active, .pill__btn.is-active:hover { background-color: #FAF8F5; color: #18181B; font-weight: 500; }
.pill__btn:focus-visible { outline-color: #FAF8F5; }

/* ── 灯箱 ─────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.25rem;
  overflow-y: auto;
  background-color: color-mix(in srgb, var(--bg) 98%, transparent);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
}
.lightbox__bar {
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.75rem;
  line-height: 1rem;
}
.lightbox__bar .btn-outline { padding: 0.25rem 0.75rem; color: var(--fg); }
.lightbox__body { width: 100%; max-width: 42rem; margin: auto; padding: 1rem 0; }
.lightbox__art {
  width: 100%;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--border);
}
.lightbox__art .photo { object-fit: contain; }
.lightbox__caption { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.75rem; line-height: 1rem; }
.lightbox__desc {
  padding-left: 0.875rem;
  border-left: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  font-size: 0.875rem;
  line-height: 1.625;
  opacity: 0.9;
}
.lightbox__exif {
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.palette { display: flex; gap: 0.375rem; flex-shrink: 0; }
.palette__chip { width: 0.875rem; height: 0.875rem; border: 1px solid rgba(0, 0, 0, 0.2); }
.dark .palette__chip { border-color: rgba(255, 255, 255, 0.2); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-caption { animation: fadeUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) both; }

/* ── 断点（对应 Tailwind 的 sm / md）──────────────── */
@media (min-width: 640px) {
  .story__text { padding-left: 1.5rem; padding-right: 1.5rem; }
  .story__desc { font-size: 0.875rem; }
}
@media (min-width: 768px) {
  .site-header { padding-left: 2.5rem; padding-right: 2.5rem; }
  .brand__title { font-size: 1.25rem; line-height: 1.75rem; }
  .stream { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .story__art { aspect-ratio: 4 / 3; }
  .story__text { padding-left: 3rem; padding-right: 3rem; }
  .story__date { font-size: 0.75rem; }
  .story__desc { font-size: 1rem; }
  .lightbox { padding: 2.5rem; }
  .lightbox__desc { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  body, .photo { transition: none; }
  .animate-caption { animation: none; }
  .cell:hover .photo, .story:hover .photo { transform: none; }
}
