/* The Quiet Wing — gallery chrome. Everything is system-font; nothing downloads. */

:root {
  --bg: #060504;
  --ink: #ece3d4;
  --ink-dim: #a2988a;
  --ink-faint: #6b6257;
  --gold: #c9a46a;
  --hair: rgba(255, 255, 255, 0.16);

  --serif: "Didot", "Bodoni 72", "Bodoni MT", "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; }

/* Several overlays set an explicit display, which would beat the UA rule. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(ellipse 78% 78% at 50% 50%, transparent 40%, rgba(0, 0, 0, 0.5) 100%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.32), transparent 22%, transparent 78%, rgba(0, 0, 0, 0.38));
}

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

/* ------------------------------------------------------------------ HUD */

#hud {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

#crosshair {
  --aim: 0;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  display: grid;
  place-items: center;
}

#crosshair::before {
  /* Ring that blooms open when you are aiming at a painting. */
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(201, 164, 106, calc(0.55 * var(--aim)));
  border-radius: 50%;
  transform: scale(calc(0.55 + 0.45 * var(--aim)));
  transition: none;
}

#crosshair i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 248, 236, calc(0.3 + 0.62 * var(--aim)));
  box-shadow: 0 0 calc(6px * var(--aim)) rgba(201, 164, 106, calc(0.9 * var(--aim)));
  transform: scale(calc(1 + 0.35 * var(--aim)));
}

#walk-hint {
  position: absolute;
  left: 50%;
  bottom: 42px;
  transform: translateX(-50%);
  margin: 0;
  font-family: var(--sans);
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
  transition: opacity 1.6s ease;
}
#walk-hint b { color: var(--ink-dim); font-weight: 500; }
#walk-hint.faded { opacity: 0; }

/* --------------------------------------------------------- title screen */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 6vh 6vw;
  background:
    radial-gradient(ellipse 90% 80% at 50% 42%, rgba(14, 11, 9, 0.5), rgba(4, 3, 3, 0.93) 72%);
  backdrop-filter: blur(16px) saturate(0.82);
  -webkit-backdrop-filter: blur(16px) saturate(0.82);
  transition: opacity 0.85s ease, transform 0.85s ease, filter 0.85s ease;
}

.overlay.leaving {
  opacity: 0;
  transform: scale(1.035);
  filter: blur(6px);
  pointer-events: none;
}

.enter-inner { max-width: 46rem; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.enter-inner > * { animation: rise 1.1s cubic-bezier(0.22, 0.7, 0.2, 1) backwards; }
.enter-inner > h1 { animation-delay: 0.05s; }
.enter-inner > .rule { animation-delay: 0.3s; }
.enter-inner > h2 { animation-delay: 0.42s; }
.enter-inner > .tagline { animation-delay: 0.56s; }
.enter-inner > .cta { animation-delay: 0.74s; }
.enter-inner > .loadbar { animation-delay: 0.8s; }
.enter-inner > .controls { animation-delay: 0.92s; }

#enter h1 {
  margin: 0;
  font-weight: 400;
  font-size: clamp(2.6rem, 9.5vw, 7.4rem);
  line-height: 0.98;
  letter-spacing: 0.19em;
  text-indent: 0.19em; /* balance the trailing tracking */
  text-transform: uppercase;
  color: var(--ink);
}

.rule {
  width: 132px;
  height: 1px;
  margin: 2.1rem auto 1.5rem;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.75;
}
.rule.small { width: 62px; margin: 0 auto 1.1rem; }

#enter h2 {
  margin: 0;
  font-family: var(--sans);
  font-weight: 400;
  font-size: 0.72rem;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.tagline {
  margin: 1.7rem auto 2.6rem;
  font-style: italic;
  font-size: clamp(1rem, 2.1vw, 1.32rem);
  line-height: 1.6;
  color: #b6ab99;
  max-width: 30rem;
}

.cta {
  display: inline-block;
  padding: 15px 40px;
  border: 1px solid rgba(201, 164, 106, 0.34);
  font-family: var(--sans);
  font-size: 0.66rem;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  text-transform: uppercase;
  color: var(--ink-dim);
  transition: color 0.4s ease, border-color 0.4s ease, background-color 0.4s ease, letter-spacing 0.4s ease;
}
.cta[disabled] { opacity: 0.42; cursor: progress; }
.cta:not([disabled]):hover {
  color: #1a140e;
  background: var(--gold);
  border-color: var(--gold);
}
#enter.ready .cta:not(:hover) { animation: breathe 3.6s ease-in-out infinite; }

@keyframes breathe {
  0%, 100% { border-color: rgba(201, 164, 106, 0.26); color: var(--ink-dim); }
  50% { border-color: rgba(201, 164, 106, 0.62); color: var(--ink); }
}

.loadbar {
  width: 178px;
  height: 1px;
  margin: 1.5rem auto 0;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}
.loadbar i {
  display: block;
  height: 100%;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.5s ease;
}
#enter.ready .loadbar { opacity: 0; transition: opacity 0.8s ease 0.2s; }

.controls {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 2.3rem;
  margin: 3.4rem 0 0;
  padding: 0;
}
.controls li { display: flex; align-items: baseline; gap: 0.55rem; }
.controls b {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  color: var(--ink-dim);
}
.controls span { font-style: italic; font-size: 0.82rem; color: var(--ink-faint); }

