@font-face {
  font-family: "Tiempos";
  src: url("../fonts/tiempos-headline-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Sohne";
  src: url("../fonts/soehne-buch.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Sohne";
  src: url("../fonts/soehne-halbfett.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #080706;
  --bone: #f3efe7;
  --paper: #d9d3c6;
  --muted: #9a958a;
  --line: rgba(243, 239, 231, 0.15);
  --glass: rgba(8, 7, 6, 0.72);
  --red: #ff5a4d;
  --cyan: #00b7a8;
  --gold: #e7c84b;
  --blue: #7db4ff;
  --green: #9cc76c;
  --accent: #9cc76c;
  --font-display: "Tiempos", Georgia, "Times New Roman", serif;
  --font-body: "Sohne", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  color: inherit;
}

button {
  font: inherit;
}

#renderStage,
.grain {
  position: fixed;
  inset: 0;
}

#renderStage {
  z-index: 0;
}

.grain {
  z-index: 1;
  pointer-events: none;
  opacity: 0.58;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 240 240' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.96' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.18'/%3E%3C/svg%3E");
}

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

.topbar,
.room {
  position: relative;
  z-index: 2;
}

.topbar {
  display: grid;
  grid-template-columns: 110px 1fr 110px;
  gap: 14px;
  align-items: start;
  padding: 22px 24px;
}

.backlink {
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 7, 6, 0.34);
  color: var(--paper);
  text-align: center;
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  backdrop-filter: blur(16px);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  color: var(--bone);
  font-family: var(--font-display);
  font-size: clamp(34px, 6.2vw, 96px);
  font-weight: 400;
  line-height: 0.92;
  text-align: center;
  text-wrap: balance;
}

.room {
  display: grid;
  grid-template-columns: minmax(310px, 0.9fr) minmax(320px, 1.1fr);
  gap: 16px;
  padding: 18px 24px 24px;
}

.rendering,
.chamber,
.accession,
.receipt,
.studio-labor {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--glass);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(22px);
}

.rendering {
  min-height: 500px;
  padding: 18px;
}

.rendering h2 {
  max-width: 760px;
  margin: 40px 0 18px;
  color: var(--bone);
  font-family: var(--font-display);
  font-size: clamp(38px, 6vw, 86px);
  font-weight: 400;
  line-height: 0.92;
}

.reason {
  max-width: 650px;
  color: var(--paper);
  font-size: 19px;
}

.rituals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 34px;
}

.rituals button {
  min-height: 64px;
  border: 1px solid rgba(243, 239, 231, 0.13);
  border-radius: 8px;
  background: rgba(243, 239, 231, 0.06);
  cursor: pointer;
  padding: 10px;
  text-align: left;
}

.rituals button:last-child {
  grid-column: 1 / -1;
}

.rituals button:hover,
.rituals button.active {
  border-color: rgba(156, 199, 108, 0.62);
  background: rgba(156, 199, 108, 0.14);
}

.chamber {
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  min-height: 500px;
  overflow: hidden;
  padding: 18px;
  gap: 10px;
}

.pane {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(243, 239, 231, 0.12);
  border-radius: 8px;
  background: rgba(243, 239, 231, 0.04);
}

.pane-label {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.glyph {
  margin: 0;
  color: var(--bone);
  font-family: var(--font-display);
  font-size: clamp(40px, 7vw, 78px);
  line-height: 1;
  letter-spacing: 0.04em;
}

.gloss {
  margin: 0;
  max-width: 42ch;
  color: var(--paper);
  font-size: 14px;
}

.membrane {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 46px;
  border-top: 1px dashed rgba(156, 199, 108, 0.5);
  border-bottom: 1px dashed rgba(156, 199, 108, 0.5);
}

.customs {
  padding: 5px 12px;
  border: 1px solid rgba(156, 199, 108, 0.4);
  border-radius: 999px;
  background: rgba(8, 7, 6, 0.55);
  color: var(--green);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color 360ms var(--ease), border-color 360ms var(--ease);
}

.target-pane .arriving {
  margin: 0;
  color: var(--bone);
  font-family: var(--font-display);
  font-size: clamp(22px, 3.4vw, 40px);
  line-height: 1.04;
  transition: opacity 420ms var(--ease);
}

.target-pane .arriving[data-stalled="true"] {
  opacity: 0.42;
  filter: blur(0.4px);
}

.target-pane .arriving[lang="zh"] {
  font-size: clamp(34px, 6vw, 64px);
  letter-spacing: 0.04em;
}

.remainder {
  margin: 0;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
  color: var(--paper);
  font-size: 14px;
}

.accession,
.receipt,
.studio-labor,
.trace-panel {
  padding: 15px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#condition {
  color: var(--gold);
  font-size: 12px;
  font-weight: 600;
}

.accession p:last-child,
.receipt p:last-child {
  margin-bottom: 0;
}

.studio-labor {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(240px, 0.42fr) minmax(280px, 1fr) auto;
  gap: 12px;
  align-items: end;
  border-color: rgba(156, 199, 108, 0.24);
  background:
    linear-gradient(90deg, rgba(156, 199, 108, 0.1), rgba(125, 180, 255, 0.055)),
    var(--glass);
}

.studio-labor h2 {
  margin: 0;
  color: var(--bone);
  font-size: clamp(18px, 2.4vw, 32px);
  line-height: 1.08;
}

.studio-labor p:not(.eyebrow) {
  margin: 0;
  color: var(--paper);
  font-size: 14px;
}

.labor-meter {
  grid-column: 2;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(243, 239, 231, 0.1);
}

.labor-meter span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--labor-color, var(--green));
  box-shadow: 0 0 18px var(--labor-color, var(--green));
  transition: width 420ms var(--ease), background 420ms var(--ease);
}

.labor-button {
  grid-row: 1 / span 3;
  grid-column: 3;
  min-height: 44px;
  align-self: stretch;
  border: 1px solid rgba(156, 199, 108, 0.38);
  border-radius: 8px;
  background: rgba(156, 199, 108, 0.09);
  cursor: pointer;
  padding: 9px 12px;
  color: var(--bone);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.labor-button:hover,
.labor-button:focus-visible {
  background: rgba(156, 199, 108, 0.16);
}

.trace-panel {
  grid-column: 1 / -1;
}

.dispatch-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
}

.directorate-link {
  display: inline-flex;
  min-height: 40px;
  margin-top: 12px;
  align-items: center;
  border: 1px solid rgba(156, 199, 108, 0.42);
  border-radius: 8px;
  background: rgba(156, 199, 108, 0.08);
  padding: 9px 12px;
  color: var(--bone);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.directorate-link:hover {
  background: rgba(156, 199, 108, 0.14);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 920px) {
  .room {
    grid-template-columns: 1fr;
  }

  .studio-labor {
    grid-template-columns: 1fr;
  }

  .labor-meter,
  .labor-button {
    grid-column: 1;
    grid-row: auto;
  }
}

@media (max-width: 620px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  h1 {
    text-align: left;
  }

  .room {
    padding: 12px 18px 18px;
  }

  .rituals {
    grid-template-columns: 1fr;
  }

  .rituals button:last-child {
    grid-column: auto;
  }
}
