/* ==========================================================================
   The Adventures of The Cubes

   The idea: the album is a real object sitting on the table. Everything
   around it is the game's interface: tooltips, red buttons, the chat box.
   ========================================================================== */

@font-face {
  font-family: "Morpheus";
  src: url("fonts/morpheus.TTF") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Friz Quadrata";
  src: url("fonts/friz-quadrata.ttf") format("truetype");
  font-display: swap;
}

:root {
  /* the room */
  --ground: #161a27;
  --panel: #0c0f19;
  --panel-edge: #2c3144;

  /* the game's own UI colours */
  --ui-gold: #ffd100;      /* default WoW interface text */
  --tooltip: rgba(9, 9, 28, .94);
  --tooltip-edge: #7a7a8e;
  --paladin: #f58cba;      /* class colours */
  --mage: #69ccf0;
  --achievement: #ffff00;
  --guild: #40ff40;
  --emote: #ff8040;

  /* the album */
  --parchment: #f2e6c7;
  --mount: #fbf6e8;
  --ink: #2e1f0f;
  --ink-soft: #6b5536;
  --stamp: #e6c47a;         /* gold-stamped lettering */
  --corner: 50px;

  --outline: 1px 1px 0 #000, -1px 1px 0 #000, 1px -1px 0 #000, -1px -1px 0 #000;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--ground);
  color: #e9e4d8;
  font-family: "Friz Quadrata", Georgia, serif;
  font-size: 15px;
  line-height: 1.45;
}

a { color: inherit; }
button { font: inherit; }

:focus-visible {
  outline: 2px solid var(--ui-gold);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- the panel everything sits on ---------- */

.page-stage {
  position: relative;
  width: min(1120px, calc(100% - 24px));
  margin: 22px auto 40px;
  isolation: isolate;
}

.site-shell {
  position: relative;
  z-index: 2;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
}

/* ---------- header ---------- */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 34px 40px 10px;
}

.masthead h1 {
  margin: 0;
  font-family: "Morpheus", "Friz Quadrata", serif;
  font-weight: normal;
  font-size: clamp(38px, 5.4vw, 62px);
  line-height: 1;
  color: var(--ui-gold);
  text-shadow: var(--outline), 3px 4px 0 #000;
}

.masthead-subtitle {
  margin: 10px 0 0;
  color: #d9d2c0;
  font-size: 16px;
}

/* the two of them, as in-game tooltips */
.party {
  display: grid;
  gap: 8px;
  flex: 0 0 auto;
}

.unit {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 232px;
  padding: 8px 16px 8px 9px;
  background: var(--tooltip);
  border: 1px solid var(--tooltip-edge);
  border-radius: 5px;
  box-shadow: inset 0 0 0 1px #000, 0 0 0 1px #000;
  color: #fff;
  font-size: 13px;
  line-height: 1.3;
  text-decoration: none;
  text-shadow: 1px 1px 0 #000;
}
.unit-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #000, 0 0 0 2px #5a5a6a;
}
.unit-lines > span { display: block; }
.unit-name { font-size: 16px; }
.unit--paladin .unit-name { color: var(--paladin); }
.unit--mage .unit-name { color: var(--mage); }
.unit:hover { color: #fff; }
.unit--paladin:hover { border-color: var(--paladin); }
.unit--mage:hover { border-color: var(--mage); }

/* ---------- the album ---------- */

.album { padding: 8px 18px 0; }

.book-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 640px;
  padding: 26px 0 18px;
}

.book {
  width: min(840px, 100%);
  filter: drop-shadow(0 18px 26px rgba(0, 0, 0, .6));
  transition: transform .5s ease;
}
.book.closed-front { transform: translateX(-25%); }
.book.closed-back { transform: translateX(25%); }
@media (prefers-reduced-motion: reduce) {
  .book { transition: none; }
}

/* the pages: a paper scan (Paper001/Paper002 from ambientCG, CC0) relit in
   the parchment colour. Left-hand pages use a mirrored copy. */
