/*
 * Book of Odds HTML graphics (Core 1.8.0): ranking, steps, comparison and stats cards.
 * Mirrors the PNG card drawn by book-of-odds-core/renderer/graphic.cjs from the same tokens.
 * Colors come only from generated custom properties. Layout reflows by the card's own width
 * (container queries at 560px, and 840px for three-column comparisons), never by viewport.
 * Loaded after article.css, so every rule is scoped under .boo-graphic--html to win over the
 * image-fallback figcaption and hero rules.
 */

/* Card frame. The card is the size container; padding and disc size sit on its children (a container cannot query itself). */
.boo-graphic--html {
  --boo-gfx-pad: 32px;
  --boo-gfx-disc: 40px;
  position: relative;
  container-type: inline-size;
  max-width: 960px;
  margin-inline: auto;
  padding: 0;
  overflow: hidden;
  background: var(--wp--preset--color--white);
  border: 1px solid var(--wp--custom--line);
  border-radius: 12px;
  color: var(--wp--preset--color--navy);
  font-family: var(--wp--preset--font-family--inter);
  font-variant-numeric: tabular-nums;
}
.boo-hero.boo-graphic--html {
  margin: 0 0 24px;
}
.boo-graphic--html::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 12px;
  background: var(--wp--preset--color--blue);
}
.boo-graphic--html * {
  box-sizing: border-box;
}

/* Head */
.boo-graphic--html .boo-graphic__head {
  padding: 44px var(--boo-gfx-pad) 0;
}
.boo-graphic--html .boo-graphic__kicker {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 780;
  line-height: 1.4;
  letter-spacing: 0.12em;
  color: var(--wp--preset--color--blue);
}
.boo-graphic--html .boo-graphic__title {
  margin: 8px 0 0;
  font-size: clamp(24px, 5cqw, 32px);
  font-weight: 780;
  line-height: 1.2;
  letter-spacing: -0.012em;
  color: var(--wp--preset--color--navy);
  overflow-wrap: anywhere;
}
.boo-graphic--html .boo-graphic__subtitle {
  margin: 8px 0 0;
  font-size: 1.125rem;
  line-height: 1.5;
  color: var(--wp--preset--color--muted);
  overflow-wrap: anywhere;
}

/* Body */
.boo-graphic--html .boo-graphic__body {
  padding: 24px var(--boo-gfx-pad) 0;
}

/* Foot (a figcaption: override the image-fallback figcaption and hero figcaption sizing) */
.boo-graphic--html figcaption.boo-graphic__foot,
.boo-hero.boo-graphic--html figcaption.boo-graphic__foot {
  margin: 24px var(--boo-gfx-pad) 0;
  padding: 16px 0 var(--boo-gfx-pad);
  border-top: 1px solid var(--wp--custom--line);
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--wp--preset--color--muted);
}
.boo-graphic--html .boo-graphic__source,
.boo-graphic--html .boo-graphic__note {
  margin: 0 0 4px;
  overflow-wrap: anywhere;
}
.boo-graphic--html .boo-graphic__footrow {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}
.boo-graphic--html .boo-graphic__brand {
  margin: 0;
}
.boo-graphic--html .boo-graphic__brand-name {
  font-weight: 780;
  color: var(--wp--preset--color--navy);
}
.boo-graphic--html .boo-graphic__brand-domain {
  font-weight: 400;
  color: var(--wp--preset--color--muted);
}
.boo-graphic--html .boo-graphic__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}
.boo-graphic--html .boo-graphic__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: inherit;
  text-decoration: underline;
}
.boo-graphic--html .boo-graphic__link + .boo-graphic__link {
  margin-left: 16px;
}
.boo-graphic--html .boo-graphic__link:hover {
  text-decoration-thickness: 2px;
}
.boo-graphic--html .boo-graphic__link:focus-visible {
  outline: 2px solid var(--wp--custom--focus);
  outline-offset: 2px;
}

