/* castle.css - "A Benevolent Castle": pixel-art rooms, dark stone and candlelight. Shared by every page. */
:root {
  --ink: #11161f;
  --ink-deep: #0b0f16;
  --slate: #2b3a4a;
  --fog: #8aa0a8;
  --parchment: #e6d8b8;
  --parchment-deep: #c9b48a;
  --candle: #f2b35c;
  --candle-hot: #ffd58f;
  --wax: #b3261e;
  --wax-deep: #5c130f;
  --wood: #6b4a2b;
  --wood-deep: #1a120c;
  --panel: #161d2a;
  --text: #e6d8b8;
  --text-soft: #b9a988;
  --pixel: "Pixelify Sans", ui-monospace, monospace;
  --serif: "EB Garamond", Georgia, serif;
}

* { box-sizing: border-box; }

body.castle {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.castle a { color: var(--candle); }
.castle a:hover { color: var(--candle-hot); }
.castle img.px, .castle .px img { image-rendering: pixelated; }

/* Hidden but read aloud. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Framed boxes ---------- */
.box {
  background: var(--panel);
  border: 4px solid var(--slate);
  box-shadow: 0 0 0 4px var(--ink-deep);
  padding: 20px 22px;
}
.box--wood { background: var(--wood-deep); border-color: var(--wood); }
.box--parchment {
  background: var(--parchment);
  color: #2a1d12;
  border-color: var(--wood);
  box-shadow: 0 0 0 4px var(--ink-deep), inset 0 0 60px var(--parchment-deep);
}
.box--parchment a { color: var(--wax); }
.box--parchment a:hover { color: var(--wax-deep); }

.pixel-h {
  margin: 0;
  font-family: var(--pixel);
  font-weight: 600;
  color: var(--candle);
  line-height: 1.2;
}
.box--parchment .pixel-h { color: var(--wax); }
.kicker { font-family: var(--pixel); font-size: 14px; letter-spacing: 1px; color: var(--fog); }

.btn {
  font-family: var(--pixel);
  font-size: 16px;
  color: #f6e7c4;
  background: var(--wax);
  border: 3px solid var(--wax-deep);
  padding: 10px 16px;
  cursor: pointer;
}
.btn:hover { background: #c8352b; }
.field {
  font: inherit;
  font-size: 18px;
  padding: 10px 12px;
  background: #fffaf0;
  color: #2a1d12;
  border: 3px solid var(--wood);
  min-width: 0;
}

/* ---------- The main room (landing page) ---------- */
.room {
  position: relative;
  max-width: 1600px;
  margin: 0 auto;
  background: var(--ink-deep);
}
.room > img { display: block; width: 100%; height: auto; }
.room-title {
  position: absolute; left: 0; top: 0;
  padding: clamp(12px, 2vw, 24px) clamp(14px, 2.4vw, 30px);
  text-shadow: 0 2px 0 var(--ink-deep), 0 0 12px var(--ink-deep);
}
.room-title h1 {
  margin: 0;
  font-family: var(--pixel);
  font-weight: 600;
  font-size: clamp(22px, 2.6vw, 38px);
  color: #f6e7c4;
  letter-spacing: 1px;
}
.room-title p { margin: 2px 0 0; font-style: italic; font-size: clamp(15px, 1.4vw, 20px); color: var(--parchment); }
.room-title .wip-sign {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 10px;
  font-family: var(--pixel);
  font-style: normal;
  font-size: clamp(11px, 0.95vw, 14px);
  color: #2a1d12;
  text-shadow: none;
  background: var(--candle);
  border: 3px solid #8a5a1e;
  box-shadow: 0 0 0 3px var(--ink-deep);
  transform: rotate(-2deg);
}

.hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--pixel);
  font-size: clamp(12px, 1.05vw, 16px);
  white-space: nowrap;
  text-decoration: none;
  color: #f6e7c4 !important;
  background: var(--wood-deep);
  border: 3px solid var(--wood);
  box-shadow: 0 0 0 3px var(--ink-deep);
  padding: 6px 10px;
  transition: background .12s, border-color .12s;
}
.hotspot:hover, .hotspot:focus-visible { background: #3a2412; border-color: var(--candle); outline: none; }
.hotspot::before { content: "▸ "; }

.room-nav { display: none; }

.below {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px 48px;
}
.welcome {
  position: relative;
  display: flex;
  gap: 22px;
  align-items: center;
  margin-top: clamp(-70px, -5vw, -24px);
}
.welcome img { width: clamp(84px, 9vw, 128px); height: auto; flex: none; }
.welcome p { margin: 0; font-size: clamp(19px, 1.7vw, 23px); line-height: 1.5; }

.subscribe {
  position: relative;
  margin: 40px auto 0;
  max-width: 720px;
}
.subscribe .letter { position: absolute; right: -14px; top: -28px; width: 84px; transform: rotate(8deg); }
.subscribe p { margin: 6px 0 14px; font-size: 18px; }
.subscribe form { display: flex; flex-wrap: wrap; gap: 8px; }
.subscribe .field { flex: 1 1 220px; }
.form-note { margin: 10px 0 0; font-size: 16px; font-style: italic; min-height: 1em; }

.foot {
  margin-top: 48px;
  padding-top: 18px;
  border-top: 3px solid #3a2a1c;
  font-size: 17px;
  font-style: italic;
  color: var(--fog);
  display: flex;
  gap: 14px;
  align-items: center;
}
.foot img { width: 64px; height: auto; flex: none; }

@media (max-width: 760px) {
  .hotspot { display: none; }
  .room > img { height: 300px; object-fit: cover; object-position: 40% 50%; }
  .room-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 12px 16px;
    background: var(--wood-deep);
    border-bottom: 3px solid var(--wood);
  }
  .room-nav a {
    font-family: var(--pixel);
    font-size: 15px;
    padding: 11px 10px;
    border: 2px solid var(--wood);
    text-decoration: none;
  }
  .below { padding: 0 16px 40px; }
  .welcome { margin-top: 20px; flex-direction: column; align-items: flex-start; gap: 12px; }
  .subscribe .letter { width: 60px; right: -6px; top: -22px; }
}

