/*
 * /bible/covenants: the Covenant guide's editorial look (Anton headings, Lexend body, red attack, blue defence),
 * ported from docs/covenant-guide in the luniac workspace and scoped under .cov-guide so it never touches the rest of
 * the site. Linked only by views/partials/head-extras/bible-covenants.ejs. The guide's own palette is not the site's
 * theme, so its colours are page tokens below (one literal per line, marked for test/css/design-tokens.spec.ts).
 * Anton and Lexend are latin subsets: CJK and Hangul fall back to the system fonts (bold headings, see the end).
 */

@font-face {
  font-family: "Anton";
  font-style: normal;
  font-weight: 400;
  font-display: optional;
  src: url("/fonts/anton-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD, U+0300-0309, U+0323;
}

@font-face {
  font-family: "Lexend";
  font-style: normal;
  font-weight: 400;
  font-display: optional;
  src: url("/fonts/lexend-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD, U+0300-0309, U+0323;
}

@font-face {
  font-family: "Lexend";
  font-style: normal;
  font-weight: 700;
  font-display: optional;
  src: url("/fonts/lexend-latin-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD, U+0300-0309, U+0323;
}

.cov-guide {
  --cov-bg: #fafaf8; /* literal-ok */
  --cov-ink: #18181b; /* literal-ok */
  --cov-ink-2: #3f3f46; /* literal-ok */
  --cov-ink-3: #52525b; /* literal-ok */
  --cov-muted: #71717a; /* literal-ok */
  --cov-weak: #8d8d96; /* literal-ok */
  --cov-line: #d4d4d8; /* literal-ok */
  --cov-line-soft: #e4e4e7; /* literal-ok */
  --cov-card: #ffffff; /* literal-ok */
  --cov-red: #ff3b1f; /* literal-ok */
  --cov-atk: #c4262c; /* literal-ok */
  --cov-atk-soft: #fde8e8; /* literal-ok */
  --cov-def: #1d4ed8; /* literal-ok */
  --cov-def-soft: #e3ebff; /* literal-ok */
  --cov-display: "Anton", Impact, "Arial Narrow", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --cov-body: "Lexend", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  color: var(--cov-ink);
  background: var(--cov-bg);
  text-align: left;
  letter-spacing: normal;
  font: 400 20px/1.7 var(--cov-body);
  counter-reset: s;
  /* never wider than the page: the 6x6 table scrolls in its own box instead of stretching the panel on phones */
  min-width: 0;
  max-width: 100%;
}

.cov-guide * {
  box-sizing: border-box;
}

/* the site's own element rules (heading colours, image borders) stay out */
.cov-guide h1,
.cov-guide h2,
.cov-guide h3,
.cov-guide p {
  color: inherit;
  background: none;
  border: 0;
  text-shadow: none;
}

.cov-guide img {
  border: 0;
  box-shadow: none;
  max-width: 100%;
  padding: 0;
}

.cov-guide .bible-crumbs,
.cov-guide .bible-sections {
  font-family: var(--font-body);
  line-height: 1.5;
}

.cov-guide section {
  margin-bottom: 72px;
  counter-increment: s;
}

.cov-guide h1,
.cov-guide h2,
.cov-guide h3 {
  text-wrap: balance;
}

.cov-guide p,
.cov-guide .fx,
.cov-guide .case .row span {
  text-wrap: pretty;
}

/* --- title --- */

.cov-guide h1 {
  margin: 16px 0 48px;
  max-width: 960px;
  font: 400 96px/0.95 var(--cov-display);
  text-transform: uppercase;
}

.cov-guide h1 em {
  font-style: normal;
  color: var(--cov-red);
}

.cov-guide .sub {
  margin: -28px 0 44px;
  font: 400 30px/1.3 var(--cov-body);
  color: var(--cov-ink-2);
}

.cov-guide h1 + .sub::after {
  content: "";
  display: block;
  width: 120px;
  height: 12px;
  margin-top: 26px;
  background: var(--cov-red);
}

.cov-guide .scene {
  margin: 0 0 32px;
}

.cov-guide .scene img {
  display: block;
  width: 100%;
  height: auto;
}

.cov-guide .line {
  max-width: 960px;
}

.cov-guide .line p {
  margin: 0;
  font: 400 36px/1.35 var(--cov-body);
  letter-spacing: -0.02em;
}

.cov-guide .line b {
  font-weight: 700;
}

.cov-guide .line .cov {
  color: var(--cov-red);
}

/* --- section headings: "02 Getting a Covenant" --- */

.cov-guide h2 {
  display: flex;
  gap: 24px;
  align-items: center;
  margin: 0 0 26px;
  padding-top: 24px;
  border-top: 1px solid var(--cov-line);
  font: 400 46px/1 var(--cov-display);
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

.cov-guide h2::before {
  content: "0" counter(s);
  font: 400 64px/1 var(--cov-display);
  color: transparent;
  -webkit-text-stroke: 1.5px var(--cov-ink);
}

/* --- getting a Covenant --- */

.cov-guide .source p {
  margin: 0 0 18px;
  max-width: 760px;
  font-size: 22px;
  line-height: 1.85;
}

/* inline (not inline-block): an atomic inline is a line-break opportunity, so a comma after a pill could wrap alone */
.cov-guide .slot {
  display: inline;
  padding: 6px 10px;
  border-radius: 999px;
  font: 700 15px/1 var(--cov-body);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.cov-guide .slot.atk {
  color: var(--cov-atk);
  background: var(--cov-atk-soft);
}

.cov-guide .slot.def {
  color: var(--cov-def);
  background: var(--cov-def-soft);
}

/* --- equipment --- */

.cov-guide .gear {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 40px;
  align-items: start;
}

.cov-guide .side {
  display: grid;
  gap: 28px;
}

.cov-guide .group h3 {
  margin: 0 0 12px;
  font: 700 22px/1.3 var(--cov-body);
  letter-spacing: -0.01em;
}

.cov-guide .group.atk h3 {
  color: var(--cov-atk);
}

.cov-guide .group.def h3 {
  color: var(--cov-def);
}

.cov-guide .items {
  display: grid;
  gap: 10px;
}

.cov-guide .item {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 10px 12px;
  background: var(--cov-card);
  border: 1px solid var(--cov-line-soft);
  border-radius: 10px;
}

.cov-guide .icon {
  position: relative;
  flex: none;
  width: 72px;
  height: 72px;
}

.cov-guide .icon img {
  display: block;
  width: 72px;
  height: 72px;
  border-radius: 3px;
}

.cov-guide .icon .badge {
  position: absolute;
  right: -8px;
  bottom: -8px;
  width: 32px;
  height: 32px;
  padding: 2px;
  background: var(--cov-ink);
  border: 2px solid var(--cov-card);
  border-radius: 50%;
}

.cov-guide .item .name {
  font: 700 21px/1.2 var(--cov-body);
  letter-spacing: -0.01em;
}

.cov-guide .item .kind {
  margin: 4px 0 2px;
  font-size: 15px;
  color: var(--cov-ink-3);
}

.cov-guide .item .kind .slot {
  font-size: 13px;
  padding: 3px 8px;
}

.cov-guide .item .fx {
  font-size: 16px;
  line-height: 1.45;
}

.cov-guide .group.atk .fx b {
  color: var(--cov-atk);
}

.cov-guide .group.def .fx b {
  color: var(--cov-def);
}

/* --- attacking and defending: legend, ring, table --- */

.cov-guide .matchups .body {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}

.cov-guide .rules {
  display: grid;
  gap: 0;
  margin-bottom: 30px;
}

.cov-guide .rule {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--cov-line-soft);
  font-size: 18px;
  color: var(--cov-ink-2);
}

.cov-guide .rule b {
  flex: none;
  width: 130px;
  text-align: left;
  font: 400 50px/1 var(--cov-display);
}

.cov-guide .sw {
  flex: none;
}

/* one colour per multiplier, in the legend and the table (multiplierClass in bible-covenants.ts) */
.cov-guide .m2 {
  color: var(--cov-red);
}

.cov-guide .m15 {
  color: var(--cov-ink);
}

.cov-guide .m1 {
  color: var(--cov-ink-3);
}

.cov-guide .m075 {
  color: var(--cov-muted);
}

.cov-guide .m025 {
  color: var(--cov-weak);
}

/* the drawings' strokes (cov-s-*) and fills (cov-f-*): legend, ring, table corner */
.cov-guide .cov-s-ink {
  stroke: var(--cov-ink);
}

.cov-guide .cov-s-red {
  stroke: var(--cov-red);
}

.cov-guide .cov-s-weak {
  stroke: var(--cov-weak);
}

.cov-guide .cov-s-line {
  stroke: var(--cov-line);
}

.cov-guide .cov-s-bg {
  stroke: var(--cov-bg);
}

.cov-guide .cov-f-ink {
  fill: var(--cov-ink);
}

.cov-guide .cov-f-red {
  fill: var(--cov-red);
}

.cov-guide .cov-f-weak {
  fill: var(--cov-weak);
}

.cov-guide .loop svg {
  display: block;
  width: 100%;
  max-width: 1000px;
  height: auto;
  margin: 0 auto;
}

.cov-guide .cov-ring__label {
  font-family: var(--cov-display);
  text-transform: uppercase;
}

.cov-guide .chart-wrap {
  grid-column: 1 / -1;
  max-width: 100%;
  margin: 40px auto 0;
  overflow-x: auto;
}

.cov-guide .chart-wrap:focus-visible {
  outline: 2px solid var(--cov-ink);
  outline-offset: 2px;
}

.cov-guide .chart {
  border-collapse: collapse;
  margin: 0 auto;
  font: 400 34px/1 var(--cov-display);
}

.cov-guide .chart th,
.cov-guide .chart td {
  width: 104px;
  height: 84px;
  text-align: center;
  border-bottom: 1px solid var(--cov-line-soft);
}

.cov-guide .chart th img {
  display: block;
  width: 58px;
  height: 58px;
  margin: 0 auto;
  padding: 4px;
  background: var(--cov-ink);
  border-radius: 50%;
}

.cov-guide .chart thead th {
  height: 112px;
  border-bottom: 2px solid var(--cov-ink);
}

.cov-guide .chart th .cn {
  display: block;
  margin-top: 6px;
  font: 400 17px/1 var(--cov-display);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.cov-guide .chart tbody th {
  width: 150px;
  text-align: left;
  border-right: 2px solid var(--cov-ink);
}

.cov-guide .chart tbody th img {
  display: inline-block;
  vertical-align: middle;
  margin: 0 10px 0 0;
}

.cov-guide .chart tbody th .cn {
  display: inline;
}

.cov-guide .chart .ax {
  width: 150px;
  padding: 0;
}

.cov-guide .chart .ax-svg {
  display: block;
}

/* --- damage example --- */

.cov-guide .calc {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
}

.cov-guide .calc .case:first-child {
  padding-right: 40px;
}

.cov-guide .calc .case + .case {
  padding-left: 40px;
  border-left: 1px solid var(--cov-line);
}

.cov-guide .calc.bad {
  margin-top: 36px;
  padding-top: 30px;
  border-top: 1px solid var(--cov-line);
}

.cov-guide .case h3 {
  margin: 0 0 10px;
  font: 400 30px/1 var(--cov-display);
  text-transform: uppercase;
}

.cov-guide .case .set {
  margin: 0 0 10px;
  font-size: 19px;
}

.cov-guide .case .set .em {
  width: 40px;
  height: 40px;
  margin: 0 2px;
  padding: 3px;
  vertical-align: middle;
  background: var(--cov-ink);
  border-radius: 50%;
}

.cov-guide .case .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
  font-size: 17px;
  line-height: 1.6;
}

.cov-guide .case .row > b {
  flex: none;
  font: 400 32px/1 var(--cov-display);
}

.cov-guide .case .row.end > b {
  font-size: 48px;
}

.cov-guide .case .row span b {
  font-weight: 700;
}

.cov-guide .case .it.atk {
  color: var(--cov-atk);
}

.cov-guide .case .it.def {
  color: var(--cov-def);
}

.cov-guide .closer {
  height: 12px;
  margin-top: 8px;
  background: var(--cov-red);
}

/*
 * Chinese, Japanese, Korean: Anton has no glyphs there, so the display type falls back to the system font, which
 * looks thin at weight 400. Ask for bold; font-synthesis: none keeps the Latin glyphs (numbers, x1.5) in real Anton
 * instead of a faked bold.
 */
.cov-guide:is(:lang(zh), :lang(ja), :lang(ko)) :is(h1, h2, .case h3, .rule b, .chart, .chart th .cn, .case .row > b, .cov-ring__label) {
  font-weight: 700;
  font-synthesis: none;
}

/* a pseudo-element cannot sit inside :is(), so the section number gets its own rule */
.cov-guide:is(:lang(zh), :lang(ja), :lang(ko)) h2::before {
  font-synthesis: none;
}

.cov-guide:is(:lang(zh), :lang(ja), :lang(ko)) :is(h1, .line p) {
  letter-spacing: 0;
}

/* --- phones --- */

@media (max-width: 720px) {
  .cov-guide {
    font-size: 17px;
  }

  .cov-guide section {
    margin-bottom: 48px;
  }

  .cov-guide h1 {
    margin: 8px 0 32px;
    font-size: 48px;
  }

  .cov-guide .sub {
    margin: -18px 0 28px;
    font-size: 20px;
  }

  .cov-guide h1 + .sub::after {
    width: 80px;
    height: 8px;
    margin-top: 18px;
  }

  .cov-guide .scene {
    margin-bottom: 24px;
  }

  .cov-guide .line p {
    font-size: 24px;
  }

  .cov-guide h2 {
    gap: 14px;
    margin-bottom: 20px;
    padding-top: 18px;
    font-size: 30px;
  }

  .cov-guide h2::before {
    font-size: 40px;
  }

  .cov-guide .source p {
    font-size: 18px;
  }

  .cov-guide .gear {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .cov-guide .item .name {
    font-size: 18px;
  }

  .cov-guide .matchups .body {
    grid-template-columns: minmax(0, 1fr);
  }

  .cov-guide .rules {
    margin-bottom: 8px;
  }

  .cov-guide .rule b {
    width: 100px;
    font-size: 36px;
  }

  .cov-guide .chart-wrap {
    margin-top: 24px;
    width: 100%;
  }

  /* large text (24 px and up), so the lighter multipliers keep their 3:1 contrast */
  .cov-guide .chart {
    font-size: 24px;
  }

  .cov-guide .chart th,
  .cov-guide .chart td {
    width: 76px;
    height: 64px;
  }

  .cov-guide .chart th img {
    width: 40px;
    height: 40px;
    padding: 3px;
  }

  .cov-guide .chart thead th {
    height: 84px;
  }

  .cov-guide .chart th .cn {
    font-size: 13px;
  }

  .cov-guide .chart tbody th,
  .cov-guide .chart .ax {
    width: 112px;
  }

  .cov-guide .chart tbody th img {
    margin-right: 6px;
  }

  .cov-guide .chart .ax-svg {
    width: 112px;
    height: auto;
  }

  .cov-guide .calc {
    grid-template-columns: minmax(0, 1fr);
  }

  .cov-guide .calc .case:first-child {
    padding-right: 0;
  }

  .cov-guide .calc .case + .case {
    margin-top: 24px;
    padding-top: 24px;
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--cov-line);
  }

  .cov-guide .case h3 {
    font-size: 26px;
  }

  .cov-guide .case .row > b {
    font-size: 26px;
  }

  .cov-guide .case .row.end > b {
    font-size: 36px;
  }

  .cov-guide .closer {
    height: 8px;
  }
}
