/* The blog's additions to guide.css (both linked on every blog page): article body and overview. */

.blog-post table {
  width: 100%;
  margin: 1rem 0;
  border-collapse: collapse;
  background: var(--card-paper);
}

.blog-post th,
.blog-post td {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--ink-rule);
  text-align: left;
  vertical-align: top;
}

.blog-post th {
  color: var(--ink-title);
}

/* The app's look (appIcons in blog.ts): a numbered seal before every section heading, the quest's
   icon before every quest link, and as the bullet of a list item that opens with one. The seal's
   numeral is a counter, so the heading's text is only its words; the words sit in a grid column of
   their own, so a wrapped line starts under the first word, not under the seal. */
.blog-post {
  counter-reset: section;
}

.blog-post h2 {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  column-gap: 0.6rem;
  counter-increment: section;
}

.blog-post h2::before {
  content: counter(section, upper-roman);
  /* Decoration: screen readers skip the numeral where the alt-text syntax is known. */
  content: counter(section, upper-roman) / '';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 1.9rem;
  height: 1.9rem;
  /* Centred on the first line: guide.css sets h2 to 1.3rem at line height 1.25 (1.625rem). */
  margin-top: calc((1.625rem - 1.9rem) / 2);
  padding: 0 0.35rem;
  border: 2px solid var(--on-seal);
  border-radius: 999px;
  background: var(--seal);
  box-shadow: 0 0 0 1px var(--seal), 0 1px 3px rgb(22 38 74 / 0.4);
  color: var(--on-seal);
  font-size: 0.8rem;
  line-height: 1;
}

.quest-link {
  white-space: nowrap;
}

.quest-link .quest-icon {
  margin-right: 0.3rem;
  vertical-align: -0.25em;
  border-radius: 4px;
}

.blog-post li.quest-item {
  list-style: none;
}

.blog-post li.quest-item > .quest-link:first-child .quest-icon {
  width: 24px;
  height: 24px;
  margin-left: -1.9rem;
  margin-right: 0.55rem;
  vertical-align: -0.35em;
}

/* A dressed table (visualTables in blog.ts): header in the title ink, rows striped, zone outlines
   and crests in front of their names, a bar under every number of an all-number column. The wrap
   is a size container: in a column narrower than 30rem (every phone) each row turns into a card,
   so the table never needs to scroll sideways; wider, header words wrap and the columns share the
   width without a minimum. */
.table-wrap {
  container-type: inline-size;
  overflow-x: auto;
  margin: 1.25rem 0;
  border: 1px solid var(--ink-rule);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgb(46 35 20 / 0.15);
}

.blog-post .visual-table {
  margin: 0;
  border: none;
}

.blog-post .visual-table th {
  background: var(--seal);
  color: var(--on-seal);
  font: 600 0.85rem/1.3 'Cinzel', Georgia, serif;
  letter-spacing: 0.02em;
  vertical-align: bottom;
  hyphens: auto;
}

.blog-post .visual-table th,
.blog-post .visual-table td {
  border: none;
  border-bottom: 1px solid var(--ink-rule);
  padding: 0.5rem 0.7rem;
}

.blog-post .visual-table tbody tr:nth-child(even) {
  background: rgb(235 223 192 / 0.55);
}

.blog-post .visual-table tbody tr:last-child td {
  border-bottom: none;
}

