.gallery-page {
  background: #ffffff;
}

.site-main--gallery {
  padding: 0;
  min-height: 100vh;
}

.gallery-detail {
  min-height: 100vh;
  padding: 0 0 96px;
  background: #ffffff;
}

.gallery-detail__inner {
  max-width: 980px;
}

.gallery-detail__back-wrap {
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 100;
}

.gallery-detail__back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.9);
  color: #666666;
  font-size: 0.85rem;
  text-decoration: none;
  backdrop-filter: blur(8px);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.gallery-detail__back-link:hover {
  color: #111111;
  border-color: rgba(0, 0, 0, 0.25);
}

.gallery-detail__header--center {
  text-align: center;
  padding: 48px 24px 40px;
  background: #ffffff;
}

.gallery-detail__header--center h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 500;
  line-height: 1.1;
}

.gallery-detail__header--center .gallery-detail__summary {
  margin: 0 auto;
  max-width: 600px;
  color: #666666;
  font-size: 1rem;
  line-height: 1.6;
}

.gallery-detail__summary {
  margin: 0;
  color: #5f5f57;
  font-size: 1rem;
  line-height: 1.8;
}

.gallery-detail__content {
  display: block;
}

.gallery-detail__content::after {
  content: '';
  display: block;
  clear: both;
}

.gallery-detail__content > * {
  margin: 0;
  max-width: 100%;
}

.gallery-detail__content > * + * {
  margin-top: 24px;
}

.gallery-layout {
  width: min(100%, 980px);
}

.gallery-layout--image-left,
.gallery-layout--image-right {
  display: grid;
  grid-template-columns: minmax(220px, 0.48fr) minmax(0, 0.52fr);
  gap: 28px;
  align-items: start;
}

.gallery-layout--image-right {
  grid-template-columns: minmax(0, 0.52fr) minmax(220px, 0.48fr);
}

.gallery-layout--image-right .gallery-layout__media {
  order: 2;
}

.gallery-layout__media img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 0;
  border-radius: 4px;
  background: #ecece7;
}

.gallery-layout__body > *:first-child,
.gallery-layout__column > *:first-child {
  margin-top: 0;
}

.gallery-layout__body > *:last-child,
.gallery-layout__column > *:last-child {
  margin-bottom: 0;
}

.gallery-layout--columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}

/* 标题样式 */
.gallery-detail__content h1,
.gallery-detail__content h2,
.gallery-detail__content h3 {
  max-width: 760px;
  line-height: 1.3;
  font-weight: 500;
}

.gallery-detail__content h1 {
  font-size: clamp(2rem, 3.5vw, 3rem);
}

.gallery-detail__content h2 {
  font-size: clamp(1.6rem, 2.8vw, 2.2rem);
}

.gallery-detail__content h3 {
  font-size: clamp(1.3rem, 2.2vw, 1.6rem);
}

/* 段落样式 */
.gallery-detail__content p {
  max-width: 760px;
  font-size: 1rem;
  line-height: 1.9;
  color: #333;
}

.gallery-detail__content p:has(> img[data-float="left"]),
.gallery-detail__content p:has(> img[data-float="right"]) {
  display: contents;
}

.gallery-detail__content p.eyebrow {
  color: #b06b2d;
  font-size: 0.72rem;
  letter-spacing: 0.26em;
  text-align: center;
  text-transform: uppercase;
}

/* 引用样式 */
.gallery-detail__content blockquote {
  max-width: 760px;
  padding: 16px 0 16px 24px;
  border-left: 3px solid #111;
  margin: 0;
  color: #555;
  font-size: 1.05rem;
  line-height: 1.8;
  font-style: italic;
}

/* 列表样式 */
.gallery-detail__content ul,
.gallery-detail__content ol {
  max-width: 760px;
  font-size: 1rem;
  line-height: 1.9;
  padding-left: 24px;
}

.gallery-detail__content li {
  margin-top: 8px;
}

.gallery-detail__content li:first-child {
  margin-top: 0;
}

/* 分割线 */
.gallery-detail__content hr {
  width: min(100%, 760px);
  margin: 24px 0;
  border: 0;
  border-top: 1px solid #d7d7cf;
}

