/* The Starless Archive.
   Every record is a leaf of vellum hanging from a gold thread, the way every Varilen letter
   hangs from the thread of the record. The night around it has no stars. */
:root {
  --night: #1b1830;        /* starless sky */
  --night-deep: #110f1f;
  --vellum: #ece0c3;       /* the leaf */
  --vellum-shade: #d9c79f;
  --ink: #2b2440;          /* iron-blue ink */
  --gall: #5a3b2a;         /* iron-gall brown: verse, signatures, annotations */
  --thread: #b49a63;       /* the gold thread */
  --seal: #7a1f1f;         /* wax */
  --ok: #2f5d3a;
  --rule: rgba(90, 59, 42, 0.28);
  --body: 'Spectral', Georgia, serif;
  --old: 'IM Fell English', 'Spectral', Georgia, serif;
}
* { box-sizing: border-box; }
html { background: var(--night-deep); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.12rem;
  line-height: 1.7;
  background:
    radial-gradient(ellipse 70% 50% at 50% 18%, rgba(180, 154, 99, 0.10), transparent 70%),
    radial-gradient(ellipse at 50% 120%, var(--night-deep), var(--night) 70%);
  background-attachment: fixed;
  padding: 0 1rem 3rem;
}

/* The thread runs across the top of the night; the leaf hangs from it on two cords. */
.thread { position: relative; height: 3.2rem; max-width: 52rem; margin: 0 auto; }
.thread::before {
  content: ""; position: absolute; left: 0; right: 0; top: 1.4rem; height: 2px;
  background: linear-gradient(90deg, transparent, var(--thread) 12%, var(--thread) 88%, transparent);
  opacity: 0.85;
}
.leaf-wrap {
  position: relative; max-width: 44rem; margin: 0 auto;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.55)) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
  transform-origin: 50% -3rem;
  animation: settle 1.6s cubic-bezier(.3, .7, .3, 1) both;
}
.cord { position: absolute; top: -1.8rem; width: 2px; height: 2.2rem; background: var(--thread); opacity: 0.85; }
.cord.left { left: 18%; } .cord.right { right: 18%; }
.cord::after { content: ""; position: absolute; left: -3px; bottom: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--thread); }
@keyframes settle {
  0% { transform: rotate(-1.4deg) translateY(-10px); opacity: 0; }
  35% { opacity: 1; }
  60% { transform: rotate(0.6deg); }
  82% { transform: rotate(-0.2deg); }
  100% { transform: rotate(0); }
}
@media (prefers-reduced-motion: reduce) { .leaf-wrap { animation: none; } }

main.leaf {
  position: relative;
  padding: 3rem clamp(1.4rem, 6vw, 4rem) 3.4rem;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 30% 15%, rgba(255, 248, 225, 0.55), transparent 55%),
    radial-gradient(ellipse at 80% 90%, rgba(150, 110, 60, 0.18), transparent 50%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.25 0 0 0 0 0.12 0 0 0 0.10 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23f)'/%3E%3C/svg%3E"),
    linear-gradient(180deg, var(--vellum), var(--vellum-shade));
  clip-path: polygon(0.6% 0%, 99.4% 0%, 99.20% 4.0%, 99.94% 8.0%, 99.43% 12.0%, 99.37% 16.0%, 99.78% 20.0%, 99.63% 24.0%, 99.46% 28.0%, 99.80% 32.0%, 99.80% 36.0%, 99.63% 40.0%, 99.75% 44.0%, 99.71% 48.0%, 99.85% 52.0%, 99.39% 56.0%, 99.50% 60.0%, 99.77% 64.0%, 99.76% 68.0%, 99.24% 72.0%, 99.75% 76.0%, 99.57% 80.0%, 99.94% 84.0%, 99.85% 88.0%, 99.30% 92.0%, 99.61% 96.0%, 97.5% 99.92%, 95.0% 99.69%, 92.5% 99.64%, 90.0% 99.58%, 87.5% 99.91%, 85.0% 99.91%, 82.5% 99.37%, 80.0% 99.34%, 77.5% 99.84%, 75.0% 99.33%, 72.5% 99.15%, 70.0% 99.30%, 67.5% 99.43%, 65.0% 99.29%, 62.5% 99.94%, 60.0% 99.56%, 57.5% 99.73%, 55.0% 99.88%, 52.5% 99.06%, 50.0% 99.27%, 47.5% 99.56%, 45.0% 99.51%, 42.5% 99.42%, 40.0% 99.19%, 37.5% 99.91%, 35.0% 99.05%, 32.5% 99.37%, 30.0% 99.34%, 27.5% 99.66%, 25.0% 99.92%, 22.5% 99.51%, 20.0% 99.17%, 17.5% 99.41%, 15.0% 99.28%, 12.5% 99.36%, 10.0% 99.42%, 7.5% 99.33%, 5.0% 99.53%, 2.5% 99.61%, 0.0% 99.23%, 0.73% 96.0%, 0.37% 92.0%, 0.69% 88.0%, 0.51% 84.0%, 0.51% 80.0%, 0.41% 76.0%, 0.40% 72.0%, 0.55% 68.0%, 0.75% 64.0%, 0.32% 60.0%, 0.57% 56.0%, 0.20% 52.0%, 0.47% 48.0%, 0.28% 44.0%, 0.26% 40.0%, 0.31% 36.0%, 0.64% 32.0%, 0.70% 28.0%, 0.09% 24.0%, 0.66% 20.0%, 0.06% 16.0%, 0.33% 12.0%, 0.12% 8.0%, 0.06% 4.0%);
}
/* A faint ruled margin, as on a scribe's leaf. */
main.leaf::before {
  content: ""; position: absolute; top: 1.6rem; bottom: 1.6rem; left: clamp(0.7rem, 3vw, 1.9rem);
  border-left: 1px solid var(--rule); pointer-events: none;
}