.album-page {
  position: relative;
  overflow: hidden;
  color: var(--ink);
  background: var(--parchment) url("images/paper-right.jpg") center / 100% 100% no-repeat;
  border: 1px solid #c9b688;
}
.album-page.--left { background-image: url("images/paper-left.jpg"); }

/* the fold between two facing pages */
.album-page.--left::before,
.album-page.--right::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 34px;
  z-index: 3;
  pointer-events: none;
}
.album-page.--left::before { right: 0; background: linear-gradient(90deg, transparent, rgba(74, 52, 24, .3)); }
.album-page.--right::before { left: 0; background: linear-gradient(270deg, transparent, rgba(74, 52, 24, .3)); }
/* ...but not on the cover, where it just smeared brown down the spine */
.cover-page.--left::before,
.cover-page.--right::before { content: none; }

.page-inner {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 50px 22px 22px;
}

/* date and place, ruled across the top of both pages */
.memory-meta {
  position: absolute;
  top: 20px; left: 22px; right: 22px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(46, 31, 15, .22);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.2;
}

.photo-frame {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  --mount-pad: 12px;
  padding: var(--mount-pad);
  background: var(--mount);
  border: 1px solid #d4c39f;
  box-shadow: 3px 6px 14px rgba(74, 51, 28, .26);
  transform: rotate(var(--tilt, 0deg));
}
.photo-frame img {
  display: block;
  max-width: 100%;
  max-height: 380px;
  background: #1e2130;
  /* so a click lands on the button, not the picture, and the page doesn't turn */
  pointer-events: none;
}
.photo-open {
  position: relative;
  display: block;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}
.photo-open:hover img { filter: brightness(1.06); }
/* a gold magnifying glass on the corner of every photo, so people know it
   opens bigger. It's part of the button, so clicking it opens the photo too. */
.photo-open::after {
  content: "";
  position: absolute;
  right: calc(-1 * var(--mount-pad) - 9px);
  bottom: calc(-1 * var(--mount-pad) - 9px);
  width: 28px;
  height: 28px;
  background: url("images/magnifier.svg") center / contain no-repeat;
  filter: drop-shadow(1px 2px 2px rgba(40, 25, 10, .35));
}
.photo-open:hover::after { filter: brightness(1.12) drop-shadow(1px 2px 2px rgba(40, 25, 10, .35)); }
.memory-caption {
  margin: 0;
  text-align: center;
  font-size: 20px;
  line-height: 1.2;
}
.memory-note {
  margin: 0 auto;
  max-width: 90%;
  text-align: center;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.5;
}
.placeholder-photo {
  display: grid;
  place-items: center;
  min-width: 260px;
  min-height: 220px;
  padding: 24px;
  text-align: center;
  color: #b9a77e;
  background: #302a24;
  font-size: 13px;
}

/* cover: one piece of leather. The leather layers in images/cover/ carry
   the grain, the light and the banded spine, but no colour; the colour is
   mixed in here, so any colour works. Pick both in album-data.js.
   Leather scans: Poly Haven and ambientCG (CC0, free to use).
   Gold is only used where there'd be metal or gold stamping. */
.cover-page {
  color: var(--stamp);
  text-align: center;
  border: 1px solid rgba(0, 0, 0, .6);
  background: #1f3354;
}
.cover-leather {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-color: #1f3354;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  /* sheen on top, then highlights, then shadows (see album.js) */
  background-blend-mode: screen, color-dodge, multiply;
}
.cover-corner {
  position: absolute;
  z-index: 4;
  right: 1px;
  width: var(--corner);
  height: var(--corner);
  background: url("images/corner.svg") center / contain no-repeat;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .55));
}
.cover-corner--tr { top: 1px; transform: scaleX(-1); }
.cover-corner--br { bottom: 1px; transform: scale(-1, -1); }

/* the back cover is the same leather seen from behind: mirrored, so the
   spine is on the right and the metal corners are on the left */
