/* scapesite — an ancient scroll, with 2004 RuneScape stone trim. */

:root {
  /* Stone interface */
  --void: #0c0a07;
  --stone-dark: #241d15;
  --stone: #3b3226;
  --stone-mid: #4f4433;
  --stone-light: #6e604b;
  --stone-hi: #8c7b5f;

  /* The scroll */
  --parch-light: #f4e6bf;
  --parch: #ead4a0;
  --parch-dark: #cfae6c;
  --parch-burn: #8b6331;
  --ink: #3a2414;
  --ink-soft: #6a4a2c;
  --rubric: #8e1b10;
  --rubric-hi: #c0341d;
  --faded: #8d7a59;

  --wood-dark: #3b220d;
  --wood: #7a4a1f;
  --wood-light: #c08a4a;

  --title-font: "IM Fell English SC", "Palatino Linotype", Georgia, serif;
  --body-font: "IM Fell English", "Palatino Linotype", Georgia, serif;

  --cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='26' viewBox='0 0 22 26'%3E%3Cpath d='M2 2 L2 20 L6.5 15.5 L10 23 L13.5 21.5 L10 14 L16.5 14 Z' fill='%23f0c63a' stroke='%23241200' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M4 6 L4 15 L6.5 12.5' fill='none' stroke='%23fff6c0' stroke-width='1.2'/%3E%3C/svg%3E") 2 2, auto;
  --cursor-hand: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='26' viewBox='0 0 22 26'%3E%3Cpath d='M2 2 L2 20 L6.5 15.5 L10 23 L13.5 21.5 L10 14 L16.5 14 Z' fill='%23ffe36a' stroke='%23601500' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M4 6 L4 15 L6.5 12.5' fill='none' stroke='%23ffffff' stroke-width='1.2'/%3E%3C/svg%3E") 2 2, pointer;

  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  cursor: var(--cursor);
  /* Keep headings that are linked to from hiding under the sticky nav bar. */
  scroll-padding-top: 84px;
}
a, [tabindex], button { cursor: var(--cursor-hand); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--body-font);
  background-color: var(--void);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(120, 82, 36, 0.35), transparent 70%),
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(70, 45, 20, 0.35), transparent 70%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.012) 0 2px, transparent 2px 6px);
  background-attachment: fixed;
  padding-bottom: 48px;
  overflow-x: clip;
}

/* ---------- Nav bar ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(to bottom, rgba(16, 12, 8, 0.96), rgba(16, 12, 8, 0.86));
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(192, 138, 74, 0.35);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.55);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: 960px;
  margin: 0 auto;
  padding: 10px 24px;
}

.nav-title {
  flex: none;
  font-family: var(--title-font);
  font-size: 1.85rem;
  line-height: 1;
  color: var(--parch);
  text-decoration: none;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.7), 0 0 18px rgba(234, 212, 160, 0.15);
  transition: color 120ms;
}
.nav-title:hover, .nav-title:focus-visible {
  color: var(--parch-light);
  outline: none;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.7), 0 0 18px rgba(244, 230, 191, 0.4);
}

/* ---------- Search ---------- */

.search {
  position: relative;
  flex: 0 1 320px;
  min-width: 0;
}
.search input {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  padding: 7px 34px 7px 34px;
  font-family: var(--body-font);
  font-size: 1.05rem;
  color: var(--ink);
  background-color: var(--parch);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 18 18'%3E%3Ccircle cx='7.5' cy='7.5' r='5' fill='none' stroke='%236a4a2c' stroke-width='1.8'/%3E%3Cpath d='M11.3 11.3 L16 16' stroke='%236a4a2c' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"),
    radial-gradient(ellipse 120% 140% at 50% 50%, var(--parch-light), var(--parch) 60%, var(--parch-dark));
  background-repeat: no-repeat;
  background-position: 10px 50%, 0 0;
  border: 2px solid;
  border-color: var(--wood-dark) var(--wood-light) var(--wood-light) var(--wood-dark);
  border-radius: 3px;
  box-shadow: inset 0 1px 4px rgba(90, 50, 10, 0.45);
  cursor: text;
}
.search input::placeholder { color: var(--faded); font-style: italic; opacity: 1; }
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus {
  outline: 2px solid rgba(240, 198, 58, 0.65);
  outline-offset: 1px;
}

