/* Pages outside the app (privacy, terms, not found, audience counts): the
   game's palette and type in a reading column. Parchment, as in the game,
   unless the player chose the dark theme there, which an inline script
   copies onto <html>. */
html[data-theme="dark"] {
  --bg-deep: #100e0b;
  --bg-mid: #1b1813;
  --panel: rgba(33, 29, 24, 0.95);
  --panel-border: rgba(236, 227, 207, 0.26);
  --text-main: #ece3cf;
  --text-soft: #c4b59b;
  --gold: #d9aa4c;
  --link: #e6bb62;
  --cta: #ece3cf;
  --cta-text: #1e1a15;
  --ink: #ece3cf;
  --rule-soft: rgba(236, 227, 207, 0.22);
  --paper-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.93 0 0 0 0 0.89 0 0 0 0 0.8 0.13 0 0 0 -0.05'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23g)'/%3E%3C/svg%3E");
  color-scheme: dark;
}

:root {
  --bg-deep: #e3d6ba;
  --bg-mid: #eee4cd;
  --panel: rgba(250, 245, 234, 0.95);
  --panel-border: rgba(30, 26, 21, 0.36);
  --text-main: #2a241c;
  --text-soft: #5e5141;
  --gold: #9a6a1a;
  --link: #7a4f0e;
  --cta: #1e1a15;
  --cta-text: #f9f4e8;
  --ink: #1e1a15;
  --rule-soft: rgba(30, 26, 21, 0.3);
  --paper-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.36 0 0 0 0 0.28 0 0 0 0 0.16 0.24 0 0 0 -0.07'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23g)'/%3E%3C/svg%3E");
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text-main);
  font-family: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  line-height: 1.6;
  background: var(--paper-grain), linear-gradient(175deg, var(--bg-mid), var(--bg-deep));
  background-color: var(--bg-mid);
  background-attachment: fixed;
}

a {
  color: var(--link);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--text-main);
}

a:focus-visible,
button:focus-visible,
select:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

.page-header,
.page,
.page-footer {
  width: min(760px, 100% - 2rem);
  margin-inline: auto;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 0 0.4rem;
}

.page-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-main);
  text-decoration: none;
  font-family: "Cinzel", Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.page-brand img {
  width: 2.4rem;
  height: 2.4rem;
}

/* The printed frame of the game's panels: a border, then a hairline inside. */
.page {
  margin-block: 1rem 2rem;
  padding: clamp(1.1rem, 4vw, 2.2rem);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  box-shadow: inset 0 0 0 4px var(--panel), inset 0 0 0 5px var(--rule-soft);
}

h1,
h2 {
  font-family: "Cinzel", Georgia, serif;
  line-height: 1.25;
}

h1 {
  margin: 0 0 0.3rem;
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem);
  letter-spacing: 0.04em;
}

h2 {
  margin: 2rem 0 0.5rem;
  font-size: 1.15rem;
  letter-spacing: 0.03em;
  color: var(--gold);
}

.page-lede {
  font-size: 1.05rem;
}

.page-updated {
  margin: 0 0 1.5rem;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.page ul {
  padding-left: 1.2rem;
}

.page li + li {
  margin-top: 0.35rem;
}

.page-footer {
  padding: 0 0 2rem;
  color: var(--text-soft);
  font-size: 0.9rem;
  text-align: center;
}

.page-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.1rem;
}

.page-footer p {
  margin: 0.6rem 0 0;
}

.page-cta {
  display: inline-block;
  margin-top: 0.6rem;
  padding: 0.7rem 1.4rem;
  border-radius: 6px;
  background: var(--cta);
  color: var(--cta-text);
  font-weight: 600;
  text-decoration: none;
}

.page-cta:hover {
  color: var(--cta-text);
  filter: brightness(1.1);
}

.page-notfound {
  text-align: center;
}

.page-notfound section + section {
  margin-top: 2rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--panel-border);
}

/* The site's generated pages (tools/make-pages.mjs): a header with the
   sections, the rule diagrams drawn as SVG, the rune sheets and the files. */
/* The diagrams are the game's engraved plate: ink lines on parchment. */
:root {
  --fig-board: #f4ecd8;
  --fig-grid: rgba(30, 26, 21, 0.55);
  --fig-frame: #1e1a15;
  --fig-black: #1e1a15;
  --fig-black-edge: none;
  --fig-white: #f9f4e8;
  --fig-white-edge: #1e1a15;
  --fig-neutral: #bfb6a2;
  --fig-neutral-edge: rgba(30, 26, 21, 0.72);
  --fig-win: #c8962f;
  --fig-fading: #b3412e;
}

html[data-theme="dark"] {
  --fig-board: #25211b;
  --fig-grid: rgba(236, 227, 207, 0.4);
  --fig-frame: #ece3cf;
  --fig-black: #0f0d0a;
  --fig-black-edge: rgba(236, 227, 207, 0.72);
  --fig-white: #efe6d2;
  --fig-white-edge: rgba(0, 0, 0, 0.5);
  --fig-neutral: #8e8676;
  --fig-neutral-edge: rgba(236, 227, 207, 0.6);
  --fig-win: #e6bb62;
  --fig-fading: #e0735e;
}

.site-header {
  width: min(760px, 100% - 2rem);
  margin-inline: auto;
  padding: 1rem 0 0.2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
}

.site-header .page-brand {
  margin-right: auto;
}

