:root {
  --paper: #e9ddca;
  --paper-light: #f2e8d8;
  --ink: #725840;
  --ink-dark: #443326;
  --ink-soft: #968973;
  --line: rgb(114 88 64 / 22%);
  --gap: clamp(14px, 1.8vw, 30px);
  --display: "Cormorant Garamond", Garamond, "Times New Roman", serif;
  --song: "Songti SC", "STSong", "Noto Serif SC", serif;
  --fangsong: "FangSong_GB2312", "FangSong", "STFangsong", serif;
  --hand: "Bad Script", "KaiTi", cursive;
  color: var(--ink-dark);
  background: var(--paper);
  font-family: var(--fangsong);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
  background: var(--paper);
}

body {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  background:
    linear-gradient(rgb(233 221 202 / 87%), rgb(233 221 202 / 91%)),
    url("./assets/paper-texture.png") top center / 1680px auto repeat-y;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background:
    radial-gradient(circle at 9% 14%, rgb(255 250 240 / 54%), transparent 25vw),
    radial-gradient(circle at 88% 62%, rgb(111 82 54 / 8%), transparent 32vw);
  content: "";
  pointer-events: none;
}

button,
a {
  color: inherit;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 5px;
}

::selection {
  color: var(--paper-light);
  background: var(--ink);
}

.site-header {
  position: fixed;
  z-index: 40;
  top: 0;
  left: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  width: 100%;
  min-height: 88px;
  padding: 20px clamp(22px, 3.2vw, 56px) 28px;
  align-items: start;
  background: linear-gradient(180deg, rgb(233 221 202 / 97%) 0 62%, rgb(233 221 202 / 0%));
  pointer-events: none;
}

.site-header > * {
  pointer-events: auto;
}

.header-start {
  display: flex;
  align-items: center;
  gap: 12px;
}

.back-home {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgb(114 88 64 / 22%);
  border-radius: 999px;
  color: #79674c;
  text-decoration: none;
  transition: transform 220ms ease, border-color 220ms ease, background 220ms ease;
}

.back-home svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.back-home:hover,
.back-home:focus-visible {
  border-color: rgb(114 88 64 / 42%);
  background: rgb(255 250 240 / 46%);
  transform: translateX(-2px);
}

.brand {
  width: fit-content;
  color: #79674c;
  font-family: var(--hand);
  font-size: clamp(28px, 2.5vw, 38px);
  line-height: 1;
  text-decoration: none;
  text-shadow: 0 3px 4px rgb(0 0 0 / 14%);
  transition: transform 220ms ease;
}

.brand:hover {
  transform: translateY(-2px) rotate(-2deg);
}

.title-lockup {
  text-align: center;
}

.title-lockup p,
.title-lockup h1 {
  margin: 0;
}

.title-lockup p {
  color: var(--ink-soft);
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: 0.27em;
}

.title-lockup h1 {
  margin-top: 2px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 21px;
  font-weight: 300;
  letter-spacing: 0.2em;
}

.header-actions {
  display: flex;
  justify-self: end;
  color: var(--ink-soft);
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: 0.18em;
  gap: 24px;
  align-items: center;
}

.header-actions b {
  color: var(--ink);
  font-weight: 400;
}

.header-actions button {
  display: flex;
  padding: 5px 0 6px 16px;
  border: 0;
  border-left: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-family: var(--fangsong);
  font-size: 11px;
  letter-spacing: 0.08em;
  gap: 7px;
  align-items: center;
}

.header-actions svg {
  width: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.3;
  transition: transform 420ms cubic-bezier(.16, 1, .3, 1);
}

.header-actions button:hover svg {
  transform: rotate(12deg);
}

main {
  width: 100%;
  padding: 0 clamp(18px, 2.8vw, 50px);
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: clamp(250px, 38svh, 380px);
  padding: clamp(112px, 14vh, 148px) clamp(8px, 2vw, 34px) clamp(38px, 5vh, 58px);
  gap: 18px;
  align-content: center;
}

.intro__index {
  margin: 0;
  color: var(--ink-soft);
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: 0.25em;
}

.intro__quote {
  grid-column: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
  margin: 0;
  color: var(--ink);
  font-family: var(--display);
  gap: clamp(22px, 3vw, 48px);
  align-items: end;
}