.back-cover .cover-leather { transform: scaleX(-1); }
.cover-corner--tl { top: 1px; left: 1px; right: auto; }
.cover-corner--bl { bottom: 1px; left: 1px; right: auto; transform: scaleY(-1); }

/* padding in % so the text keeps clear of the spine at any size */
.cover-page .page-inner {
  gap: 0;
  padding: 15% 12% 15% 20%;
}
.cover-symbol {
  display: block;
  width: 80px;
  margin: 0 auto 24px;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .6));
}
.cover-page h3 {
  margin: 0;
  font-weight: normal;
  font-size: 27px;
  line-height: 1.18;
  color: var(--stamp);
  text-shadow: 0 1px 1px rgba(0, 0, 0, .7);
}
.cover-page p {
  margin: 14px 0 0;
  color: rgba(243, 230, 205, .72);
  text-shadow: 0 1px 1px rgba(0, 0, 0, .6);
}
.cover-signature {
  margin-top: 26px;
  color: var(--stamp);
  font-size: 14px;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .6);
}

/* inside back cover */
.end-page .page-inner { text-align: center; }
.end-emblem {
  width: 54px;
  margin: 0 auto;
  opacity: .7;
}
.end-page h3 {
  margin: 4px 0 0;
  font-weight: normal;
  font-size: 24px;
}
.end-page p {
  margin: 0;
  color: var(--ink-soft);
}

/* ---------- page buttons: the red ones from every in-game window ---------- */

.book-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--ui-gold);
  font-size: 14px;
  text-shadow: 1px 1px 0 #000;
}
.book-main { display: flex; align-items: center; gap: 16px; }
.book-extras { display: flex; gap: 36px; }