.zone-cell .cell-value {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.zone-cell .zone-thumb,
.zone-cell .crest {
  flex: none;
  margin: 0;
}

/* Where the column has room, a zone's name stays on one line; narrower, it may wrap. */
@container (min-width: 40rem) {
  .zone-cell {
    white-space: nowrap;
  }
}

.faction-cell {
  white-space: nowrap;
}

.faction-cell .crest {
  margin-right: 0.45rem;
  vertical-align: middle;
}

.num-cell .num {
  display: block;
  font-weight: bold;
  color: var(--ink-title);
  font-variant-numeric: lining-nums tabular-nums;
}

.cell-bar {
  display: block;
  width: 100%;
  max-width: 6rem;
  height: 8px;
  margin-top: 0.2rem;
}

/* A row as a card: its first cell (the zone with outline and crest) as the title, then one line
   per further cell: the column's header text, the value and, for a number, its bar. */
@container (max-width: 30rem) {
  .blog-post .visual-table,
  .blog-post .visual-table tbody,
  .blog-post .visual-table tr,
  .blog-post .visual-table td {
    display: block;
  }

  .blog-post .visual-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .blog-post .visual-table tr {
    padding: 0.6rem 0.85rem;
    border-bottom: 1px solid var(--ink-rule);
  }

  .blog-post .visual-table tbody tr:last-child {
    border-bottom: none;
  }

  .blog-post .visual-table td,
  .blog-post .visual-table tbody tr:last-child td {
    padding: 0.1rem 0;
    border: none;
  }

  .blog-post .visual-table td:first-child {
    padding-bottom: 0.35rem;
  }

  .blog-post .visual-table td:not(:first-child) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 5rem;
    align-items: center;
    column-gap: 0.6rem;
  }

  .blog-post .visual-table td:not(:first-child)::before {
    content: attr(data-label);
    color: var(--ink-edge);
    font-size: 0.92rem;
  }

  .blog-post .visual-table td:not(:first-child) .cell-value {
    grid-column: 2 / -1;
    text-align: right;
  }

  .num-cell .num {
    text-align: right;
  }

  .num-cell .cell-bar {
    max-width: none;
    margin: 0;
  }
}

.cell-bar-track {
  fill: var(--ink-rule);
  fill-opacity: 0.35;
}

.cell-bar-fill {
  fill: var(--seal);
}

.blog-post li + li {
  margin-top: 0.25rem;
}

.post-list {
  margin: 1.5rem 0;
  padding: 0;
  list-style: none;
}

/* Lists of article cards (the cards themselves are in guide.css): on the overview and wherever
   an article lists others. */
.blog-post ul:has(> .article-card-item),
.post-list {
  display: grid;
  gap: 0.7rem;
  padding: 0;
  list-style: none;
}

.blog-post li.article-card-item + li.article-card-item {
  margin-top: 0;
}

/* A zone article's picture: the zone's own outline, large, beside its locator on the continent,
   in one row at every width; on a phone both shrink so the picture stays below 260 px. */
.zone-hero {
  margin: 1rem 0 1.5rem;
  padding: 1rem;
  border: 1px solid var(--ink-rule);
  border-radius: 10px;
  background: var(--card-paper);
}

.zone-hero-maps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}

.zone-outline {
  display: block;
  flex: none;
  width: min(200px, 40vw);
  height: auto;
  filter: drop-shadow(0 2px 4px rgb(46 35 20 / 0.3));
}

.zone-outline path {
  fill: var(--seal);
  fill-opacity: 0.85;
  stroke: var(--ink-title);
  stroke-width: 1.5px;
  vector-effect: non-scaling-stroke;
  stroke-linejoin: round;
}

.zone-hero .locator-map {
  flex: none;
  float: none;
  width: 8rem;
  margin: 0;
}

.zone-hero figcaption {
  margin-top: 1rem;
  color: var(--ink-title);
  font-family: 'Cinzel', Georgia, serif;
  font-weight: 600;
  text-align: center;
}

@media (max-width: 30rem) {
  .zone-hero {
    padding: 0.75rem;
  }

  .zone-hero-maps {
    gap: 1.25rem;
  }

  .zone-hero .locator-map {
    width: 6rem;
  }

  .zone-hero figcaption {
    margin-top: 0.6rem;
  }
}

/* The screenshots under an article (blog.ts picks them by the zone's side): on a phone at most
   two, each large enough to read, instead of three thumbnails. */
@media (max-width: 30rem) {
  .article-screens li:nth-child(n + 3) {
    display: none;
  }

  .article-screens img {
    max-width: 42vw;
  }
}

/* The reading measure: on a wide screen an article's running text and headings stop near 38rem,
   a comfortable line length, while its tables, zone picture and article cards keep the column. */
@media (min-width: 50rem) {
  .blog-post p,
  .blog-post li:not(.article-card-item),
  .blog-post h2,
  .blog-post h3 {
    max-width: 38rem;
  }
}
