@font-face {
  font-family: "Cinzel";
  src: url("fonts/Cinzel.ttf") format("truetype");
  font-weight: 400 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ink: #141518;
  --ink-2: #1d1f23;
  --rule: #363940;
  --bone: #ebe5d9;
  --muted: #aba599;
  --yellow: #f4c430;
  --yellow-hi: #ffd659;
  --on-yellow: #1a1505;
  --rust: #d9774a;
  --lake: #6aa6d8;
  --moss: #a9ba5c;
  --crypt: #dccda3;
  --margin: clamp(96px, 14vw, 210px);
  --gutter: clamp(20px, 3.2vw, 52px);
  --tabs: 0px;
  --display: "Cinzel", "Trajan Pro", Georgia, serif;
  --text: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scrollbar-color: #4a4d55 var(--ink); scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font: 17px/1.6 var(--text);
  caret-color: var(--yellow);
  -webkit-text-size-adjust: 100%;
}
::selection { background: var(--yellow); color: var(--on-yellow); }
a { color: var(--bone); text-decoration-color: var(--yellow); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; }
img { max-width: 100%; }
.cinzel { font-family: var(--display); font-weight: 600; letter-spacing: .02em; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

.skip { position: absolute; left: -9999px; top: 8px; z-index: 20; background: var(--yellow); color: var(--on-yellow); padding: 8px 14px; font-weight: 700; }
.skip:focus { left: 16px; }

/* Running head with the page-numbered contents */
.head {
  display: grid;
  grid-template-columns: var(--margin) 1fr;
  align-items: center;
  border-bottom: 1px solid var(--rule);
  font-size: 14px;
}
.head-title { margin: 0; padding: 14px 20px; text-align: right; color: var(--muted); line-height: 1.25; }
.head-title .cinzel { display: block; color: var(--bone); font-size: 15px; letter-spacing: .08em; }
.contents { border-left: 1px solid var(--rule); padding: 0 calc(var(--gutter) + var(--tabs)) 0 var(--gutter); min-width: 0; }
.contents ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 26px; }
.contents a { display: inline-block; padding: 14px 0; text-decoration: none; color: var(--bone); white-space: nowrap; }
.contents a:hover { text-decoration: underline; text-decoration-color: var(--yellow); }
.pg { color: var(--yellow); font-weight: 700; font-variant-numeric: tabular-nums; margin-right: 4px; }

/* Thumb tabs on the page edge */
.tabs { display: none; }

/* Pages: a margin column and the body, split by one off-centre rule */
.page { display: grid; grid-template-columns: var(--margin) 1fr; position: relative; }
.margin { padding: 72px 20px 0; text-align: right; }
.body { border-left: 1px solid var(--rule); padding: 72px calc(var(--gutter) + var(--tabs)) 0 var(--gutter); min-width: 0; }
.folio { display: block; font-family: var(--display); font-weight: 700; font-size: 40px; line-height: 1; color: var(--yellow); font-variant-numeric: lining-nums tabular-nums; }
.tip { margin: 24px 0 0 auto; max-width: 23ch; font-size: 14px; line-height: 1.5; color: var(--muted); text-align: left; padding-top: 12px; border-top: 1px solid var(--rule); }
h2 { font-size: clamp(30px, 3.4vw, 44px); line-height: 1.1; margin: 0 0 20px; }
h3 { font-size: clamp(26px, 2.6vw, 34px); line-height: 1.1; margin: 0 0 12px; }

