/* =========================================================================
 *  base.css —— 共享设计系统 · 「摄影游乐场」版
 * -------------------------------------------------------------------------
 *  方向：把作品集做成一本会动的手工杂志 / 照片墙。
 *    · 奶油纸底、墨色粗线、番茄红 / 黄油黄 / 天蓝 / 薄荷绿撞色
 *    · 硬边卡片 + 硬投影（像贴纸和拍立得），标题用粗黑体，图注用手写楷体
 *    · 照片是主角：厚白边、胶带、歪一点
 *  这是公共站的视觉语言；后台沿用同一套色板，但更克制。
 * ========================================================================= */

/* ------------------------------------------------------------- 字体 */
@font-face {
  font-family: 'Instrument Serif';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('../fonts/instrument-serif-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: italic; font-weight: 400; font-display: swap;
  src: url('../fonts/instrument-serif-400-italic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter Tight';
  font-style: normal; font-weight: 300 600; font-display: swap;
  src: url('../fonts/inter-tight-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ------------------------------------------------------------- 变量 */
:root {
  --serif: 'Instrument Serif', 'Songti SC', 'Source Han Serif SC', 'Noto Serif SC', 'SimSun', Georgia, serif;
  --sans: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB',
          'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  --hand: 'Kaiti SC', 'STKaiti', 'KaiTi', 'Songti SC', 'Noto Serif SC', serif;
  --display: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Inter Tight', sans-serif;

  --paper: #f3ede1;
  --cream: #fbf7ee;
  --ink: #1d1b16;
  --tomato: #c54530;
  --butter: #e8c56a;
  --sky: #c2d6de;
  --mint: #cbdcc5;
  --pink: #ebd1cb;
  --blue: #2454ff;

  --line: 2px solid var(--ink);
  --shadow: 5px 5px 0 var(--ink);
  --shadow-lg: 9px 9px 0 var(--ink);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --edge: clamp(18px, 2.6vw, 48px);
  --gut: clamp(16px, 1.8vw, 28px);
  --label: 10.5px;
  --track: 0.16em;
}

/* 深色：墨色底、奶油字（阅读页切暗色用） */
.theme-dark {
  color-scheme: dark;
  --bg: #1d1b16;
  --bg-2: #26221b;
  --fg: #fff8e9;
  --fg-2: rgba(255, 243, 223, 0.74);
  --fg-3: rgba(255, 243, 223, 0.58);
  --hair: rgba(255, 243, 223, 0.22);
  --glass: rgba(23, 19, 14, 0.7);
  --glass-brd: rgba(255, 243, 223, 0.24);
  --img-bg: rgba(255, 243, 223, 0.08);
}

/* 浅色：奶油纸 */
.theme-light {
  color-scheme: light;
  --bg: #fbf7ee;
  --bg-2: #f4ebdc;
  --fg: #1d1b16;
  --fg-2: rgba(29, 27, 22, 0.72);
  --fg-3: rgba(29, 27, 22, 0.62);
  --hair: rgba(29, 27, 22, 0.24);
  --glass: rgba(255, 249, 238, 0.7);
  --glass-brd: rgba(255, 249, 238, 0.85);
  --img-bg: rgba(23, 19, 14, 0.08);
}

/* ------------------------------------------------------------- 基础 */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
html.is-locked, html.is-locked body { overflow: hidden; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.65;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
}

img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
figure { margin: 0; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

::selection { background: var(--tomato); color: var(--cream); }

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

/* --------------------------------------------------- 排版原子 */
.label {
  font-family: var(--sans);
  font-size: var(--label);
  font-weight: 600;
  letter-spacing: var(--track);
  text-transform: uppercase;
  line-height: 1.2;
  color: var(--fg-3, rgba(23, 19, 14, 0.6));
}
.label--fg { color: var(--fg, var(--ink)); }
.label--2 { color: var(--fg-2, rgba(23, 19, 14, 0.72)); }

.serif { font-family: var(--serif); font-weight: 400; letter-spacing: 0.005em; }
.hand { font-family: var(--hand); }

.display {
  font-family: var(--display);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.num { font-variant-numeric: tabular-nums; }

.hair { height: 2px; border: 0; margin: 0; background: var(--ink); }

.link {
  position: relative;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  transition: color 0.25s var(--ease), background 0.25s var(--ease);
}
.link:hover { color: var(--tomato); }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --------------------------------------------------- 贴纸式按钮 */
.btn-sticker,
.cover__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  background: var(--cream);
  border: var(--line);
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  transition: transform 0.16s var(--ease), box-shadow 0.16s var(--ease), background 0.16s var(--ease);
}
.btn-sticker:hover,
.cover__btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); background: var(--butter); }
.btn-sticker:active,
.cover__btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.cover__btn--solid { background: var(--tomato); color: var(--cream); }
.cover__btn--solid:hover { background: var(--ink); color: var(--butter); }

/* --------------------------------------------------- 顶部固定条 */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: var(--edge);
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

/* 站名做成一枚歪贴纸 */
.topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 7px;
  background: var(--cream);
  border: var(--line);
  box-shadow: 3px 3px 0 var(--ink);
  transform: rotate(-1.1deg);
  transition: transform 0.2s var(--ease);
}
.topbar__brand:hover { transform: rotate(0) translateY(-1px); }
.topbar__brand .label--fg {
  font-family: var(--display);
  font-size: clamp(15px, 1.3vw, 18px);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-transform: none;
  line-height: 1;
  color: var(--ink);
}
.topbar__brand > .label:last-child {
  color: var(--ink);
  font-size: 8.5px;
  letter-spacing: 0.18em;
  border-left: 1.5px solid var(--ink);
  padding-left: 9px;
}

/* 导航：一排彩色贴纸 */
.nav { display: flex; align-items: center; gap: 8px; }
.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 13px;
  background: var(--cream);
  border: var(--line);
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  transition: transform 0.16s var(--ease), box-shadow 0.16s var(--ease), background 0.16s var(--ease), color 0.16s var(--ease);
}
.nav a:nth-child(2n) { background: var(--butter); }
.nav a:nth-child(3n) { background: var(--sky); }
.nav a:hover { transform: translate(-1px, -1px) rotate(-1deg); box-shadow: 5px 5px 0 var(--ink); }
.nav a.is-on { background: var(--tomato); color: var(--cream); }
.nav--pill { gap: 8px; padding: 0; border-radius: 0; }
.nav--pill a { padding: 0 13px; border-radius: 0; }

/* 小图标按钮 */
.iconbtn {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border: var(--line);
  background: var(--cream);
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink);
}
.iconbtn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.iconbtn:hover { background: var(--butter); transform: translate(-1px, -1px); }