.search-key {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 1.4em;
  padding: 0 0.35em;
  font-family: var(--body-font);
  font-size: 0.85rem;
  line-height: 1.4;
  text-align: center;
  color: var(--ink-soft);
  border: 1px solid rgba(106, 74, 44, 0.5);
  border-radius: 3px;
  pointer-events: none;
}
.search:focus-within .search-key,
.search input:not(:placeholder-shown) ~ .search-key { display: none; }
@media (hover: none) { .search-key { display: none; } }

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(480px, calc(100vw - 32px));
  max-height: min(70vh, 560px);
  overflow-y: auto;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background-color: var(--parch);
  background-image: radial-gradient(ellipse 120% 90% at 50% 40%, var(--parch-light), var(--parch) 60%, var(--parch-dark));
  border: 2px solid;
  border-color: var(--wood-light) var(--wood-dark) var(--wood-dark) var(--wood-light);
  border-radius: 3px;
  box-shadow: inset 0 0 30px rgba(122, 76, 22, 0.35), 0 14px 40px rgba(0, 0, 0, 0.75);
}
.search-results[hidden] { display: none; }
.search-results li + li { border-top: 1px dashed rgba(106, 74, 44, 0.35); }
.search-results a {
  display: block;
  padding: 9px 16px 10px;
  color: var(--ink);
  text-decoration: none;
}
.search-results a:hover,
.search-results [aria-selected="true"] a {
  background: rgba(142, 27, 16, 0.1);
}
.result-title {
  display: block;
  font-family: var(--title-font);
  font-size: 1.2rem;
  line-height: 1.25;
  color: var(--rubric);
}
.result-snippet {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  margin-top: 2px;
  font-size: 0.98rem;
  line-height: 1.4;
  color: var(--ink-soft);
}
.search-results mark {
  color: inherit;
  background: rgba(240, 180, 60, 0.5);
  border-radius: 2px;
  padding: 0 1px;
}
.search-note {
  padding: 12px 16px;
  font-style: italic;
  color: var(--ink-soft);
}

/* Words a search result pointed at, highlighted on arrival. */
::target-text { background: rgba(240, 180, 60, 0.6); color: inherit; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 560px) {
  .nav-inner { gap: 14px; padding: 8px 16px; }
  .nav-title { font-size: 1.45rem; }
  .search { flex: 1 1 auto; max-width: 240px; }
  .search input { font-size: 1rem; padding: 6px 10px 6px 32px; }
}

/* ---------- Layout ---------- */

.scroll {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px 0;
}
@media (max-width: 860px) {
  .scroll { padding: 18px 16px 0; }
}

/* ---------- The scroll ---------- */