/* Getting started spread */
.spread .margin, .spread .body { padding-top: 48px; }
.spread .body { display: grid; grid-template-columns: minmax(300px, 0.78fr) 1.22fr; gap: 24px clamp(28px, 3.4vw, 56px); align-items: start; }
h1 { font-size: clamp(3rem, 7.4vw, 6rem); line-height: .92; margin: 0 0 18px; letter-spacing: .03em; font-weight: 700; }
.dek { font-size: 21px; line-height: 1.35; font-weight: 600; margin: 0 0 12px; max-width: 26ch; }
.hook { color: var(--muted); margin: 0 0 26px; max-width: 42ch; }
.download {
  display: inline-grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "icon main" "icon sub";
  column-gap: 14px;
  align-items: center;
  min-width: min(100%, 320px);
  padding: 15px 24px 15px 18px;
  background: var(--yellow);
  color: var(--on-yellow);
  text-decoration: none;
  border-radius: 3px;
  box-shadow: 0 8px 18px -8px rgb(0 0 0 / .75), 0 2px 4px rgb(0 0 0 / .4);
  transition: background-color .2s ease-out, transform .2s cubic-bezier(.16, 1, .3, 1);
}
.download:hover { background: var(--yellow-hi); transform: translateY(-1px); }
.download:active { transform: translateY(1px); }
.download:focus-visible { outline: 3px solid var(--bone); outline-offset: 3px; }
.dl-icon { grid-area: icon; width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.dl-main { grid-area: main; font-size: 20px; font-weight: 800; line-height: 1.2; }
.dl-sub { grid-area: sub; font-size: 14px; font-weight: 600; line-height: 1.3; }
.phone-note { display: none; margin: 14px 0 0; max-width: 40ch; font-size: 15px; padding: 10px 14px; border: 1px solid rgb(244 196 48 / .5); border-radius: 3px; background: rgb(244 196 48 / .07); }
@media (hover: none) and (pointer: coarse) { .phone-note { display: block; } }
.facts { margin: 28px 0 0; padding: 0; border-top: 2px solid var(--bone); max-width: 440px; font-variant-numeric: tabular-nums; }
.facts div { display: grid; grid-template-columns: 6.5rem 1fr; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--rule); }
.facts dt { color: var(--muted); font-size: 14px; font-weight: 600; padding-top: 1px; }
.facts dd { margin: 0; font-size: 15px; }

/* Annotated plates */
.plate { margin: 0; }
.shot { position: relative; }
.shot img { display: block; width: 100%; height: auto; border-radius: 2px; background: var(--ink-2); }
.leaders { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; filter: drop-shadow(0 1px 1.5px rgb(0 0 0 / .85)); }
.leaders path { fill: none; stroke: var(--yellow); stroke-width: 1.7; stroke-linecap: round; vector-effect: non-scaling-stroke; transition: stroke-width .2s ease-out, stroke .2s ease-out; }
.leaders circle { fill: var(--yellow); }
.dot {
  position: absolute;
  left: var(--x);
  top: var(--y);
  translate: -50% -50%;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--on-yellow);
  font: 800 15px/30px var(--text);
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 1px 4px rgb(0 0 0 / .7);
  transition: scale .25s cubic-bezier(.16, 1, .3, 1), outline-color .2s;
  outline: 3px solid transparent;
  outline-offset: 2px;
}
figcaption { margin-top: 14px; }
.cap { margin: 0 0 10px; font-size: 15px; color: var(--muted); }
.key { list-style: none; counter-reset: k; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 26px; }
.key li { counter-increment: k; display: grid; grid-template-columns: 24px 1fr; gap: 10px; font-size: 15px; line-height: 1.45; }
.key li::before { content: counter(k); width: 24px; height: 24px; border-radius: 50%; background: var(--yellow); color: var(--on-yellow); font-weight: 800; font-size: 13px; line-height: 24px; text-align: center; margin-top: -1px; }
.folio-end { text-align: right; margin-top: 18px; }

/* A key entry under the pointer marks its dot and leader */
.plate:has(.key li:nth-child(1):hover) .dot:nth-of-type(1),
.plate:has(.key li:nth-child(2):hover) .dot:nth-of-type(2),
.plate:has(.key li:nth-child(3):hover) .dot:nth-of-type(3) { scale: 1.22; outline-color: var(--bone); }
.plate:has(.key li:nth-child(1):hover) .leaders path:nth-of-type(1),
.plate:has(.key li:nth-child(2):hover) .leaders path:nth-of-type(2),
.plate:has(.key li:nth-child(3):hover) .leaders path:nth-of-type(3) { stroke-width: 3; stroke: var(--bone); }

/* Callout positions, % of the screenshot */
.fig-walls .dot:nth-of-type(1) { --x: 44%; --y: 88%; }
.fig-walls .dot:nth-of-type(2) { --x: 82%; --y: 14%; }
.fig-walls .dot:nth-of-type(3) { --x: 53%; --y: 6%; }
.fig-court .dot:nth-of-type(1) { --x: 8%; --y: 30%; }
.fig-court .dot:nth-of-type(2) { --x: 34%; --y: 66%; }
.fig-court .dot:nth-of-type(3) { --x: 92%; --y: 64%; }
.fig-lake .dot:nth-of-type(1) { --x: 56%; --y: 10%; }
.fig-lake .dot:nth-of-type(2) { --x: 20%; --y: 50%; }
.fig-lake .dot:nth-of-type(3) { --x: 12%; --y: 86%; }
.fig-ashby .dot:nth-of-type(1) { --x: 88%; --y: 50%; }
.fig-chapel .dot:nth-of-type(1) { --x: 8%; --y: 50%; }
.fig-chapel .dot:nth-of-type(2) { --x: 75%; --y: 40%; }