/* --------------------------------------------------- 作品卡（拍立得） */
.masonry { columns: var(--photo-cols, 3); column-gap: var(--gut); }
.masonry > .work { break-inside: avoid; }

.work {
  position: relative;
  margin-bottom: calc(var(--gut) * 1.55);
  padding: 9px 9px 0;
  background: #fff;
  border: var(--line);
  box-shadow: var(--shadow);
  cursor: zoom-in;
  transform: rotate(var(--tilt, -0.8deg));
  transition: transform 0.3s var(--ease-expo), box-shadow 0.3s var(--ease);
}
.work:nth-child(3n + 1) { --tilt: -1.1deg; }
.work:nth-child(3n + 2) { --tilt: 0.9deg; }
.work:nth-child(3n) { --tilt: -0.3deg; }
.work:hover,
.work:focus-visible { transform: rotate(0) translateY(-4px); box-shadow: var(--shadow-lg); }

.work__frame { position: relative; overflow: hidden; background: var(--img-bg); }
.work__img {
  width: 100%;
  height: auto;
  aspect-ratio: var(--ar, 3 / 2);
  object-fit: cover;
  opacity: 0;
  transition: transform 0.9s var(--ease-expo), opacity 0.7s var(--ease);
}
.work__img.is-loaded { opacity: 1; }
.work:hover .work__img { transform: scale(1.03); }

/* 悬停时贴一枚「看大图」小贴纸 */
.work__frame::after {
  content: '看大图 ↗';
  position: absolute;
  right: 10px; bottom: 10px;
  padding: 5px 9px;
  background: var(--butter);
  border: 1.5px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  opacity: 0;
  transform: translateY(6px) rotate(-3deg);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.work:hover .work__frame::after { opacity: 1; transform: translateY(0) rotate(-3deg); }

.work__cap {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 2px 12px;
  color: var(--ink);
}
.work__idx {
  display: inline-block;
  padding: 2px 6px;
  background: var(--tomato);
  color: var(--cream);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}
.work__title { font-family: var(--hand); font-size: 19px; font-weight: 700; letter-spacing: 0.01em; }
.work__sub { font-size: 11.5px; color: rgba(23, 19, 14, 0.62); }
.work:hover .work__title { background: var(--butter); }

/* --------------------------------------------------- 分类筛（贴纸） */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 12px;
  background: var(--cream);
  border: 1.5px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), background 0.15s var(--ease);
}
.filter i { font-style: normal; font-size: 9px; opacity: 0.65; font-variant-numeric: tabular-nums; }
.filter:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); background: var(--butter); }
.filter.is-active { background: var(--ink); color: var(--cream); }