.rod {
  position: relative;
  height: 30px;
  margin: 0 -6px;
  border-radius: 15px;
  background: linear-gradient(to bottom,
    var(--wood-dark) 0%, var(--wood) 22%, var(--wood-light) 45%, #e2b57a 52%, var(--wood) 74%, var(--wood-dark) 100%);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.6), inset 0 -2px 3px rgba(0, 0, 0, 0.4);
  z-index: 2;
}
/* Finials on the scroll's rollers. */
.rod::before, .rod::after {
  content: "";
  position: absolute;
  top: -6px;
  width: 22px;
  height: 42px;
  border-radius: 9px;
  background: radial-gradient(ellipse at 40% 35%, #f2c66b, #a8711f 45%, #4a2a07 100%);
  border: 1px solid #1c0f02;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.6);
}
.rod::before { left: -14px; }
.rod::after { right: -14px; }
@media (max-width: 860px) {
  .rod { margin: 0 -2px; }
  .rod::before, .rod::after { width: 16px; }
  .rod::before { left: -8px; }
  .rod::after { right: -8px; }
}
.rod.top { margin-bottom: -8px; }
.rod.bottom { margin-top: -8px; }

.parchment {
  position: relative;
  padding: 46px clamp(20px, 6vw, 64px) 52px;
  background-color: var(--parch);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.42 0 0 0 0 0.27 0 0 0 0 0.09 0 0 0 0.16 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse 18% 9% at 82% 18%, rgba(150, 100, 40, 0.18), transparent 70%),
    radial-gradient(ellipse 12% 7% at 12% 62%, rgba(150, 100, 40, 0.14), transparent 70%),
    radial-gradient(ellipse 22% 12% at 70% 88%, rgba(120, 80, 30, 0.12), transparent 70%),
    radial-gradient(ellipse 120% 90% at 50% 50%, var(--parch-light) 0%, var(--parch) 55%, var(--parch-dark) 100%);
  box-shadow:
    inset 0 0 70px rgba(122, 76, 22, 0.55),
    inset 0 0 14px rgba(90, 50, 10, 0.5),
    0 0 0 1px rgba(60, 35, 10, 0.6),
    0 10px 40px rgba(0, 0, 0, 0.7);
  font-size: 1.22rem;
  line-height: 1.6;
}

.page-title {
  margin: 0;
  text-align: center;
  font-family: var(--title-font);
  font-weight: 400;
  font-size: clamp(2rem, 5vw, 2.9rem);
  line-height: 1.1;
  color: var(--rubric);
  text-shadow: 0 1px 0 rgba(255, 240, 200, 0.6);
}
.ornament {
  text-align: center;
  color: var(--ink-soft);
  letter-spacing: 0.5em;
  margin: 4px 0 18px;
  font-size: 1.15rem;
  opacity: 0.85;
}

.prose { max-width: 42em; margin: 0 auto; }
.prose > p:first-of-type::first-letter {
  float: left;
  font-family: var(--title-font);
  font-size: 3.6em;
  line-height: 0.82;
  padding: 0.08em 0.1em 0 0;
  color: var(--rubric);
  text-shadow: 1px 1px 0 rgba(255, 230, 170, 0.8), 2px 2px 0 rgba(90, 30, 10, 0.25);
}

.prose p { margin: 0 0 0.95em; }
/* Keep the drop cap from spilling into the next paragraph when the first is short. */
.prose > p:first-of-type { display: flow-root; }

.prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
  font-family: var(--title-font);
  font-weight: 400;
  color: var(--rubric);
  line-height: 1.2;
  margin: 1.5em 0 0.5em;
}
.prose h2 {
  font-size: 1.65rem;
  text-align: center;
}
.prose h2::before, .prose h2::after { content: " ~ "; color: var(--ink-soft); }
.prose h3 {
  font-size: 1.4rem;
  border-bottom: 1px solid rgba(106, 74, 44, 0.45);
  padding-bottom: 2px;
}
.prose h4 { font-size: 1.2rem; }
.prose h5, .prose h6 { font-size: 1.05rem; color: var(--ink-soft); }

.prose ul, .prose ol { padding-left: 1.6em; margin: 0 0 1em; }
.prose li { margin: 0.15em 0; }
.prose li > ul, .prose li > ol { margin: 0.1em 0 0.2em; }
.prose ul { list-style: none; }
.prose ul > li { position: relative; }
.prose ul > li::before {
  content: "◆";
  position: absolute;
  left: -1.15em;
  top: 0.1em;
  font-size: 0.7em;
  color: var(--rubric);
}
.prose ul ul > li::before { content: "◇"; }
.prose ol > li::marker { color: var(--rubric); font-family: var(--title-font); }