h1 {
  font-family: var(--old); font-weight: 400; font-size: clamp(2rem, 5vw, 2.7rem);
  line-height: 1.15; text-align: center; margin: 0.3rem 0 1.6rem; color: var(--ink);
}
p { margin: 0 0 1.05rem; }
main.leaf > p:first-of-type:not(.big)::first-letter {
  font-family: var(--old); float: left; font-size: 2.75em; line-height: 0.85;
  padding: 0.12em 0.12em 0 0; color: var(--seal);
}
p.big { font-family: var(--old); font-size: 1.45rem; line-height: 1.4; text-align: center; }
p.quiet { text-align: center; font-style: italic; color: var(--gall); }
p.note { margin-top: 2.6rem; font-size: 0.92rem; font-style: italic; color: var(--gall); opacity: 0.85; text-align: center; }
p.sign { font-family: var(--old); text-align: right; font-size: 1.25rem; color: var(--gall); margin-top: 2.2rem; }
em { font-style: italic; }
code { font-family: var(--old); letter-spacing: 0.1em; font-size: 1.15em; color: var(--gall); }
a { color: var(--seal); text-decoration-thickness: 1px; text-underline-offset: 3px; }
hr { border: 0; height: 1.4rem; margin: 2.2rem auto; width: 9rem; background:
  radial-gradient(circle, var(--gall) 0 2px, transparent 2.5px) center / 1.4rem 1.4rem no-repeat,
  linear-gradient(var(--rule), var(--rule)) center / 100% 1px no-repeat; }

.seal { display: flex; justify-content: center; margin-bottom: 0.4rem; }
/* Barely there: a seal pressed into the vellum long ago. */
.watermark { position: absolute; right: 4%; top: 72%; width: clamp(15rem, 54%, 26rem); opacity: 0.075; pointer-events: none; transform: rotate(-9deg); }
.watermark svg { display: block; width: 100%; height: auto; }
.door { padding: 2.5rem 0 1rem; display: flex; flex-direction: column; justify-content: center; }
.door h1 { margin-bottom: 0.6rem; }

blockquote.verse {
  margin: 1.6rem auto 0.6rem; max-width: 24rem;
  font-family: var(--old); font-style: italic; font-size: 1.22rem; line-height: 1.65; color: var(--gall);
}
blockquote.verse p { margin: 0 0 1.1rem; }
blockquote.verse p::first-letter { all: unset; }
blockquote.verse cite { display: block; text-align: right; font-style: normal; font-size: 1.05rem; }