/* --------------------------------------------------- 全屏灯箱 */
.lb {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: block;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s var(--ease), visibility 0.35s;
  --bg: #17130e;
  --fg: #fff3df;
  --fg-2: rgba(255, 243, 223, 0.76);
  --fg-3: rgba(255, 243, 223, 0.6);
  --hair: rgba(255, 243, 223, 0.25);
  color: var(--fg);
}
.lb.is-open { opacity: 1; visibility: visible; }
.lb__scrim {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 95%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.lb__stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
  padding: clamp(52px, 7vh, 90px) clamp(48px, 7vw, 110px) clamp(72px, 11vh, 120px);
  overflow: hidden;
  overscroll-behavior: contain;
  cursor: zoom-out;
}
.lb__img {
  max-width: 100%;
  max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
  opacity: 0;
  transform: scale(0.98);
  transition: opacity 0.4s var(--ease), transform 0.55s var(--ease-expo);
  cursor: zoom-in;
}
.lb__img.is-ready { opacity: 1; transform: none; }
.lb.is-zoomed .lb__stage { display: block; overflow: auto; }
.lb.is-zoomed .lb__img { max-width: none; max-height: none; margin: 0 auto; transform: none; cursor: grab; }
.lb.is-zoomed.is-panning, .lb.is-zoomed.is-panning .lb__img { cursor: grabbing; }

.lb__bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--tomato);
  transform: scaleX(0);
  transform-origin: left;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
.lb.is-loading .lb__bar { opacity: 1; animation: lb-load 1.7s var(--ease) infinite; }
@keyframes lb-load {
  0% { transform: scaleX(0); }
  70% { transform: scaleX(0.86); }
  100% { transform: scaleX(0.92); }
}

.lb__cap {
  position: absolute;
  left: var(--edge);
  bottom: var(--edge);
  right: var(--edge);
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  pointer-events: none;
}
.lb__title { font-family: var(--hand); font-size: clamp(22px, 1.8vw, 28px); }
.lb__sub { font-size: 12.5px; color: var(--fg-2); }
.lb__tags { color: var(--fg-3); }
.lb__meta { margin-left: auto; }

.lb__count { position: absolute; right: var(--edge); top: var(--edge); }
.lb__x { position: absolute; left: var(--edge); top: var(--edge); color: var(--fg-2); transition: color 0.3s; }
.lb__x:hover { color: var(--tomato); }
.lb__nav {
  position: absolute;
  top: 50%;
  width: 54px; height: 54px;
  margin-top: -27px;
  display: grid;
  place-items: center;
  color: var(--fg-2);
  border: 2px solid rgba(255, 243, 223, 0.35);
  transition: color 0.3s, background 0.3s, transform 0.4s var(--ease-expo);
}
.lb__nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.lb__nav:hover { color: var(--ink); background: var(--butter); border-color: var(--ink); }
.lb__nav--prev { left: clamp(8px, 2vw, 26px); }
.lb__nav--next { right: clamp(8px, 2vw, 26px); }
.lb__zoom { position: absolute; right: var(--edge); top: calc(var(--edge) + 22px); display: flex; align-items: center; gap: 4px; }
.lb__zoom button {
  padding: 5px 8px;
  font-size: var(--label);
  font-weight: 700;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--fg-3);
  transition: color 0.3s var(--ease);
}
.lb__zoom button:hover, .lb__zoom button.is-on { color: var(--fg); background: var(--tomato); }
.lb__zoomval { min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------- 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ink); border: 2px solid var(--paper); }
::-webkit-scrollbar-thumb:hover { background: var(--tomato); }

@media (max-width: 1024px) { .masonry { columns: var(--photo-cols-sm, 2); } }
@media (max-width: 640px) {
  .masonry { columns: 1; }
  :root { --label: 10px; --edge: 16px; --gut: 16px; }
  .topbar { padding: 12px 14px; }
  .lb__stage { padding: 62px 14px 96px; }
  .lb__cap { left: 16px; right: 16px; bottom: 18px; gap: 8px; }
  .lb__meta { margin-left: 0; width: 100%; }
  .lb__nav { top: auto; bottom: 20px; margin-top: 0; }
  .lb__nav--prev { left: calc(50% - 58px); }
  .lb__nav--next { left: calc(50% + 4px); right: auto; }
  .lb__count { top: auto; bottom: 30px; right: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
