/* Privacy page: an in-world codex panel over the tavern artwork.
   Loaded after site.css; shared navigation, Privacy button, footer and transitions come from there.

   Desktop artwork (1774 x 887, 2:1): the dragon peeks out on the right (x ~1130-1400, y 195-745);
   the left two thirds is open scenery and floor. The artwork is fixed and height-first like the
   other pages; the policy panel scrolls with the page in the open area to the dragon's left.
   Portrait artwork (941 x 1672): the dragon peeks out upper left (x ~290-520, y ~340-820); the
   panel starts below it, and its faded top lets the dragon show through as the panel scrolls up.

   The fade: the panel's dark background and gold border live on ::before, which is masked from
   transparent at the top edge to fully solid ~200px down. The text itself is never masked. */

/* ---------- Fixed artwork ---------- */

.privacy-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: var(--walnut-950);
}
/* Narrower windows crop the sides, biased right so the dragon stays in view; wider windows centre
   the scene on solid walnut. Never blurred, feathered or stretched. */
.privacy-stage {
  --w: calc(var(--vh) * 2);
  position: absolute;
  top: 0;
  left: max(calc((100% - var(--w)) * .62), calc((100% - var(--w)) / 2));
  width: var(--w);
  aspect-ratio: 1774 / 887;
}
.privacy-stage picture,
.privacy-stage img {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------- The codex panel ---------- */

.privacy {
  position: relative;
  z-index: 2;
  container-type: inline-size;
  /* Same stage geometry, measured against the page width. */
  --w: calc(var(--vh) * 2);
  --x: max(calc((100cqw - var(--w)) * .62), calc((100cqw - var(--w)) / 2));
  --left: max(160px, calc(var(--x) + var(--w) * .08));
  padding: clamp(84px, 16vh, 190px) 0 clamp(96px, 14vh, 150px);
}

.codex {
  position: relative;
  /* Stops before the dragon (artwork x ~1110). */
  width: min(760px, calc(var(--w) * .47), calc(var(--x) + var(--w) * .615 - var(--left)));
  margin-left: var(--left);
  padding: clamp(30px, 4.4vh, 52px) clamp(26px, 2.6vw, 50px) clamp(30px, 4vh, 46px);
  font-size: clamp(16px, 1.02vw, 18.5px);
  line-height: 1.65;
  color: var(--cream);
}
.codex::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border: 1px solid rgba(214, 164, 84, .5);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 210, 140, .05), transparent 30%),
    rgba(17, 9, 4, .84);
  box-shadow: inset 0 1px 0 rgba(255, 220, 160, .1), 0 18px 50px rgba(0, 0, 0, .45);
  -webkit-mask-image: linear-gradient(180deg, transparent 0, rgba(0, 0, 0, .3) 70px, rgba(0, 0, 0, .78) 150px, #000 220px);
  mask-image: linear-gradient(180deg, transparent 0, rgba(0, 0, 0, .3) 70px, rgba(0, 0, 0, .78) 150px, #000 220px);
}

/* Header: sits over the faded part of the panel, so it carries its own shadow for contrast. */
.codex__head { text-shadow: 0 1px 2px #000, 0 0 10px rgba(0, 0, 0, .95), 0 0 24px rgba(0, 0, 0, .7); }
.codex__kicker {
  margin: 0;
  font-size: .82em;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold-300);
}
.codex h1 {
  margin: .1em 0 .35em;
  font-size: 2.6em;
  font-weight: 700;
  line-height: 1.05;
  color: #ffe2a6;
}
.codex__lede { margin: 0 0 1em; font-size: 1.12em; line-height: 1.55; }
.codex__draft {
  margin: 0;
  padding: .7em 1em;
  border-left: 3px solid var(--gold-500);
  border-radius: 0 8px 8px 0;
  background: rgba(238, 171, 62, .1);
  font-size: .92em;
  line-height: 1.5;
  color: var(--cream-dim);
  text-shadow: none;
}
.codex__draft strong { color: var(--gold-300); }

/* Contents */
.codex__toc { margin: 1.6em 0 .4em; }
.codex__toc ol {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15em, 1fr));
  gap: .2em 1.6em;
  margin: 0;
  padding: 0 0 0 1.3em;
  font-size: .95em;
}
.codex__toc li::marker { color: var(--gold-500); font-weight: 700; }
.codex__toc a {
  color: var(--cream);
  text-decoration: none;
  border-bottom: 1px solid rgba(214, 164, 84, .35);
  transition: color .2s, border-color .2s;
}
.codex__toc a:hover,
.codex__toc a:focus-visible { color: var(--gold-100); border-color: var(--gold-300); }