.intro__quote p {
  margin: 0;
  font-size: clamp(26px, 2.65vw, 42px);
  font-weight: 300;
  line-height: 1.18;
}

.intro__quote cite {
  display: block;
  margin: 0 0 0.35em;
  color: var(--ink-soft);
  font-size: clamp(12px, 1vw, 15px);
  font-style: italic;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.gallery-grid {
  display: grid;
  width: 100%;
  min-height: 70vh;
  padding-bottom: clamp(100px, 12vw, 180px);
  gap: var(--gap);
  align-items: start;
  transition: opacity 180ms ease, transform 380ms cubic-bezier(.16, 1, .3, 1);
}

.gallery-grid.is-rearranging {
  opacity: 0;
  transform: translateY(10px);
}

.masonry-column {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: var(--gap);
}

.photo-card {
  position: relative;
  min-width: 0;
  margin: 0;
  align-self: start;
  animation: photo-reveal 720ms cubic-bezier(.16, 1, .3, 1) both;
  animation-delay: var(--reveal-delay, 0ms);
}

@keyframes photo-reveal {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
}

.photo-card button {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: #d6c9b6;
  box-shadow: 0 1px 0 rgb(66 48 33 / 9%);
  cursor: zoom-in;
}

.photo-card img {
  display: block;
  width: 100%;
  height: auto;
  transition: filter 520ms ease, transform 900ms cubic-bezier(.16, 1, .3, 1);
}

.photo-card figcaption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  min-height: 54px;
  padding: 26px 12px 10px;
  color: rgb(255 250 241 / 88%);
  background: linear-gradient(transparent, rgb(28 22 17 / 54%));
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: 0.15em;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 260ms ease, transform 380ms cubic-bezier(.16, 1, .3, 1);
  justify-content: space-between;
}

.photo-card button:hover img,
.photo-card button:focus-visible img {
  filter: saturate(0.94) contrast(1.025);
  transform: scale(1.018);
}

.photo-card button:hover figcaption,
.photo-card button:focus-visible figcaption {
  opacity: 1;
  transform: translateY(0);
}

.site-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  min-height: 150px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: 0.22em;
  align-items: center;
}

.site-footer span:last-child {
  justify-self: end;
}

.site-footer button {
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgb(242 232 216 / 35%);
  cursor: pointer;
  font-family: var(--fangsong);
  font-size: 11px;
  letter-spacing: 0.06em;
  transition: background 180ms ease, transform 220ms ease;
}

.site-footer button:hover {
  background: rgb(247 239 226 / 74%);
  transform: translateY(-2px);
}

.lightbox {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  padding: clamp(44px, 6vw, 88px);
  border: 0;
  color: var(--paper-light);
  background: rgb(28 23 19 / 94%);
}

.lightbox::backdrop {
  background: rgb(28 23 19 / 72%);
  backdrop-filter: blur(10px);
}

.lightbox[open] {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  gap: clamp(12px, 3vw, 40px);
  place-items: center;
  animation: lightbox-in 280ms ease both;
}

@keyframes lightbox-in {
  from { opacity: 0; }
}

.lightbox figure {
  display: grid;
  width: 100%;
  height: 100%;
  margin: 0;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 18px;
  place-items: center;
}

.lightbox img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(100vh - 180px);
  object-fit: contain;
  box-shadow: 0 24px 80px rgb(0 0 0 / 38%);
}

.lightbox figcaption {
  display: flex;
  width: 100%;
  color: rgb(233 221 202 / 64%);
  font-family: var(--display);
  font-size: 10px;
  letter-spacing: 0.2em;
  justify-content: space-between;
}

.lightbox__close,
.lightbox__arrow {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgb(233 221 202 / 28%);
  border-radius: 50%;
  color: var(--paper-light);
  background: transparent;
  cursor: pointer;
  place-items: center;
}

.lightbox__close {
  position: fixed;
  z-index: 2;
  top: 22px;
  right: 26px;
  font-family: var(--display);
  font-size: 28px;
  line-height: 1;
}

.lightbox__arrow {
  font-size: 16px;
  transition: background 180ms ease, transform 220ms ease;
}

.lightbox__arrow:hover,
.lightbox__close:hover {
  background: rgb(233 221 202 / 10%);
}

