
.subpage[data-route="projects"]:has(.sub-wrap > weizhi-project-gallery) {
  background: #f3efe5;
  color: #272820;
  padding: clamp(17px, 3.3vw, 54px) clamp(20px, 6vw, 104px) 76px;
}
.sub-wrap:has(> weizhi-project-gallery) { max-width: 1216px; }
.gallery-navigation {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 18px;
}
.gallery-navigation .back, .gallery-navigation .deck-back {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 0;
  color: #515245;
  font-size: 14px;
  line-height: 1.35;
  border-bottom: 1px solid #8e856e;
}
.gallery-navigation .deck-back[hidden] { display: none; }
.sub-wrap:has(> weizhi-project-gallery) > .sub-footer {
  margin-top: clamp(34px, 5vw, 64px);
  padding-top: 16px;
  border-top: 1px solid #c8bfac;
  color: #65604f;
}
weizhi-project-gallery {
  display: block;
  --gallery-line: #c8bfac;
  --gallery-text: #272820;
  --gallery-muted: #545446;
  --gallery-green: #253a32;
}
.gallery-intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px 36px;
  margin-block: clamp(28px, 4.8vw, 68px) clamp(24px, 3vw, 38px);
  padding-bottom: clamp(18px, 2.2vw, 28px);
  border-bottom: 1px solid var(--gallery-line);
}
.gallery-intro-title {
  min-width: 0;
  width: fit-content;
  text-align: center;
}
.gallery-intro h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.65rem, 6.15vw, 5.8rem);
  font-weight: 400;
  letter-spacing: .045em;
  line-height: 1.14;
}
.gallery-intro-en {
  margin: 10px 0 0;
  padding-left: .34em;
  font-family: 'Bahnschrift', 'Avenir Next Condensed', 'Segoe UI Light', 'Helvetica Neue', sans-serif;
  font-size: clamp(15px, 1.45vw, 19px);
  font-weight: 300;
  font-stretch: 82%;
  line-height: 1.35;
  letter-spacing: .34em;
  color: #77705c;
  text-transform: uppercase;
  text-align: center;
}
.gallery-intro-copy {
  flex-shrink: 0;
  text-align: right;
}
.gallery-intro-copy p {
  margin: 0;
  color: var(--gallery-muted);
  line-height: 1.6;
  font-size: 1rem;
}
.gallery-intro-copy .gallery-intro-copy-zh {
  white-space: nowrap;
  margin-right: -.38em;
}
.gallery-intro-copy .gallery-intro-copy-en {
  margin-top: 8px;
  font-size: 12.5px;
  line-height: 1.45;
  letter-spacing: .035em;
  color: #7c7561;
}
.gallery-grid {
  display: grid;
  grid-template-columns: 1.12fr 1fr;
  gap: clamp(18px, 2.2vw, 32px);
}
.gallery-work { min-width: 0; border-bottom: 1px solid var(--gallery-line); }
.work-cover {
  display: block;
  position: relative;
  width: 100%;
  height: clamp(260px, 26vw, 365px);
  border: 1px solid rgba(90, 82, 64, .18);
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  isolation: isolate;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(36, 32, 22, .14);
  transition: box-shadow .28s ease, border-color .28s ease;
}
.work-cover:hover {
  border-color: rgba(37, 58, 50, .38);
  box-shadow: 0 18px 40px rgba(36, 32, 22, .20);
}
.work-cover:focus-visible { outline: 2px solid var(--gallery-green); outline-offset: 4px; }
.cover-galaxy { background: #11151b; }
.cover-galaxy img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 50% 52%;
  transition: transform .55s cubic-bezier(.22, 1, .36, 1);
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .cover-galaxy:hover img { transform: scale(1.035); }
}
.cover-caption {
  position: absolute;
  z-index: 3;
  bottom: 13px;
  left: 15px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 245, 228, .20);
  border-radius: 4px;
  background: rgb(20 24 22 / 72%);
  backdrop-filter: blur(8px);
  color: #fff5e4;
  font-size: 12.5px;
  line-height: 1.2;
  letter-spacing: .08em;
}
.cover-cards {
  background:
    radial-gradient(ellipse at 46% 34%, #bf946377, transparent 54%),
    radial-gradient(ellipse at 88% 72%, #5162889e, transparent 55%),
    repeating-linear-gradient(122deg, #f4c8870e 0 1px, transparent 1px 6px),
    linear-gradient(132deg, #272132, #442f38 47%, #1b283c);
}
.cover-cards::before {
  content: "";
  position: absolute;
  inset: 11px;
  border: 1px solid #f5d69a5e;
  pointer-events: none;
}
.cover-card {
  position: absolute;
  top: var(--y, 16%);
  left: var(--x);
  height: var(--h, 65%);
  aspect-ratio: 9 / 16;
  max-width: 24%;
  transform: translateX(-50%) rotate(var(--tilt));
}
.cover-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 4% / 2.3%;
  box-shadow: 0 12px 24px #10111bb3;
  pointer-events: none;
  transition: transform .28s cubic-bezier(.2,.75,.28,1.25);
}
.cover-card:nth-of-type(1) { --x: 15%; --y: 24%; --h: 54%; --tilt: -19deg; }
.cover-card:nth-of-type(2) { --x: 25%; --y: 18%; --h: 60%; --tilt: -12deg; }
.cover-card:nth-of-type(3) { --x: 36%; --y: 15%; --h: 67%; --tilt: -8deg; z-index: 1; }
.cover-card:nth-of-type(4) { --x: 50%; --y: 10%; --h: 76%; --tilt: 0deg; z-index: 2; }
.cover-card:nth-of-type(5) { --x: 64%; --y: 15%; --h: 67%; --tilt: 8deg; z-index: 1; }
.cover-card:nth-of-type(6) { --x: 75%; --y: 18%; --h: 60%; --tilt: 12deg; }
.cover-card:nth-of-type(7) { --x: 85%; --y: 24%; --h: 54%; --tilt: 19deg; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) { .cover-card:hover img { transform: translateY(-8%) scale(1.035); } }
.work-copy { padding: 18px 0 24px; }
.work-kind {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .18em;
  color: #7b735e;
  font-variant-numeric: tabular-nums;
}
.work-copy h2 { margin: 0; font: 400 clamp(1.5rem, 2.55vw, 2.35rem)/1.28 var(--serif); }
.work-en {
  margin: 5px 0 0;
  font-size: 13px;
  letter-spacing: .08em;
  color: #7a7360;
}
.work-description { margin: 11px 0 0; color: var(--gallery-muted); font-size: 1rem; line-height: 1.72; }
.work-actions { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; margin-top: 16px; }
.dialog-actions a { color: var(--gallery-green); text-decoration: underline; text-underline-offset: 4px; font-size: 14px; }
.work-actions a:not(.work-primary) { color: var(--gallery-green); text-decoration: underline; text-underline-offset: 4px; font-size: 14px; }
.work-primary, .work-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #9c9988;
  border-radius: 5px;
  font: 500 14px/1.25 var(--sans);
  padding: 9px 15px;
  min-height: 40px;
  text-decoration: none;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.work-primary {
  color: #fff7e5;
  background: var(--gallery-green);
  border-color: var(--gallery-green);
  box-shadow: 0 4px 14px rgba(37, 58, 50, .20);
}
.work-primary:hover {
  color: #fffaf0;
  background: #344d43;
  border-color: #344d43;
  box-shadow: 0 6px 18px rgba(37, 58, 50, .28);
}
.work-chip { color: var(--gallery-green); background: rgba(255, 252, 244, .45); }
.work-chip:hover { background: #e6e1d3; border-color: #7c7a69; }
.gallery-dialog {
  width: min(1080px, calc(100% - 28px));
  max-width: none;
  max-height: calc(100% - 28px);
  padding: 0;
  border: 1px solid #aaa290;
  color: var(--gallery-text);
  background: #f3efe5;
}
.gallery-dialog::backdrop { background: #191f1ad1; }
.dialog-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 15px;
  flex-wrap: wrap;
  padding: 11px 14px;
  border-bottom: 1px solid var(--gallery-line);
}
.dialog-bar h2 { margin: 0; font: 400 1.3rem/1.2 var(--serif); }
.dialog-actions { display: flex; align-items: center; gap: 12px; }
.simulator-frame { background: #11151b; }
.simulator-frame iframe { display: block; width: 100%; height: min(74dvh, 680px); border: 0; }
@media (max-width: 960px) {
  .gallery-intro { display: block; margin-top: 26px; }
  .gallery-intro-copy { margin-top: 14px; max-width: none; text-align: left; }
  .gallery-intro-copy .gallery-intro-copy-zh { white-space: normal; margin-right: 0; }
}
@media (max-width: 680px) {
  .gallery-intro br { display: none; }
  .gallery-grid { grid-template-columns: 1fr; gap: 23px; }
  .work-cover { height: auto; aspect-ratio: 1.69; }
  .work-copy { padding-top: 14px; }
}

@keyframes gallery-sub-in { from { opacity: 0; } to { opacity: 1; } }
.subpage[data-route="projects"]:has(.sub-wrap > weizhi-project-gallery) {
  isolation: isolate;
  animation: gallery-sub-in .35s ease;
  background: #ece8dc;
}
.sub-wrap:has(> weizhi-project-gallery) { position: relative; z-index: 1; }
.sub-wrap:has(> weizhi-project-gallery) > .gallery-navigation,
.sub-wrap:has(> weizhi-project-gallery) > .sub-footer {
  position: relative;
  z-index: 1;
}
weizhi-project-gallery { position: relative; }
weizhi-project-gallery > :not(.gallery-backdrop) { position: relative; z-index: 1; }
.gallery-backdrop {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(ellipse 68% 52% at 88% 10%, rgba(196, 174, 132, .22), transparent 62%),
    radial-gradient(ellipse 60% 48% at 10% 88%, rgba(114, 138, 122, .18), transparent 64%),
    radial-gradient(ellipse at 12% 8%, #fff9e6b5, transparent 38rem),
    repeating-linear-gradient(115deg, #7d735607 0 1px, transparent 1px 4px),
    #ece8dc;
}
.gallery-backdrop .backdrop-wash {
  position: absolute;
  inset: -4%;
  background: url("../assets/study-wide.jpg") 52% 45% / cover no-repeat;
  opacity: .065;
  filter: grayscale(.55) sepia(.28) contrast(.92) blur(1px);
  mix-blend-mode: multiply;
  transform: translate3d(calc(var(--bg-px, 0px) * .55), calc(var(--bg-py, 0px) * .55), 0) scale(1.04);
  transition: transform .45s cubic-bezier(.22, 1, .36, 1), opacity .35s ease;
}
.gallery-backdrop .backdrop-art {
  position: absolute;
  inset: -24px;
  width: calc(100% + 48px);
  height: calc(100% + 48px);
  color: #4f4a3c;
  opacity: .16;
  transform: translate3d(var(--bg-px, 0px), var(--bg-py, 0px), 0);
  transition: transform .42s cubic-bezier(.22, 1, .36, 1), opacity .35s ease, color .35s ease;
}
weizhi-project-gallery[data-focus="galaxy"] .gallery-backdrop .backdrop-art {
  opacity: .23;
  color: #2f434a;
}
weizhi-project-gallery[data-focus="cards"] .gallery-backdrop .backdrop-art {
  opacity: .22;
  color: #6b5139;
}
@media (max-width: 680px) {
  .gallery-backdrop .backdrop-wash { opacity: .05; }
  .gallery-backdrop .backdrop-art { opacity: .12; }
}
weizhi-project-gallery [hidden] { display: none !important; }
.deck-heading { margin-block: clamp(21px, 4vw, 52px) 24px; }
.deck-heading h1 { margin: .55rem 0 0; font: 400 clamp(2rem, 5vw, 4.6rem)/1.22 var(--serif); }
.deck-title-en {
  margin: .45rem 0 0;
  font-size: 13.5px;
  letter-spacing: .12em;
  color: #7a7360;
}
.deck-heading p { margin: .65rem 0 0; color: var(--gallery-muted); }
.deck-series-note { max-width: 44rem; line-height: 1.7; }
.deck-back {
  border: 0;
  background: transparent;
  cursor: pointer;
}
.deck-modes {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--gallery-line);
}
.deck-modes .work-chip {
  min-inline-size: clamp(116px, 11vw, 162px);
  min-block-size: 46px;
  font-size: 1rem;
}
.deck-modes button[aria-pressed="true"], .deck-auto[aria-pressed="true"] {
  background: var(--gallery-green);
  color: #fff7e5;
  border-color: var(--gallery-green);
}
.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr));
  gap: clamp(10px, 1.6vw, 22px);
}
.deck-slot {
  min-width: 0;
  border: 1px solid #cbc1ad;
  border-radius: 7px;
  padding: 7px;
  background: rgba(252, 249, 240, .88);
  color: var(--gallery-text);
  text-align: start;
  box-shadow: 0 2px 8px rgba(42, 36, 24, .06);
  transition: transform .22s cubic-bezier(.22, 1, .36, 1), box-shadow .22s ease, border-color .22s ease, background .22s ease;
}
button.deck-slot { cursor: pointer; }
button.deck-slot:hover {
  background: #fffdf7;
  border-color: #8f846b;
  box-shadow: 0 12px 26px rgba(36, 31, 20, .14);
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  button.deck-slot:hover { transform: translateY(-4px); }
}
.deck-slot img, .slot-back {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: contain;
  border-radius: 5px;
  background: #171a23;
}
.slot-caption {
  display: grid;
  gap: 3px;
  color: var(--gallery-muted);
  font-size: 14px;
  padding: 7px 3px 2px;
  line-height: 1.35;
}
.slot-caption strong { font-size: 14px; color: #2f342d; overflow-wrap: anywhere; }
.slot-face { color: #4b554a; font-size: 13px; }
.slot-face.card-face-red { color: #9b392f; }
.slot-empty { background: rgba(235, 230, 216, .76); border-style: dashed; border-color: #bfb6a1; box-shadow: none; }
.slot-back {
  display: grid;
  place-items: center;
  color: #7c7869;
  font: 400 clamp(20px, 3.2vw, 38px)/1 Georgia, serif;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(255, 250, 238, .48), transparent 68%),
    repeating-linear-gradient(135deg, rgba(146, 138, 118, .12) 0 1px, transparent 1px 10px),
    #e2dccb;
}
.deck-single {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(220px, .75fr);
  min-height: 450px;
  border: 1px solid rgba(235, 214, 174, .22);
  border-radius: 10px;
  background: #141720;
  color: #fbf6e9;
  box-shadow: 0 20px 52px rgba(18, 16, 22, .34);
}
.deck-single::before,
.deck-single::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.deck-single::before {
  z-index: -2;
  inset: -64px;
  background: var(--card-ambient, none) center 45% / cover no-repeat;
  filter: blur(54px) saturate(.90);
  opacity: .64;
  transition: background-image .35s ease;
}
.deck-single::after {
  z-index: -1;
  inset: 0;
  background:
    linear-gradient(100deg, #1216210d 10%, #13172138 45%, #121620ee 75%, #121620f6),
    radial-gradient(ellipse at 27% 42%, #ead2a424 0%, transparent 54%, #0d1019c8 100%);
}
.deck-art {
  position: relative;
  display: grid;
  place-items: center;
  margin: 0;
  padding: clamp(12px, 2vw, 26px);
}
.deck-art::before {
  content: "";
  position: absolute;
  inset: 11px;
  border: 1px solid #f6e4c424;
  border-radius: 6px;
  pointer-events: none;
}
.deck-enlarge {
  position: relative;
  display: grid;
  gap: 11px;
  justify-items: center;
  max-width: 100%;
  color: #f3eddb;
  font-size: 13.5px;
  text-decoration: none;
  cursor: zoom-in;
}
.deck-enlarge span {
  padding: 4px 13px;
  border: 1px solid rgba(243, 237, 219, .26);
  border-radius: 999px;
  background: rgba(15, 18, 28, .54);
  backdrop-filter: blur(8px);
  letter-spacing: .04em;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.deck-enlarge:hover span {
  background: rgba(30, 36, 52, .78);
  border-color: rgba(246, 224, 180, .58);
  color: #fffaf0;
}
.deck-enlarge:focus-visible { outline: 2px solid #f3eddb; outline-offset: 5px; }
.deck-art img {
  display: block;
  width: auto;
  max-width: 100%;
  height: min(57dvh, 620px);
  aspect-ratio: 9 / 16;
  object-fit: contain;
  border-radius: 2.5%;
  box-shadow: 0 0 0 1px #fef1da48, 0 22px 52px #070a12c8;
  transition: transform .26s cubic-bezier(.22, 1, .36, 1), box-shadow .26s ease;
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .deck-enlarge:hover img {
    transform: translateY(-3px) scale(1.012);
    box-shadow: 0 0 0 1px #fef1da70, 0 26px 58px #070a12de;
  }
}
.deck-panel {
  align-self: center;
  padding: clamp(18px, 4vw, 48px);
}
.deck-panel .work-kind { color: #e8d6aa; }
.deck-panel h2 {
  margin: 0;
  block-size: 2.4em;
  font: 400 clamp(1.7rem, 3.5vw, 3.1rem)/1.2 var(--serif);
  overflow-wrap: anywhere;
}
#deck-title[tabindex="-1"]:focus, .deck-card-name[tabindex="-1"]:focus { outline: none; }
.deck-panel p { color: #e3decf; }
.deck-panel .deck-card-chinese {
  block-size: 1.5em;
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.5;
}
.deck-panel .deck-card-face {
  block-size: 1.5em;
  margin: 0 0 .6em;
  color: #e8d6aa;
  font-size: 14px;
  line-height: 1.5;
}
.deck-panel .deck-card-face.card-face-red { color: #f2a9a4; }
.deck-card-title {
  block-size: 2.8em;
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.deck-counter { margin: .55rem 0; font-size: 14px; }
.deck-description {
  block-size: 7em;
  padding: .65em .55em .65em 0;
  border-block: 1px solid #97a49360;
  overflow: auto;
  overscroll-behavior: contain;
  font-size: 1rem;
  line-height: 1.6;
  scrollbar-color: #a0a998 transparent;
}
.deck-description p { margin: 0; }
.deck-panel .work-chip { color: #fff5e1; border-color: #d7c39f88; background: #f7e8cc10; }
.deck-panel .work-chip:hover, .deck-panel .work-chip[aria-pressed="true"] { background: #f7e8cc29; }
.deck-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.deck-controls .work-chip { min-inline-size: 70px; white-space: nowrap; }
@media (max-width: 680px) {
  .deck-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .deck-single { grid-template-columns: 1fr; min-height: 0; }
  .deck-single::after {
    background: linear-gradient(180deg, #13172212, #14182126 28%, #141721ed 64%, #141721);
  }
  .deck-panel { padding-right: 60px; }
  .deck-art img { height: 53dvh; }
}

.gallery-navigation-bottom {
  margin-top: clamp(28px, 4vw, 48px);
}
.sub-wrap:has(> weizhi-project-gallery) > .sub-footer.gallery-footer {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid #c8bfac;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px 28px;
  flex-wrap: wrap;
}
.gallery-footer-main { display: grid; gap: 6px; }
.gallery-footer-brand {
  margin: 0;
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: .06em;
  color: #323329;
}
.gallery-footer-motto {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.65;
  color: #5c594b;
}
.gallery-footer-pillars {
  margin: 0;
  font-size: 12px;
  letter-spacing: .16em;
  color: #7c745f;
  text-transform: uppercase;
  white-space: nowrap;
}
@media (max-width: 680px) {
  .sub-wrap:has(> weizhi-project-gallery) > .sub-footer.gallery-footer {
    align-items: flex-start;
  }
  .gallery-footer-pillars {
    white-space: normal;
    line-height: 1.6;
    letter-spacing: .12em;
  }
}
