/*
  Art Gallery (creations/gallery/index.php + gallery.js).
  Placeholders are CSS; files dropped into art/ arrive as --art-* variables (see index.php).
*/
:root {
  --wall: #ebe5da;
  --wall-shade: #d9d0c1;
  --floor: #7a573b;
  --floor-dark: #5c3f2a;
  --ink: #2c2621;
  --muted: #6c6157;
  --accent: #8a4f2e;
  --paper: #f6efdf;
  --paper-edge: #e4d8bf;
  --frame: #2f2a26;
  --night: rgba(22, 18, 15, .975);
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Jost", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--wall);
  color: var(--ink);
  font-family: var(--sans);
  overflow: hidden;
  --home-left: 16px;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- Room wall ---------- */
.room {
  position: fixed; inset: 0;
  display: grid; grid-template-rows: auto 1fr 13vh; grid-template-columns: minmax(0, 1fr);
  background:
    radial-gradient(ellipse at 50% -10%, rgba(255, 252, 240, .7), transparent 60%),
    var(--art-wall, none),
    linear-gradient(180deg, var(--wall) 0%, var(--wall-shade) 100%);
  background-size: auto, 512px auto, auto;
}
.room-sign { text-align: center; padding: 22px 70px 0; }
.room-kicker { margin: 0; font-size: .75rem; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); }
.room-sign h1 { margin: 2px 0 0; font-family: var(--serif); font-weight: 700; font-size: clamp(1.8rem, 4.5vw, 3rem); letter-spacing: .02em; }

.wall-wrap { position: relative; min-height: 0; }
.wall {
  height: 100%;
  display: flex; align-items: center; gap: clamp(48px, 7vw, 110px);
  padding: 0 max(80px, 8vw);
  overflow-x: auto; overflow-y: hidden;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  outline: none;
}
.wall::-webkit-scrollbar { display: none; }
.wall::after { content: ""; flex: 0 0 1px; }   /* keeps the end padding when scrolled */
.wall > .exhibit:first-child { margin-left: auto; }   /* centered when everything fits */
.wall > .exhibit:last-child { margin-right: auto; }
.wall-empty { margin: auto; font-family: var(--serif); font-size: 1.4rem; font-style: italic; color: var(--muted); text-align: center; }