.lightbox__arrow--prev:hover { transform: translateX(-3px); }
.lightbox__arrow--next:hover { transform: translateX(3px); }

noscript {
  position: fixed;
  z-index: 100;
  inset: 20px;
  padding: 20px;
  color: var(--paper-light);
  background: var(--ink-dark);
}

@media (max-width: 1100px) {
  .intro {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 680px) {
  :root {
    --gap: 12px;
  }

  .site-header {
    grid-template-columns: 1fr auto;
    min-height: 74px;
    padding: 16px 18px 24px;
    align-items: center;
  }

  .title-lockup {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }

  .title-lockup p,
  .header-actions > span {
    display: none;
  }

  .title-lockup h1 {
    font-size: 18px;
  }

  .header-actions button {
    padding-left: 0;
    border-left: 0;
  }

  .header-actions button span {
    display: none;
  }

  .header-actions svg {
    width: 18px;
  }

  main {
    padding-inline: 12px;
  }

  .intro {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 102px 8px 46px;
    gap: 18px;
  }

  .intro__index {
    margin: 0;
  }

  .intro__quote {
    grid-column: 1;
    display: block;
  }

  .intro__quote p {
    font-size: clamp(27px, 8.2vw, 36px);
    line-height: 1.16;
  }

  .intro__quote cite {
    margin-top: 16px;
  }

  .gallery-grid { padding-bottom: 90px; }

  .photo-card figcaption {
    display: none;
  }

  .site-footer {
    grid-template-columns: 1fr auto;
    min-height: 110px;
  }

  .site-footer span:first-child {
    display: none;
  }

  .site-footer span:last-child {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }

  .lightbox {
    padding: 70px 16px 28px;
  }

  .lightbox[open] {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    gap: 6px;
  }

  .lightbox__arrow {
    width: 36px;
    height: 36px;
  }

  .lightbox img {
    max-height: calc(100vh - 150px);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Archive light-table theme. Gallery placement and behaviour stay in gallery.js. */
:root {
  --paper: #f7f5ee;
  --paper-light: #fcfaf4;
  --ink: #464b3e;
  --ink-dark: #30352b;
  --ink-soft: #858173;
  --line: #d4cebf;
  --gap: clamp(22px, 2.4vw, 40px);
  --display: Georgia, "Songti SC", serif;
  --fangsong: "Songti SC", "Noto Serif CJK SC", serif;
  background: #252620;
}
html { background: #252620; }
body { width: calc(100% - 40px); max-width: 1800px; margin: 20px auto; min-width: 0; background: var(--paper); box-shadow: 0 4px 25px #0003; }
body::before { display: none; }
.site-header { position: sticky; top: 0; left: auto; min-height: 100px; padding: 25px clamp(24px, 4vw, 64px); align-items: center; background: var(--paper); border-bottom: 1px solid var(--line); }
.header-start { gap: 15px; }
.back-home { width: 30px; height: 35px; border: 0; border-radius: 0; color: var(--ink); }
.back-home:hover, .back-home:focus-visible { background: transparent; }
.brand { color: var(--ink-dark); font: 23px/1 Georgia, serif; text-shadow: none; }
.brand span { display: block; margin-top: 8px; font: 7px/1.5 "Courier New", monospace; letter-spacing: .12em; }
.brand:hover { transform: none; }
.title-lockup p { font: 9px/1.7 "Courier New", monospace; letter-spacing: .13em; }
.title-lockup .archive-file { margin-top: 4px; font-size: 8px; letter-spacing: .08em; }
.header-actions { font: 9px/1.5 "Courier New", monospace; letter-spacing: .05em; gap: 24px; }
.header-actions button { color: var(--ink); font-size: 12px; }
.header-actions svg { transition: transform 180ms ease; }
main { padding: 0 clamp(24px, 4vw, 64px); }
.intro { min-height: 0; padding: 74px 0 38px; gap: 0; position: relative; }
.intro__index { font: 10px/1.8 "Courier New", monospace; letter-spacing: .13em; }
.intro h1 { margin: 25px 0 34px; font: 400 clamp(44px, 5.2vw, 76px)/1.2 var(--display); letter-spacing: .035em; color: var(--ink-dark); }
.intro__quote { display: block; width: 68%; max-width: 800px; margin: -17px 0 0 auto; position: relative; }
.intro__quote::before { content: "“"; position: absolute; left: -40px; top: -17px; font: 60px/1 Georgia, serif; color: #b6ad98; }
.intro__quote p { font: 400 clamp(16px, 1.3vw, 20px)/2 var(--song); letter-spacing: .025em; color: #5c6053; }
.intro__quote cite { margin: 18px 2px 0; font: italic 15px/1.5 Georgia, serif; text-align: right; color: #89816e; }
.intro__footnote { display: flex; justify-content: space-between; gap: 20px; margin: 48px 0 0; padding-top: 17px; border-top: 1px solid var(--line); font: 9px/1.7 "Courier New", var(--song); letter-spacing: .08em; color: #8d8573; }
.intro__footnote span:last-child { font: 11px/1.7 var(--song); letter-spacing: .1em; }
.gallery-grid { padding: 12px 6px 95px; }
.photo-card { animation-duration: 280ms; }
.photo-card button { background: #e4dfd4; outline: 6px solid #fdfcf7; box-shadow: 0 2px 9px 7px #39312212; transition: box-shadow 160ms, transform 160ms; }
.photo-card img { transition: transform 180ms ease; }
.photo-card button:hover, .photo-card button:focus-visible { box-shadow: 0 5px 13px 7px #39312222; transform: translateY(-2px); }
.photo-card button:focus-visible { outline: 2px solid var(--ink); outline-offset: 8px; }
.photo-card button:hover img, .photo-card button:focus-visible img { filter: none; transform: none; }
.photo-card figcaption { inset: auto 8px 8px auto; min-height: 0; width: auto; padding: 5px 8px; background: #f8f5eccf; color: #464b3e; font: 9px/1.4 "Courier New", monospace; }
.site-footer { min-height: 120px; font: 9px/1.6 "Courier New", monospace; letter-spacing: .08em; }
.site-footer button { padding: 10px 0; border: 0; border-radius: 0; background: transparent; }
.site-footer button:hover { background: transparent; text-decoration: underline; text-underline-offset: 5px; }
.lightbox { margin: 0; background: #20221ef5; }
.lightbox::backdrop { background: #151611d9; backdrop-filter: none; }
.lightbox img { outline: 6px solid #f7f4eb; box-shadow: 0 10px 40px #0005; }
.lightbox figcaption { font-family: "Courier New", monospace; color: #c7c3b7; }
.lightbox__arrow, .lightbox__close { border-color: #d4cebf55; border-radius: 0; }

@media (max-width: 1050px) {
  .header-actions > span { display: none; }
  .intro__quote { width: 80%; }
}
@media (max-width: 680px) {
  :root { --gap: 22px; }
  body { width: calc(100% - 16px); margin: 8px; }
  .site-header { min-height: 79px; padding: 20px 18px; }
  .header-start { gap: 5px; }
  .back-home { width: 22px; }
  .brand { font-size: 20px; }
  .brand span { display: none; }
  .title-lockup { width: 140px; }
  .title-lockup > p { display: block; font-size: 7px; letter-spacing: .06em; }
  .title-lockup .archive-file { font-size: 7px; }
  .header-actions button { min-width: 30px; min-height: 30px; justify-content: center; }
  main { padding-inline: 20px; }
  .intro { padding: 45px 0 26px; }
  .intro__index { font-size: 8px; letter-spacing: .07em; }
  .intro h1 { font-size: 44px; margin: 22px 0 35px; }
  .intro__quote { width: 100%; margin: 0; }
  .intro__quote::before { display: none; }
  .intro__quote p { font-size: 16px; line-height: 1.95; }
  .intro__quote cite { margin-top: 16px; font-size: 13px; }
  .intro__footnote { margin-top: 28px; font-size: 7px; letter-spacing: .015em; }
  .intro__footnote span:last-child { font-size: 9px; letter-spacing: 0; }
  .gallery-grid { padding: 8px 4px 70px; }
  .photo-card button { outline-width: 4px; box-shadow: 0 2px 7px 4px #39312214; }
  .site-footer { min-height: 95px; font-size: 8px; }
  .lightbox { padding-inline: 9px; }
  .lightbox[open] { grid-template-columns: 28px minmax(0, 1fr) 28px; gap: 8px; }
  .lightbox__arrow { width: 28px; height: 36px; border: 0; }
}
