:root {
  --nav-h: 52px;
  --mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --serif: 'Iowan Old Style', 'Songti SC', 'Noto Serif SC', 'SimSun', Georgia, serif;
  --sans: system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;

  --bg: #f6f5f0;
  --surface: #ffffff;
  --surface-alt: #efeee8;
  --ink: #141413;
  --muted: #5c5b57;
  --line: #dfddd4;
  --line-strong: #141413;
  --accent: #1b4332;
  --accent-hover: #123123;
  --accent-ink: #ffffff;
  --plate-border: #ffffff;
  --plate-shadow: 0 18px 38px rgba(20, 20, 19, .13), 0 2px 6px rgba(20, 20, 19, .06);
  --badge-bg: rgba(246, 245, 240, .92);
  --badge-ink: #242522;
  --demo-bg: rgba(22, 24, 21, .82);
  --demo-ink: #f2f1eb;
  --dialog-backdrop: rgba(20, 20, 19, .54);
  --grid-copy-alpha: 1;
  --grid-copy-y: 0px;
  --filters-alpha: 1;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--nav-h) + 64px); background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--sans);
  overflow-x: clip;
}
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; }
a:hover, button:not(.primary):hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1, h2, h3 { font-family: var(--serif); }
svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.45; }
kbd, .folio, time, .ledger dd, #matches, .cover small, .custom b {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
kbd { font-size: 11px; color: var(--muted); }

.wrap { width: min(1240px, calc(100% - 72px)); margin-inline: auto; }

/* Top bar */
.top {
  position: sticky;
  z-index: 6;
  top: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.nav {
  height: var(--nav-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  font-size: 13px;
}
.nav > a { justify-self: start; }
.nav-name { font: 12px var(--mono); color: var(--muted); letter-spacing: .04em; }
.nav-tools { justify-self: end; display: flex; align-items: center; gap: 15px; min-width: 0; }
.nav-tools > span {
  border-left: 1px solid var(--line);
  padding-left: 15px;
  max-width: 18ch;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.nav-tools a { display: inline-flex; align-items: center; min-height: 40px; }
.nav-tools button, .search { display: flex; align-items: center; gap: 7px; }
.nav-tools button { min-height: 40px; }

/* ============================================================
   STAGE 1: Full-Screen Editorial Hero
   Left: tilted 2-col counter-scrolling marquee of club covers
   Right: oversized display typography & countdown ledger
   ============================================================ */
.hero-stage {
  position: relative;
  height: calc(100vh - var(--nav-h));
  height: calc(100svh - var(--nav-h));
  min-height: 540px;
  max-height: 1080px;
  overflow: clip;
  border-bottom: 1px solid var(--line);
}
.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(0, .88fr);
  height: 100%;
  width: 100%;
  max-width: 1680px;
  margin-inline: auto;
}

/* Left tilted 2-column marquee wall */
.marquee-stage {
  position: relative;
  height: 100%;
  overflow: hidden;
  -webkit-mask-image:
    linear-gradient(180deg, transparent 0%, #000 10%, #000 90%, transparent 100%),
    linear-gradient(90deg, #000 0%, #000 84%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(180deg, transparent 0%, #000 10%, #000 90%, transparent 100%),
    linear-gradient(90deg, #000 0%, #000 84%, transparent 100%);
  mask-composite: intersect;
}
.marquee-tilt {
  position: absolute;
  inset: -14% -4% -14% -6%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(14px, 1.6vw, 24px);
  padding-inline: clamp(16px, 2.6vw, 40px);
  transform: rotate(-11deg);
  transform-origin: center center;
}
.marquee-col {
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 1.6vw, 24px);
  will-change: transform;
}
.marquee-tile {
  position: relative;
  flex: none;
  aspect-ratio: 16 / 10;
  border-radius: 3px;
  overflow: hidden;
  contain: layout style paint;
  background: var(--theme, #354139);
  border: 3px solid var(--plate-border);
  box-shadow: var(--plate-shadow);
  transition: opacity .16s linear;
}
.marquee-tile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.marquee-tile::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 58%, rgba(12, 14, 13, .62) 100%);
  pointer-events: none;
}
.marquee-caption {
  position: absolute;
  left: 11px;
  right: 11px;
  bottom: 8px;
  z-index: 1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: #f7f6f0;
  font-size: 12px;
  font-weight: 600;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .55);
}
.marquee-caption small {
  font: 500 10px/1 var(--mono);
  letter-spacing: .08em;
  opacity: .84;
  white-space: nowrap;
}
.marquee-tile.is-flying-source { visibility: hidden; }
.marquee-tile.is-secondary-fade { opacity: var(--secondary-marquee-alpha, 1); }

/* Right oversized editorial copy */
.hero-copy {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(24px, 4vw, 60px) clamp(28px, 5vw, 76px) clamp(24px, 3vw, 48px) clamp(16px, 2.5vw, 40px);
  will-change: transform, opacity;
}
.eyebrow {
  margin-bottom: 18px;
  font: 500 11px/1.6 var(--mono);
  letter-spacing: .12em;
  color: var(--accent);
}
#title { font-weight: 600; }
.title-en {
  display: block;
  font: italic 400 clamp(26px, 2.9vw, 48px)/1.05 Georgia, 'Times New Roman', serif;
  letter-spacing: -.04em;
  color: var(--accent);
  margin-bottom: 8px;
}
.title-zh {
  display: block;
  font: 600 clamp(46px, 5.4vw, 90px)/1.08 var(--serif);
  letter-spacing: -.055em;
}
.ledger {
  margin-top: 36px;
  max-width: 420px;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, .85fr);
  gap: 20px;
  padding-block: 14px;
  border-block: 1px solid var(--line);
}
.ledger div { display: flex; flex-direction: column; gap: 4px; }
.ledger dt { font-size: 11px; color: var(--muted); letter-spacing: .04em; }
.ledger dd {
  color: var(--accent);
  font-size: clamp(18px, 1.7vw, 26px);
  line-height: 1.25;
  white-space: nowrap;
}
.ledger dd small { font-size: 12px; color: var(--muted); }
.ledger dd.event-label { font-size: 14px; }

/* ============================================================
   FLIP Flight Layer (fixed viewport overlay during scroll 0 -> 1)
   ============================================================ */
.flight-layer {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}
.flight-card {
  position: fixed;
  top: 0;
  left: 0;
  transform-origin: center center;
  will-change: transform, opacity;
  contain: layout style paint;
  overflow: hidden;
  border-radius: 3px;
  background: var(--theme, #354139);
  box-shadow: var(--plate-shadow);
}
.flight-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 58%, rgba(12, 14, 13, .62) 100%);
  opacity: var(--flight-caption-alpha, 0);
  pointer-events: none;
}
.flight-card .marquee-caption {
  opacity: var(--flight-caption-alpha, 0);
}
.flight-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cover img[src*="wordmark.png"],
.marquee-tile img[src*="wordmark.png"],
.flight-card img[src*="wordmark.png"] {
  object-fit: contain;
  background: #eee4e0;
  padding: 6%;
}