/* Sections, separated by a thin gold rule with a small diamond. */
.codex section { position: relative; padding-top: 1.9em; margin-top: 1.9em; scroll-margin-top: 90px; }
.codex section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(214, 164, 84, .55) 18%, rgba(214, 164, 84, .55) 82%, transparent);
}
.codex section::after {
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  width: 7px;
  height: 7px;
  margin-left: -3.5px;
  transform: rotate(45deg);
  background: var(--gold-500);
}
.codex h2 {
  margin: 0 0 .65em;
  font-size: 1.45em;
  font-weight: 700;
  line-height: 1.2;
  color: var(--gold-300);
}
.codex p { margin: 0 0 .9em; }
.codex p:last-child { margin-bottom: 0; }
.codex strong { color: #fff3dc; }
.codex ul { margin: 0; padding-left: 1.2em; }
.codex li { margin: 0 0 .6em; }
.codex li:last-child { margin-bottom: 0; }
.codex ul li::marker { color: var(--gold-500); }
.codex__steps { margin: 0 0 .9em; padding-left: 1.4em; }
.codex__steps li { margin: 0 0 .6em; padding-left: .2em; }
.codex__steps li::marker { color: var(--gold-500); font-weight: 700; }
.codex code,
.codex kbd {
  padding: .05em .35em;
  border: 1px solid rgba(214, 164, 84, .35);
  border-radius: 5px;
  background: rgba(255, 220, 160, .08);
  font-family: Consolas, "Cascadia Mono", "Segoe UI Mono", monospace;
  font-size: .86em;
  color: #fff3dc;
  overflow-wrap: anywhere;
}
.codex section a {
  color: var(--gold-100);
  text-decoration: underline;
  text-decoration-color: rgba(255, 210, 122, .55);
  text-underline-offset: 3px;
}
.codex section a:hover,
.codex section a:focus-visible { color: #fff; text-decoration-color: var(--gold-300); }
.codex__note {
  font-size: .92em;
  font-style: italic;
  color: var(--cream-dim);
}

/* No Privacy button on its own page: keep the footer notice in its usual bottom-right spot. */
.page-privacy .site-footer { justify-content: flex-end; }

/* ---------- Portrait and phone ----------
   The portrait artwork fills the screen behind everything; the panel starts below the dragon and
   scrolls up over the scene. Same condition as the other pages, duplicated in the <source media>
   attributes in privacy/index.html. */

@media (max-aspect-ratio: 7/5), (max-width: 760px) {
  .privacy-scene { bottom: auto; height: 100lvh; }
  .privacy-stage { inset: 0; width: auto; aspect-ratio: auto; }
  .privacy-stage img { object-fit: cover; object-position: 34% 32%; }

  .privacy { container-type: normal; padding: 50svh 12px 28px; }
  .codex {
    width: auto;
    max-width: 720px;
    margin: 0 auto;
    padding: 30px 20px 30px;
    font-size: 16.5px;
    line-height: 1.6;
  }
  .codex::before {
    -webkit-mask-image: linear-gradient(180deg, transparent 0, rgba(0, 0, 0, .3) 50px, rgba(0, 0, 0, .78) 110px, #000 170px);
    mask-image: linear-gradient(180deg, transparent 0, rgba(0, 0, 0, .3) 50px, rgba(0, 0, 0, .78) 110px, #000 170px);
  }
  .codex h1 { font-size: 2.35em; }
  .codex h2 { font-size: 1.32em; }
  .codex__toc ol { grid-template-columns: 1fr; }
}
