:root {
  --ink: #EAE2D5;
  --ink-dim: #B7AB97;
  --wall: #17120F;
  --wall2: #221A15;
  --mat: #F3ECDD;
  --mat-edge: #C8A96B;
  --accent: #C8A96B;
  --accent-ink: #241A0E;
  --serif: "Didot", "Bodoni MT", "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "Helvetica Neue", "Avenir Next", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(120vmin 90vmin at 50% 18%, var(--wall2), transparent 70%),
    radial-gradient(150vmax 120vmax at 50% 120%, #0D0907 30%, var(--wall) 70%),
    var(--wall);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

.wall {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(14px, 2.4vmin, 26px);
  padding:
    calc(clamp(14px, 3vmin, 34px) + env(safe-area-inset-top))
    calc(clamp(12px, 3vw, 40px) + env(safe-area-inset-right))
    calc(clamp(14px, 3vmin, 30px) + env(safe-area-inset-bottom))
    calc(clamp(12px, 3vw, 40px) + env(safe-area-inset-left));
}

/* ------- masthead ------- */
.masthead { text-align: center; margin-top: 4px; }
.kicker {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.masthead h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(30px, 5.4vmin, 52px);
  letter-spacing: .045em;
}
.masthead .sub {
  margin: 8px 0 0;
  color: var(--ink-dim);
  font-size: clamp(12px, 1.7vmin, 15px);
  letter-spacing: .02em;
}

/* ------- frame ------- */
.gallery {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(14px, 2.4vmin, 24px);
  width: 100%;
  flex: 1;
  min-height: 0;
}

.frame {
  margin: 0;
  display: flex;
  flex-direction: column;
  width: fit-content;
  max-width: 100%;
}

.mat {
  position: relative;
  background:
    linear-gradient(160deg, #F6F0E2, var(--mat) 55%, #EAE0CB);
  padding: clamp(10px, 2vmin, 26px);
  border: 1px solid #0A0705;
  outline: 1px solid var(--mat-edge);
  outline-offset: clamp(5px, 1vmin, 10px);
  box-shadow:
    0 22px 60px rgba(0, 0, 0, .55),
    0 4px 14px rgba(0, 0, 0, .5),
    inset 0 0 0 1px rgba(200, 169, 107, .35);
}

/* ------- stage (pan / zoom) ------- */
.stage {
  position: relative;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  background: #D9CDB9;
  box-shadow: inset 0 0 0 1px rgba(60, 40, 20, .25);
  height: min(64dvh, 153vw);
  aspect-ratio: 1000 / 1300;
}
.stage.dragging { cursor: grabbing; }

.stage .pz {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.stage .pz svg, .stage > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

/* layered reveal on load */
.stage .pz.reveal svg > g {
  opacity: 0;
  animation: rise .85s cubic-bezier(.22, .7, .3, 1) forwards;
}
.stage .pz.reveal svg > g:nth-of-type(1)  { animation-delay: .02s; }
.stage .pz.reveal svg > g:nth-of-type(2)  { animation-delay: .06s; }
.stage .pz.reveal svg > g:nth-of-type(3)  { animation-delay: .12s; }
.stage .pz.reveal svg > g:nth-of-type(4)  { animation-delay: .18s; }
.stage .pz.reveal svg > g:nth-of-type(5)  { animation-delay: .26s; }
.stage .pz.reveal svg > g:nth-of-type(6)  { animation-delay: .34s; }
.stage .pz.reveal svg > g:nth-of-type(7)  { animation-delay: .42s; }
.stage .pz.reveal svg > g:nth-of-type(8)  { animation-delay: .5s; }
.stage .pz.reveal svg > g:nth-of-type(9)  { animation-delay: .58s; }
.stage .pz.reveal svg > g:nth-of-type(10) { animation-delay: .64s; }
.stage .pz.reveal svg > g:nth-of-type(11) { animation-delay: .7s; }
.stage .pz.reveal svg > g:nth-of-type(12) { animation-delay: .76s; }
.stage .pz.reveal svg > g:nth-of-type(13) { animation-delay: .82s; }
.stage .pz.reveal svg > g:nth-of-type(14) { animation-delay: .88s; }
.stage .pz.reveal svg > g:nth-of-type(15) { animation-delay: .92s; }
.stage .pz.reveal svg > g:nth-of-type(16) { animation-delay: .96s; }
.stage .pz.reveal svg > g:nth-of-type(17) { animation-delay: 1s; }

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

/* wall intro */
.intro .masthead, .intro .actions, .intro .colophon { opacity: 0; animation: rise .9s ease .35s forwards; }
.intro .frame { opacity: 0; animation: rise .9s ease .12s forwards; }

.hint {
  position: absolute;
  left: 50%;
  top: clamp(10px, 2vmin, 18px);
  transform: translateX(-50%);
  margin: 0;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(20, 14, 9, .72);
  color: #F0E7D6;
  font-size: 11.5px;
  letter-spacing: .04em;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  animation: riseHint .8s ease 1.4s forwards, fadeoutHint 1s ease 7s forwards;
}
@keyframes riseHint {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes fadeoutHint { to { opacity: 0; visibility: hidden; } }

/* ------- controls ------- */
.controls {
  position: absolute;
  right: clamp(18px, 3vmin, 34px);
  bottom: clamp(22px, 4vmin, 46px);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 3;
}
.ctl {
  appearance: none;
  border: 1px solid rgba(200, 169, 107, .55);
  background: rgba(20, 14, 9, .78);
  color: #F0E7D6;
  min-width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, transform .1s ease;
}
.ctl.wide { font-size: 13px; letter-spacing: .06em; padding: 0 14px; }
.ctl:hover { background: rgba(46, 32, 18, .9); }
.ctl:active { transform: scale(.94); }
.ctl:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.zoom-label {
  min-width: 52px;
  text-align: center;
  font-size: 12.5px;
  color: #DCCFAF;
  font-variant-numeric: tabular-nums;
}

/* ------- caption & actions ------- */
.caption {
  max-width: 62ch;
  margin: clamp(14px, 2.6vmin, 26px) auto 0;
  text-align: center;
  color: var(--ink-dim);
  font-size: clamp(12.5px, 1.7vmin, 14.5px);
  line-height: 1.65;
}
.caption strong { color: var(--ink); font-family: var(--serif); letter-spacing: .05em; }

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  letter-spacing: .03em;
  background: rgba(46, 34, 20, .75);
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.btn:hover { background: rgba(58, 44, 26, .75); border-color: var(--accent); }
.btn:active { transform: scale(.97); }
.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 600;
}
.btn.primary:hover { background: #D9BC80; }

.colophon {
  margin: 6px 0 2px;
  text-align: center;
  color: rgba(183, 171, 151, .75);
  font-size: 11.5px;
  letter-spacing: .03em;
}
.colophon p { margin: 0; }

/* ------- responsive ------- */
@media (max-width: 760px) {
  .wall { gap: 12px; }
  .stage { height: min(56dvh, 113vw); }
  .controls { right: 12px; bottom: 14px; gap: 6px; }
  .zoom-label { display: none; }
  .hint { font-size: 10.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .stage .pz.reveal svg > g,
  .intro .masthead, .intro .frame, .intro .actions, .intro .colophon,
  .hint { animation: none !important; opacity: 1 !important; }
}