.prose blockquote {
  margin: 1em 0;
  padding: 0.4em 1.1em;
  border-left: 4px double var(--ink-soft);
  background: rgba(140, 100, 40, 0.09);
  font-style: italic;
  color: var(--ink-soft);
}
.prose blockquote p:last-child { margin-bottom: 0; }

.prose hr {
  border: 0;
  height: 1.4em;
  margin: 1.6em 0;
  text-align: center;
}
.prose hr::after { content: "✦ ✦ ✦"; color: var(--ink-soft); letter-spacing: 0.6em; }

code {
  font-family: "Courier New", monospace;
  font-size: 0.86em;
  background: rgba(90, 58, 20, 0.12);
  border: 1px solid rgba(90, 58, 20, 0.25);
  border-radius: 2px;
  padding: 0 0.25em;
}
pre {
  overflow-x: auto;
  padding: 0.8em 1em;
  background: rgba(90, 58, 20, 0.1);
  border: 1px solid rgba(90, 58, 20, 0.3);
}
pre code { border: 0; background: none; padding: 0; }

.table-wrap { overflow-x: auto; margin: 1em 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.95em; }
th, td { padding: 0.35em 0.7em; border: 1px solid rgba(106, 74, 44, 0.45); }
th { font-family: var(--title-font); font-weight: 400; color: var(--rubric); background: rgba(140, 100, 40, 0.12); }
.align-center { text-align: center; }
.align-right { text-align: right; }

/* ---------- Links ---------- */

.parchment a {
  color: var(--rubric);
  text-decoration: none;
  border-bottom: 1px solid rgba(142, 27, 16, 0.35);
  transition: background-color 120ms, color 120ms;
}
.parchment a:hover, .parchment a:focus-visible {
  color: var(--rubric-hi);
  background: rgba(255, 196, 70, 0.3);
  border-bottom-color: currentColor;
  outline: none;
}
.parchment a.external::after { content: " ↗"; font-size: 0.8em; }

.wikilink.missing {
  color: var(--faded);
  border-bottom: 1px dotted var(--faded);
  cursor: var(--cursor);
}
.wikilink.missing:focus-visible { outline: 1px dotted var(--faded); outline-offset: 2px; }

/* ---------- Illustrations ---------- */

.plate {
  margin: 1.6em auto 1.8em;
  text-align: center;
}
.plate-frame {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
  padding: 7px;
  background: var(--stone);
  border: 3px solid;
  border-color: var(--stone-hi) var(--stone-dark) var(--stone-dark) var(--stone-hi);
  outline: 2px solid rgba(30, 18, 6, 0.85);
  box-shadow: 0 6px 18px rgba(60, 35, 10, 0.55);
}
.parchment .plate-link, .parchment .plate-link:hover { border: 0; background: none; display: block; }
.plate img {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 78vh;
  object-fit: contain;
  background: var(--stone-dark);
}
.gallery .plate-frame > * { flex: 1 1 240px; }
.has-hero .prose > .plate:first-child { margin-top: 0.4em; }
.has-hero .prose > .plate:first-child img { max-height: 70vh; }

.plate figcaption {
  max-width: 34em;
  margin: 0.8em auto 0;
  font-style: italic;
  font-size: 0.95em;
  line-height: 1.45;
  color: var(--ink-soft);
}
.plate figcaption p { margin: 0 0 0.3em; }
.plate figcaption p:first-child::before { content: "— "; }

.inline-figure img { max-height: 1.6em; vertical-align: middle; }
.inline-figure .plate-link { display: inline; }

.lost-image {
  display: block;
  padding: 2em 1.4em;
  max-width: 28em;
  border: 2px dashed var(--faded);
  color: var(--faded);
  font-style: italic;
  background: rgba(140, 100, 40, 0.08);
}

::selection { background: rgba(255, 196, 70, 0.55); color: #2a1406; }
