:root {
  --ink: #1d2926;
  --muted: #5e665f;
  --paper: #f4f1e9;
  --paper-deep: #e7e2d5;
  --green: #243832;
  --red: #a04633;
  --gold: #b69057;
  --line: #c9c5b9;
  --content: 1280px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

button { font: inherit; }

.site-header {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 max(24px, calc((100% - var(--content)) / 2));
  color: #fff;
  background: var(--green);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.brand__mark {
  width: 17px;
  height: 17px;
  display: inline-block;
  border: 2px solid var(--gold);
  border-top-width: 5px;
  transform: rotate(45deg);
}

.header-actions { display: flex; align-items: center; gap: 18px; }

.header-count { color: #dbe0d8; font-size: 13px; white-space: nowrap; }

.share-button {
  min-height: 34px;
  padding: 0 12px;
  color: #fff;
  background: transparent;
  border: 1px solid #aebbb3;
  border-radius: 3px;
  cursor: pointer;
}

.share-button:hover, .share-button:focus-visible {
  color: var(--green);
  background: #fff;
  border-color: #fff;
}

.intro, .viewer, .gallery { width: min(var(--content), calc(100% - 48px)); margin-inline: auto; }

.intro { padding: 74px 0 36px; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--red);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
}

h1, h2, p { margin-top: 0; }

.intro h1, .gallery h2, .viewer h2 {
  margin-bottom: 0;
  font-family: Georgia, "Noto Serif SC", "SimSun", serif;
  font-weight: 700;
  letter-spacing: 0;
}

.intro h1 { font-size: clamp(36px, 6vw, 62px); line-height: 1.12; }

.intro p:last-child { margin: 14px 0 0; color: var(--muted); font-size: 16px; }

.viewer { padding-top: 18px; border-top: 1px solid var(--line); }

.viewer__meta {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.viewer__index { margin-bottom: 2px; color: var(--red); font-size: 12px; font-weight: 700; letter-spacing: 1px; }

.viewer h2 { font-size: 25px; line-height: 1.2; }

.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }

.view-toggle__button {
  min-width: 64px;
  min-height: 34px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  cursor: pointer;
}

.view-toggle__button:last-child { border-right: 0; }
.view-toggle__button:hover { color: var(--green); background: #ebe8df; }
.view-toggle__button.is-active { color: #fff; background: var(--green); }

.comparison {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  margin: 0;
  overflow: hidden;
  background: #d8d7d1;
  isolation: isolate;
}

.comparison__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  user-select: none;
}

.comparison__after {
  position: absolute;
  inset: 0;
  z-index: 1;
  clip-path: inset(0 0 0 var(--split));
}

.comparison__guide {
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  left: var(--split);
  width: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 18%);
  pointer-events: none;
}

.comparison__label {
  position: absolute;
  top: 18px;
  min-width: 58px;
  padding: 4px 8px;
  color: #fff;
  background: rgb(19 28 25 / 78%);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  white-space: nowrap;
}

.comparison__label--before { right: 14px; }
.comparison__label--after { left: 14px; background: var(--red); }

.comparison__handle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: #fff;
  border: 1px solid rgb(0 0 0 / 18%);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgb(0 0 0 / 22%);
}

.comparison__handle i { width: 2px; height: 14px; display: block; background: var(--green); }

.comparison__range {
  position: absolute;
  z-index: 3;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: col-resize;
  opacity: 0;
}

.comparison__range:focus-visible { opacity: 1; outline: 3px solid var(--gold); outline-offset: -3px; }

.comparison[data-view="before"] .comparison__after { display: none; }
.comparison[data-view="before"] .comparison__guide { left: 100%; }
.comparison[data-view="after"] .comparison__before { visibility: hidden; }
.comparison[data-view="after"] .comparison__after { clip-path: none; }
.comparison[data-view="after"] .comparison__guide { left: 100%; }
.comparison:not([data-view="compare"]) .comparison__range { pointer-events: none; }

.viewer__controls {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.viewer__controls p { min-width: 150px; margin: 0; color: var(--muted); font-size: 13px; text-align: center; }

.arrow-button {
  width: 36px;
  height: 36px;
  color: var(--green);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  font-size: 21px;
  line-height: 1;
}

.arrow-button:hover, .arrow-button:focus-visible { color: #fff; background: var(--green); border-color: var(--green); }

.gallery { padding: 78px 0 88px; }
.gallery__heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 24px; }
.gallery h2 { margin: 0; font-size: 31px; }

.gallery__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }

.thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  color: #fff;
  background: #dedbd2;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 220ms ease; }
.thumb__after { position: absolute; inset: 0; clip-path: inset(0 0 0 51%); }
.thumb:hover img, .thumb:focus-visible img { transform: scale(1.04); }
.thumb::after { content: ""; position: absolute; inset: 0; border: 3px solid transparent; pointer-events: none; }
.thumb.is-active::after { border-color: var(--red); }

.thumb__caption {
  position: absolute;
  z-index: 1;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 18px 13px 10px;
  background: linear-gradient(transparent, rgb(20 28 25 / 85%));
  font-size: 13px;
  text-align: left;
}

.thumb__caption span:first-child { font-family: Georgia, "Noto Serif SC", "SimSun", serif; font-size: 15px; }
.thumb__caption span:last-child { color: #e8c896; font-size: 11px; }

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 22px max(24px, calc((100% - var(--content)) / 2));
  color: #d9e0d8;
  background: var(--green);
  font-size: 12px;
}

.toast {
  position: fixed;
  z-index: 10;
  bottom: 22px;
  left: 50%;
  max-width: calc(100% - 40px);
  padding: 10px 14px;
  color: #fff;
  background: var(--green);
  border: 1px solid #60736c;
  border-radius: 3px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 22%);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 720px) {
  .site-header { min-height: 58px; padding-inline: 18px; }
  .brand { font-size: 14px; }
  .brand__mark { width: 14px; height: 14px; }
  .header-count { display: none; }
  .header-actions { gap: 0; }
  .share-button { min-height: 31px; padding-inline: 9px; font-size: 12px; }
  .intro, .viewer, .gallery { width: min(100% - 32px, var(--content)); }
  .intro { padding: 48px 0 26px; }
  .intro h1 { font-size: 40px; }
  .intro p:last-child { font-size: 14px; }
  .viewer__meta { min-height: 108px; align-items: start; flex-direction: column; gap: 13px; padding: 18px 0; }
  .viewer h2 { font-size: 22px; }
  .view-toggle { width: 100%; }
  .view-toggle__button { flex: 1; min-width: 0; padding-inline: 4px; }
  .comparison__label { top: 10px; font-size: 11px; }
  .comparison__label--before { right: 9px; }
  .comparison__label--after { left: 9px; }
  .comparison__handle { width: 32px; height: 32px; }
  .viewer__controls { min-height: 60px; }
  .gallery { padding: 52px 0 58px; }
  .gallery h2 { font-size: 27px; }
  .gallery__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .thumb__caption { padding: 14px 9px 7px; }
  .thumb__caption span:first-child { font-size: 13px; }
  .thumb__caption span:last-child { display: none; }
  .site-footer { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
