* { box-sizing: border-box; }

:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: rgba(247, 239, 222, .9);
  --muted: rgba(236, 226, 207, .62);
  --line: rgba(236, 226, 207, .2);
  --glass: rgba(20, 15, 12, .78);
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: #17120f;
}

body {
  overflow: hidden;
  color: var(--ink);
}

button,
a { font: inherit; }

button { color: inherit; }

.gallery {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100svh;
  min-height: 520px;
  overflow: hidden;
  isolation: isolate;
  background: #17120f;
}

.gallery-background,
.gallery-grade,
.cloth-canvas {
  position: absolute;
  inset: 0;
}

.gallery-background {
  z-index: 0;
  background-image: url("./assets/展示室.png");
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  transform: scale(1.002);
}

.gallery-grade {
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 47%, rgba(255, 247, 226, .02) 0 27%, rgba(15, 10, 8, .08) 66%, rgba(10, 7, 6, .28) 100%),
    linear-gradient(180deg, rgba(8, 5, 4, .12), transparent 25%, transparent 72%, rgba(8, 5, 4, .24));
}

.cloth-canvas {
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.masthead {
  position: absolute;
  z-index: 12;
  top: max(22px, env(safe-area-inset-top));
  left: max(24px, env(safe-area-inset-left));
  right: max(24px, env(safe-area-inset-right));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  pointer-events: none;
}

.identity {
  display: grid;
  gap: 7px;
  pointer-events: auto;
}

.lab-link,
.work-title,
.plain-button,
.live-readout,
.panel-kicker,
.mapping-list dt,
.data-strip span {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  text-transform: uppercase;
  letter-spacing: .14em;
}

.lab-link {
  width: fit-content;
  color: rgba(248, 239, 220, .7);
  font-size: 9px;
  font-weight: 700;
  text-decoration: none;
  text-shadow: 0 1px 10px rgba(0, 0, 0, .4);
}

.lab-link:hover,
.lab-link:focus-visible { color: #fff7e7; }

.work-title {
  color: rgba(248, 239, 220, .9);
  font-size: 12px;
  font-weight: 650;
  text-shadow: 0 1px 12px rgba(0, 0, 0, .44);
}

.masthead-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.plain-button {
  min-width: 45px;
  height: 31px;
  padding: 0 10px;
  border: 1px solid rgba(249, 239, 220, .24);
  border-radius: 999px;
  background: rgba(20, 15, 12, .42);
  backdrop-filter: blur(10px);
  color: rgba(249, 239, 220, .8);
  font-size: 8px;
  font-weight: 750;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.plain-button:hover,
.plain-button:focus-visible {
  border-color: rgba(255, 246, 228, .52);
  background: rgba(20, 15, 12, .64);
  color: #fff8e9;
  outline: none;
}

.live-readout {
  position: absolute;
  z-index: 10;
  left: max(24px, env(safe-area-inset-left));
  bottom: max(34px, calc(env(safe-area-inset-bottom) + 34px));
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: calc(100vw - 48px);
  color: rgba(244, 233, 214, .66);
  font-size: 8px;
  font-weight: 700;
  line-height: 1.5;
  text-shadow: 0 1px 10px rgba(0, 0, 0, .55);
}

.status-dot {
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #d6ab70;
  box-shadow: 0 0 10px rgba(214, 171, 112, .5);
}

.status-dot.is-live {
  background: #dfe5c8;
  box-shadow: 0 0 10px rgba(223, 229, 200, .6);
}

.status-dot.is-stale {
  background: #b98e6a;
  box-shadow: 0 0 10px rgba(185, 142, 106, .48);
}

.info-panel {
  position: absolute;
  z-index: 30;
  top: 0;
  right: 0;
  width: min(430px, 100vw);
  height: 100%;
  overflow-y: auto;
  padding: max(76px, calc(env(safe-area-inset-top) + 68px)) 36px max(38px, calc(env(safe-area-inset-bottom) + 28px));
  border-left: 1px solid rgba(247, 236, 216, .14);
  background: linear-gradient(180deg, rgba(19, 14, 11, .91), rgba(12, 9, 8, .96));
  backdrop-filter: blur(22px) saturate(.85);
  box-shadow: -24px 0 70px rgba(0, 0, 0, .18);
}

.info-panel[hidden] { display: none; }

.panel-close {
  position: absolute;
  top: max(22px, env(safe-area-inset-top));
  right: max(24px, env(safe-area-inset-right));
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(247, 236, 216, .18);
  border-radius: 50%;
  background: transparent;
  color: rgba(247, 236, 216, .74);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.panel-close:hover,
.panel-close:focus-visible {
  border-color: rgba(247, 236, 216, .44);
  color: #fff7e7;
  outline: none;
}

.panel-kicker {
  margin: 0 0 16px;
  color: rgba(228, 203, 165, .72);
  font-size: 9px;
  font-weight: 750;
}

.info-panel h2 {
  margin: 0;
  color: #f5ecdc;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 400;
  line-height: 1.16;
  letter-spacing: -.025em;
}

.info-panel > p:not(.panel-kicker):not(.source-note) {
  margin: 22px 0 0;
  color: rgba(238, 228, 210, .72);
  font-size: 13px;
  line-height: 1.9;
}

.mapping-list {
  margin: 30px 0 0;
  border-top: 1px solid var(--line);
}

.mapping-list div {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.mapping-list dt,
.mapping-list dd { margin: 0; }

.mapping-list dt {
  color: rgba(224, 194, 151, .72);
  font-size: 8px;
  font-weight: 800;
}

.mapping-list dd {
  color: rgba(243, 233, 216, .76);
  font-size: 12px;
  line-height: 1.55;
}

.data-strip {
  display: grid;
  gap: 10px;
  margin-top: 26px;
  padding: 16px;
  border: 1px solid rgba(244, 230, 207, .14);
  background: rgba(255, 248, 234, .035);
}

.data-strip div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
}

.data-strip span {
  color: rgba(231, 211, 181, .56);
  font-size: 7px;
  font-weight: 800;
}

.data-strip strong {
  color: rgba(247, 237, 220, .82);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .05em;
}

.source-note {
  margin: 24px 0 0;
  color: rgba(230, 219, 199, .52);
  font-size: 10px;
  line-height: 1.75;
}

.info-panel a {
  color: rgba(242, 218, 181, .8);
  text-decoration-color: rgba(242, 218, 181, .26);
  text-underline-offset: 4px;
}

.site-legal--012 {
  right: max(24px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  color: rgba(239, 226, 204, .46);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 760px) {
  .gallery { min-height: 480px; }

  .masthead {
    top: max(15px, env(safe-area-inset-top));
    left: max(15px, env(safe-area-inset-left));
    right: max(15px, env(safe-area-inset-right));
  }

  .work-title { font-size: 10px; }
  .lab-link { font-size: 8px; }

  .plain-button {
    min-width: 42px;
    height: 29px;
    padding: 0 9px;
  }

  .live-readout {
    left: max(15px, env(safe-area-inset-left));
    right: max(15px, env(safe-area-inset-right));
    bottom: max(42px, calc(env(safe-area-inset-bottom) + 42px));
    max-width: none;
    flex-wrap: wrap;
    row-gap: 2px;
    font-size: 7px;
  }

  .info-panel {
    width: 100%;
    padding-left: 24px;
    padding-right: 24px;
    border-left: 0;
  }

  .mapping-list div { grid-template-columns: 100px 1fr; }

  .site-legal--012 {
    right: max(15px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
    font-size: 7px;
  }
}

@media (max-aspect-ratio: 3 / 4) {
  .gallery-background { background-position: center center; }
}

@media (prefers-reduced-motion: reduce) {
  .plain-button { transition: none; }
}