/* Suffixes for assistive tech only (for example ", highlighted") */
.boo-graphic--html .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Ranking */
.boo-graphic--html .boo-graphic__metric {
  margin: 0 0 8px;
  font-size: 0.875rem;
  font-weight: 780;
  line-height: 1.4;
  text-align: left;
  color: var(--wp--preset--color--muted);
}
.boo-graphic--html .boo-graphic__list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: boo-rank;
}
.boo-graphic--html .boo-graphic__row {
  position: relative;
  display: grid;
  grid-template-columns: 32px 1fr;
  column-gap: 16px;
  align-items: center;
  margin: 0 0 16px;
  padding: 8px 0;
  counter-increment: boo-rank;
}
.boo-graphic--html .boo-graphic__row::before {
  content: counter(boo-rank) / "";
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.125rem;
  font-weight: 780;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--wp--custom--line) 55%, transparent);
  color: var(--wp--preset--color--navy);
}
.boo-graphic--html .boo-graphic__row.is-subject {
  margin-inline: -8px;
  padding-inline: 8px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--wp--preset--color--blue) 7%, transparent);
}
.boo-graphic--html .boo-graphic__row.is-subject::before {
  background: var(--wp--preset--color--blue);
  color: var(--wp--preset--color--white);
}
.boo-graphic--html .boo-graphic__main {
  min-width: 0;
}
.boo-graphic--html .boo-graphic__label {
  font-size: 1.125rem;
  font-weight: 780;
  line-height: 1.5;
  color: var(--wp--preset--color--navy);
  overflow-wrap: anywhere;
}
.boo-graphic--html .boo-graphic__badge {
  display: inline-block;
  margin-left: 8px;
  padding: 4px 8px;
  border: 1px solid var(--wp--preset--color--blue);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 780;
  line-height: 1.4;
  color: var(--wp--preset--color--blue);
}
.boo-graphic--html .is-subject .boo-graphic__badge {
  background: var(--wp--preset--color--blue);
  color: var(--wp--preset--color--white);
}
.boo-graphic--html .boo-graphic__detail {
  display: block;
  margin: 4px 0 0;
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--wp--preset--color--muted);
  overflow-wrap: anywhere;
}
.boo-graphic--html .boo-graphic__bar {
  display: block;
  height: 12px;
  margin-top: 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--wp--custom--line) 50%, transparent);
  overflow: hidden;
}
.boo-graphic--html .boo-graphic__fill {
  display: block;
  height: 100%;
  border-radius: 6px;
  background: var(--wp--custom--chart-neutral);
}
.boo-graphic--html .is-subject .boo-graphic__fill {
  background: var(--wp--preset--color--blue);
}
.boo-graphic--html .boo-graphic__value {
  grid-column: 2;
  margin-top: 4px;
  font-size: 1.125rem;
  font-weight: 780;
  line-height: 1.5;
  text-align: left;
  font-variant-numeric: tabular-nums;
  color: var(--wp--preset--color--navy);
}
.boo-graphic--html .is-subject .boo-graphic__value {
  color: var(--wp--preset--color--blue);
}

/* Steps */
.boo-graphic--html .boo-graphic__steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: boo-step;
}
.boo-graphic--html .boo-graphic__step {
  position: relative;
  display: grid;
  grid-template-columns: var(--boo-gfx-disc) 1fr;
  column-gap: 16px;
  padding-bottom: 16px;
  counter-increment: boo-step;
}
.boo-graphic--html .boo-graphic__step::before {
  content: counter(boo-step) / "";
  grid-row: 1 / span 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--boo-gfx-disc);
  height: var(--boo-gfx-disc);
  border-radius: 50%;
  font-size: 1.125rem;
  font-weight: 780;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: var(--wp--preset--color--blue);
  color: var(--wp--preset--color--white);
}
.boo-graphic--html .boo-graphic__step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: var(--boo-gfx-disc);
  bottom: 0;
  left: calc(var(--boo-gfx-disc) / 2 - 1.5px);
  width: 3px;
  background: var(--wp--custom--line);
}
.boo-graphic--html .boo-graphic__step-title {
  grid-column: 2;
  margin: 0;
  font-size: 1.125rem;
  font-weight: 780;
  line-height: 1.5;
  color: var(--wp--preset--color--navy);
  overflow-wrap: anywhere;
}
.boo-graphic--html .boo-graphic__step .boo-graphic__detail {
  grid-column: 2;
  margin: 4px 0 0;
}

