/* ------------------------------------------------------------------
   发条照相馆 · darwinz.net
   苹果式极简 / 低饱和 / 无彩色强调
   ------------------------------------------------------------------ */

:root {
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --bg-sunken: #f2f2f4;
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #a1a1a6;
  --line: rgba(0, 0, 0, .08);
  --line-strong: rgba(0, 0, 0, .22);
  --ease: cubic-bezier(.22, .61, .36, 1);
  --nav-h: 52px;
  --frame: 1320px;
  /* 照片墙列数（只作用于宽屏那一档）：列数越大，单张越小、一屏看到越多。
     9 列时 1320px 容器下单张约 131px。嫌小改 8，嫌大改 10。
     各断点的降列阶梯在下面的 .grid 处，改这里要顺手对齐那一阶梯。 */
  --cols: 9;
  --danger: #a33c2c;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Helvetica Neue", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ---------------- 导航 ---------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, .74);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: var(--frame);
  margin: 0 auto;
  height: var(--nav-h);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  font-size: 19px;
  font-weight: 500;
  letter-spacing: .08em;
  /* 站名带了一串后缀，窄屏宁可截断也不要撑破导航 */
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-links { display: flex; align-items: center; gap: 26px; flex: none; }
.nav-link {
  font-size: 13px;
  color: var(--ink-2);
  letter-spacing: .06em;
  transition: color .25s var(--ease);
  white-space: nowrap;
}
.nav-link:hover { color: var(--ink); }

/* 背景音乐开关：排版沿用 .nav-link（元素同时带两个类），这里只清掉 <button> 自带的浏览器外观 */
.bgm-btn {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: 0;
  margin: 0;
  padding: 0;
  cursor: pointer;
}
/* 静音态：一道细删除线，不加任何彩色，维持"无彩色强调"的调子 */
.bgm-btn.is-off {
  color: var(--ink-3);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

/* 窄屏：站名和导航链接一起缩，留出呼吸 */
@media (max-width: 900px) {
  .brand { font-size: 15px; letter-spacing: .04em; }
  .nav-links { gap: 16px; }
}
@media (max-width: 620px) {
  .brand { font-size: 13px; letter-spacing: 0; }
  .nav-link { font-size: 12px; }
  .nav-inner { padding: 0 16px; }
}

/* ---------------- Hero ---------------- */
.hero {
  padding: 92px 24px 48px;
  text-align: center;
}
.hero h1 {
  /* 注意：.hero 是 flex column，子项默认按内容宽度收缩而不换行 —— 必须给 width */
  width: 100%;
  max-width: 17em;
  margin: 0 auto;
  font-size: clamp(26px, 5.4vw, 56px);
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.26;
  text-wrap: balance;
  overflow-wrap: break-word;
}
.hero-sub {
  width: 100%;
  margin: 22px auto 0;
  max-width: 34em;
  font-size: clamp(15px, 1.5vw, 18px);
  font-weight: 400;
  color: var(--ink-2);
  line-height: 1.6;
}
.hero-meta {
  margin: 28px 0 0;
  font-size: 11.5px;
  letter-spacing: .22em;
  color: var(--ink-3);
  text-transform: uppercase;
}

/* ---------------- 相册筛选 ---------------- */
.filters {
  max-width: var(--frame);
  margin: 0 auto;
  padding: 0 24px 34px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.chip {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  letter-spacing: .03em;
  padding: 7px 17px;
  border-radius: 980px;
  cursor: pointer;
  transition: color .25s var(--ease), border-color .25s var(--ease), background .25s var(--ease);
}
.chip:hover { color: var(--ink); border-color: var(--line-strong); }
.chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.chip .n { opacity: .5; margin-left: 6px; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] .n { opacity: .65; }

/* ---------------- 照片墙 ---------------- */
/* 宽屏默认 9 列（最初 3 列时单张竖图高 600px+，一屏只看得到一张多一点）。
   每降一档视口就少一列，单张宽度稳定在 125~160px，不会"越窄越大"。 */
.grid {
  max-width: var(--frame);
  margin: 0 auto;
  padding: 0 24px 140px;
  columns: var(--cols);
  column-gap: 12px;
}
/* 逐级降列（单张宽度实测）：1180→8 列≈131px、1000→7 列≈126px、
   860→6 列≈125px、700→5 列≈122px、540→3 列≈159px、380→2 列≈158px */
@media (max-width: 1180px) { .grid { columns: 8; } }
@media (max-width: 1000px) { .grid { columns: 7; } }
@media (max-width: 860px)  { .grid { columns: 6; } }
@media (max-width: 700px)  { .grid { columns: 5; column-gap: 10px; } }
@media (max-width: 540px)  { .grid { columns: 3; column-gap: 8px; } }
@media (max-width: 380px) {
  .grid { columns: 2; column-gap: 8px; padding-bottom: 96px; }
  .hero { padding: 84px 20px 48px; }
}
/* 窄屏：长标题按语义折成两行（span 在宽屏是行内，窄屏转块级） */
@media (max-width: 520px) {
  .hero h1 {
    font-size: clamp(23px, 6.4vw, 30px);
    line-height: 1.38;
  }
  .hero h1 span { display: block; }
}

.tile {
  break-inside: avoid;
  position: relative;
  margin: 0 0 14px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-sunken);
  cursor: zoom-in;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .9s var(--ease), transform .9s var(--ease);
}
.tile.in { opacity: 1; transform: none; }
.tile img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 1s var(--ease);
}
.tile:hover img { transform: scale(1.028); }
.tile::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 42%;
  background: linear-gradient(to top, rgba(0, 0, 0, .46), rgba(0, 0, 0, 0));
  opacity: 0;
  transition: opacity .45s var(--ease);
  pointer-events: none;
}
.tile.has-cap:hover::after { opacity: 1; }
.tile-cap {
  position: absolute;
  left: 15px; right: 15px; bottom: 13px;
  z-index: 2;
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity .45s var(--ease), transform .45s var(--ease);
  pointer-events: none;
}
.tile.has-cap:hover .tile-cap { opacity: 1; transform: none; }