/* ---------- Room pages: a backdrop with the room's name on it ---------- */
.backdrop {
  position: relative;
  max-width: 1600px;
  margin: 0 auto;
  background: var(--ink-deep);
}
.backdrop > img {
  display: block;
  width: 100%;
  height: clamp(260px, 42vw, 560px);
  object-fit: cover;
  object-position: 50% 50%;
}
.backdrop .back {
  position: absolute; left: clamp(12px, 2vw, 24px); top: clamp(12px, 2vw, 20px);
  font-family: var(--pixel);
  font-size: 15px;
  text-decoration: none;
  color: #f6e7c4 !important;
  background: var(--wood-deep);
  border: 3px solid var(--wood);
  box-shadow: 0 0 0 3px var(--ink-deep);
  padding: 8px 12px;
}
.backdrop .back:hover { border-color: var(--candle); }
.plaque {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 50%);
  min-width: min(560px, 90vw);
  text-align: center;
  background: var(--wood-deep);
  border: 4px solid var(--wood);
  box-shadow: 0 0 0 4px var(--ink-deep), 0 14px 30px #00000080;
  padding: 14px 24px;
}
.plaque h1 { margin: 0; font-family: var(--pixel); font-weight: 600; font-size: clamp(24px, 3vw, 36px); color: #f6e7c4; }
.plaque p { margin: 4px 0 0; font-style: italic; font-size: 18px; color: var(--text-soft); }

.room-page {
  max-width: 900px;
  margin: 0 auto;
  padding: clamp(64px, 8vw, 90px) 20px 56px;
}
.room-page--wide { max-width: 1180px; }

/* Essay list on the desk */
.entries { list-style: none; margin: 0; padding: 0; }
.entries a {
  display: flex;
  gap: 18px;
  align-items: baseline;
  padding: 14px 4px;
  border-bottom: 1px solid var(--slate);
  text-decoration: none;
  color: var(--text);
}
.entries a:hover { color: #fff3d6; background: #1a2230; }
.entries .when { flex: none; width: 110px; font-family: var(--pixel); font-size: 14px; color: var(--fog); }
.entries .what { flex: 1; min-width: 0; font-size: 23px; line-height: 1.25; }
@media (max-width: 560px) {
  .entries a { display: block; }
  .entries .when { display: block; width: auto; margin-bottom: 4px; }
}

/* Thirty nights */
.candles { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; margin: 18px 0; }
.candles img { width: 100%; height: auto; }
.candles .unlit { opacity: .5; }
.candles .lit { filter: drop-shadow(0 0 6px #f2b35caa); }

/* Friends & guestbook */
.blogroll { display: flex; flex-direction: column; gap: 6px; font-size: 21px; }
.badge-88 {
  display: inline-block; vertical-align: middle;
  width: 88px; height: 31px;
  border: 2px solid var(--wood);
  background: var(--wood-deep);
  color: var(--candle);
  font-family: var(--pixel); font-size: 11px; line-height: 27px; text-align: center;
}
/* Postcards pinned to the door, each a link to a friend's blog. */
.postcards {
  list-style: none;
  margin: 0;
  padding: 8px 4px 4px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 26px 22px;
}
.postcards li:nth-child(3n+1) a { transform: rotate(-2deg); }
.postcards li:nth-child(3n+2) a { transform: rotate(1.5deg); }
.postcards li:nth-child(3n) a { transform: rotate(-0.8deg); }
.postcards a {
  position: relative;
  display: block;
  background: #f6ecd4;
  padding: 8px 8px 0;
  box-shadow: 0 6px 14px #00000080;
  text-decoration: none;
  transition: transform .15s;
}
.postcards a::before {
  /* the pin */
  content: "";
  position: absolute; z-index: 1; left: 50%; top: -6px;
  width: 12px; height: 12px; margin-left: -6px;
  background: var(--wax);
  border: 2px solid var(--wax-deep);
  border-radius: 50%;
}
.postcards a:hover, .postcards a:focus-visible { transform: rotate(0) scale(1.04); outline: none; }
.postcards a > img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.pc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 2px 8px 4px; }
.pc-name { font-size: 19px; font-style: italic; color: #2a1d12; line-height: 1.2; }
.pc-stamp {
  flex: none;
  width: 34px; height: 34px;
  object-fit: cover;
  background: #fff;
  border: 2px dashed #a88d63;
  padding: 2px;
}
.pc-stamp--emoji { display: grid; place-items: center; font-size: 20px; line-height: 1; }

.guest { padding: 10px 0; border-bottom: 1px dashed #a88d63; }
.guest .who { font-family: var(--pixel); font-size: 13px; color: var(--wood); }
.stack { display: flex; flex-direction: column; gap: 32px; }

/* ---------- Existing pages moved into the castle ---------- */
/* Gifts: the old catalogue sits on a parchment sheet inside the cabinet room. */
body.castle .sheet {
  max-width: 1180px;
  margin: clamp(64px, 8vw, 90px) auto 56px;
  background: #efe3c6;
  border: 4px solid var(--wood);
  box-shadow: 0 0 0 4px var(--ink-deep);
  --card: #efe3c6;
  --tile: #f6ecd4;
  --rule: #d8c7a0;
  --accent: var(--wax);
  --accent-deep: var(--wax-deep);
  color: #2a1d12;
}
body.castle .sheet .page-shell { padding-top: clamp(2.5rem, 5vw, 4rem); }

/* Rankings: same page, read by candlelight. */
body.castle.rk-page {
  --rk-ink: var(--parchment);
  --rk-muted: var(--text-soft);
  --rk-faint: var(--fog);
  --rk-accent: var(--candle);
  --rk-paper: var(--ink);
  --rk-rule: var(--slate);
  background: var(--ink);
}
body.castle.rk-page .wrap { padding-top: clamp(64px, 8vw, 90px); }
body.castle.rk-page .tabs a { color: var(--text-soft); }
body.castle.rk-page .tabs a.on, body.castle.rk-page .tabs a:hover { color: var(--candle); }