/* 链接 */
.gallery-detail__content a {
  color: #111;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.gallery-detail__content a:hover {
  color: #b06b2d;
}

/* 代码块 */
.gallery-detail__content pre,
.gallery-detail__content code {
  background: #f5f5f0;
  border-radius: 4px;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 0.9em;
}

.gallery-detail__content code {
  padding: 2px 6px;
}

.gallery-detail__content pre {
  padding: 16px 20px;
  overflow-x: auto;
}

.gallery-detail__content pre code {
  padding: 0;
  background: none;
}

/* 图片容器 */
.gallery-figure {
  margin: 32px 0;
}

.gallery-figure img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  background: #ecece7;
}

/* 图片宽度 */
.gallery-figure--small {
  width: 33.33%;
}

.gallery-figure--medium {
  width: 50%;
}

.gallery-figure--large {
  width: 66.67%;
}

.gallery-figure--full {
  width: 100%;
}

.gallery-figure--auto {
  width: auto;
  max-width: 100%;
}

/* 图片对齐 */
.gallery-figure--left {
  margin-left: 0;
  margin-right: auto;
}

.gallery-figure--center {
  margin-left: auto;
  margin-right: auto;
}

.gallery-figure--right {
  margin-left: auto;
  margin-right: 0;
}

/* 图片说明 */
.gallery-caption {
  margin-top: 12px;
  font-size: 0.9rem;
  color: #666;
  font-style: italic;
  line-height: 1.6;
  text-align: center;
}

/* 单独的图片 */
.gallery-detail__content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 24px auto;
  border-radius: 4px;
  background: #ecece7;
}

.gallery-detail__content img[data-float="left"],
.gallery-detail__content img[data-float="right"] {
  display: block;
  width: min(100%, var(--gallery-float-width, 420px));
  max-width: 48%;
  margin-top: 6px;
  margin-bottom: 14px;
}

.gallery-detail__content img[data-float="left"] {
  float: left;
  margin-left: 0;
  margin-right: 24px;
}

.gallery-detail__content img[data-float="right"] {
  float: right;
  margin-left: 24px;
  margin-right: 0;
}

.gallery-detail__content h1,
.gallery-detail__content h2,
.gallery-detail__content h3,
.gallery-detail__content blockquote,
.gallery-detail__content ul,
.gallery-detail__content ol,
.gallery-detail__content hr,
.gallery-detail__content .gallery-figure,
.gallery-detail__content .gallery-spacer {
  clear: both;
}

/* 留白 */
.gallery-spacer {
  width: 100%;
}

.gallery-detail__content .spacer {
  display: block;
}

.gallery-detail__content .spacer-s {
  height: 20px;
}

.gallery-detail__content .spacer-m,
.gallery-detail__content .spacer-medium {
  height: 40px;
}

.gallery-detail__content .spacer-l,
.gallery-detail__content .spacer-large {
  height: 80px;
}

/* 空状态 */
.gallery-detail__empty {
  display: grid;
  place-items: center;
  min-height: 240px;
  border: 1px solid #dadad3;
  background: #fafaf7;
  color: #666666;
}

/* 长图模式 */
.gallery-detail__content--long-image {
  padding: 0;
  background: #ffffff;
}

.gallery-detail__long-image {
  display: block;
  width: 100vw;
  max-width: none;
  height: auto;
  margin: 0;
  margin-left: calc(50% - 50vw);
}

/* 响应式 */
@media (max-width: 720px) {
  .gallery-detail {
    padding: 32px 0 72px;
  }

  .gallery-detail__content {
    display: block;
  }

  .gallery-figure {
    margin: 24px 0;
  }

  /* 移动端图片全宽 */
  .gallery-figure--small,
  .gallery-figure--medium,
  .gallery-figure--large {
    width: 100%;
  }

  .gallery-layout--image-left,
  .gallery-layout--image-right,
  .gallery-layout--columns {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .gallery-layout--image-right .gallery-layout__media {
    order: 0;
  }

  .gallery-detail__content img[data-float="left"],
  .gallery-detail__content img[data-float="right"] {
    float: none;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  .gallery-detail__back-wrap {
    top: 16px;
    left: 16px;
  }

  .gallery-detail__header--center {
    padding: 32px 16px 32px;
  }
}