/* The callouts draw themselves onto each plate */
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes pop { from { opacity: 0; scale: .3; } to { opacity: 1; scale: 1; } }
@media (prefers-reduced-motion: no-preference) {
  .leaders path { stroke-dasharray: 1; }
  .hero-plate .leaders path { animation: draw .9s cubic-bezier(.16, 1, .3, 1) both; }
  .hero-plate .leaders path:nth-of-type(1) { animation-delay: .35s; }
  .hero-plate .leaders path:nth-of-type(2) { animation-delay: .55s; }
  .hero-plate .leaders path:nth-of-type(3) { animation-delay: .75s; }
  .hero-plate .dot, .hero-plate .leaders circle { animation: pop .5s cubic-bezier(.16, 1, .3, 1) both; }
  .hero-plate .dot:nth-of-type(1) { animation-delay: .9s; }
  .hero-plate .dot:nth-of-type(2) { animation-delay: 1.1s; }
  .hero-plate .dot:nth-of-type(3) { animation-delay: 1.3s; }
  .hero-plate .leaders circle { animation-delay: .3s; }
  @supports (animation-timeline: view()) {
    .region .shot, .moves .shot { view-timeline: --plate block; }
    .region .leaders path, .moves .leaders path { animation: draw linear both; animation-timeline: --plate; animation-range: entry 10% cover 20%; }
    .region .dot, .region .leaders circle, .moves .dot, .moves .leaders circle { animation: pop linear both; animation-timeline: --plate; animation-range: entry 40% cover 25%; }
  }
}

/* New in this build */
.changes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 40px; max-width: 980px; }
.changes li { padding: 14px 0; border-top: 1px solid var(--rule); }
.changes b { display: block; font-size: 18px; margin-bottom: 2px; }
.not-yet { margin: 22px 0 0; max-width: 70ch; color: var(--muted); font-size: 15px; }
.not-yet b { color: var(--bone); }

/* Installing */
.steps { list-style: none; counter-reset: s; margin: 0; padding: 0; max-width: 68ch; }
.steps li { counter-increment: s; position: relative; padding: 12px 0 12px 56px; border-top: 1px solid var(--rule); }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 12px; font-family: var(--display); font-weight: 700; font-size: 28px; line-height: 1; color: var(--yellow); }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 14px; background: var(--ink-2); border: 1px solid var(--rule); padding: 1px 6px; border-radius: 3px; overflow-wrap: anywhere; }

/* The Hollowmarch */
.chapter-head .body { padding-bottom: 0; }
.lede { margin: 0; max-width: 60ch; color: var(--muted); font-size: 18px; }
.region .margin, .region .body { padding-top: 56px; }
.region-body { display: grid; grid-template-columns: minmax(240px, .7fr) 1.3fr; gap: 20px clamp(28px, 3.4vw, 56px); align-items: start; }
.region-text p { margin: 0; max-width: 46ch; }
.r-castle h3, .r-castle .folio { color: var(--rust); }
.r-lake h3, .r-lake .folio { color: var(--lake); }
.r-ashby h3, .r-ashby .folio { color: var(--moss); }
.r-crypt h3, .r-crypt .folio { color: var(--crypt); }
.r-castle { --accent: var(--rust); }
.r-lake { --accent: var(--lake); }
.r-ashby { --accent: var(--moss); }
.r-crypt { --accent: var(--crypt); }
.region .dot, .region .key li::before { background: var(--accent); }
.region .leaders path { stroke: var(--accent); }
.region .leaders circle { fill: var(--accent); }

/* Fighting */
.moves { list-style: none; counter-reset: m; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.moves img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 2px; background: var(--ink-2); }
.moves li:nth-child(1) img { object-position: 36% 50%; }
.moves li:nth-child(2) img { object-position: 47% 50%; }
.moves li:nth-child(3) img { object-position: 52% 60%; }
.moves li { counter-increment: m; }
.move { margin: 12px 0 4px; font-weight: 700; font-size: 17px; }
.move::before { content: counter(m); display: inline-block; width: 24px; height: 24px; margin-right: 10px; border-radius: 50%; background: var(--yellow); color: var(--on-yellow); font-size: 13px; font-weight: 800; line-height: 24px; text-align: center; vertical-align: 1px; }
.moves li:nth-child(1) .dot { --x: 80%; --y: 30%; }
.moves li:nth-child(2) .dot { --x: 14%; --y: 34%; }
.moves li:nth-child(3) .dot { --x: 70%; --y: 30%; }
.moves li:hover .dot { scale: 1.22; outline-color: var(--bone); }
.nb { white-space: nowrap; }
.input { margin: 0; font-size: 14px; color: var(--muted); }
.or { margin: 0 4px; }
kbd {
  display: inline-block;
  font: 700 13px/1.5 var(--text);
  color: var(--bone);
  background: var(--ink-2);
  border: 1px solid #4a4d55;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 7px;
  white-space: nowrap;
}

