:root {
  color-scheme: dark;
  --paper: #f2eee6;
  --muted: #9e9689;
  --dim: #5f584f;
  --line: rgba(242, 238, 230, 0.18);
  --black: #000;
  --mono: "Courier New", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body, #app { min-height: 100%; margin: 0; }

body {
  background: #000;
  color: var(--paper);
  font-family: var(--sans);
  letter-spacing: 0;
}

button {
  color: inherit;
  font: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

.home {
  min-height: 100vh;
  padding: clamp(24px, 5vw, 72px);
  background:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px),
    #000;
  background-size: 100% 48px, 48px 100%;
}

.mast {
  min-height: 38vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: 36px;
}

.eyebrow, .tile-index, .tile-vocab, figcaption, cite, .person-name {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1, h2 {
  margin: 0;
  font-weight: 800;
  letter-spacing: 0;
}

h1 span, h2 {
  display: block;
  font-size: clamp(48px, 10vw, 138px);
  line-height: 0.84;
}

h1 small {
  display: block;
  margin-top: 16px;
  font-family: var(--mono);
  font-size: clamp(16px, 2.1vw, 24px);
  color: var(--muted);
}

.mast p {
  margin: 28px 0 0;
  font-family: var(--serif);
  font-size: clamp(22px, 3vw, 38px);
  color: #d8d0c2;
}

.contact-sheet {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.person-tile {
  min-height: 240px;
  padding: 18px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  opacity: 0;
  animation: reveal 500ms ease forwards;
  animation-delay: var(--delay);
  transition: background 240ms ease, color 240ms ease, transform 240ms ease;
}

.person-tile:hover, .person-tile:focus-visible {
  background: #f2eee6;
  color: #050505;
  transform: translateY(-4px);
  outline: none;
}

.tile-name {
  font-size: clamp(20px, 2vw, 30px);
  font-weight: 800;
  line-height: 1;
}

.tile-dates, .tile-line {
  color: var(--muted);
  font-family: var(--serif);
  line-height: 1.35;
}

.person-tile:hover .tile-dates,
.person-tile:hover .tile-line,
.person-tile:hover .tile-vocab,
.person-tile:hover .tile-index { color: #333; }

.controller {
  min-height: 100vh;
  background: #000;
  overflow: hidden;
}

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-rows: minmax(22vh, 35vh) auto auto 1fr;
  place-items: center;
  padding: 3vh clamp(20px, 5vw, 84px) 108px;
  isolation: isolate;
}

.safe-area {
  width: 100%;
  height: 100%;
}

.controller-portrait {
  position: relative;
  width: min(48vw, 520px);
  aspect-ratio: 4 / 3;
  margin: 0;
  display: grid;
  place-items: center;
  transform: translate(var(--jitter-x), var(--jitter-y));
  transition: transform 1300ms ease, opacity 900ms ease;
}

.controller-portrait::before {
  content: "";
  position: absolute;
  inset: -12%;
  background: radial-gradient(ellipse at center, rgba(242,238,230,0.13), transparent 62%);
  z-index: -1;
}

.controller-portrait img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: grayscale(1) contrast(1.45) brightness(0.9);
  mix-blend-mode: screen;
  opacity: 0.86;
  mask-image: radial-gradient(ellipse, black 45%, transparent 76%);
}

.controller-portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.08) 0 1px, transparent 1px 4px),
    repeating-radial-gradient(circle at 50% 45%, rgba(255,255,255,0.08) 0 1px, transparent 1px 5px);
  mix-blend-mode: overlay;
  pointer-events: none;
}

.image-failed {
  border: 1px solid var(--line);
}

/* Broken remote image: hide the icon/alt text and the ring overlay (was a grey moire box). */
.image-failed img { visibility: hidden; }
.image-failed::after { display: none; }

/* Engraved portraits are already final white-ink art: no filters, glow or overlay. */
.controller-portrait.engraved::before,
.controller-portrait.engraved::after { display: none; }
.controller-portrait.engraved img {
  filter: none;
  mix-blend-mode: normal;
  opacity: 1;
  mask-image: none;
}

.image-failed::before {
  content: "ARCHIVAL IMAGE SOURCE\A SEE MANIFEST";
  white-space: pre;
  font-family: var(--mono);
  color: var(--muted);
}