.exhibit { position: relative; z-index: 0; margin: 0; flex: 0 0 auto; display: flex; align-items: flex-end; gap: 14px; scroll-snap-align: center; }
.exhibit::before {                           /* gallery spotlight: a soft glow that fades out inside its box */
  content: ""; position: absolute; inset: -7vh -30% -3vh; z-index: -1;
  background: radial-gradient(closest-side, rgba(255, 250, 230, .75), rgba(255, 250, 230, 0));
  pointer-events: none;
}
.art {
  display: block; padding: 0; border: 0; background: none;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.exhibit--2d .art {
  padding: clamp(8px, 1.2vw, 14px);
  background: #fbf8f2;
  border: clamp(6px, .9vw, 10px) solid var(--frame);
  box-shadow: 0 14px 26px rgba(40, 28, 18, .28), 0 2px 4px rgba(40, 28, 18, .3);
}
.art img, .art .noimg { display: block; max-height: min(46vh, 440px); max-width: min(42vw, 520px); width: auto; height: auto; }
.art .noimg { width: 220px; height: 160px; display: grid; place-items: center; background: repeating-linear-gradient(45deg, #eee7da 0 10px, #e6dece 10px 20px); color: var(--muted); font-family: var(--serif); font-style: italic; }
.art:hover, .art:focus-visible { transform: translateY(-4px); }
.exhibit--2d .art:hover { box-shadow: 0 20px 34px rgba(40, 28, 18, .32), 0 2px 4px rgba(40, 28, 18, .3); }

/* 3D: object on a plinth standing on the floor */
.exhibit--3d { align-self: flex-end; flex-direction: column; align-items: center; gap: 0; }
.exhibit--3d .art img, .exhibit--3d .art .noimg { max-height: min(34vh, 330px); max-width: min(34vw, 360px); filter: drop-shadow(0 10px 10px rgba(40, 28, 18, .3)); }
.plinth {
  width: calc(100% + 28px); min-width: clamp(150px, 20vw, 260px); height: clamp(110px, 21vh, 210px);
  margin: 0 -14px -1px;
  background:
    var(--art-plinth, none),
    linear-gradient(90deg, #ddd6ca 0%, #f6f2ea 18%, #fbf9f4 50%, #ece6dc 85%, #d6cec0 100%);
  background-size: 100% 100%, auto;
  border-top: 6px solid #fffdf8;
  box-shadow: inset 0 -10px 18px rgba(80, 60, 40, .12), 0 4px 0 rgba(0, 0, 0, .08);
  display: flex; align-items: flex-start; justify-content: center; padding-top: 18%;
}

/* Placard: a small label beside the work (on the plinth's front for 3D) */
.placard {
  display: block; width: 118px; padding: 9px 10px 8px; margin-bottom: 6%;
  text-align: left; border: 0; border-radius: 2px;
  background: var(--art-placard, none), #fdfbf6;
  background-size: cover;
  box-shadow: 0 2px 5px rgba(40, 28, 18, .25);
  font-family: var(--serif); line-height: 1.15;
  transition: transform .2s var(--ease);
}
.placard strong { display: block; font-size: .95rem; }
.placard span { display: block; margin-top: 3px; font-family: var(--sans); font-size: .66rem; color: var(--muted); letter-spacing: .04em; }
.placard:hover, .placard:focus-visible { transform: translateY(-2px); }
.exhibit--3d .placard { margin: 0; width: 70%; max-width: 150px; text-align: center; }

/* Edge arrows: appear when hovering near an edge; always shown on touch screens */
.edge {
  position: absolute; top: 0; bottom: 0; z-index: 3; width: 110px;
  border: 0; background: transparent; opacity: 0; transition: opacity .2s;
  display: flex; align-items: center;
}
.edge span {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  background: rgba(44, 38, 33, .78); color: #fff; font-size: 2rem; line-height: 1; padding-bottom: 4px;
}
.edge-prev { left: 0; justify-content: flex-start; padding-left: 14px; background: linear-gradient(90deg, rgba(235, 229, 218, .7), transparent); }
.edge-next { right: 0; justify-content: flex-end; padding-right: 14px; background: linear-gradient(270deg, rgba(235, 229, 218, .7), transparent); }
.edge:hover, .edge:focus-visible { opacity: 1; }
@media (hover: none) { .edge { opacity: 1; width: 70px; background: none; } .edge span { width: 42px; height: 42px; font-size: 1.6rem; } }

.floor {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .28), transparent 22%),
    repeating-linear-gradient(90deg, var(--floor) 0 120px, var(--floor-dark) 120px 122px),
    var(--floor);
  border-top: 8px solid #f4efe6;           /* skirting board */
}

/* ---------- Entryway ---------- */
.entry {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center;
  background: linear-gradient(180deg, #e8dcc6 0%, #dccdb2 64%, #8d6747 64%, #6d4c33 100%);
  transition: opacity .7s ease;
}
.entry.leaving { opacity: 0; }
.has-entry-art .entry { background: var(--art-entry) center / cover no-repeat, #6d4c33; }
.has-entry-art .entry-scene { display: none; }
.entry-scene { position: absolute; inset: 0; }
.entry-lettering {
  position: absolute; top: 16%; left: 0; right: 0; text-align: center;
  font-family: var(--serif); font-weight: 700; font-size: clamp(2.4rem, 8vw, 5.5rem); letter-spacing: .08em; color: #4a3a2c;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
}
.entry-lettering span { display: block; font-size: .32em; letter-spacing: .5em; text-transform: uppercase; color: #7b6650; font-weight: 500; }
.entry-desk {
  position: absolute; left: 50%; bottom: 22%; width: min(560px, 76vw); height: min(150px, 20vh); transform: translateX(-50%);
  background: linear-gradient(180deg, #a87c56, #7d5839);
  border-top: 14px solid #c39a70; border-radius: 6px 6px 0 0;
  box-shadow: 0 18px 30px rgba(40, 25, 12, .35);
}
.entry-bell { position: absolute; top: -34px; left: 22%; width: 34px; height: 20px; border-radius: 34px 34px 4px 4px; background: linear-gradient(#f1d58a, #b8902f); }
.entry-rack { position: absolute; top: -58px; right: 18%; width: 54px; height: 44px; background: repeating-linear-gradient(90deg, #f6efdf 0 14px, #c9b48f 14px 18px); border-radius: 2px; transform: skewX(-6deg); }
.entry-hint { position: absolute; bottom: 6%; margin: 0; font-family: var(--serif); font-style: italic; font-size: 1.15rem; color: #f3e9d6; }

/* ---------- Brochure ---------- */
.brochure {
  position: fixed; inset: 0; z-index: 30;
  display: grid; place-items: center;
  padding: 12px;
  background: rgba(30, 22, 15, .55);
  overflow: auto;
}
.js .brochure { transform: translateY(105%); transition: transform .7s var(--ease), background-color .7s; background-color: transparent; visibility: hidden; }
.js .brochure.open { transform: none; background-color: rgba(30, 22, 15, .55); visibility: visible; }
.js .brochure.closing { visibility: visible; }
.paper {
  position: relative;
  width: min(1100px, 100%); min-height: min(100%, 760px);
  padding: clamp(18px, 3vw, 38px) clamp(14px, 3vw, 44px) 28px;
  background:
    linear-gradient(90deg, transparent 33.1%, rgba(120, 95, 60, .13) 33.3%, transparent 33.6%, transparent 66.4%, rgba(120, 95, 60, .13) 66.6%, transparent 66.9%),
    var(--art-paper, none),
    radial-gradient(ellipse at 30% 20%, #fbf6ea, var(--paper) 60%, var(--paper-edge));
  background-size: auto, cover, auto;
  box-shadow: 0 30px 60px rgba(20, 12, 5, .45);
  border-radius: 3px;
  display: flex; flex-direction: column;
}
.paper.bounce { animation: bounce .55s var(--ease) 2; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-12px); } 70% { transform: translateY(3px); } }
.brochure-head { text-align: center; }
.brochure-kicker { margin: 0; font-size: .72rem; letter-spacing: .32em; text-transform: uppercase; color: var(--accent); }
.brochure-head h2 { margin: 4px 0 2px; font-family: var(--serif); font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1; }
.brochure-sub { margin: 4px 0 0; font-family: var(--serif); font-style: italic; font-size: 1.15rem; color: var(--muted); }
.brochure-notice { margin: 10px auto 0; padding: 6px 12px; display: inline-block; background: #f3dfc9; border-radius: 3px; font-size: .9rem; }
.map-scroll { flex: 1; min-height: 0; margin: 16px 0 10px; overflow: auto; display: flex; }
.map-scroll .gallery-map { --map-font: var(--serif); display: block; margin: auto; width: 100%; height: auto; max-height: 62vh; }
.map-scroll .map-room { cursor: pointer; }
.room-list { list-style: none; margin: 0 auto; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; font-family: var(--serif); font-size: 1.05rem; }
.room-list a { color: var(--ink); font-weight: 700; text-decoration-color: rgba(138, 79, 46, .4); }
.room-list a:hover { color: var(--accent); }
.room-list span { margin-left: 4px; font-style: italic; color: var(--muted); font-size: .9em; }
.brochure-close { position: absolute; top: 12px; right: 12px; padding: 6px 12px; border: 1px solid rgba(44, 38, 33, .3); border-radius: 999px; background: transparent; font-size: .8rem; }
.noscript { color: #fff; text-align: center; }

/* ---------- Corner buttons ---------- */
.map-btn, .sound-btn {
  position: fixed; z-index: 25; border: 0; padding: 0; background: none;
  transition: transform .15s var(--ease);
}
.map-btn { left: 16px; bottom: 16px; width: 64px; height: 64px; filter: drop-shadow(0 4px 6px rgba(30, 20, 10, .35)); }
.map-btn svg { width: 100%; height: 100%; }
.map-btn .map-fold { fill: var(--paper); stroke: #6c5236; stroke-width: 2; stroke-linejoin: round; }
.map-btn .map-line { stroke: #b59b78; stroke-width: 1.5; fill: none; }
.map-btn .map-route { stroke: var(--accent); stroke-width: 2.4; fill: none; stroke-dasharray: 3 3; stroke-linecap: round; }
.map-btn.has-art { background: var(--art-map-icon) center / contain no-repeat; }
.map-btn.has-art svg { display: none; }
.map-btn:hover, .sound-btn:hover { transform: scale(1.08); }
.sound-btn { z-index: 35; top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, .6); }
.sound-btn svg { width: 24px; height: 24px; fill: none; stroke: #555; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sound-btn .spk { fill: #555; }
.sound-btn .mute { display: none; }
.sound-btn[aria-pressed="false"] .wave { display: none; }
.sound-btn[aria-pressed="false"] .mute { display: inline; }

/* ---------- Piece view ---------- */
.piece {
  position: fixed; inset: 0; z-index: 40;
  background: var(--night); color: #f1ebe2;
  opacity: 0; transition: opacity .35s ease;
  overflow-y: auto;
}
.piece.open { opacity: 1; }
.piece-body {
  min-height: 100%;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); gap: 36px;
  padding: 60px 96px 36px;
  align-items: center;
}
.piece-stage { display: flex; flex-direction: column; align-items: center; gap: 14px; min-width: 0; }
.piece-frame { display: grid; place-items: center; width: 100%; height: calc(100vh - 170px); }
.piece-frame img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; box-shadow: 0 20px 50px rgba(0, 0, 0, .5); opacity: 0; transition: opacity .3s; }
.piece-frame img.loaded { opacity: 1; }
.piece-frame .noimg { padding: 60px 40px; border: 1px dashed rgba(255, 255, 255, .3); font-family: var(--serif); font-style: italic; }

/* This piece's own images: a small pill + thumbnails, unlike the big piece-to-piece arrows */
.piece-images { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; font-size: .85rem; }
.piece-images > button { width: 30px; height: 30px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .35); background: transparent; color: #fff; line-height: 1; }
.piece-thumbs { flex-basis: 100%; display: flex; justify-content: center; gap: 6px; }
.piece-thumbs button { width: 46px; height: 46px; padding: 0; border: 2px solid transparent; border-radius: 4px; background: #000 center / cover; opacity: .55; }
.piece-thumbs button[aria-current="true"] { border-color: #fff; opacity: 1; }

.piece-info h2 { margin: 0; font-family: var(--serif); font-size: clamp(1.8rem, 3vw, 2.5rem); line-height: 1.05; }
.piece-info .year { margin: 4px 0 18px; font-family: var(--serif); font-style: italic; font-size: 1.2rem; color: #cbbfae; }
.piece-info dl { margin: 0 0 18px; display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: .9rem; }
.piece-info dt { color: #a99d8c; text-transform: uppercase; letter-spacing: .1em; font-size: .7rem; padding-top: 3px; }
.piece-info dd { margin: 0; }
.piece-info .story { font-family: var(--serif); font-size: 1.15rem; line-height: 1.5; }
.piece-info .story a, .piece-info .sale a { color: #f0c79f; }
.piece-info .sale { margin-top: 22px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .15); font-size: .9rem; }
.piece-info .sale strong { display: inline-block; margin-right: 8px; padding: 2px 9px; border: 1px solid currentColor; border-radius: 999px; font-weight: 500; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; }
.piece-info .sale .buy { display: inline-block; margin-top: 10px; padding: 7px 16px; background: #f0c79f; color: #2a1f16; border-radius: 4px; text-decoration: none; font-weight: 500; }

.piece-close { position: fixed; top: 14px; right: 16px; z-index: 2; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .1); color: #fff; font-size: 2rem; line-height: 1; }
.piece-nav {
  position: fixed; top: 50%; z-index: 2; transform: translateY(-50%);
  width: 60px; height: 60px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .12); color: #fff; font-size: 2.4rem; line-height: 1; padding-bottom: 6px;
}
.piece-prev { left: 18px; }
.piece-next { right: 18px; }
.piece-nav:hover, .piece-close:hover { background: rgba(255, 255, 255, .22); }

/* ---------- Phones / narrow ---------- */
@media (max-width: 800px) {
  .piece-body { grid-template-columns: 1fr; gap: 20px; padding: 64px 16px 90px; align-items: start; }
  .piece-frame { height: auto; max-height: 62vh; }
  .piece-frame img { max-height: 62vh; }
  .piece-nav { top: auto; bottom: 16px; transform: none; width: 50px; height: 50px; font-size: 2rem; background: rgba(60, 52, 45, .9); }
  .piece-prev { left: 16px; }
  .piece-next { right: 16px; }
}
@media (max-width: 600px) {
  body { --home-left: 10px; }
  .room { grid-template-rows: auto 1fr 10vh; }
  .room-sign { padding: 14px 56px 0; }
  .wall { padding: 0 56px; gap: 44px; }
  .art img, .art .noimg { max-height: 40vh; max-width: 66vw; }
  .exhibit { flex-direction: column; align-items: center; gap: 12px; }
  .exhibit--3d { gap: 0; }
  .exhibit--3d .art img { max-height: 30vh; max-width: 60vw; }
  .placard { width: auto; max-width: 66vw; margin: 0; text-align: center; }
  .map-btn { width: 54px; height: 54px; left: 10px; bottom: 10px; }
  .sound-btn { top: 10px; right: 10px; }
  .brochure { padding: 0; place-items: stretch; }
  .paper { min-height: 100%; border-radius: 0; padding-top: 58px; }
  .map-scroll .gallery-map { max-height: none; min-width: 340px; }
}
@media (prefers-reduced-motion: reduce) {
  .js .brochure, .entry, .piece, .art, .placard { transition-duration: .01s !important; }
  .paper.bounce { animation: none; }
  .wall { scroll-behavior: auto; }
}