.empty {
  text-align: center;
  color: var(--ink-3);
  font-size: 14px;
  padding: 60px 24px 140px;
  letter-spacing: .04em;
}

/* ---------------- 页脚 ---------------- */
.footer {
  border-top: 1px solid var(--line);
  padding: 54px 24px 62px;
  text-align: center;
}
.f-line {
  margin: 0;
  font-size: 13px;
  color: var(--ink-2);
  letter-spacing: .06em;
}
.f-sub {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: .04em;
}
.f-views {
  margin: 16px 0 0;
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: .18em;
  font-variant-numeric: tabular-nums;
}
/* 备案号：大陆节点必须展示，并链接到工信部备案管理系统 */
.f-icp {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: .04em;
}
.f-icp a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 0, 0, .14);
  padding-bottom: 1px;
}
.f-icp a:hover { border-bottom-color: rgba(0, 0, 0, .42); }

/* ---------------- 灯箱 ---------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(250, 250, 250, .93);
  -webkit-backdrop-filter: saturate(160%) blur(30px);
  backdrop-filter: saturate(160%) blur(30px);
  opacity: 0;
  transition: opacity .32s var(--ease);
}
.lightbox[hidden] { display: none; }
.lightbox.open { opacity: 1; }

.lb-figure {
  margin: 0;
  max-width: min(1180px, 92vw);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.lb-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 78vh;
}
.lb-stage img {
  max-width: min(1180px, 92vw);
  max-height: 78vh;
  width: auto;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .18);
  opacity: 0;
  transition: opacity .4s var(--ease);
}
.lb-stage img.ready { opacity: 1; }

.lb-info {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  text-align: center;
}
.lb-cap {
  font-size: 14px;
  color: var(--ink);
  max-width: 76vw;
  letter-spacing: .01em;
}
.lb-meta {
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: .16em;
  text-transform: uppercase;
}
/* 没有内容时整行不占位，避免灯箱下方留出多余空隙
   （说明行可能只剩相册名，甚至全空 —— 日期与序号已去掉） */
