:root {
  color-scheme: dark;
  --background: #050505;
  --surface: #101010;
  --text: #f3f1ec;
  --muted: rgba(243, 241, 236, .65);
  --line: rgba(243, 241, 236, .14);
  --control: rgba(8, 8, 8, .72);
  --backdrop: rgba(2, 2, 2, .92);
  --font-serif: "Cormorant Garamond", "Noto Serif SC", serif;
  --font-sans: "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

html.light {
  color-scheme: light;
  --background: #f4f2ee;
  --surface: #ffffff;
  --text: #131313;
  --muted: rgba(19, 19, 19, .64);
  --line: rgba(19, 19, 19, .16);
  --control: rgba(247, 245, 241, .8);
  --backdrop: rgba(240, 238, 234, .92);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  transition: background-color .3s ease, color .3s ease;
}

img {
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

.site-header {
  width: min(1240px, calc(100% - 52px));
  margin: 0 auto;
  padding: 42px 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 28px;
}

.site-name {
  display: inline-block;
  color: currentColor;
  text-decoration: none;
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 600;
  letter-spacing: .08em;
  line-height: 1;
}

.site-note {
  width: min(720px, 100%);
  margin: 12px 0 0;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 300;
}

.theme-toggle {
  flex: 0 0 auto;
  width: 54px;
  height: 28px;
  margin-top: 18px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

.theme-dot {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text);
  transform: translateX(0);
  transition: transform .25s ease, background-color .3s ease;
}

html.light .theme-dot { transform: translateX(26px); }
main { width: min(1240px, calc(100% - 52px)); margin: 0 auto; }
.section-heading { margin: 54px 0 28px; }

.section-heading h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  font-weight: 600;
  letter-spacing: .04em;
}

.section-heading::after {
  content: "";
  display: block;
  width: 34px;
  height: 1px;
  margin-top: 16px;
  background: var(--line);
}

.daily-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 34%);
  align-items: center;
  gap: clamp(28px, 5vw, 68px);
}

.daily-photo { margin: 0 auto; width: 100%; }
.daily-photo.vertical-photo { max-width: min(580px, 100%); }
.daily-photo.horizontal-photo { max-width: min(820px, 100%); }

.photo-frame {
  position: relative;
  display: flex;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
}

.frame-backdrop {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(26px) saturate(1.18) brightness(.5);
  transform: scale(1.16);
  transition: filter .45s ease;
  pointer-events: none;
}

.photo-frame:hover .frame-backdrop { filter: blur(26px) saturate(1.24) brightness(.58); }
html.light .frame-backdrop { filter: blur(26px) saturate(1.12) brightness(.66); }
html.light .photo-frame:hover .frame-backdrop { filter: blur(26px) saturate(1.16) brightness(.72); }

.photo-button {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: inherit;
  cursor: zoom-in;
}

.photo-image {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100% - 40px);
  max-height: calc(100% - 40px);
  object-fit: contain;
  box-shadow: 0 18px 54px rgba(0, 0, 0, .45);
  opacity: 0;
  transform: scale(.985);
  transition: opacity .45s ease, transform .5s ease, filter .45s ease;
}

.photo-image.is-loading { filter: blur(16px); transform: scale(1.02); }
.photo-image.is-loaded { opacity: 1; transform: none; }
.photo-frame:hover .photo-image.is-loaded { transform: scale(1.015); }

.daily-photo .photo-frame,
.random-photo .photo-frame { aspect-ratio: 16 / 10; max-height: 74vh; }

.daily-photo.vertical-photo .photo-frame,
.random-photo.vertical-photo .photo-frame { aspect-ratio: 3 / 4; }

.photo-title {
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-size: clamp(1.35rem, 2vw, 1.8rem);
  font-weight: 600;
  line-height: 1.3;
}

.photo-facts {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: .78rem;
  letter-spacing: .08em;
}

.photo-caption { margin: 0; max-width: 54ch; color: var(--muted); font-size: .95rem; }

.browse-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
}

.theme-module { margin-bottom: 48px; }

.theme-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.theme-name {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: .04em;
}

.theme-count { color: var(--muted); font-size: .78rem; letter-spacing: .08em; }

.portrait-lock {
  display: grid;
  gap: 14px;
  justify-items: start;
  padding: 22px;
  border: 1px dashed var(--line);
  background: color-mix(in srgb, var(--surface) 45%, transparent);
}

.portrait-lock .theme-head { border-bottom: 0; padding-bottom: 0; margin-bottom: 0; }
.portrait-lock-desc { margin: 0; color: var(--muted); font-size: .88rem; }

