/* Halgard, the site. The app's own palette (lib/ui/theme.dart): tanned paper,
   iron ink, brass ornament, and the app's blood red as the scribe's second
   ink — rubrics, eyebrows and the wax seal. No external requests of any
   kind — the privacy page promises exactly that, so no webfont, no CDN, no
   analytics. Two inks carry the whole system: black for the text, red for
   the structure, brass for whatever can be touched. */

:root {
  --paper: #e7d7b4;
  --ink: #1e1710;
  /* The card a drawn encounter is printed on, and the display face it is set in. */
  --card: #f1e4c6;
  --serif-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", Georgia, serif;
  --ink-soft: #6b5c46;
  --rule: #2e2a24;
  --hairline: rgba(46, 42, 36, 0.35);
  --brass: #8a6224;
  --brass-ink: #634515;
  --seal: #8c2118;
  --plate: #f4e9d0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12100c;
    --card: #1d1913;
    --ink: #e4d2ac;
    --ink-soft: #a08f74;
    --rule: #4a4238;
    --hairline: rgba(160, 143, 116, 0.35);
    --brass: #d8b46a;
    --brass-ink: #d8b46a;
    --seal: #c96a53;
    --plate: #1c1710;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.65;
}

a {
  color: var(--brass-ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

a:hover { color: var(--ink); }

a:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

::selection { background: var(--brass); color: var(--paper); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* The masthead reads as a book's title head, not an app bar: the red
   headband a bound volume gets, the title in small capitals, the sections
   beneath it, separated by middle dots. */

.mast {
  border-top: 4px solid var(--seal);
  border-bottom: 1px solid var(--rule);
  text-align: center;
  padding: 1.5rem 1.25rem 1rem;
}

.logo {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua",
    "URW Palladio L", Palatino, Georgia, serif;
  font-variant: small-caps;
  letter-spacing: 0.14em;
  font-size: 1.45rem;
  color: var(--ink);
  text-decoration: none;
}

.nav { margin-top: 0.45rem; }

.nav a {
  font-variant: small-caps;
  letter-spacing: 0.07em;
  font-size: 0.98rem;
  text-decoration: none;
  white-space: nowrap;
}

.nav a:hover { text-decoration: underline; }

.nav a + a::before {
  content: "·";
  color: var(--ink-soft);
  margin: 0 0.55rem 0 0.4rem;
  display: inline-block;
  text-decoration: none;
}

/* Every page is one document from the Dornwacht's files: an eyebrow naming
   the register it was copied from, the title, the lede, and a double ledger
   rule before the text begins. */

.wrap {
  max-width: 42rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
}

.dochead {
  margin: 0 0 1.7rem;
  padding-bottom: 1.2rem;
  border-bottom: 4px double var(--rule);
}

.eyebrow {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.26em;
  color: var(--seal);
  margin-bottom: 0.7rem;
}

h1 {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua",
    "URW Palladio L", Palatino, Georgia, serif;
  font-variant: small-caps;
  font-weight: normal;
  letter-spacing: 0.045em;
  margin: 0;
  font-size: 2.4rem;
  line-height: 1.12;
}

.lede {
  color: var(--ink-soft);
  font-style: italic;
  font-size: 1.12rem;
  margin: 0.45rem 0 0;
}

/* Rubrication: the red ink is the structure. Headings need no rule of
   their own. */

h2 {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua",
    "URW Palladio L", Palatino, Georgia, serif;
  font-variant: small-caps;
  font-weight: normal;
  letter-spacing: 0.06em;
  color: var(--seal);
  font-size: 1.3rem;
  margin: 2.2rem 0 0.5rem;
}

/* Plates are mounted, not merely placed: a paper mat and a hairline frame. */

.lore-lead,
.shot,
figure.lore img,
figure.folk img {
  display: block;
  width: 100%;
  object-fit: cover;
  border: 1px solid var(--hairline);
  background: var(--plate);
  padding: 0.3rem;
}

.lore-lead { aspect-ratio: 21 / 9; margin: 1.4rem 0 0; }
.shot { aspect-ratio: 16 / 9; margin: 1.4rem 0 0; }

/* The site's own wide plates are 21:9; the game's own are 16:9. */
.shot.wide { aspect-ratio: 21 / 9; }

/* A screenshot is read, not looked at: give it its own shape and let it be
   whole, or cover crops the sidebar and the choices off both edges. */
.shot.screen {
  aspect-ratio: 16 / 9;
  height: auto;
  object-fit: contain;
}

/* The tower plate is 11:6 rather than 21:9, and cover would crop its spire
   off the top. Give it the shape it actually has. */
.lore-lead.tall { aspect-ratio: 11 / 6; }

.caption {
  margin: 0.5rem 0 1.4rem;
  text-align: center;
  font-style: italic;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

/* The lore page, generated from world.json by tool/web/build_lore.dart. */

dl { margin: 0.75rem 0 0; }

dt {
  font-variant: small-caps;
  letter-spacing: 0.04em;
  font-size: 1.05rem;
  margin-top: 0.9rem;
}

dt small {
  font-variant: normal;
  letter-spacing: 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

dd {
  margin: 0.15rem 0 0;
  color: var(--ink-soft);
}

/* Plates on the lore page: one picture, one name, one line. */

.lore-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  margin-top: 1rem;
}

figure.lore { margin: 0; }

figure.lore img { aspect-ratio: 16 / 9; }

figure.lore figcaption { margin-top: 0.4rem; }

figure.lore strong {
  font-variant: small-caps;
  letter-spacing: 0.04em;
  font-size: 1.05rem;
}

figure.lore small {
  color: var(--ink-soft);
  font-size: 0.85rem;
}

figure.lore span {
  display: block;
  color: var(--ink-soft);
}

/* The folk page: one portrait each, taller than wide because a character
   study is. The chips carry the ancestry's attribute dowry. */

.folk-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  margin-top: 1.25rem;
}

figure.folk { margin: 0; }

figure.folk img {
  aspect-ratio: 3 / 4;
  object-position: top center;
}

figure.folk figcaption { margin-top: 0.45rem; }

figure.folk strong {
  font-variant: small-caps;
  letter-spacing: 0.04em;
  font-size: 1.05rem;
}

figure.folk span {
  display: block;
  color: var(--ink-soft);
}

figure.folk .line {
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

figure.folk .line em { font-style: normal; color: var(--ink); }

figure.folk .locked { font-style: italic; }

.chips {
  margin: 0.4rem 0 0.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.chip {
  border: 1px solid var(--hairline);
  padding: 0.05rem 0.35rem;
  font-size: 0.82rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* The rules pages. Ledger tables: a double rule closes the header the way a
   ledger closes a column head, hairlines carry the rows, and the numbers
   line up because they are meant to be compared. */

table.rules {
  width: 100%;
  border-collapse: collapse;
  margin: 0.8rem 0;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

table.rules th,
table.rules td {
  text-align: left;
  vertical-align: top;
  padding: 0.35rem 0.6rem 0.35rem 0;
  border-bottom: 1px solid var(--hairline);
}

table.rules th {
  font-variant: small-caps;
  letter-spacing: 0.04em;
  font-weight: normal;
  border-bottom: 3px double var(--rule);
}

table.rules td:first-child { color: var(--ink); white-space: nowrap; }
table.rules td:not(:first-child) { color: var(--ink-soft); }

/* Die faces beside the two rolls that ignore every modifier. Brass is the
   game's colour for the good kind of surprise, the app's blood red for the
   other kind. */

.pips {
  font-size: 1.3em;
  line-height: 0;
  letter-spacing: 0.08em;
  vertical-align: -0.08em;
}

.pips.good { color: var(--brass); }
.pips.bad { color: var(--seal); }

ul { color: var(--ink-soft); padding-left: 1.2rem; }
ul strong { color: var(--ink); }

/* The foot: a fleuron where a chapter ends, then the imprint. */

.foot {
  border-top: 1px solid var(--rule);
  text-align: center;
  font-size: 0.9rem;
  color: var(--ink-soft);
  padding: 1.5rem 1.25rem 2.2rem;
}

.fleuron {
  display: block;
  color: var(--brass);
  font-size: 1.15rem;
  margin-bottom: 0.7rem;
}

.foot-links { margin-top: 0.35rem; }

.foot-links a { white-space: nowrap; }

.foot-links a + a::before {
  content: "·";
  color: var(--ink-soft);
  margin: 0 0.5rem 0 0.35rem;
  display: inline-block;
  text-decoration: none;
}

@media (max-width: 34rem) {
  body { font-size: 16px; }
  h1 { font-size: 1.9rem; }
  .wrap { padding-top: 1.9rem; }
}

/* The writ and the stack of the Ambermarch: the front page deals the cards
   it talks about. Appended after main's own rules, all new selectors. */

.skip {
  position: absolute;
  left: -9999px;
  background: var(--card);
  border: 1px solid var(--rule);
  padding: 0.5rem 0.9rem;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
}
.ink {
  border: 0;
  background: transparent;
  height: auto;
  mix-blend-mode: multiply;
}

@media (prefers-color-scheme: dark) {
  /* The plates are opaque line art on white, so multiplying them into a dark
     page leaves a black rectangle. Invert the ink and screen the paper away. */
  .ink {
    mix-blend-mode: screen;
    filter: invert(1) hue-rotate(180deg) brightness(0.88);
  }
}

.home {
  --pad: 2.5rem;
  --measure: 34rem;
}
.home .wrap { max-width: 58rem; }

.home .page { padding: var(--pad); }

.home .page p,
.home .page h2,
.home .page h3,
.home .page ul { max-width: var(--measure); }

.home section + section { margin-top: 3.25rem; }

.home h2 { margin-top: 2.25rem; }

.bleed {
  width: calc(100% + var(--pad) * 2);
  max-width: none;
  margin-left: calc(var(--pad) * -1);
  margin-right: calc(var(--pad) * -1);
}
.writ { display: grid; gap: 1.5rem; }

.writ-text h1 {
  font-size: clamp(2.1rem, 7vw, 3.2rem);
  line-height: 1.05;
  margin-bottom: 0.5rem;
}
.writ-text .lede {
  font-size: 1.1rem;
  max-width: 26rem;
}
.terms {
  font-family: var(--serif-display);
  font-size: 1.3rem;
  line-height: 1.4;
  border-top: 1px solid var(--rule);
  padding-top: 1rem;
  margin: 1.6rem 0 0;
  max-width: 28rem;
}
.terms-seal {
  display: block;
  margin-top: 0.45rem;
  font-variant: small-caps;
  letter-spacing: 0.08em;
  font-size: 0.95rem;
  color: var(--seal);
}
.writ-plate { margin: 0; }

.writ-plate img {
  display: block;
  width: 100%;
  height: auto;
}
.deck-band {
  background: var(--paper);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 2rem var(--pad) 2.25rem;
}
.deck-band h2 { margin-top: 0; }

.deck {
  display: grid;
  max-width: 23rem;
  margin: 1.6rem 0 0;
  padding-top: 1rem;
}
.card {
  grid-area: 1 / 1;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 1.1rem 1.2rem 1.2rem;
  opacity: calc(1 - var(--pos, 0) * 0.12);
  transform: translate(calc(var(--pos, 0) * 0.5rem), calc(var(--pos, 0) * -0.5rem))
             rotate(calc(var(--pos, 0) * -1.3deg));
  transform-origin: bottom left;
}
.card:nth-child(1) { --pos: 0; z-index: 4; }
.card:nth-child(2) { --pos: 1; z-index: 3; }
.card:nth-child(3) { --pos: 2; z-index: 2; }
.card:nth-child(4) { --pos: 3; z-index: 1; }

.card.is-leaving {
  transform: translate(-35%, -4%) rotate(-9deg);
  opacity: 0;
}
.card-where {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.6rem;
  margin: 0;
  font-variant: small-caps;
  letter-spacing: 0.06em;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.card-where .chip { font-size: 0.78rem; color: var(--ink-soft); }

.card h3 {
  font-family: var(--serif-display);
  font-variant: small-caps;
  letter-spacing: 0.03em;
  font-size: 1.25rem;
  margin: 0.4rem 0 0.5rem;
}
.card-text { font-size: 0.95rem; margin: 0; }

.card-choices {
  list-style: none;
  color: var(--ink);
  padding: 0;
  margin: 1rem 0 0;
}
.card-choices li {
  position: relative;
  border-top: 1px solid var(--rule);
  padding: 0.32rem 0 0.32rem 1.1rem;
  font-size: 0.92rem;
}
.card-choices li::before {
  content: "\203A";
  position: absolute;
  left: 0.15rem;
  color: var(--brass);
}
.deck-foot {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1.4rem 0 0;
}
.draw {
  font: inherit;
  font-family: var(--serif-display);
  font-variant: small-caps;
  letter-spacing: 0.06em;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.35rem 1.1rem;
  cursor: pointer;
}
.draw:hover { background: var(--plate); }
.draw:active { transform: translateY(1px); }

.deck-count { font-size: 0.9rem; color: var(--ink-soft); }

/* One movement, and it is the game's: the land deals, the cards settle. */

@media (prefers-reduced-motion: no-preference) {
  .card { transition: transform 260ms ease, opacity 260ms ease; }

  @keyframes austeilen {
    from {
      opacity: 0;
      transform: translate(-30%, -12%) rotate(-11deg);
    }
  }

  .deck.is-live .card {
    animation: austeilen 480ms ease backwards;
  }

  .deck.is-live .card:nth-child(4) { animation-delay: 0ms; }
  .deck.is-live .card:nth-child(3) { animation-delay: 80ms; }
  .deck.is-live .card:nth-child(2) { animation-delay: 160ms; }
  .deck.is-live .card:nth-child(1) { animation-delay: 240ms; }
}
.sending {
  border-left: 2px solid var(--seal);
  padding-left: 1.2rem;
  margin: 1.2rem 0 1.4rem;
  max-width: var(--measure);
}
.sending p {
  font-family: var(--serif-display);
  font-size: 1.25rem;
  line-height: 1.45;
  margin: 0;
}
.more {
  list-style: none;
  padding: 0;
  margin: 0.6rem 0 0;
}
