/* =========================================================
   Max's Website — the gallery (a little pixel museum)
   loaded after style.css, which provides --px
   ========================================================= */

/* always keep the scrollbar, so the picture columns are measured at their real width */
html { overflow-y: scroll; }

body.museum {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: Georgia, "Times New Roman", serif;
  color: #f4ecd2;
  background: #5a1e2a url("assets/sprites/museum-wallpaper.png") repeat 0 0 /
    calc(24px * var(--px)) calc(32px * var(--px));
}

/* sprites in the room stay crisp; photos inside frames don't inherit this */
.molding, .wainscot, .ivy, body.museum { image-rendering: pixelated; }
.framed img { image-rendering: auto; }
.framed img.crisp, .viewer img.crisp { image-rendering: pixelated; }

/* ---------- the room ---------- */
.molding {
  position: relative;
  z-index: 3;
  height: calc(22px * var(--px));
  background: url("assets/sprites/museum-molding.png") repeat-x 0 0 /
    calc(16px * var(--px)) calc(22px * var(--px));
}
.wainscot {
  position: relative;
  z-index: 3;
  height: calc(60px * var(--px));
  background: url("assets/sprites/museum-wainscot.png") repeat-x 0 0 /
    calc(40px * var(--px)) calc(60px * var(--px));
}
/* ivy creeping down both sides, from the molding to the panelling;
   it grows on the wall, so pictures hang in front of it */
.ivy {
  position: absolute;
  z-index: 0;
  top: calc(18px * var(--px));
  bottom: calc(56px * var(--px));
  width: calc(36px * var(--px));
  pointer-events: none;
  background: url("assets/sprites/museum-ivy.png") repeat-y 0 0 /
    calc(36px * var(--px)) calc(96px * var(--px));
}
.ivy-left  { left: 0; }
.ivy-right { right: 0; transform: scaleX(-1); background-position-y: calc(-40px * var(--px)); }