/* ============================================================
   STAGE 2: Sticky Filter Bar & Light Gallery 3-Column Grid
   ============================================================ */
.catalog-shell { position: relative; z-index: 2; }
.filters-bar {
  position: sticky;
  top: var(--nav-h);
  z-index: 3;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
body.is-flying .filters-bar { opacity: var(--filters-alpha); }
.filters, .tools, .categories { display: flex; align-items: center; }
.filters { justify-content: space-between; gap: 20px; min-height: 62px; }
.categories { align-self: stretch; gap: 18px; overflow: auto; }
.categories button {
  align-self: stretch;
  white-space: nowrap;
  border-block: 2px solid transparent;
  font-size: 14px;
  color: var(--muted);
}
.categories [aria-pressed="true"] {
  border-bottom-color: var(--accent);
  font-weight: 650;
  color: var(--accent);
}
.tools { gap: 15px; }
.tools label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  white-space: nowrap;
  min-height: 40px;
  cursor: pointer;
  color: var(--muted);
}
.tools .search {
  border-bottom: 1px solid var(--line);
  min-height: 32px;
  width: 220px;
  cursor: text;
}
.search input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 100%;
  min-width: 0;
  padding: 5px 0;
  font-size: 13px;
  color: var(--ink);
}
.search input::placeholder { color: var(--muted); opacity: .82; }
.search:focus-within { border-bottom-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 3px; }
.search svg { flex: none; color: var(--muted); }

.exhibits { padding-top: 28px; }
.list-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 22px;
}
.list-line h2 { font-size: 21px; font-weight: 600; }
.list-line h2 span { font: italic 16px Georgia, serif; color: var(--muted); margin-left: 6px; }
#matches { font-size: 12px; color: var(--muted); }
#notice { padding: 26px 0; color: var(--muted); }
#notice button { margin-left: .75em; text-decoration: underline; color: var(--accent); }

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 38px 26px;
}