figcaption {
  position: absolute;
  bottom: -18px;
  text-align: center;
}

figcaption button {
  margin-right: 8px;
  color: var(--paper);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
}

.brand-lockup {
  margin-top: 22px;
  text-align: center;
}

.brand-lockup h2 {
  font-size: clamp(42px, 8vw, 112px);
}

.controller-tagline {
  margin: 12px 0 0;
  font-family: var(--mono);
  color: #c8c0b3;
  text-transform: uppercase;
  font-size: clamp(12px, 1.4vw, 16px);
}

.telemetry {
  width: min(980px, 100%);
  margin-top: 34px;
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(300px, 1.1fr);
  gap: clamp(24px, 5vw, 68px);
  align-items: start;
}

.dispatch-block {
  min-width: 0;
}

.text-label {
  margin-bottom: 10px;
  font-family: var(--mono);
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dispatch-text {
  margin: 0;
  font-family: var(--mono);
  color: #d8d0c2;
  font-size: clamp(12px, 1.25vw, 15px);
  line-height: 1.65;
  white-space: pre-wrap;
}

blockquote {
  margin: 0;
  padding-left: 24px;
  border-left: 1px solid var(--line);
}

.quote-text {
  margin: 0 0 14px;
  font-family: var(--serif);
  color: #dfd8cc;
  font-size: clamp(18px, 2.2vw, 30px);
  line-height: 1.18;
}

.chrome {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 10;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  max-width: calc(100vw - 24px);
  padding: 8px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.74);
  backdrop-filter: blur(14px);
  overflow-x: auto;
}

.chrome button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(242,238,230,0.16);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--paper);
}

.chrome button:hover {
  background: var(--paper);
  color: #000;
}

.source-dialog {
  width: min(520px, calc(100vw - 32px));
  border: 1px solid var(--line);
  background: #050505;
  color: var(--paper);
  font-family: var(--sans);
  padding: 22px;
}

.source-dialog::backdrop {
  background: rgba(0,0,0,0.78);
}

.source-dialog h3 {
  margin: 6px 0 18px;
  font-size: 22px;
}

.source-dialog dl {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px 16px;
  margin: 0 0 18px;
}

.source-dialog dt {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.source-dialog dd {
  margin: 0;
  color: #d8d0c2;
  line-height: 1.35;
}

.source-dialog a {
  color: var(--paper);
}

.chrome-hidden .chrome { display: none; }
.chrome-hidden .stage { padding-bottom: 3vh; cursor: none; }

.wallpaper-mode .stage {
  width: min(430px, calc(100vw - 28px));
  min-height: auto;
  aspect-ratio: 9 / 19.5;
  margin: 18px auto 108px;
  border: 1px solid var(--line);
  grid-template-rows: 38% auto auto 1fr;
  padding: 0 28px 42px;
}

.wallpaper-mode .controller-portrait {
  width: 86%;
  align-self: end;
}

.wallpaper-mode .brand-lockup h2 {
  font-size: clamp(34px, 11vw, 54px);
}

.wallpaper-mode .telemetry {
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 20px;
}

.wallpaper-mode blockquote {
  padding-left: 0;
  border-left: 0;
}

.safe-guide {
  position: absolute;
  left: 0;
  right: 0;
  border: 1px dashed rgba(242,238,230,0.34);
  pointer-events: none;
  z-index: 4;
}

.safe-guide.top { top: 0; background: rgba(255,255,255,0.025); }
.safe-guide.bottom { bottom: 0; background: rgba(255,255,255,0.025); }

@keyframes reveal {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 920px) {
  .contact-sheet { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .telemetry { grid-template-columns: 1fr; }
  .stage { grid-template-rows: minmax(22vh, 33vh) auto auto 1fr; }
  .controller-portrait { width: min(84vw, 480px); }
}

@media (max-width: 560px) {
  .home { padding: 22px; }
  .mast { min-height: 32vh; }
  .contact-sheet { grid-template-columns: 1fr; }
  .person-tile { min-height: 174px; }
  .stage { padding: 0 18px 96px; grid-template-rows: minmax(26vh, 36vh) auto auto 1fr; }
  .brand-lockup h2 { font-size: 40px; }
  .person-name { font-size: 9px; }
  .quote-text { font-size: 20px; }
}