/* Images bleed to the edges of the leaf, like plates bound into a book. */
figure.art { margin: 2.2rem calc(-1 * clamp(1.4rem, 6vw, 4rem)); }
figure.art svg, figure.art img {
  display: block; width: 100%; height: auto;
  box-shadow: inset 0 0 0 1px rgba(43, 36, 64, 0.35), 0 1px 0 rgba(255, 255, 255, 0.4);
}
figure.art figcaption {
  text-align: center; font-family: var(--old); font-style: italic; font-size: 1rem;
  color: var(--gall); margin-top: 0.6rem; padding: 0 1rem;
}
figure.tool svg { touch-action: none; user-select: none; -webkit-user-select: none; }
svg.lensmap { display: block; width: 100%; height: auto; outline: none; }
svg.lensmap.lens-on { cursor: none; touch-action: none; }
svg.lensmap:focus-visible { outline: 2px solid var(--seal); outline-offset: -2px; }
.controls #lens-toggle { width: auto; height: auto; border-radius: 2px; font-size: 1.05rem; padding: 0.45rem 1.2rem; }
#compass { transition: filter 0.9s ease; }
#compass.locked { filter: drop-shadow(0 0 6px rgba(246, 212, 138, 0.95)) drop-shadow(0 0 22px rgba(246, 212, 138, 0.7)); animation: compass-breathe 3.2s ease-in-out infinite; }
@keyframes compass-breathe { 50% { filter: drop-shadow(0 0 4px rgba(246, 212, 138, 0.8)) drop-shadow(0 0 14px rgba(246, 212, 138, 0.45)); } }
#compass-hint { transition: color 0.6s ease; min-width: 14rem; text-align: center; }
#compass-hint.found { color: var(--seal); font-style: normal; }
@media (prefers-reduced-motion: reduce) { #compass.locked { animation: none; } }
.controls { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 0.9rem; font-size: 0.98rem; font-style: italic; color: var(--gall); }
.controls button { font-size: 1.4rem; width: 2.9rem; height: 2.9rem; border-radius: 50%; padding: 0; }

.aside { border-left: 1px solid var(--rule); padding-left: 1.1rem; margin: 2.2rem 0; }
.newletter { display: flex; align-items: center; gap: 0.8rem; margin: 0.4rem 0 1.2rem; font-family: var(--old); font-size: 1.4rem; }
dl.lexicon { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1.3rem; margin: 0.5rem 0 0; }
dl.lexicon dt { font-family: var(--old); font-style: italic; font-size: 1.15em; color: var(--gall); }
dl.lexicon dd { margin: 0; }

/* Answers are written onto the leaf: an ink line, not a box. */
form.riddle { margin: 2.4rem 0 0; text-align: center; }
form.riddle label { display: block; font-family: var(--old); font-size: 1.35rem; margin-bottom: 0.9rem; }
form.riddle .row { display: flex; gap: 0.8rem; justify-content: center; align-items: flex-end; flex-wrap: wrap; }
input, button { font: inherit; color: var(--ink); }
input {
  min-width: 0; flex: 1 1 14rem; max-width: 21rem;
  background: transparent; border: 0; border-bottom: 1.5px solid var(--ink);
  padding: 0.35rem 0.2rem; font-family: var(--old); font-size: 1.25rem; text-align: center;
}
input::placeholder { color: rgba(90, 59, 42, 0.55); font-style: italic; }
button {
  cursor: pointer; border: 1px solid var(--ink); border-radius: 2px;
  background: var(--ink); color: var(--vellum); padding: 0.45rem 1.1rem; font-family: var(--old); font-size: 1.1rem;
}
button:hover { background: #3a3258; }
input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--seal); outline-offset: 3px; }
button:disabled { opacity: 0.5; cursor: default; }
.reply { min-height: 1.7em; margin-top: 1.1rem; font-family: var(--old); font-style: italic; font-size: 1.15rem; color: var(--gall); }
.reply.ok { color: var(--ok); }
.reply.no { color: var(--seal); }

form.choice { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-top: 2rem; }
form.choice .accept { background: var(--seal); border-color: var(--seal); font-size: 1.25rem; padding: 0.6rem 1.6rem; }
form.choice .decline { background: transparent; color: var(--ink); }

/* Words outside the leaf sit faintly on the night. */
.outside { max-width: 44rem; margin: 1.6rem auto 0; text-align: center; font-family: var(--old); font-style: italic; color: rgba(236, 224, 195, 0.45); font-size: 0.95rem; }

@media (max-width: 560px) {
  body { font-size: 1.04rem; padding: 0 0.6rem 2rem; }
  .cord.left { left: 12%; } .cord.right { right: 12%; }
  main.leaf::before { display: none; }
}
