/* Dialogue lettering for regular text; the colourful display face stays below. */
@font-face {
  font-family: "SM64 Dialogue";
  src: url("fonts/castle/mario64/64.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Mario 256";
  src: url("fonts/castle/SuperMario256.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: white;
  font-family: "SM64 Dialogue", Verdana, sans-serif;
  font-size: 18px;
  line-height: 1.4;
  background: #94bcec url("images/castle/main-hall-wall.png") repeat;
  background-size: 320px 320px;
}
a { color: inherit; }
button { font: inherit; }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 3px dotted #fff6a9;
  outline-offset: 5px;
}
[hidden] { display: none !important; }

.cornice {
  height: 26px;
  border-top: 5px solid #ffffe2;
  border-bottom: 6px solid #a99c78;
  background: linear-gradient(#e7dbb4 0 50%, #f8f2d8 50%);
  box-shadow: 0 4px 0 #655d4a;
}
.castle-room {
  position: relative;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 50px;
  border-left: 16px ridge #e5dbb6;
  border-right: 16px ridge #e5dbb6;
}
.room-nav {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0 0;
  text-shadow: 1px 2px #263a58;
}
.castle-header {
  display: grid;
  grid-template-columns: 1fr 360px;
  align-items: center;
  gap: 45px;
  max-width: 820px;
  margin: 32px auto 46px;
}
.welcome { text-align: center; }
.peach-window {
  display: block;
  width: 180px;
  height: auto;
  margin: 0 auto 14px;
  image-rendering: pixelated;
  filter: drop-shadow(4px 5px 0 #344763);
}
h1 {
  margin: 0;
  font-family: "Mario 256", Impact, sans-serif;
  font-size: clamp(44px, 6vw, 76px);
  font-weight: normal;
  letter-spacing: -3px;
  line-height: 1.2;
  text-shadow: 3px 4px 0 #152747, -2px -1px 0 #152747, 2px -1px 0 #152747, -2px 2px 0 #152747;
}
h1 i { display: inline-block; font-style: normal; }
h1 i:nth-child(4n+1) { color: #ff5346; transform: rotate(-6deg); }
h1 i:nth-child(4n+2) { color: #60b2ff; transform: rotate(5deg); }
h1 i:nth-child(4n+3) { color: #ffe34b; transform: rotate(-4deg); }
h1 i:nth-child(4n+4) { color: #62d946; transform: rotate(5deg); }
.invitation {
  margin: 14px 0 0;
  font-size: 24px;
  text-shadow: 1px 2px #263a58;
}
.music-box {
  min-width: 0;
  padding: 10px;
  border: 5px ridge #dfbd68;
  background: #171723;
  box-shadow: 5px 6px 0 #273b57;
  font-size: 18px;
}
.music-caption p { margin: 0 0 4px; }
.music-label { color: #ffe479; }
#selected-room { font-size: 22px; }
#selected-song { color: #d5d5e0; }
.player-frame { margin-top: 9px; min-height: 200px; background: #080810; }
.player-frame iframe { display: block; border: 0; width: 100%; height: 200px; }
.player-note { min-height: 2.8em; margin: 9px 0 3px; font-size: 16px; line-height: 1.4; }
.player-controls { display: flex; gap: 13px; flex-wrap: wrap; }
.player-controls button {
  border: 0;
  padding: 4px 0;
  background: none;
  color: white;
  cursor: pointer;
}
.player-controls button:hover { color: #ffe479; }
.soundtrack-link { display: inline-block; margin-top: 6px; color: #e5d8aa; font-size: 16px; }
.gallery-intro {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  scroll-margin-top: 20px;
  margin-bottom: 30px;
  text-shadow: 2px 2px #263a58;
}
.gallery-intro p { margin: 0; font-size: 24px; }
.gallery-intro > span { color: #ffe34b; font-size: 28px; }
.paintings {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 220px));
  justify-content: center;
  align-items: start;
  column-gap: 64px;
  row-gap: 48px;
  list-style: none;
  padding: 0;
  margin: 0 auto;
}
.painting { display: block; text-align: center; text-decoration: none; }
.course-number {
  display: block;
  margin-bottom: 9px;
  font-size: 16px;
  text-shadow: 1px 2px #203456;
}
.painting-frame {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border: 5px ridge #d2a93f;
  background: #252a32;
  box-shadow: 5px 6px 0 #314c4a;
}
.painting-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  image-rendering: pixelated;
}
.portal { border-color: #aca88e; }
.portal img { object-fit: cover; }
.boo { background: #222d45; }
.boo img { object-fit: contain; padding: 12px; }
.clock { border-radius: 50%; overflow: hidden; }
.mirror img { transform: scaleX(-1); }
.course-name {
  display: block;
  margin-top: 14px;
  font-family: "Mario 256", Impact, sans-serif;
  font-size: 18px;
  line-height: 1.4;
  font-weight: normal;
  text-shadow: 2px 3px #243b38, -1px -1px #243b38, 1px -1px #243b38;
}
.entrance-note { display: block; margin-top: 5px; font-size: 16px; text-shadow: 1px 2px #243b38; }
.painting:hover .painting-frame,
.painting:focus-visible .painting-frame { outline: 3px solid #fff5ae; outline-offset: 3px; }
.painting:hover img { animation: painting-ripple .7s ease-in-out; }
.painting[aria-current="true"] .painting-frame { outline: 4px solid #ffe34b; outline-offset: 3px; }
.painting[aria-current="true"] .course-number::before { content: "★ "; color: #ffe34b; }
.painting[aria-current="true"] .course-name { color: #ffe479; }
@keyframes painting-ripple {
  25% { transform: perspective(300px) rotateY(5deg) scale(.97); }
  50% { transform: perspective(300px) rotateY(-4deg) scale(1.01); }
  75% { transform: perspective(300px) rotateY(2deg) scale(.99); }
}
.room-footer {
  padding: 45px 0 30px;
  text-align: center;
  text-shadow: 1px 2px #263a58;
}
.room-footer > p { margin: 0 0 16px; }
.credits { max-width: 590px; margin: auto; font-size: 16px; line-height: 1.4; }
.credits summary { cursor: pointer; }
.credits[open] { background: #223e53; padding: 12px; text-shadow: none; }
.castle-floor {
  height: 150px;
  border-top: 12px ridge #d3ba8c;
  background: #ddd5c6 url("images/castle/marble-floor.png") repeat;
  background-size: 80px 80px;
}
.red-carpet {
  width: 210px;
  height: 100%;
  margin: 0 auto;
  border-left: 6px solid #e8b34e;
  border-right: 6px solid #e8b34e;
  background: #a71924 url("images/castle/carpet.png") repeat;
  background-size: 96px 96px;
}
.no-script { text-align: center; background: #243b38; padding: 12px; }

@media (max-width: 900px) {
  .castle-room { padding: 0 24px; border-width: 10px; }
  .castle-header { gap: 22px; grid-template-columns: 1fr 330px; }
  .paintings { column-gap: 30px; }
  .course-name { font-size: 16px; }
}
@media (max-width: 640px) {
  .castle-room { padding: 0 16px; border-width: 7px; }
  .room-nav { font-size: 16px; }
  .castle-header { grid-template-columns: 1fr; margin-top: 25px; }
  .peach-window { width: 138px; }
  h1 { font-size: 60px; }
  .music-box { width: 100%; max-width: 360px; margin: 5px auto 0; }
  .paintings { grid-template-columns: repeat(2, minmax(0, 220px)); gap: 34px 24px; }
  .gallery-intro p { font-size: 20px; }
  .gallery-intro { gap: 8px; }
  .painting-frame { border-width: 3px; box-shadow: 3px 4px 0 #314c4a; }
  .course-name { font-size: 14px; }
  .entrance-note { font-size: 14px; }
}
@media (max-width: 340px) {
  .paintings { grid-template-columns: minmax(0, 220px); }
  .room-nav { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .painting:hover img { animation: none; }
}