/* ------------------------------------------------------------- lock lost */

#resume {
  z-index: 18;
  cursor: pointer;
  background: rgba(4, 3, 3, 0.55);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}
#resume p {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.66rem;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

/* ------------------------------------------------------------ focus mode */

#focus-ui {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}
#focus-ui.visible { opacity: 1; }

.focus-label {
  position: absolute;
  top: clamp(24px, 4vh, 48px);
  left: clamp(24px, 4vw, 56px);
  max-width: 34ch;
  transform: translateY(-8px);
  transition: transform 0.7s cubic-bezier(0.22, 0.7, 0.2, 1);
}
#focus-ui.visible .focus-label { transform: none; }

.focus-label h3 {
  margin: 0 0 0.55rem;
  font-weight: 400;
  font-size: clamp(1.15rem, 2.1vw, 1.6rem);
  letter-spacing: 0.02em;
  color: var(--ink);
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.85);
}
.focus-label p {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.62rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.focus-label::after {
  content: "";
  display: block;
  width: 46px;
  height: 1px;
  margin-top: 0.95rem;
  background: linear-gradient(90deg, var(--gold), transparent);
  opacity: 0.7;
}

/* subtitles */

#subtitle {
  position: absolute;
  left: 50%;
  bottom: clamp(76px, 12vh, 132px);
  transform: translateX(-50%);
  width: min(58rem, 82vw);
  opacity: 0;
  transition: opacity 0.45s ease;
}
#subtitle.visible { opacity: 1; }

#subtitle::before {
  content: "";
  position: absolute;
  inset: -2.4rem -4rem;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.62), transparent 72%);
  z-index: -1;
}

#subtitle p {
  margin: 0;
  text-align: center;
  font-size: clamp(1rem, 1.55vw, 1.28rem);
  line-height: 1.62;
  letter-spacing: 0.012em;
  color: #f2ebdd;
  text-shadow: 0 1px 16px rgba(0, 0, 0, 0.95), 0 0 3px rgba(0, 0, 0, 0.8);
}

@keyframes subtitle-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}
#subtitle.step p { animation: subtitle-in 0.55s cubic-bezier(0.22, 0.7, 0.2, 1); }

/* actions */

.focus-actions {
  position: absolute;
  right: clamp(20px, 3.4vw, 48px);
  bottom: clamp(22px, 3.6vh, 44px);
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.ghost {
  pointer-events: auto;
  padding: 10px 18px;
  border: 1px solid var(--hair);
  background: rgba(8, 6, 5, 0.42);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: var(--sans);
  font-size: 0.62rem;
  letter-spacing: 0.19em;
  text-transform: uppercase;
  color: var(--ink-dim);
  transition: color 0.3s ease, border-color 0.3s ease, background-color 0.3s ease;
}
.ghost:hover {
  color: var(--ink);
  border-color: rgba(201, 164, 106, 0.6);
  background: rgba(28, 21, 14, 0.7);
}

/* ---------------------------------------------------------- inspect mode */

#inspect {
  position: fixed;
  inset: 0;
  z-index: 30;
  overflow: hidden;
  background: #050403;
  cursor: grab;
  opacity: 0;
  transition: opacity 0.28s ease;
  touch-action: none;
}
#inspect.visible { opacity: 1; }
#inspect.grabbing { cursor: grabbing; }

#inspect-img {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
  opacity: 0;
  transition: opacity 0.5s ease;
  user-select: none;
  -webkit-user-drag: none;
  image-rendering: auto;
}
#inspect-img.visible { opacity: 1; }

#inspect-spinner {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#inspect-error {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ink-faint);
  text-align: center;
}

.inspect-bar {
  position: absolute;
  inset: 0 0 auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: clamp(14px, 2.4vh, 26px) clamp(18px, 3vw, 38px);
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.78), transparent);
  pointer-events: none;
}
.inspect-bar h4 {
  margin: 0;
  font-weight: 400;
  font-size: 1.05rem;
  letter-spacing: 0.03em;
  color: var(--ink);
}
.inspect-tools { display: flex; align-items: center; gap: 1.1rem; }
#inspect-zoom {
  font-family: var(--sans);
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  color: var(--ink-faint);
  min-width: 3.4em;
  text-align: right;
}
#inspect-close { padding: 7px 13px; font-size: 0.7rem; letter-spacing: 0; }

.inspect-hint {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  margin: 0;
  font-family: var(--sans);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(160, 148, 130, 0.55);
  pointer-events: none;
  white-space: nowrap;
}

/* -------------------------------------------------------------- failure */

#fatal {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 90;
  margin: 0;
  padding: 1.2rem;
  text-align: center;
  font-family: var(--sans);
  font-size: 0.8rem;
  color: #e0b1a2;
  background: rgba(40, 12, 8, 0.9);
}

@media (prefers-reduced-motion: reduce) {
  #enter.ready .cta { animation: none; }
  .enter-inner > * { animation-duration: 0.01s; }
  #subtitle.step p { animation: none; }
}

/* ------------------------------------------------------- the other place */

/* Shown on exactly one work in each experience: the Michelangelo in the wing,
   and the sign standing where it should have been. */
.crosslink {
  display: inline-block;
  text-decoration: none;
  border-color: rgba(201, 164, 106, 0.34);
}