/* Controls */
.controls { width: 100%; max-width: 900px; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.controls thead th { text-align: left; font-size: 13px; font-weight: 700; color: var(--muted); padding: 0 12px 8px 0; border-bottom: 2px solid var(--bone); }
.controls tbody th { text-align: left; font-weight: 400; padding: 9px 12px 9px 0; border-bottom: 1px solid var(--rule); }
.controls td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--rule); }
.controls td:last-child { color: var(--muted); }

/* Colophon */
.colophon { border-top: 1px solid var(--rule); }
#controls .body { padding-bottom: 96px; }
.colophon .margin, .colophon .body { padding-top: 28px; padding-bottom: 40px; }
.colophon p { margin: 0 0 6px; max-width: 70ch; color: var(--muted); font-size: 15px; }
.colophon .small { font-size: 13px; }

/* Wide screens: the region thumb tabs stand out from the page edge */
@media (min-width: 1100px) {
  :root { --tabs: 34px; }
  .tabs { display: flex; flex-direction: column; gap: 6px; position: fixed; right: 0; top: 50%; translate: 0 -50%; z-index: 5; }
  .tab {
    writing-mode: vertical-rl;
    padding: 14px 7px 14px 9px;
    font: 700 12px/1 var(--text);
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink);
    text-decoration: none;
    border-radius: 4px 0 0 4px;
    box-shadow: -2px 2px 6px rgb(0 0 0 / .45);
    transition: padding-right .2s cubic-bezier(.16, 1, .3, 1);
  }
  .tab:hover, .tab:focus-visible { padding-right: 13px; }
  .tab:focus-visible { outline-offset: 2px; }
  .t-castle { background: var(--rust); }
  .t-lake { background: var(--lake); }
  .t-ashby { background: var(--moss); }
  .t-crypt { background: var(--crypt); }
  .hero-plate { margin-right: calc(-1 * (var(--gutter) + var(--tabs))); }
  .hero-plate .crop { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 2px 0 0 2px; }
  .hero-plate .crop .shot { position: absolute; top: 0; left: -21.33%; width: 133.33%; }
  .hero-plate figcaption, .hero-plate .folio-end { margin-right: calc(var(--gutter) + var(--tabs)); }
}

@media (max-width: 1099px) {
  .spread .body { grid-template-columns: 1fr; }
  .hero-plate { max-width: 900px; }
  .region-body { grid-template-columns: 1fr; }
  .region-body .plate { max-width: 900px; }
}

@media (max-width: 760px) {
  body { font-size: 16px; }
  .head { grid-template-columns: 1fr; }
  .head-title { text-align: left; padding: 12px 16px 0; }
  .head-title .cinzel { display: inline; margin-right: 6px; }
  .contents { border-left: 0; padding: 0 16px; overflow-x: auto; scrollbar-width: none; }
  .contents ol { flex-wrap: nowrap; gap: 20px; }
  .contents a { padding: 10px 0 12px; }
  .page { display: flex; flex-direction: column; }
  .margin { order: 2; padding: 0 16px 0 14px; text-align: left; margin: 0 0 0 16px; border-left: 1px solid var(--rule); }
  .spread .margin, .region .margin { padding-top: 0; }
  .margin .folio { position: absolute; top: 52px; right: 16px; font-size: 26px; }
  .spread .margin .folio { top: 34px; }
  .tip { margin: 18px 0 0; max-width: 46ch; }
  .body { margin-left: 16px; padding: 56px 16px 0 14px; }
  .spread .body { padding-top: 32px; }
  .region .body { padding-top: 48px; }
  .region .margin .folio { top: 44px; }
  .moves { grid-template-columns: 1fr; gap: 28px; }
  .dot { width: 24px; height: 24px; font-size: 13px; line-height: 24px; }
  .facts div { grid-template-columns: 5.5rem 1fr; }
  .controls { font-size: 14px; }
  .controls thead th, .controls tbody th, .controls td { padding-right: 8px; }
  .controls thead th:first-child, .controls tbody th { width: 30%; }
  .controls thead th:last-child, .controls td:last-child { padding-right: 0; }
  .folio-end { display: none; }
  #controls .body { padding-bottom: 64px; }
  .colophon .margin { display: none; }
}