.lb-cap:empty,
.lb-meta:empty { display: none; }

.lb-close,
.lb-nav {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  border-radius: 50%;
  transition: color .25s var(--ease), background .25s var(--ease);
}
.lb-close:hover,
.lb-nav:hover { background: rgba(0, 0, 0, .05); color: var(--ink); }
.lb-close { top: 18px; right: 20px; width: 40px; height: 40px; }
.lb-nav { top: 50%; transform: translateY(-50%); width: 48px; height: 48px; }
.lb-prev { left: 14px; }
.lb-next { right: 14px; }
@media (max-width: 640px) {
  .lb-nav { width: 40px; height: 40px; }
  .lb-prev { left: 4px; }
  .lb-next { right: 4px; }
  .lb-stage img { max-height: 66vh; }
}

/* ---------------- 留言板 ---------------- */
.gb {
  padding: 0 24px 120px;
  scroll-margin-top: calc(var(--nav-h) + 24px);   /* 导航是 sticky，锚点别被盖住 */
}
.gb-inner { max-width: 640px; margin: 0 auto; }
.gb-title {
  margin: 0 0 30px;
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 600;
  letter-spacing: -.01em;
  text-align: center;
}

/* 输入区：一个圆角大输入框，聚焦时边框加深，其余一概不加装饰 */
.gb-form {
  position: relative;
  padding: 15px 17px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  transition: border-color .3s var(--ease);
}
.gb-form:focus-within { border-color: var(--line-strong); }
.gb-text {
  display: block;
  width: 100%;
  min-height: 62px;
  max-height: 240px;
  border: none;
  outline: none;
  resize: vertical;
  background: transparent;
  font: inherit;
  font-size: 14.5px;
  line-height: 1.72;
  color: var(--ink);
}
.gb-text::placeholder { color: var(--ink-3); }
.gb-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 11px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}
.gb-name {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
}
.gb-name::placeholder { color: var(--ink-3); }
.gb-count {
  flex: none;
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: .06em;
  font-variant-numeric: tabular-nums;
}
.gb-send {
  flex: none;
  padding: 8px 20px;
  border: none;
  border-radius: 980px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  letter-spacing: .04em;
  cursor: pointer;
  transition: opacity .25s var(--ease);
}
.gb-send:hover { opacity: .82; }
.gb-send:disabled { opacity: .4; cursor: default; }
/* 蜜罐：机器人会填，人类看不见 */
.gb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.gb-tip {
  margin: 10px 2px 0;
  min-height: 1.35em;
  font-size: 12px;
  letter-spacing: .03em;
  color: var(--ink-3);
}
.gb-tip.bad { color: var(--danger); }

.gb-empty {
  margin: 44px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--ink-3);
}
.gb-list {
  list-style: none;
  margin: 40px 0 0;
  padding: 0;
}
.gb-item {
  padding: 20px 2px 22px;
  border-top: 1px solid var(--line);
}
.gb-item:first-child { border-top: none; padding-top: 0; }
.gb-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 9px;
}
.gb-who {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: .01em;
}
.gb-region {
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: .04em;
}
.gb-region:empty { display: none; }
.gb-time {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.gb-body {
  margin: 9px 0 0;
  font-size: 14.5px;
  line-height: 1.72;
  color: var(--ink-2);
  white-space: pre-wrap;      /* 保留访客自己敲的换行 */
  overflow-wrap: anywhere;
}
@media (max-width: 540px) {
  .gb { padding: 0 20px 96px; }
  .gb-actions { flex-wrap: wrap; }
  .gb-name { flex: 1 0 100%; order: -1; margin-bottom: 9px; }
  .gb-count { margin-right: auto; }
  .gb-item { padding: 18px 0 20px; }
}

/* 滚动条：更安静 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .14); border-radius: 10px; border: 2px solid #fff; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, .24); }
::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition-duration: .01ms !important; }
  .tile { opacity: 1; transform: none; }
}