/* Light Gallery Card: cover dominates, crisp name + one-liner beneath, whisper-light action row */
.card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: transparent;
}
.cover {
  position: relative;
  display: block;
  isolation: isolate;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  border-radius: 2px;
  background: var(--theme, #45534a);
  color: #ffffff;
  border: 1px solid var(--line);
}
.cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .42s cubic-bezier(.16, 1, .3, 1);
}
.card:hover .cover img { transform: scale(1.035); }
.cover .badges {
  position: absolute;
  inset: 10px 10px auto;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 8px;
  z-index: 1;
}
.demo {
  padding: 2px 7px;
  font: 11px/1.5 var(--sans);
  backdrop-filter: blur(6px);
  background: var(--demo-bg);
  color: var(--demo-ink);
  border: 1px solid rgba(255, 255, 255, .32);
}
.initials {
  position: absolute;
  inset: 0;
  display: grid;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font: italic clamp(84px, 9vw, 148px)/1 Georgia, serif;
  letter-spacing: -.11em;
  color: rgba(255, 255, 255, .92);
  background: repeating-linear-gradient(90deg, transparent 0 12.3%, rgba(255, 255, 255, .13) 12.4% 12.5%);
}
.initials:after {
  content: '';
  position: absolute;
  width: 38%;
  height: 130%;
  border-inline: 1px solid rgba(255, 255, 255, .4);
  transform: rotate(31deg);
  left: 33%;
}
.cover small {
  position: absolute;
  inset: auto 12px 10px;
  font-size: 10px;
  letter-spacing: .12em;
  opacity: .88;
}

body.is-flying .card .cover { opacity: 0; }
body.is-flying .card .copy,
body.is-flying .card .actions {
  opacity: var(--grid-copy-alpha);
  transform: translate3d(0, var(--grid-copy-y), 0);
  will-change: opacity, transform;
}

.copy {
  padding: 14px 0 10px;
  flex: 1;
}
.card-identity {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.card-names {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 9px;
  min-width: 0;
}
.card h3 {
  font-size: clamp(20px, 1.65vw, 24px);
  line-height: 1.24;
  font-weight: 600;
  letter-spacing: -.03em;
  overflow-wrap: anywhere;
}
.name-en {
  color: var(--muted);
  font: italic 14px/1.35 Georgia, serif;
  overflow-wrap: anywhere;
}
.category {
  flex: none;
  font: 11px/1.5 var(--sans);
  white-space: nowrap;
  color: var(--muted);
  letter-spacing: .02em;
}
.slogan {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 7px 0 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--muted);
}
.booth {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  opacity: .88;
}
.flag { font-weight: 600; color: var(--ink); }
.flag:before { content: '＋'; color: var(--accent); margin-right: 2px; }

.actions {
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
}
.actions a, .actions button {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
}
.actions button { color: var(--muted); }
.actions button:hover { color: var(--ink); }
.actions a { color: var(--accent); font-weight: 600; }

/* Open submission card */
.custom {
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px dashed var(--line);
  border-radius: 2px;
  background: var(--surface-alt);
  scroll-margin-top: 72px;
}
.custom-inner { padding: 28px clamp(18px, 2vw, 28px); }
.sheet-mark { position: absolute; right: 14px; top: 8px; color: var(--muted); font: 23px var(--mono); }
.folio { font-size: 12px; color: var(--muted); }
.custom h3 {
  font-size: clamp(22px, 2vw, 29px);
  line-height: 1.32;
  margin: 14px 0 10px;
  max-width: 12em;
  font-weight: 500;
}
.custom ul { font-size: 13px; color: var(--muted); list-style: none; padding: 0; margin: 16px 0 22px; }
.custom li { border-top: 1px solid var(--line); padding: 6px 0; }
.custom small { display: block; font-size: 12px; color: var(--muted); margin-top: 10px; }
.primary {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 10px 14px;
  min-height: 42px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 600;
}
.primary:hover { background: var(--accent-hover); color: var(--accent-ink); text-decoration: none; }
.copy-state { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
#manual { display: block; font-size: 12px; margin-top: 8px; }
textarea { width: 100%; font-size: 12px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); }

/* Footer */
.foot {
  border-top: 1px solid var(--line);
  margin-top: 64px;
  padding: 24px 0 40px;
  color: var(--muted);
  font-size: 12px;
}
.foot p { max-width: 88ch; }
.foot small { display: block; margin-top: 7px; font-size: 11px; }