/* Contents and Newest: quieter than the red page-turn buttons */
.text-button {
  padding: 4px 2px;
  color: var(--ui-gold);
  background: none;
  border: 0;
  font: inherit;
  font-size: 14px;
  text-shadow: 1px 1px 0 #000;
  text-decoration: underline;
  text-decoration-color: rgba(255, 209, 0, .35);
  text-underline-offset: 4px;
  cursor: pointer;
}
.text-button:hover { color: #fff; text-decoration-color: currentColor; }
.text-button:disabled { color: #6f6a5c; text-decoration: none; cursor: default; }

/* the page number is an in-game edit box you can type into */
.page-jump { display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 190px; white-space: nowrap; }
.page-jump input {
  width: 3ch;
  box-sizing: content-box;
  padding: 3px 4px 2px;
  color: #fff;
  background: #000;
  border: 1px solid #6b6b80;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px #000;
  font: inherit;
  text-align: center;
}
.page-jump input::placeholder { color: #8a8578; }
.page-jump input:focus { outline: none; border-color: var(--ui-gold); }

.wow-button {
  min-width: 108px;
  padding: 6px 16px 5px;
  color: var(--ui-gold);
  font-size: 14px;
  text-shadow: 1px 1px 0 #000;
  background: linear-gradient(#b3200f, #7a1006 50%, #560a03);
  border: 1px solid #1a0200;
  border-radius: 4px;
  box-shadow:
    inset 0 1px 0 rgba(255, 190, 130, .4),
    inset 0 -2px 3px rgba(0, 0, 0, .35),
    0 0 0 2px #5b4a24,
    0 0 0 3px #000;
  cursor: pointer;
}
.wow-button:hover { color: #fff; }
.wow-button:active { transform: translateY(1px); }
.wow-button:disabled {
  color: #8a8a8a;
  background: linear-gradient(#5a4a46, #3b302d);
  cursor: default;
  transform: none;
}

/* ---------- bottom row: chat box + footer ---------- */

.lower {
  display: grid;
  grid-template-columns: minmax(0, 560px) 1fr;
  align-items: end;
  gap: 24px;
  padding: 36px 24px 22px;
}

.chat-tab {
  display: inline-block;
  margin: 0;
  padding: 5px 14px 4px;
  color: var(--ui-gold);
  font-size: 13px;
  font-weight: normal;
  text-shadow: 1px 1px 0 #000;
  background: rgba(255, 255, 255, .07);
  border-radius: 6px 6px 0 0;
}
.chat-log {
  margin: 0;
  padding: 10px 14px 12px;
  list-style: none;
  background: rgba(255, 255, 255, .07);
  border-radius: 0 6px 6px 6px;
  color: var(--guild);
  font-size: 14px;
  line-height: 1.55;
  text-shadow: 1px 1px 0 #000;
}
.chat-time { color: #b5b5b5; }
.chat-emote { color: var(--emote); }

.chat-link {
  position: relative;
  color: var(--achievement);
  text-decoration: none;
  white-space: nowrap;
}
.chat-link:hover { text-decoration: underline; }

/* hovering a link shows its tooltip, like an item link in chat */
.link-tip {
  display: none;
  position: absolute;
  z-index: 10;
  left: 0;
  bottom: calc(100% + 8px);
  width: 270px;
  padding: 9px 11px 11px;
  background: var(--tooltip);
  border: 1px solid var(--tooltip-edge);
  border-radius: 5px;
  box-shadow: inset 0 0 0 1px #000, 0 0 0 1px #000, 0 10px 24px rgba(0, 0, 0, .5);
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  white-space: normal;
  pointer-events: none;
}
.chat-link:hover .link-tip,
.chat-link:focus-visible .link-tip { display: block; }
.link-tip img {
  display: block;
  width: 100%;
  height: 138px;
  object-fit: cover;
  margin-bottom: 8px;
  border: 1px solid #000;
}
.link-tip strong {
  display: block;
  color: var(--achievement);
  font-weight: normal;
  font-size: 15px;
}
.link-tip span { display: block; }
.tip-note { margin-top: 5px; color: var(--ui-gold); }

footer {
  color: #8a8578;
  font-size: 12px;
  text-align: right;
}
footer p { margin: 3px 0; }
footer a { color: #cfc6b0; }
footer a:hover { color: #fff; }

/* ---------- pop-up windows: the photo viewer and the contents ---------- */

body:has(dialog[open]) { overflow: hidden; }

dialog {
  padding: 0;
  border: 0;
  color: #fff;
  background: none;
}
dialog::backdrop { background: rgba(4, 5, 11, .95); }

/* the red square close button from every in-game window */
.close-x {
  position: relative;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  padding: 0;
  background: linear-gradient(#b3200f, #7a1006 55%, #560a03);
  border: 1px solid #1a0200;
  border-radius: 5px;
  box-shadow: inset 0 1px 0 rgba(255, 190, 130, .4), 0 0 0 2px #5b4a24, 0 0 0 3px #000;
  cursor: pointer;
}
.close-x::before,
.close-x::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 3px;
  background: #f1dfbb;
  border-radius: 1px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .6);
  transform: translate(-50%, -50%) rotate(45deg);
}
.close-x::after { transform: translate(-50%, -50%) rotate(-45deg); }
.close-x:hover::before,
.close-x:hover::after { background: #fff; }

/* photo viewer */
.viewer {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
}
.viewer[open] { display: flex; }
.viewer .close-x { position: absolute; top: calc(18px + env(safe-area-inset-top, 0px)); right: 20px; }
.viewer-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 0;
  min-height: 0;
}
.viewer-img {
  display: block;
  max-width: min(1600px, 100%);
  max-height: calc(100dvh - 230px);
  object-fit: contain;
  border: 8px solid var(--mount);
  background: #1e2130;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .6);
}
.viewer figcaption {
  display: grid;
  justify-items: center;
  gap: 3px;
  max-width: 70ch;
  text-align: center;
  text-shadow: 1px 1px 0 #000;
}
.viewer-caption { color: var(--ui-gold); font-size: 20px; font-weight: normal; }
.viewer-meta { color: #b8b2a3; font-size: 13px; }
.viewer-note { color: #e9e4d8; font-size: 15px; }
.viewer-controls { display: flex; align-items: center; gap: 16px; color: var(--ui-gold); text-shadow: 1px 1px 0 #000; }
.viewer-count { min-width: 64px; text-align: center; }

/* contents, laid out like the quest log: the list on the left, a page of
   parchment on the right showing whichever entry you're pointing at */
.contents {
  width: min(900px, calc(100vw - 24px));
  height: min(640px, calc(100dvh - 24px));
  max-width: none;
  max-height: none;
  background: var(--tooltip);
  border: 1px solid var(--tooltip-edge);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px #000, 0 0 0 1px #000, 0 30px 80px rgba(0, 0, 0, .6);
}
.contents[open] { display: flex; flex-direction: column; }
.contents-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px 20px;
}
.contents-head h2 {
  margin: 0;
  font-family: "Morpheus", "Friz Quadrata", serif;
  font-weight: normal;
  font-size: 32px;
  line-height: 1;
  color: var(--ui-gold);
  text-shadow: var(--outline), 2px 3px 0 #000;
}
.contents-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 14px;
  padding: 0 14px 14px;
}
.toc {
  overflow-y: auto;
  padding: 2px 8px 10px 6px;
  scrollbar-color: #4a4f66 transparent;
}
.toc h3 {
  margin: 14px 0 4px 8px;
  color: #b8b2a3;
  font-size: 13px;
  font-weight: normal;
}
.toc h3:first-child { margin-top: 2px; }
.toc ol { margin: 0; padding: 0; list-style: none; }
.toc-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 12px;
  width: 100%;
  padding: 6px 8px 7px;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 3px;
  font: inherit;
  cursor: pointer;
}
.toc-title { color: var(--ui-gold); font-size: 15px; text-shadow: 1px 1px 0 #000; }
.toc-page { color: #8a8578; font-size: 13px; align-self: center; }
.toc-meta {
  grid-column: 1 / -1;
  color: #8a8578;
  font-size: 12px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.toc-row:hover,
.toc-row:focus-visible,
.toc-row.is-previewed { background: rgba(255, 209, 0, .1); }
.toc-row:hover .toc-title,
.toc-row:focus-visible .toc-title { color: #fff; }
.toc-row:focus-visible { outline-offset: -2px; }

.toc-preview {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px 24px;
  color: var(--ink);
  background: var(--parchment) url("images/paper-right.jpg") center / cover no-repeat;
  border-radius: 3px;
  box-shadow: inset 0 0 30px rgba(110, 80, 35, .2);
}
.toc-photo {
  margin-bottom: 8px;
  padding: 8px;
  background: var(--mount);
  box-shadow: 2px 4px 10px rgba(74, 51, 28, .25);
}
.toc-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #1e2130;
}
.toc-preview-title {
  font-family: "Morpheus", "Friz Quadrata", serif;
  font-weight: normal;
  font-size: 28px;
  line-height: 1.05;
}
.toc-preview-meta { color: var(--ink-soft); font-size: 13px; }
.toc-preview-note { margin: 6px 0 0; line-height: 1.5; }
.toc-preview-hint { margin-top: auto; padding-top: 10px; color: #9c8a68; font-size: 12px; }

/* ---------- cover workshop (only appears with ?workshop in the address) ---------- */

.workshop {
  position: fixed;
  z-index: 50;
  right: 16px;
  bottom: 16px;
  width: 270px;
  padding: 12px 14px 14px;
  background: var(--tooltip);
  border: 1px solid var(--tooltip-edge);
  border-radius: 5px;
  box-shadow: inset 0 0 0 1px #000, 0 0 0 1px #000, 0 12px 30px rgba(0, 0, 0, .6);
  color: #fff;
  font-size: 13px;
  text-shadow: 1px 1px 0 #000;
}
.workshop h2 {
  margin: 0 0 10px;
  color: var(--ui-gold);
  font-size: 16px;
  font-weight: normal;
}
.workshop label { display: block; margin: 10px 0 5px; color: #d9d2c0; }
.workshop select,
.workshop input[type="color"] { width: 100%; font: inherit; }
.workshop input[type="color"] { height: 34px; padding: 0 2px; border: 1px solid #555; background: #111; cursor: pointer; }
.workshop select { padding: 5px 6px; color: #fff; background: #111; border: 1px solid #555; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.swatches button {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid #000;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #777;
  cursor: pointer;
}
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ui-gold); }
.workshop pre {
  margin: 12px 0 8px;
  padding: 8px 9px;
  background: #000;
  border: 1px solid #333;
  color: var(--guild);
  font-size: 12px;
  white-space: pre-wrap;
  text-shadow: none;
}
.workshop-buttons { display: flex; gap: 8px; }
.workshop-buttons .wow-button { flex: 1; min-width: 0; padding: 5px 8px 4px; font-size: 13px; }

/* ==========================================================================
   Character pages
   ========================================================================== */

.profile-shell { width: min(960px, calc(100% - 24px)); margin: 22px auto 40px; }

.profile-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 34px 6px;
}
.profile-top h1 {
  margin: 0;
  font-family: "Morpheus", "Friz Quadrata", serif;
  font-weight: normal;
  font-size: clamp(34px, 5vw, 50px);
  line-height: 1;
  color: var(--ui-gold);
  text-shadow: var(--outline), 3px 4px 0 #000;
}
.back-home {
  color: #d9d2c0;
  font-size: 14px;
  text-decoration: none;
}
.back-home:hover { color: #fff; text-decoration: underline; }

.profile-main { padding: 18px 26px 10px; }

/* the sheet: a page out of the quest log */
.character-sheet {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 34px;
  padding: 32px 34px 34px;
  color: var(--ink);
  background: var(--parchment);
  border-radius: 3px;
  box-shadow: inset 0 0 40px rgba(110, 80, 35, .22), 0 14px 30px rgba(0, 0, 0, .45);
}

.portrait {
  margin: 0;
  align-self: center;
}
.portrait img {
  display: block;
  width: 100%;
  height: 330px;
  object-fit: contain;
  filter: drop-shadow(0 8px 10px rgba(60, 40, 15, .3));
}
.portrait figcaption {
  margin-top: 10px;
  text-align: center;
  font-family: "Morpheus", "Friz Quadrata", serif;
  font-size: 24px;
}
.paladin-theme .portrait figcaption { color: #a63d6e; }
.mage-theme .portrait figcaption { color: #1f6f92; }

.bio h2 {
  margin: 0;
  font-family: "Morpheus", "Friz Quadrata", serif;
  font-weight: normal;
  font-size: clamp(40px, 6vw, 58px);
  line-height: .95;
}
.bio-title {
  margin: 6px 0 0;
  font-size: 17px;
}
.paladin-theme .bio-title { color: #a63d6e; }
.mage-theme .bio-title { color: #1f6f92; }
.bio-tagline {
  margin: 4px 0 20px;
  color: var(--ink-soft);
  font-size: 16px;
}

.bio-list { margin: 0; border-top: 1px solid rgba(46, 31, 15, .2); }
.bio-list div {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(46, 31, 15, .2);
}
.bio-list dt { color: var(--ink-soft); }
.bio-list dd { margin: 0; }

.bio-note { margin-top: 24px; }
.bio-note h3 {
  margin: 0 0 4px;
  font-family: "Morpheus", "Friz Quadrata", serif;
  font-weight: normal;
  font-size: 24px;
}
.bio-note p { margin: 0; font-size: 17px; }
.bio-note .note-sign { margin-top: 4px; color: var(--ink-soft); font-size: 14px; }

/* photos they're in */
.fav-strip { padding: 34px 8px 8px; }
.fav-strip h2 {
  margin: 0 0 18px;
  color: var(--ui-gold);
  font-size: 16px;
  font-weight: normal;
  text-shadow: 1px 1px 0 #000;
}
.fav-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}
.fav-card {
  display: block;
  padding: 9px 9px 0;
  background: var(--mount);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 3px 6px 16px rgba(0, 0, 0, .45);
  transform: rotate(var(--tilt, 0deg));
  transition: transform .2s ease;
}
.fav-card:hover { transform: rotate(0deg) translateY(-3px); }
.fav-card img {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: cover;
  background: #1a1f2e;
}
.fav-card span {
  display: block;
  padding: 9px 2px 12px;
  text-align: center;
  font-size: 14px;
}

.profile-shell footer {
  padding: 18px 34px 22px;
  text-align: left;
}

/* ==========================================================================
   Small screens
   ========================================================================== */

@media (max-width: 860px) {
  .masthead { flex-direction: column; align-items: flex-start; gap: 18px; padding: 26px 22px 6px; }
  .party { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); width: 100%; }
  .lower { grid-template-columns: 1fr; }
  footer { text-align: left; }
}

@media (max-width: 760px) {
  .page-stage, .profile-shell { width: 100%; margin: 0; }
  .site-shell { border-left: 0; border-right: 0; border-radius: 0; }
  .masthead h1 { font-size: clamp(32px, 9vw, 46px); }
  .masthead-subtitle { font-size: 14px; }

  .album { padding: 4px 8px 0; }
  .book-stage { min-height: 520px; padding: 14px 0; }
  .book.closed-front, .book.closed-back { transform: none; }

  .page-inner { padding: 42px 14px 16px; }
  .memory-meta { top: 15px; left: 14px; right: 14px; font-size: 12px; }
  .photo-frame { --mount-pad: 9px; }
  .photo-open::after { width: 25px; height: 25px; right: calc(-1 * var(--mount-pad) - 8px); bottom: calc(-1 * var(--mount-pad) - 8px); }
  .photo-frame img { max-height: 250px; }
  .memory-caption { font-size: 17px; }
  .memory-note { font-size: 12.5px; max-width: 100%; }

  :root { --corner: 38px; }
  .cover-page h3 { font-size: 21px; }
  .cover-symbol { width: 58px; }

  .book-main { gap: 10px; }
  .page-jump { min-width: 0; }
  .wow-button { min-width: 0; padding: 9px 14px 8px; }

  .viewer { padding: 14px 10px calc(14px + env(safe-area-inset-bottom, 0px)); }
  .viewer .close-x { top: calc(12px + env(safe-area-inset-top, 0px)); right: 12px; }
  .viewer-img { border-width: 5px; max-height: calc(100dvh - 250px); }
  .viewer-caption { font-size: 18px; }
  .viewer-note { font-size: 14px; }

  .contents-body { grid-template-columns: 1fr; }
  .toc-preview { display: none; }

  .lower { padding: 28px 12px 18px; }
  .workshop { left: 8px; right: 8px; bottom: 8px; width: auto; }
  .link-tip { width: min(270px, 80vw); }

  .profile-top { flex-direction: column-reverse; align-items: flex-start; gap: 8px; padding: 20px 18px 4px; }
  .profile-main { padding: 12px 10px 6px; }
  .character-sheet { grid-template-columns: 1fr; gap: 20px; padding: 24px 18px; }
  .portrait { width: min(260px, 100%); margin: 0 auto; }
  .portrait img { height: 260px; }
  .bio-list div { grid-template-columns: 1fr; gap: 2px; }
  .fav-row { grid-template-columns: 1fr 1fr; gap: 14px; }
  .fav-card img { height: 100px; }
  .profile-shell footer { padding: 16px 18px 20px; }
}

@media (max-width: 420px) {
  .fav-row { grid-template-columns: 1fr; }
  .fav-card img { height: 160px; }
}

@media (hover: none) {
  .fav-card:hover { transform: rotate(var(--tilt, 0deg)); }
}