.site-header-actions {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.site-lang {
  color: var(--text-soft);
}

.site-play {
  margin-top: 0;
  padding: 0.45rem 1.1rem;
}

.site-nav {
  flex: 1 0 100%;
  display: flex;
  gap: 0.2rem 1.15rem;
  overflow-x: auto;
  padding: 0.45rem 0 0.3rem;
  border-top: 1px solid var(--panel-border);
  scrollbar-width: none;
}

.site-nav a {
  padding: 0.15rem 0;
  color: var(--text-soft);
  text-decoration: none;
  white-space: nowrap;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text-main);
}

.site-nav a[aria-current="page"] {
  box-shadow: inset 0 -2px 0 var(--gold);
}

.rule-figure {
  margin: 0.8rem 0 1.2rem;
}

.rule-figure svg {
  display: block;
  width: min(100%, 280px);
  height: auto;
}

.fig-board {
  fill: var(--fig-board);
  stroke: var(--fig-frame);
  stroke-width: 2.5;
}

.fig-frame {
  fill: none;
  stroke: var(--fig-frame);
  stroke-width: 1;
}

.fig-grid {
  stroke: var(--fig-grid);
  stroke-width: 1;
}

.fig-forced {
  fill: rgba(184, 134, 43, 0.2);
}

.fig-black {
  fill: var(--fig-black);
  stroke: var(--fig-black-edge);
  stroke-width: 2;
}

.fig-white {
  fill: var(--fig-white);
  stroke: var(--fig-white-edge);
  stroke-width: 2;
}

.fig-neutral {
  fill: var(--fig-neutral);
  stroke: var(--fig-neutral-edge);
  stroke-width: 2;
  stroke-dasharray: 4 3;
}

/* The rune an effect is about to remove or move away. */
.fig-fading {
  opacity: 0.42;
  stroke: var(--fig-fading);
  stroke-width: 2.5;
}

.fig-win {
  fill: none;
  stroke: var(--fig-win);
  stroke-width: 3;
}

.fig-glyph-light {
  filter: invert(0.93) sepia(0.4) brightness(1.02);
}

.rule-rune,
.rune-entry {
  scroll-margin-top: 1rem;
}

.rule-rune-glyph,
.rune-entry-glyph {
  border-radius: 50%;
  background: #f9f4e8;
  box-shadow: inset 0 0 0 2px #1e1a15;
}

.rule-rune-glyph {
  width: 1.6rem;
  height: 1.6rem;
  margin-right: 0.45rem;
  padding: 0.15rem;
  vertical-align: -0.45rem;
}

.rune-index {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.85rem;
  margin: 0.6rem 0 0.4rem;
  font-size: 0.92rem;
}

.rune-entry {
  padding: 1rem 0;
  border-top: 1px solid var(--panel-border);
}

.rune-entry p {
  margin: 0.45rem 0;
}

.rune-entry-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.rune-entry-head h3 {
  margin: 0;
  font-family: "Cinzel", Georgia, serif;
  font-size: 1.15rem;
}

.rune-entry-glyph {
  width: 2.6rem;
  height: 2.6rem;
  padding: 0.35rem;
}

.rune-entry-chip {
  display: inline-block;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
}

.rune-entry-chip-plain {
  background: radial-gradient(circle at 34% 30%, #51483b 0, #2a241c 40%, #13100c 100%);
}

.rune-entry-chip-neutral {
  background: repeating-linear-gradient(45deg, rgba(30, 26, 21, 0.26) 0 1px, transparent 1px 4px), radial-gradient(circle at 34% 30%, #ddd5c4 0, #a89f8b 75%);
  border: 2px dashed rgba(30, 26, 21, 0.72);
}

.page .rune-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.6rem 0 0.2rem;
  padding: 0;
  list-style: none;
}

.page .rune-tags li {
  margin: 0;
  padding: 0.1rem 0.55rem;
  border: 1px solid rgba(212, 175, 88, 0.55);
  border-radius: 999px;
  font-size: 0.8rem;
}

.rune-entry-note {
  color: var(--text-soft);
  font-size: 0.92rem;
}

.page .file-list {
  padding: 0;
  list-style: none;
}

.page .file-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.2rem 1rem;
  margin: 0;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--panel-border);
}

.file-meta,
.supply-count {
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

.file-meta {
  font-size: 0.88rem;
}

.page .supply-list {
  columns: 2 11rem;
  column-gap: 2rem;
}

.page .supply-list li {
  margin: 0 0 0.3rem;
  break-inside: avoid;
}

.faq-item h2 {
  margin: 1.6rem 0 0.4rem;
  font-size: 1.05rem;
}

.faq-item p {
  margin: 0;
}

.page-cta-box {
  text-align: center;
}

.page-cta-box h2 {
  margin-top: 0;
  color: var(--text-main);
}

.page-cta-box h3 {
  margin: 1.6rem 0 0.4rem;
  color: var(--text-soft);
  font-size: 0.95rem;
  font-weight: 600;
}

.page .read-next {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.2rem;
  padding: 0;
  list-style: none;
}

.page .read-next li {
  margin: 0;
}

/* Audience counts */
.metrics-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.metrics-controls select {
  font: inherit;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: var(--bg-mid);
  color: var(--text-main);
}

.metrics-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.6rem;
}

.metrics-tile {
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
}

.metrics-tile strong {
  display: block;
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
}

.metrics-tile span {
  color: var(--text-soft);
  font-size: 0.85rem;
}

.metrics-table-wrap {
  overflow-x: auto;
}

.metrics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.metrics-table th,
.metrics-table td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--panel-border);
  text-align: right;
  white-space: nowrap;
}

.metrics-table th:first-child,
.metrics-table td:first-child {
  text-align: left;
}

.metrics-message {
  color: var(--text-soft);
}