.portrait-lock-row { display: flex; gap: 10px; width: min(380px, 100%); }

.portrait-lock-input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--control);
  color: var(--text);
  font: inherit;
}

.portrait-lock-input:focus { outline: 1px solid var(--text); }

.portrait-lock-button {
  padding: 10px 18px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: background-color .25s ease;
}

.portrait-lock-button:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.portrait-lock-message { margin: 0; color: #e07a6a; font-size: .82rem; }
.portrait-lock.shake { animation: portrait-shake .35s ease; }

@keyframes portrait-shake {
  20% { transform: translateX(-5px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

.browse-tab {
  min-width: 66px;
  padding: 8px 15px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 1.03rem;
  font-family: inherit;
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease;
}

.browse-tab:hover { color: var(--text); }
.browse-tab.active { border-color: var(--line); color: var(--text); }

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: var(--control);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: opacity .2s ease;
}

.icon-button:hover { opacity: .82; }
.icon-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.random-refresh { position: relative; width: 40px; height: 40px; border-radius: 50%; }

.random-refresh span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.random-photo { margin: 0 auto; }
.random-photo.horizontal-photo { width: min(980px, 100%); }
.random-photo.vertical-photo { width: min(580px, 100%); }
.random-photo .photo-meta { max-width: 760px; margin: 22px auto 0; text-align: center; }
.random-photo .photo-caption { margin: 0 auto; }

.group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 24px;
}

.group-card {
  overflow: hidden;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 58%, transparent);
  text-align: left;
  padding: 0;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
}

.group-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.group-thumb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  aspect-ratio: 1 / 1;
}
.group-thumb .frame-backdrop { filter: blur(14px) saturate(1.12) brightness(.52); transform: scale(1.14); }
.group-thumb .photo-image {
  max-width: calc(100% - 12px);
  max-height: calc(100% - 12px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .4);
}
.group-thumb.placeholder { display: grid; place-items: center; color: var(--muted); font-size: .7rem; }
.group-card-info { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 16px 18px; }
.group-name { font-size: 1.02rem; font-weight: 500; }
.group-count { color: var(--muted); font-size: .78rem; white-space: nowrap; }

.expanded-group {
  border: 1px solid var(--line);
  padding: 24px;
  background: color-mix(in srgb, var(--surface) 45%, transparent);
}

.expanded-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 22px; }
.expanded-title { margin: 0; font-size: 1.28rem; font-family: var(--font-serif); font-weight: 600; }

.collapse-button {
  padding: 8px 13px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .82rem;
  cursor: pointer;
}

.photo-grid { columns: 240px 3; column-gap: 20px; }
.gallery-photo {
  position: relative;
  break-inside: avoid;
  margin-bottom: 20px;
}
.gallery-title { margin: 10px 0 3px; font-size: .95rem; font-weight: 500; }
.gallery-facts { margin: 0; color: var(--muted); font-size: .74rem; letter-spacing: .06em; }

.zoom-button {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(10, 10, 10, .82);
  color: #fff;
  cursor: zoom-in;
}

html.light .zoom-button { background: rgba(250, 250, 250, .82); color: #111; }
.zoom-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }

.empty-state {
  max-width: 620px;
  padding: 38px;
  margin: 0 auto;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: .92rem;
}

.site-footer {
  width: min(1240px, calc(100% - 52px));
  margin: 82px auto 0;
  padding: 26px 0 38px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 28px;
  color: var(--muted);
  font-size: .8rem;
}

.site-footer p { margin: 0; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow: hidden;
  opacity: 0;
  transition: opacity .3s ease;
}
.lightbox[hidden] { display: none; }
.lightbox.open { opacity: 1; }

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(60px) saturate(1.3) brightness(.45);
  transform: scale(1.18);
}

html.light .lightbox-backdrop { filter: blur(60px) saturate(1.12) brightness(.92); }

.lightbox-scrim {
  position: absolute;
  inset: 0;
  background: radial-gradient(130% 130% at 50% 38%, rgba(0, 0, 0, .12), rgba(0, 0, 0, .52));
  pointer-events: none;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 4;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 50%;
  background: rgba(8, 8, 8, .45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #fff;
  cursor: pointer;
  transition: background-color .25s ease;
}

.lightbox-close:hover { background: rgba(8, 8, 8, .72); }

html.light .lightbox-close {
  border-color: rgba(19, 19, 19, .22);
  background: rgba(255, 255, 255, .58);
  color: #131313;
}

.lightbox-close svg, .lightbox-nav svg, .random-refresh svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }

.lightbox-nav {
  position: absolute;
  top: 50%;
  z-index: 4;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 50%;
  background: rgba(8, 8, 8, .4);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color .25s ease;
}

