/* CT hub — v0.3 page styles · rules live in DESIGN.md (white gallery + pyramid + refraction) */

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--color-wall);
  color: var(--color-ink);
  font-family: var(--font-ui);
  font-weight: var(--font-weight-regular);
  font-size: var(--text-body);
  line-height: var(--leading-body-zh);
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, p, dl, dt, dd { margin: 0; font-weight: var(--font-weight-regular); }
svg, img { display: block; }

:focus-visible {
  outline: 1px solid var(--color-ink);
  outline-offset: 4px;
  border-radius: 2px;
}

/* ---------- Structure ---------- */

.wrap {
  max-width: var(--page-max-width);
  margin-inline: auto;
  padding-inline: clamp(20px, 5vw, 64px);
}

.section { margin-block: var(--section-gap); }

/* ---------- Shared atoms ---------- */

.label {
  font-size: var(--text-label);
  letter-spacing: 0.02em;
  color: var(--color-ink-soft);
}

.en {
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
}

.section > .label { margin-bottom: var(--space-16); }

/* Ghost link — the only interactive element */
.link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 5px 2px;
  border-radius: var(--radius-link);
  font-size: 13px;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-size: 0% 1px;
  background-position: left bottom;
  transition: background-size 300ms var(--ease-out-soft);
}

.link:hover { background-size: 100% 1px; }

/* ---------- Header — a nameplate, nothing more ---------- */

.site-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-block: var(--space-8);
}

.brand {
  font-family: var(--font-serif);
  font-size: 24px;
  letter-spacing: 0.01em;
}

/* ---------- 序厅 — the entry hall ---------- */

.hall {
  min-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.stage {
  perspective: 1400px;
  width: 320px;
  height: 300px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.tilt {
  transform-style: preserve-3d;
  transform: rotateX(14deg);
}

.pyramid {
  position: relative;
  width: 280px;
  height: 240px;
  transform-style: preserve-3d;
  transform: rotateY(30deg); /* resting pose — two facets visible */
}

.face {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 280px;
  height: 278px;
  transform-origin: 50% 100%;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  backface-visibility: hidden;
  /* 2px base edge so the pyramid meets the plinth crisply */
  background-image: linear-gradient(0deg, rgba(19, 19, 19, 0.16) 0 2px, transparent 2px);
}

.f1 { background-color: var(--color-facet-1); transform: rotateY(0deg)   translateZ(140px) rotateX(30.3deg); }
.f2 { background-color: var(--color-facet-2); transform: rotateY(90deg)  translateZ(140px) rotateX(30.3deg); }
.f3 { background-color: var(--color-facet-3); transform: rotateY(180deg) translateZ(140px) rotateX(30.3deg); }
.f4 { background-color: var(--color-facet-4); transform: rotateY(270deg) translateZ(140px) rotateX(30.3deg); }

.plinth {
  width: min(480px, 74vw);
  height: 1px;
  margin-top: var(--space-4);
  background: var(--color-hairline);
}

.caption { margin-top: var(--space-6); }

/* ---------- 宣言 — wall text ---------- */

.wall-text {
  margin-block: var(--space-50);
  text-align: center;
}

.wall-text .label { margin-bottom: var(--space-12); }

.wall-text .line {
  font-size: clamp(19px, 2.2vw, 27px);
  line-height: 2;
}

/* ---------- 馆藏 — exhibits with plaques ---------- */

.collection { margin-bottom: var(--space-32); }

.exhibit {
  position: relative;
  display: grid;
  grid-template-columns: 72px 1fr auto;
  align-items: end;
  gap: var(--space-8);
  padding-block: var(--exhibit-padding);
  border-top: 1px solid var(--color-hairline);
  transition: background-color var(--duration-ui) var(--ease-out-soft);
}

.collection-end { border-top: 1px solid var(--color-hairline); }

a.exhibit:hover { background-color: var(--color-facet-1); }

/* the single chromatic event — lit only by downward scroll (see gallery.js) */
.exhibit .refraction {
  position: absolute;
  inset: 0;
  background: var(--gradient-refraction);
  opacity: 0;
  pointer-events: none;
}

.exhibit .no,
.exhibit .work,
.exhibit .plaque { position: relative; }

.exhibit .no { padding-bottom: 10px; }

.work { display: flex; flex-direction: column; gap: var(--space-4); }

.work .glyph { width: 24px; height: 24px; }

.work h2 {
  font-size: var(--text-display);
  line-height: var(--leading-display);
  letter-spacing: var(--tracking-display);
  text-transform: uppercase;
}

.work .note {
  font-size: 15px;
  color: var(--color-ink-soft);
}

/* 说明牌 — museum plaque */
.plaque {
  align-self: end;
  min-width: 200px;
  border-top: 1px solid var(--color-hairline);
  padding-top: var(--space-4);
  font-size: var(--text-plaque);
  line-height: 1.7;
  color: var(--color-ink-soft);
}

.plaque > div {
  display: flex;
  justify-content: space-between;
  gap: var(--space-8);
}

.plaque .en { font-size: 10px; margin-left: 6px; }

.exhibit .enter {
  position: absolute;
  right: 0;
  top: var(--space-6);
  opacity: 0;
  transition: opacity var(--duration-ui) var(--ease-out-soft);
}

a.exhibit:hover .enter { opacity: 1; }

.exhibit.pending { opacity: 0.45; }

/* ---------- Footer ---------- */

.site-foot {
  margin-top: var(--space-50);
  border-top: 1px solid var(--color-hairline);
  padding-block: var(--space-12);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-6);
}

.site-foot .brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.site-foot .mark { width: 20px; height: 20px; }

.site-foot .meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-6);
  font-size: var(--text-plaque);
  color: var(--color-ink-soft);
}

/* ---------- Responsive ---------- */

@media (max-width: 820px) {
  .hall { min-height: 80vh; }
  .stage { transform: scale(0.7); transform-origin: bottom center; }
  .exhibit { grid-template-columns: 48px 1fr; }
  .plaque { grid-column: 2; justify-self: start; min-width: 240px; margin-top: var(--space-6); }
  .exhibit .enter { display: none; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .exhibit, .link, .enter { transition: none; }
  /* gallery.js checks the same query — pyramid rests, refraction never lights */
}