/* ---------- header ---------- */
.museum-head {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 34px 16px 0;
}
.title-plaque {
  margin: 0;
  padding: 10px 34px 12px;
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 400;
  letter-spacing: 6px;
  text-transform: uppercase;
  color: #3c2c10;
  background: linear-gradient(180deg, #f2d77e, #c79a3a 55%, #a67c2a);
  border: 4px solid #2e1c06;
  box-shadow: 0 0 0 3px #e0b84a, 0 0 0 7px #2e1c06, 6px 10px 0 4px rgba(0, 0, 0, 0.35),
    inset 0 2px 0 #fff6c8;
  text-shadow: 0 1px 0 #f6e6a8;
}
.back-sign {
  padding: 6px 16px;
  font: 700 14px "Trebuchet MS", sans-serif;
  color: #3c2c10;
  text-decoration: none;
  background: #e0b45c;
  border: 3px solid #2e1c06;
  box-shadow: 3px 3px 0 #2e1c06;
}
.back-sign:hover { background: #f0ca79; }
.back-sign:active { transform: translate(3px, 3px); box-shadow: none; }

/* ---------- the wall of pictures ---------- */
.wall {
  position: relative;
  z-index: 1;
  flex: 1;
  box-sizing: border-box;
  width: 100%;
  max-width: 1600px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
  justify-items: center;
  align-items: center;
  align-content: start;
  gap: 64px 48px;
  padding: 56px calc(40px * var(--px)) 90px;
}
.wall .wall-empty { grid-column: 1 / -1; }
.exhibit {
  position: relative;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.framed {
  position: relative;
  display: block;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  filter: drop-shadow(6px 10px 0 rgba(0, 0, 0, 0.35));
}
.framed canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
.framed img {
  position: absolute;
  object-fit: cover;
  background: #140609;
}
.framed:focus-visible { outline: 3px dashed #fbe58a; outline-offset: 6px; }

/* brass plaque under each picture */
.plaque {
  margin-top: 18px;
  padding: 5px 16px 6px;
  max-width: 280px;
  text-align: center;
  color: #3c2c10;
  background: linear-gradient(180deg, #e3c469, #b3903a);
  border: 3px solid #2e1c06;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3), inset 0 2px 0 #f6e6a8;
}
.plaque { position: relative; }
.plaque b { display: block; font-size: 15px; letter-spacing: 1px; }
.plaque b a { color: inherit; text-decoration: none; }
.plaque b a:hover, .plaque b a:focus-visible { text-decoration: underline; }
.plaque span { font-size: 11px; color: #5c4517; }

/* editable plaques (local server only): click the title or date to change it */
.plaque.editable b, .plaque.editable span {
  min-width: 2ch;
  padding: 0 3px;
  outline: none;
  cursor: text;
  overflow-wrap: anywhere;
}
.plaque.editable span { display: inline-block; }
.plaque.editable b:hover, .plaque.editable span:hover { background: rgba(255, 246, 200, 0.35); }
.plaque.editable b:focus, .plaque.editable span:focus {
  background: #f6e6a8;
  box-shadow: 0 0 0 2px #2e1c06;
}
.plaque::after {
  content: attr(data-note);
  position: absolute;
  left: 50%;
  top: 100%;
  margin-top: 6px;
  transform: translateX(-50%);
  white-space: nowrap;
  font: 700 12px "Trebuchet MS", sans-serif;
  color: #fbe58a;
  opacity: 0;
  pointer-events: none;
}
.plaque.noted::after { animation: note 1.6s ease-out; }
@keyframes note { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }

.wall-empty {
  max-width: 560px;
  margin: 40px auto;
  padding: 22px;
  text-align: center;
  font-size: 17px;
  color: #3a3129;
  background: #f4ecd2;
  border: 4px solid #2e1c06;
}

/* ---------- full-size viewer ---------- */
.viewer {
  max-width: 94vw;
  max-height: 94vh;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-out;
}
.viewer::backdrop { background: rgba(20, 6, 9, 0.88); }
.viewer figure { margin: 0; text-align: center; }
.viewer img {
  display: block;
  max-width: 92vw;
  max-height: 84vh;
  object-fit: contain;
  border: 6px solid #e0b84a;
  box-shadow: 0 0 0 4px #2e1c06;
}
.viewer figcaption { margin-top: 12px; color: #f4ecd2; font-size: 16px; letter-spacing: 1px; }

@media (max-width: 640px) {
  .wall { gap: 48px 32px; padding-inline: calc(30px * var(--px)); }
}

/* ---------- framed videos (the Reposts page) ---------- */
.framed.video { cursor: default; }
/* the opening shows just the video's picture area; the video inside is scaled
   so that area fills it exactly, and any baked-in bars fall outside */
.framed .opening {
  position: absolute;
  overflow: hidden;
  background: #140609;
}
.framed video {
  position: absolute;
  max-width: none;
  object-fit: fill;
  cursor: pointer;
}
/* brass buttons sitting on the bottom rail of the frame */
.vid-controls {
  position: absolute;
  left: 50%;
  z-index: 3;
  display: flex;
  gap: 5px;
  transform: translate(-50%, 50%);
}
.vid-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 24px;
  padding: 0;
  color: #3c2c10;
  background: linear-gradient(180deg, #f2d77e, #c79a3a);
  border: 2px solid #2e1c06;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.45), inset 0 1px 0 #fff6c8;
  cursor: pointer;
}
.vid-btn svg { width: 14px; height: 13px; image-rendering: pixelated; }
.vid-btn:hover { background: linear-gradient(180deg, #fbe58a, #e0b84a); }
.vid-btn:active { transform: translate(2px, 2px); box-shadow: none; }
.vid-btn:focus-visible { outline: 2px dashed #fbe58a; outline-offset: 2px; }

/* public site: TikTok's player needs one tap on the video before the buttons work */
.tap-hint {
  position: absolute;
  left: 50%;
  bottom: 12%;
  padding: 4px 10px;
  font: bold 12px/1.2 Georgia, serif;
  white-space: nowrap;
  color: #2b1a05;
  background: linear-gradient(#f3dc8c, #c89b3c);
  border: 2px solid #5a3b0c;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
}
.tap-hint.show { animation: taphint 2.6s ease-out; }
@keyframes taphint {
  0%, 85% { opacity: 1; }
  100% { opacity: 0; }
}
