/* The reading companion. Long-form typography on top of the game's design system. */

body.reading { background: var(--bg); }

#rhead {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 13px 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.rhead-home {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -.01em;
  color: var(--text);
  text-decoration: none;
}
.rhead-home:hover { color: var(--accent); text-decoration: none; }
#rhead nav { margin-left: auto; display: flex; gap: 8px; align-items: center; }
#rhead nav a {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  text-decoration: none;
  padding: 6px 11px;
  border-radius: 8px;
  border: 1px solid transparent;
}
#rhead nav a:hover { color: var(--accent); background: var(--panel-2); text-decoration: none; }
.rhead-play {
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}

#doc { max-width: 43rem; margin: 0 auto; padding: 46px 24px 120px; }

.rdoc { animation: rise .45s var(--ease) both; }

/* ── Post typography ─────────────────────────────────────────────── */

.rpost-head { margin-bottom: 34px; }
.rpost-meta {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent);
  margin-bottom: 10px;
}
.rdoc h1 {
  font-family: var(--serif);
  font-size: clamp(31px, 5.4vw, 42px);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -.025em;
  margin: 0 0 14px;
}
.rlede {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.6;
  color: var(--text-dim);
  margin: 0;
}
.rsub { font-size: 15px; line-height: 1.65; color: var(--muted); margin: 14px 0 0; }

.rdoc h2 {
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 500;
  line-height: 1.22;
  letter-spacing: -.018em;
  margin: 46px 0 14px;
}
.rdoc h3 {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.3;
  margin: 34px 0 10px;
}
.rdoc h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  margin: 26px 0 8px;
}

.rdoc p {
  font-family: var(--serif);
  font-size: 18.5px;
  line-height: 1.72;
  color: var(--text);
  margin: 0 0 1.15em;
}
.rdoc li {
  font-family: var(--serif);
  font-size: 18.5px;
  line-height: 1.68;
  color: var(--text);
  margin-bottom: .5em;
}
.rdoc ul, .rdoc ol { margin: 0 0 1.3em; padding-left: 24px; }
.rdoc strong { font-weight: 600; }
.rdoc a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.rdoc blockquote {
  margin: 0 0 1.4em;
  padding: 2px 0 2px 20px;
  border-left: 3px solid var(--line-2);
}
.rdoc blockquote p {
  font-style: italic;
  color: var(--text-dim);
  margin-bottom: .6em;
}
.rdoc blockquote p:last-child { margin-bottom: 0; }

.rdoc code {
  font-family: var(--mono);
  font-size: .82em;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
}
.rdoc pre {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 15px 17px;
  overflow-x: auto;
  margin: 0 0 1.4em;
}
.rdoc pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: 13px;
  line-height: 1.62;
}

.rdoc hr { border: 0; border-top: 1px solid var(--line); margin: 38px 0; }

.tablewrap { overflow-x: auto; margin: 0 0 1.5em; }
.rdoc table { border-collapse: collapse; width: 100%; font-family: var(--sans); }
.rdoc th, .rdoc td {
  text-align: left;
  padding: 9px 13px;
  border-bottom: 1px solid var(--line);
  font-size: 14.5px;
  line-height: 1.5;
  vertical-align: top;
}
.rdoc th { font-weight: 700; font-size: 12.5px; color: var(--muted); }

/* ── Callouts ────────────────────────────────────────────────────── */

.callout {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 4px 11px 11px 4px;
  background: var(--bg-2);
  padding: 15px 18px;
  margin: 0 0 1.5em;
}
.callout p {
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--text-dim);
  margin-bottom: .7em;
}
.callout p:last-child { margin-bottom: 0; }
.callout.eli5 { border-left-color: var(--m-trust); }
.callout.deeper { border-left-color: var(--m-speed); }
.callout.warning { border-left-color: var(--bad); }
.callout.try { border-left-color: var(--good); }

/* ── Play card ───────────────────────────────────────────────────── */

.playcard {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin: 34px 0;
}
.playcard.end { margin-top: 46px; background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 34%, var(--line)); }
.playcard-body { flex: 1; min-width: 15rem; }
.playcard b {
  display: block;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  margin-bottom: 5px;
}
.playcard p {
  font-family: var(--sans) !important;
  font-size: 14.5px !important;
  line-height: 1.6 !important;
  color: var(--text-dim) !important;
  margin: 0 !important;
}
.playcard .btn, .rdoc a.btn {
  /* .rdoc a sets the link colour and outranks .btn, which left the label
     amber on an amber ground. State it here rather than relying on order. */
  color: var(--bg);
  background: var(--accent);
  text-decoration: none;
  flex: none;
}
.playcard .btn:hover, .rdoc a.btn:hover { background: var(--accent-hi); color: var(--bg); }

/* ── Index ───────────────────────────────────────────────────────── */

.rindex-head { margin-bottom: 44px; }
.rgroup { margin-bottom: 40px; }
.rgroup h2 { margin-top: 0; margin-bottom: 6px; font-size: 24px; }
.rgroup-blurb { font-size: 15px !important; font-family: var(--sans) !important; color: var(--muted) !important; margin-bottom: 16px !important; line-height: 1.6 !important; }

.rlist { list-style: none; margin: 0; padding: 0; }
.rlist li { margin: 0 0 7px; }
.rlist a {
  display: flex;
  align-items: baseline;
  gap: 15px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  text-decoration: none;
  transition: border-color .15s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease);
}
.rlist a:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-lift); text-decoration: none; }
.rlist-n { font-family: var(--mono); font-size: 12px; color: var(--muted); flex: none; }
.rlist-body { flex: 1; min-width: 0; }
.rlist-title { display: block; font-family: var(--serif); font-size: 19px; font-weight: 500; color: var(--text); line-height: 1.3; }
.rlist-blurb { display: block; font-size: 13.5px; color: var(--muted); line-height: 1.5; margin-top: 3px; }
.rlist-time { font-family: var(--mono); font-size: 11px; color: var(--muted); flex: none; }

/* ── Prev / next ─────────────────────────────────────────────────── */

.rnav {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.rnav a {
  display: block;
  max-width: 47%;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  text-decoration: none;
  transition: border-color .15s var(--ease);
}
.rnav a:hover { border-color: var(--accent); text-decoration: none; }
.rnav-next { text-align: right; margin-left: auto; }
.rnav span { display: block; font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 3px; }
.rnav b { font-family: var(--serif); font-size: 16px; font-weight: 500; color: var(--text); line-height: 1.3; }

@media (max-width: 620px) {
  #doc { padding: 30px 18px 90px; }
  .rdoc p, .rdoc li { font-size: 17.5px; }
  .rlede { font-size: 18px; }
  .rnav { flex-direction: column; }
  .rnav a, .rnav-next { max-width: 100%; text-align: left; margin-left: 0; }
  #rhead { padding: 11px 16px; }
}

/* ── Figures ─────────────────────────────────────────────────────── */

.rfig { margin: 30px 0; }
.rfig img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--bg-2);
}
.rfig figcaption {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted);
  margin-top: 9px;
  text-align: center;
}
/* Art not generated yet: collapse quietly rather than showing a broken icon. */
.rfig.missing img { display: none; }
.rfig.missing figcaption { display: none; }
