.characters-page {
  --loyal: #2f7775;
  --loyal-light: #b9d9d0;
  --complex: #c3913f;
  --complex-light: #f0d69c;
  --danger: #b9553d;
  --danger-light: #ecc0ae;
}

.character-page-label {
  margin: 0;
  color: rgba(255, 253, 247, 0.7);
  font-size: 0.72rem;
  font-weight: 760;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}

.guide-hero {
  min-height: calc(100svh - 68px);
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(480px, 1.1fr);
  gap: clamp(48px, 7vw, 98px);
  align-items: center;
  padding-block: clamp(62px, 9vw, 116px);
}

.guide-hero h1 {
  max-width: 9ch;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(4.5rem, 9vw, 8.8rem);
  font-weight: 520;
  letter-spacing: -0.07em;
  line-height: 0.82;
}

.guide-hero h1::after {
  content: "";
  display: block;
  width: 82px;
  height: 5px;
  margin-top: 32px;
  background: linear-gradient(90deg, var(--loyal) 0 33%, var(--complex) 33% 66%, var(--danger) 66%);
}

.guide-lead {
  max-width: 58ch;
  margin: 28px 0 0;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: clamp(1.16rem, 2vw, 1.44rem);
  line-height: 1.62;
}

.guide-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}

.hero-cast {
  position: relative;
  height: 650px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  align-items: center;
}

.hero-cast::before {
  content: "";
  position: absolute;
  inset: 9% 5%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(47, 119, 117, 0.22), rgba(195, 145, 63, 0.1) 48%, transparent 70%);
  filter: blur(14px);
}

.hero-person {
  position: relative;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(16, 43, 42, 0.18);
  border-radius: 110px 110px 12px 12px;
  background: var(--sea-dark);
  box-shadow: 0 24px 64px rgba(22, 47, 43, 0.15);
}

.hero-person-billy {
  transform: translateY(-34px);
}

.hero-person-silver {
  transform: translateY(34px);
}

.hero-person img {
  width: 100%;
  height: 480px;
  object-fit: cover;
  object-position: center 18%;
}

.hero-person figcaption {
  min-height: 82px;
  display: grid;
  align-content: center;
  padding: 14px 17px 18px;
  background: var(--sea-dark);
  color: var(--white);
}

.hero-person strong,
.hero-person span {
  display: block;
}

.hero-person strong {
  font-family: var(--serif);
  font-size: 1.2rem;
}

.hero-person span {
  margin-top: 2px;
  color: rgba(255, 253, 247, 0.58);
  font-size: 0.67rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.trust-overview {
  padding-block: 86px 110px;
}

.guide-heading h2,
.billy-explainer h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.8rem, 5.5vw, 5.4rem);
  font-weight: 520;
  letter-spacing: -0.05em;
  line-height: 0.94;
}

.compact-heading {
  margin-bottom: 30px;
}

.trust-scale {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.trust-summary {
  position: relative;
  min-height: 310px;
  padding: 30px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper-light);
  box-shadow: 0 16px 40px rgba(16, 43, 42, 0.08);
}

.trust-summary::after {
  content: "";
  position: absolute;
  right: -54px;
  bottom: -74px;
  width: 190px;
  height: 190px;
  border: 44px solid var(--summary-color);
  border-radius: 50%;
  opacity: 0.09;
}

.trust-summary-loyal { --summary-color: var(--loyal); }
.trust-summary-complex { --summary-color: var(--complex); }
.trust-summary-danger { --summary-color: var(--danger); }

.summary-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--summary-color);
  color: var(--white);
  font-family: var(--serif);
}

.summary-label {
  margin: 50px 0 7px;
  color: var(--summary-color);
  font-size: 0.68rem;
  font-weight: 820;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.trust-summary h3 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 560;
}

.trust-summary > p:last-child {
  max-width: 38ch;
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.65;
}

.relationship-section {
  padding-block: 100px;
  background: var(--sea-dark);
  color: var(--white);
}