.lightbox-nav:hover { background: rgba(8, 8, 8, .7); }
.lightbox-nav[hidden] { display: none; }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

html.light .lightbox-nav {
  border-color: rgba(19, 19, 19, .22);
  background: rgba(255, 255, 255, .58);
  color: #131313;
}

.lightbox-stage {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 64px 84px 28px;
}

.lightbox-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 100%;
  max-height: 100%;
}

.lightbox-frame {
  width: 100%;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

.lightbox-frame.zoomed { cursor: zoom-out; }

.lightbox-frame img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(1160px, 100%);
  max-height: calc(100vh - 212px);
  object-fit: contain;
  box-shadow: 0 32px 110px rgba(0, 0, 0, .6);
  opacity: 0;
  transform: scale(.975);
  transition: opacity .35s ease, transform .4s ease, max-width .35s ease, max-height .35s ease, filter .35s ease;
}

.lightbox-frame img.is-loading { filter: blur(18px); }
.lightbox-frame img.is-loaded { opacity: 1; transform: none; }

.lightbox-frame.zoomed img {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  object-fit: cover;
}

.lightbox-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  width: min(960px, 100%);
  padding: 14px 20px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(8, 8, 8, .5);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  color: #f3f1ec;
}

html.light .lightbox-meta {
  border-color: rgba(19, 19, 19, .16);
  background: rgba(255, 255, 255, .62);
  color: #131313;
}

.lightbox-meta-text { flex: 1; min-width: 0; }
.lightbox-meta h3 { margin: 0 0 4px; font-size: 1.16rem; line-height: 1.35; }
.lightbox-meta p { margin: 0; color: rgba(243, 241, 236, .68); font-size: .8rem; }
.lightbox-meta p + p { margin-top: 3px; }

.lightbox-meta #lightboxCaption {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

html.light .lightbox-meta p { color: rgba(19, 19, 19, .62); }

.download-button {
  flex: none;
  width: auto;
  padding: 9px 20px;
  border: 1px solid rgba(255, 255, 255, .3);
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: .84rem;
  cursor: pointer;
}

.download-button:hover { background: rgba(255, 255, 255, .12); }
html.light .download-button { border-color: rgba(19, 19, 19, .3); }
html.light .download-button:hover { background: rgba(19, 19, 19, .08); }

.lightbox-counter {
  position: absolute;
  bottom: 22px;
  right: 24px;
  z-index: 4;
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  background: rgba(8, 8, 8, .45);
  backdrop-filter: blur(12px);
  color: rgba(255, 255, 255, .85);
  font-size: .76rem;
  letter-spacing: .14em;
}

.lightbox-counter[hidden] { display: none; }

html.light .lightbox-counter {
  border-color: rgba(19, 19, 19, .14);
  background: rgba(255, 255, 255, .6);
  color: rgba(19, 19, 19, .7);
}

@media (max-width: 840px) {
  .site-header { padding-top: 30px; align-items: center; }
  .theme-toggle { margin-top: 0; }
  .section-heading { margin-top: 42px; }
  .daily-layout { grid-template-columns: 1fr; gap: 24px; }
  .daily-photo { max-width: 100%; }
  .daily-photo.vertical-photo .photo-frame,
  .random-photo.vertical-photo .photo-frame { aspect-ratio: 3 / 4; max-height: 78vh; }
  .lightbox-backdrop { filter: blur(42px) saturate(1.2) brightness(.5); }
  html.light .lightbox-backdrop { filter: blur(42px) saturate(1.1) brightness(.94); }
  .lightbox-stage { padding: 62px 14px 24px; }
  .lightbox-frame img { max-height: calc(100vh - 218px); }
  .lightbox-nav { width: 40px; height: 40px; }
  .lightbox-prev { left: 10px; }
  .lightbox-next { right: 10px; }
  .lightbox-meta { gap: 12px; padding: 12px 14px; }
  .lightbox-counter { top: 22px; left: 16px; right: auto; bottom: auto; }
  .site-footer { flex-direction: column; gap: 6px; }
}

@media (max-width: 560px) {
  html, body { font-size: 15px; }
  .site-header, main, .site-footer { width: calc(100% - 34px); }
  .site-name { font-size: 2.15rem; }
  .site-note { font-size: .76rem; }
  .browse-controls { flex-wrap: nowrap; gap: 6px; }
  .browse-tab { min-width: 52px; padding: 7px 8px; font-size: .95rem; }
  .group-grid { grid-template-columns: 1fr; gap: 16px; }
  .photo-grid { columns: 1; }
  .expanded-group { padding: 16px; }
}