/* Contact Modal */
dialog {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  max-width: min(440px, calc(100% - 30px));
  width: 100%;
  padding: 22px;
  max-height: 85dvh;
  overflow: auto;
}
dialog::backdrop { background: var(--dialog-backdrop); }
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  margin-bottom: 17px;
  color: var(--muted);
  font-size: 12px;
}
.dialog-head button { min-height: 34px; }
dialog h2 { font-size: 30px; }
#contact-en { font: italic 18px Georgia, serif; color: var(--muted); }
dialog section {
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding-top: 12px;
  font-size: 14px;
  overflow-wrap: anywhere;
}
dialog section h3 { font: bold 14px var(--sans); margin-bottom: 7px; }
dialog section a { display: block; text-decoration: underline; margin-top: 6px; color: var(--accent); }
dialog section img { width: 160px; max-width: 100%; display: block; }
dialog .private-id { font: 600 18px var(--mono); }
body:has(dialog[open]) { overflow: hidden; }

/* ============================================================
   Responsive Breakpoints (1100 / 900 / 620 / 390)
   ============================================================ */
@media (max-width: 1100px) {
  .filters { flex-wrap: wrap; gap: 0; padding-bottom: 9px; }
  .categories { min-height: 46px; }
  .tools { justify-content: flex-end; margin-left: auto; }
  .grid { gap: 30px 18px; }
  .hero-inner { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); }
}

@media (max-width: 900px) {
  .wrap { width: calc(100% - 44px); }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 20px; }
  .filters { align-items: stretch; flex-flow: column nowrap; }
  .categories, .tools { min-width: 0; max-width: 100%; }
  .tools { margin: 4px 0 0; justify-content: flex-start; }
  .search { margin-left: auto; }
  .hero-copy { padding: 24px 24px 24px 16px; }
  .title-zh { font-size: clamp(38px, 5.8vw, 60px); }
  .initials { font-size: 19vw; }
}

@media (max-width: 620px) {
  :root { --nav-h: 46px; }
  .wrap { width: calc(100% - 32px); }
  .nav { height: var(--nav-h); font-size: 11px; }
  .nav-name { font-size: 10px; white-space: nowrap; }
  .nav-tools { gap: 5px; }
  .nav-tools > span { padding-left: 6px; max-width: 8ch; }
  .nav-tools button { gap: 2px; }
  .nav-tools svg { width: 14px; }

  /* Mobile hero: top horizontal tilted marquee strip + big typography below */
  .hero-stage { height: auto; min-height: calc(100svh - var(--nav-h)); max-height: none; }
  .hero-inner { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .marquee-stage {
    height: 192px;
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 8%, #000 92%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0%, #000 8%, #000 92%, transparent 100%);
  }
  .marquee-tilt {
    position: absolute;
    inset: 16px -6% 12px -6%;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    transform: rotate(-3deg);
  }
  .marquee-col[data-dir="up"] {
    flex-direction: row;
    gap: 12px;
    height: 100%;
    width: max-content;
  }
  .marquee-col[data-dir="down"] { display: none; }
  .marquee-tile {
    width: 215px;
    height: 134px;
    border-width: 2px;
  }

  .hero-copy { padding: 18px 16px 28px; justify-content: flex-start; }
  .eyebrow { font-size: 10px; margin-bottom: 10px; }
  .title-en { font-size: 24px; margin-bottom: 4px; }
  .title-zh { font-size: clamp(36px, 11vw, 50px); }
  .ledger { margin-top: 22px; padding-block: 11px; gap: 14px; }
  .ledger dd { font-size: 19px; }

  .categories { gap: 16px; min-height: 44px; }
  .tools { flex-wrap: wrap; gap: 0 14px; }
  .tools .search { width: auto; flex: 1; min-width: 140px; }
  .exhibits { padding-top: 20px; }
  .list-line { margin-bottom: 16px; }
  .grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .card h3 { font-size: 22px; }
  .initials { font-size: 35vw; }
  .custom-inner { padding: 24px; }
  .foot { margin-top: 40px; padding-bottom: 36px; }
}

@media (max-width: 390px) {
  .tools .search { flex-basis: 100%; margin: 0 0 4px; }
  .nav-name { letter-spacing: -.05em; }
}

@media (prefers-reduced-motion: reduce) {
  .cover img, .scroll-cue span { transition: none; }
}