/* Comparison */
.boo-graphic--html .boo-graphic__columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.boo-graphic--html .boo-graphic__col {
  margin: 0;
  border: 1px solid var(--wp--custom--line);
  border-radius: 8px;
  overflow: hidden;
}
.boo-graphic--html .boo-graphic__col-title {
  margin: 0;
  padding: 16px;
  font-size: 1.125rem;
  font-weight: 780;
  line-height: 1.5;
  background: color-mix(in srgb, var(--wp--custom--line) 45%, transparent);
  color: var(--wp--preset--color--navy);
  overflow-wrap: anywhere;
}
.boo-graphic--html .boo-graphic__col.is-highlight .boo-graphic__col-title {
  background: var(--wp--preset--color--blue);
  color: var(--wp--preset--color--white);
}
.boo-graphic--html .boo-graphic__points {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 16px;
  list-style: none;
}
.boo-graphic--html .boo-graphic__points li {
  position: relative;
  padding-left: 16px;
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--wp--preset--color--navy);
  overflow-wrap: anywhere;
}
.boo-graphic--html .boo-graphic__points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--wp--custom--chart-neutral);
}
.boo-graphic--html .boo-graphic__col.is-highlight .boo-graphic__points li::before {
  background: var(--wp--preset--color--blue);
}
.boo-graphic--html .boo-graphic__verdict {
  margin: 24px 0 0;
  padding-left: 16px;
  border-left: 4px solid var(--wp--preset--color--blue);
  font-size: 1.125rem;
  font-weight: 780;
  line-height: 1.5;
  color: var(--wp--preset--color--navy);
  overflow-wrap: anywhere;
}

/* Stats */
.boo-graphic--html .boo-graphic__stats {
  display: grid;
  grid-template-columns: 1fr;
  column-gap: 32px;
  row-gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.boo-graphic--html .boo-graphic__stats--4,
.boo-graphic--html .boo-graphic__stats--5,
.boo-graphic--html .boo-graphic__stats--6 {
  grid-template-columns: repeat(2, 1fr);
}
.boo-graphic--html .boo-graphic__stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding-top: 16px;
  border-top: 1px solid var(--wp--custom--line);
}
.boo-graphic--html .boo-graphic__big {
  font-size: clamp(36px, 10cqw, 56px);
  font-weight: 780;
  line-height: 1.1;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
  color: var(--wp--preset--color--blue);
}
.boo-graphic--html .boo-graphic__stat-label {
  font-size: 1.125rem;
  font-weight: 780;
  line-height: 1.5;
  color: var(--wp--preset--color--navy);
  overflow-wrap: anywhere;
}
.boo-graphic--html .boo-graphic__stat .boo-graphic__detail {
  margin: 0;
}

/* Card 560px and wider */
@container (min-width: 560px) {
  .boo-graphic--html > * {
    --boo-gfx-pad: 32px;
    --boo-gfx-disc: 40px;
  }
  .boo-graphic--html .boo-graphic__head {
    padding-top: 44px;
  }
  .boo-graphic--html .boo-graphic__metric {
    text-align: right;
  }
  .boo-graphic--html .boo-graphic__row {
    grid-template-columns: 40px 1fr auto;
  }
  .boo-graphic--html .boo-graphic__row::before {
    width: 40px;
    height: 40px;
  }
  .boo-graphic--html .boo-graphic__value {
    grid-column: auto;
    margin-top: 0;
    text-align: right;
  }
  .boo-graphic--html .boo-graphic__columns--2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .boo-graphic--html .boo-graphic__stats--2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .boo-graphic--html .boo-graphic__stats--3,
  .boo-graphic--html .boo-graphic__stats--5,
  .boo-graphic--html .boo-graphic__stats--6 {
    grid-template-columns: repeat(3, 1fr);
  }
  .boo-graphic--html .boo-graphic__stats--4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Three-column comparisons need 840px */
@container (min-width: 840px) {
  .boo-graphic--html .boo-graphic__columns--3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Card under 560px: tighter padding, thinner strip, smaller discs, stacked footer */
@container (max-width: 559.98px) {
  .boo-graphic--html > * {
    --boo-gfx-pad: 24px;
    --boo-gfx-disc: 32px;
  }
  .boo-graphic--html::before {
    height: 8px;
  }
  .boo-graphic--html .boo-graphic__head {
    padding-top: 32px;
  }
  .boo-graphic--html .boo-graphic__footrow {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }
}