.relationship-heading,
.profiles-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.55fr);
  gap: 56px;
  align-items: end;
}

.relationship-heading {
  margin-bottom: 26px;
}

.relationship-heading .eyebrow {
  color: #efd397;
}

.relationship-heading h2 {
  max-width: 12ch;
}

.relationship-heading > p,
.profiles-heading > p {
  margin: 0;
  color: rgba(255, 253, 247, 0.66);
  line-height: 1.7;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-bottom: 18px;
  color: rgba(255, 253, 247, 0.68);
  font-size: 0.72rem;
}

.map-legend span {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.legend-line {
  width: 28px;
  border-top: 2px solid;
}

.legend-old { border-color: var(--danger); }
.legend-loyal { border-color: var(--sea-light); }
.legend-mixed { border-color: #efd397; border-top-style: dashed; }

.relationship-scroll {
  overflow-x: auto;
  border: 1px solid rgba(255, 253, 247, 0.1);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 12%, rgba(195, 145, 63, 0.16), transparent 25%),
    linear-gradient(rgba(255, 253, 247, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 253, 247, 0.035) 1px, transparent 1px),
    #08262b;
  background-size: auto, 34px 34px, 34px 34px, auto;
  scrollbar-color: rgba(239, 211, 151, 0.65) transparent;
}

.relationship-board {
  position: relative;
  min-width: 1080px;
  height: 680px;
}

.relationship-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.relationship-lines path {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0.72;
}

.line-old { stroke: var(--danger); }
.line-loyal { stroke: var(--sea-light); }
.line-mixed { stroke: #efd397; stroke-dasharray: 7 7; }
.line-secondary { opacity: 0.28 !important; }

.relation-node {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 2;
  width: 126px;
  display: grid;
  justify-items: center;
  color: var(--white);
  text-align: center;
  text-decoration: none;
  transform: translate(-50%, -50%);
}

.relation-node img {
  width: 76px;
  height: 76px;
  margin-bottom: 8px;
  object-fit: cover;
  object-position: center 18%;
  border: 3px solid var(--node-color);
  border-radius: 50%;
  box-shadow: 0 0 0 7px rgba(8, 38, 43, 0.88), 0 10px 24px rgba(0, 0, 0, 0.26);
  transition: transform 170ms ease;
}

.relation-node:hover img {
  transform: scale(1.08);
}

.node-loyal { --node-color: var(--sea-light); }
.node-complex { --node-color: #efd397; }
.node-danger { --node-color: #da8067; }

.relation-node strong,
.relation-node small {
  display: block;
  padding-inline: 6px;
  background: rgba(8, 38, 43, 0.86);
}

.relation-node strong {
  font-family: var(--serif);
  font-size: 0.95rem;
}

.relation-node small {
  margin-top: 2px;
  color: rgba(255, 253, 247, 0.54);
  font-size: 0.62rem;
}

.relation-tag {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 1;
  padding: 4px 7px;
  border: 1px solid rgba(185, 85, 61, 0.3);
  border-radius: 99px;
  background: rgba(8, 38, 43, 0.9);
  color: #eaa48f;
  font-size: 0.57rem;
  font-weight: 760;
  letter-spacing: 0.04em;
  transform: translate(-50%, -50%);
}

.relation-tag.tag-loyal {
  border-color: rgba(151, 200, 189, 0.3);
  color: #b9ded4;
}

.relation-tag.tag-mixed {
  border-color: rgba(239, 211, 151, 0.3);
  color: #efd397;
}

.billy-explainer {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: clamp(36px, 7vw, 88px);
  align-items: center;
  margin-block: 110px;
  padding: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--paper-light);
  box-shadow: var(--shadow);
}

.billy-photo {
  height: 380px;
  overflow: hidden;
  border-radius: 130px 130px 10px 10px;
  background: var(--sea-dark);
}

.billy-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
}

.billy-explainer > div:last-child > p:not(.eyebrow) {
  max-width: 760px;
  color: var(--ink-soft);
  font-size: 1.04rem;
  line-height: 1.72;
}

.billy-explainer strong {
  color: var(--danger);
  font-family: var(--serif);
  font-size: 1.25em;
}

.source-boundary {
  margin-bottom: 0;
  padding: 16px 18px;
  border-left: 4px solid var(--complex);
  background: rgba(195, 145, 63, 0.09);
}

.profiles-section {
  padding-block: 30px 110px;
}

.profiles-heading {
  margin-bottom: 74px;
}

.profiles-heading > p {
  color: var(--ink-soft);
}

.profile-group + .profile-group {
  margin-top: 104px;
}

.profile-category-heading {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  margin-bottom: 24px;
}

.category-number {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--loyal);
  color: var(--white);
  font-family: var(--serif);
}

.complex-heading .category-number { background: var(--complex); }
.danger-heading .category-number { background: var(--danger); }

.profile-category-heading p {
  margin: 0 0 3px;
  color: var(--ink-soft);
  font-size: 0.65rem;
  font-weight: 820;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.profile-category-heading h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.9rem, 3.4vw, 3rem);
  font-weight: 560;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.profile-grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 5px solid var(--card-color);
  border-radius: 14px;
  background: var(--paper-light);
  box-shadow: 0 14px 40px rgba(16, 43, 42, 0.08);
}

