/* alignment stuff */
.indent {
  margin-left: 24px;
}

.centered {
  text-align: center;
}

.left-aligned {
  text-align: left;
}

.right-aligned {
  text-align: right;
}

.no-wrap {
  white-space: nowrap;
}

/* blockquote stuff */
blockquote {
  padding: 16px;
}

blockquote > :first-child {
  margin-top: 0;
}

blockquote > :last-child {
  margin-bottom: 0;
}

.no-margin > :not(:first-child) {
  margin-top: 0;
}

.no-margin > :not(:last-child) {
  margin-bottom: 0;
}

.header-bg {
  background: var(--table-header-bg);
}

/* blockquote table */
.table > :is(p, h2, h3, h4, .heading) {
  text-align: center;
  background: var(--table-header-bg);
  margin-top: 0;
  margin-bottom: 0;
  padding: 3px 15px;
}

/* blockquote framed-table */
.framed-table {
  padding: 8px 16px;
  border: 3px solid var(--fg);
  background-color: transparent;
}

.framed-table > table {
  width: calc(100% + 32px);
  margin-left: -16px;
}

/* basic table */
table {
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

table p {
  line-height: normal !important;
}

table td,
table thead th {
  padding-left: 5px;
  padding-right: 5px;
}

table :is(tr, td, th) {
  border: 0 !important;
}

table tr > :first-child {
  padding-left: 15px;
}

table tr > :last-child {
  padding-right: 15px;
}

/* table layout markers */
.fixed table {
  table-layout: fixed;
}

.tl1 tr > :nth-child(1),
.tl2 tr > :nth-child(2),
.tl3 tr > :nth-child(3),
.tl4 tr > :nth-child(4),
.tl5 tr > :nth-child(5),
.tl6 tr > :nth-child(6),
.tl7 tr > :nth-child(7),
.tl8 tr > :nth-child(8),
.tl9 tr > :nth-child(9) {
  text-align: left;
}

.tr1 tr > :nth-child(1),
.tr2 tr > :nth-child(2),
.tr3 tr > :nth-child(3),
.tr4 tr > :nth-child(4),
.tr5 tr > :nth-child(5),
.tr6 tr > :nth-child(6),
.tr7 tr > :nth-child(7),
.tr8 tr > :nth-child(8),
.tr9 tr > :nth-child(9) {
  text-align: right;
}

.tc1 tr > :nth-child(1),
.tc2 tr > :nth-child(2),
.tc3 tr > :nth-child(3),
.tc4 tr > :nth-child(4),
.tc5 tr > :nth-child(5),
.tc6 tr > :nth-child(6),
.tc7 tr > :nth-child(7),
.tc8 tr > :nth-child(8),
.tc9 tr > :nth-child(9) {
  text-align: center;
}

.tnw1 tr > :nth-child(1),
.tnw2 tr > :nth-child(2),
.tnw3 tr > :nth-child(3),
.tnw4 tr > :nth-child(4),
.tnw5 tr > :nth-child(5),
.tnw6 tr > :nth-child(6),
.tnw7 tr > :nth-child(7),
.tnw8 tr > :nth-child(8),
.tnw9 tr > :nth-child(9) {
  white-space: nowrap;
}

.line-spread {
  display: flex;
  /* flex-wrap: wrap; */
  margin: 16px 0;
  column-gap: 16px;
}

.line-spread > :first-child {
  text-align: left;
}

.line-spread > :last-child {
  text-align: right;
  margin-left: auto;
}

.line-spread * {
  margin: 0;
}

/* title formatting */
h1,
h2 {
  text-transform: uppercase;
}

:is(h2, h3, h4, .heading) {
  margin-bottom: 0;
}

.title-margin > :first-child:is(h2, h3, h4, .heading) {
  margin-bottom: 16px;
}

:is(h2, h3, h4, .heading) + *,
:is(h2, h3, h4, .heading) + * > :first-child {
  margin-top: 0 !important;
}

/* column support */
.two-columns-text {
  column-count: 2;
}

.two-columns-text > :first-child,
.smart-columns > div > :first-child {
  margin-top: 0;
}

.two-columns-text > :last-child,
.smart-columns > div > :last-child {
  margin-bottom: 0;
}

.smart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.smart-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  column-gap: 16px;
}

/* eclipse phase aptitude superscripts */
.ep-stats sup {
  padding-left: 0.2em;
  text-decoration: underline dotted;
}

/* stat-list */
.stat-list ul,
ul.stat-list,
.stat-item {
  margin-top: 8px;
  margin-bottom: 8px;
  padding-left: 0;
  list-style-type: none;
}

.stat-list li,
ul.stat-list li {
  text-indent: -24px;
  padding-left: 24px;
}

/* no spacing inside tables */
td * {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

th:empty {
  padding: 0;
}

tr:has(hr.table-header) {
  background: var(--table-header-bg) !important;
  font-weight: bold;
}

tr:has(hr.table-split) {
  background: currentColor !important;
  font-weight: bold;
}

hr.table-header,
hr.table-split {
  display: none;
}

.morph-images img {
  float: right;
  max-height: 30rem;
  max-width: 50%;
  margin: 0.5rem;
}

.large-text {
  font-size: large;
}

/* Compatibility with the Ukrainian edition’s existing markup. */
.two-columns {
  column-count: 2;
}
.two-columns > :first-child {
  margin-top: 0;
}
.two-columns > :last-child {
  margin-bottom: 0;
}