.loyal-card { --card-color: var(--loyal); }
.complex-card { --card-color: var(--complex); }
.danger-card { --card-color: var(--danger); }

.profile-card > img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  object-position: center 17%;
  border-bottom: 1px solid var(--line);
}

/* Silver's portrait is full-length with his face at the very top of the
   frame, so the shared 17% crop cuts his head off on wide cards. Anchoring
   his crop to the top keeps the face and the crutch in view at every size. */
#long-john-silver > img {
  object-position: center top;
}

.profile-copy {
  min-height: 300px;
  padding: 23px 24px 28px;
}

.status {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--card-color) 12%, transparent);
  color: var(--card-color);
  font-size: 0.65rem;
  font-weight: 820;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.card-role {
  margin: 22px 0 5px;
  color: var(--ink-soft);
  font-size: 0.67rem;
  font-weight: 760;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.profile-copy h4 {
  margin: 0 0 13px;
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 560;
  letter-spacing: -0.025em;
}

.profile-copy > p:last-of-type {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.68;
}

.inference-note {
  display: block;
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.72rem;
  line-height: 1.5;
}

.guide-conclusion {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 44px;
  align-items: start;
  margin-bottom: 110px;
  padding: 35px 38px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.guide-conclusion .eyebrow {
  margin-top: 8px;
}

.guide-conclusion > p:last-child {
  max-width: 880px;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2.4vw, 2.05rem);
  line-height: 1.42;
}

@media (max-width: 980px) {
  .character-page-label {
    display: none;
  }

  .guide-hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .hero-cast {
    height: 560px;
  }

  .hero-person img {
    height: 400px;
  }

  .trust-scale,
  .profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trust-summary-danger {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .guide-hero {
    gap: 62px;
  }

  .guide-hero h1 {
    font-size: clamp(4rem, 18vw, 6rem);
  }

  .hero-cast {
    height: 470px;
    gap: 7px;
  }

  .hero-person {
    border-radius: 76px 76px 9px 9px;
  }

  .hero-person img {
    height: 330px;
  }

  .hero-person figcaption {
    min-height: 72px;
    padding: 11px 10px 14px;
  }

  .hero-person strong {
    font-size: 0.94rem;
  }

  .hero-person span {
    font-size: 0.54rem;
  }

  .relationship-heading,
  .profiles-heading,
  .guide-conclusion {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .relationship-scroll {
    margin-right: -12px;
    border-radius: 14px 0 0 14px;
  }

  .billy-explainer {
    grid-template-columns: 1fr;
    padding: 24px;
  }

  .billy-photo {
    height: 340px;
  }
}

/* The relationship graph needs ~1080px of width, so below 700px it is
   replaced by .relation-list — a vertical, grouped list that characters.js
   builds by cloning the (already localized) board nodes and tags. Exactly one
   of the two is ever visible. */
.relation-list {
  display: none;
}

@media (max-width: 700px) {
  .relationship-scroll,
  .map-legend {
    display: none;
  }

  .relation-list {
    display: grid;
    gap: 24px;
    padding: 20px 14px 22px;
    border: 1px solid rgba(255, 253, 247, 0.1);
    border-radius: 16px;
    background:
      radial-gradient(circle at 50% 8%, rgba(195, 145, 63, 0.14), transparent 30%),
      linear-gradient(rgba(255, 253, 247, 0.035) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255, 253, 247, 0.035) 1px, transparent 1px),
      #08262b;
    background-size: auto, 34px 34px, 34px 34px, auto;
  }

  .relation-list-group {
    display: grid;
    gap: 8px;
  }

  .relation-list-group h3 {
    display: flex;
    gap: 9px;
    align-items: center;
    margin: 0 0 3px;
    color: rgba(255, 253, 247, 0.68);
    font-size: 0.72rem;
    font-weight: 700;
  }

  .relation-list-group .legend-line {
    flex: 0 0 auto;
  }

  .relation-row {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 253, 247, 0.1);
    border-radius: 12px;
    background: rgba(255, 253, 247, 0.05);
    color: var(--white);
    text-decoration: none;
  }

  .relation-row-thumbs {
    display: flex;
    flex: 0 0 auto;
  }

  .relation-row-thumbs img {
    width: 42px;
    height: 42px;
    object-fit: cover;
    object-position: center 18%;
    border: 2px solid #efd397;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(8, 38, 43, 0.9);
  }

  .relation-row-thumbs img + img {
    margin-inline-start: -11px;
  }

  .relation-row-copy {
    display: grid;
    gap: 5px;
    min-width: 0;
  }

  .relation-row-names {
    font-family: var(--serif);
    font-size: 0.95rem;
    line-height: 1.3;
  }

  .relation-row-tag {
    justify-self: start;
    padding: 3px 9px;
    border: 1px solid rgba(185, 85, 61, 0.35);
    border-radius: 99px;
    background: rgba(8, 38, 43, 0.9);
    color: #eaa48f;
    font-size: 0.62rem;
    font-weight: 760;
  }

  .relation-group-loyal .relation-row-tag {
    border-color: rgba(151, 200, 189, 0.35);
    color: #b9ded4;
  }

  .relation-group-mixed .relation-row-tag {
    border-color: rgba(239, 211, 151, 0.35);
    color: #efd397;
  }
}

@media (max-width: 620px) {
  .guide-hero {
    padding-block: 58px 82px;
  }

  .guide-actions {
    display: grid;
  }

  .hero-cast {
    height: 390px;
  }

  .hero-person-billy { transform: translateY(-20px); }
  .hero-person-silver { transform: translateY(20px); }

  .hero-person img {
    height: 270px;
  }

  .trust-overview,
  .relationship-section {
    padding-block: 72px;
  }

  .trust-scale,
  .profile-grid,
  .profile-grid-two {
    grid-template-columns: 1fr;
  }

  .trust-summary-danger {
    grid-column: auto;
  }

  .trust-summary {
    min-height: 280px;
  }

  .billy-explainer {
    margin-block: 72px;
  }

  .profile-group + .profile-group {
    margin-top: 74px;
  }

  .profile-category-heading {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 14px;
  }

  .category-number {
    width: 52px;
    height: 52px;
  }

  .profile-card > img {
    height: 360px;
  }

  .profile-copy {
    min-height: auto;
  }

  .guide-conclusion {
    margin-bottom: 72px;
    padding: 28px 14px;
  }
}
