/* Long-form guide primitives built on the shared field-manual tokens.
   Load after styles.css on guide, character, and availability-status pages. */

.guide-page {
  padding-bottom: 72px;
}

.guide-hero {
  position: relative;
  overflow: hidden;
  border-bottom: 2px solid var(--ink);
  background:
    linear-gradient(90deg, rgba(97, 211, 165, .18), transparent 44%),
    var(--paper-deep);
}

.guide-hero::after {
  position: absolute;
  right: max(24px, calc((100vw - var(--container)) / 2 + 24px));
  bottom: -28px;
  width: 124px;
  height: 82px;
  border: 2px solid rgba(46, 39, 55, .16);
  background:
    linear-gradient(135deg, transparent 47%, rgba(46, 39, 55, .12) 48% 52%, transparent 53%),
    linear-gradient(45deg, transparent 47%, rgba(46, 39, 55, .12) 48% 52%, transparent 53%);
  background-size: 24px 24px;
  content: "";
  transform: rotate(-3deg);
}

.guide-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 850px;
  padding-top: 46px;
  padding-bottom: 42px;
}

.guide-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  margin: 0 0 18px;
  color: var(--ink-soft);
  font: 600 .75rem/1.3 var(--font-data);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.guide-breadcrumbs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--dusk-deep);
}

.guide-breadcrumbs span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guide-hero h1 {
  max-width: 20ch;
  margin: 0;
  color: var(--ink);
  font: 700 clamp(2.25rem, 5vw, 4.4rem)/.96 var(--font-display);
  letter-spacing: -.025em;
  overflow-wrap: break-word;
}

.guide-lede {
  max-width: 65ch;
  margin: 18px 0 0;
  color: var(--ink-soft);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.55;
}

.guide-byline {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 16px;
  margin: 22px 0 0;
  color: var(--ink-soft);
  font: 500 .78rem/1.4 var(--font-data);
}

.guide-byline span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
}

.guide-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 278px;
  gap: clamp(30px, 5vw, 64px);
  align-items: start;
  padding-top: 32px;
}

.guide-article,
.guide-sidebar {
  min-width: 0;
}

.guide-article {
  max-width: 76ch;
}

.guide-article > *:first-child {
  margin-top: 0;
}

.guide-article h2,
.guide-article h3 {
  scroll-margin-top: 84px;
  color: var(--ink);
  font-family: var(--font-display);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.guide-article h2 {
  margin: 44px 0 14px;
  padding-bottom: 9px;
  border-bottom: 2px solid var(--ink);
  font-size: clamp(1.55rem, 3vw, 2.15rem);
}

.guide-article h3 {
  margin: 28px 0 10px;
  font-size: clamp(1.15rem, 2vw, 1.4rem);
}

.guide-article p,
.guide-article li,
.guide-article dd {
  overflow-wrap: anywhere;
}

.guide-article p {
  margin: 12px 0;
  line-height: 1.72;
}

.guide-article a:not(.btn) {
  font-weight: 700;
}

/* Answer-first summary for the player who is checking something mid-session. */
.guide-quick-answer {
  position: relative;
  margin: 0 0 30px;
  padding: 20px 22px 20px 26px;
  border: 2px solid var(--ink);
  background: var(--card);
  box-shadow: var(--shadow);
}

.guide-quick-answer::before {
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: -2px;
  width: 8px;
  background: var(--mint);
  content: "";
}

.guide-quick-answer-label {
  margin: 0 0 7px;
  color: var(--moss-deep);
  font: 700 .75rem/1.2 var(--font-data);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.guide-quick-answer p {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.6;
}

.guide-quick-answer p + p {
  margin-top: 9px;
}

/* Sticky contents block doubles as a compact field-manual index. */
.guide-toc {
  position: sticky;
  top: 82px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--dusk-deep);
  background: var(--card);
  box-shadow: 3px 4px 0 rgba(46, 39, 55, .09);
}

.guide-toc-title {
  margin: 0;
  padding: 14px 16px 8px;
  color: var(--ink-soft);
  font: 700 .74rem/1.2 var(--font-data);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.guide-toc ol,
.guide-toc ul {
  margin: 0;
  padding: 0 8px 10px;
  list-style: none;
}

.guide-toc a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 8px;
  border-top: 1px dashed var(--line);
  color: var(--ink);
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.guide-toc a:hover {
  background: var(--paper-deep);
  color: var(--dusk-deep);
}

/* Fact tables remain readable as stacked key/value rows on narrow screens. */
.guide-fact-table {
  width: 100%;
  margin: 20px 0 30px;
  border: 2px solid var(--ink);
  border-collapse: collapse;
  background: var(--card);
  table-layout: fixed;
}

.guide-fact-table caption {
  padding: 0 0 8px;
  color: var(--ink-soft);
  font: 600 .78rem/1.4 var(--font-data);
  text-align: left;
}

.guide-fact-table th,
.guide-fact-table td {
  padding: 11px 13px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.guide-fact-table th {
  width: 31%;
  background: var(--paper-deep);
  color: var(--ink-soft);
  font: 700 .75rem/1.4 var(--font-data);
  letter-spacing: .03em;
  text-transform: uppercase;
}

.guide-fact-table tr:last-child > * {
  border-bottom: 0;
}

.guide-fact-table tr > *:last-child {
  border-right: 0;
}

.guide-comparison-table th:first-child {
  width: 22%;
}

.guide-comparison-table th:not(:first-child),
.guide-comparison-table td {
  width: 39%;
}

.guide-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 20px 0 30px;
  border: 2px solid var(--ink);
  background: var(--card);
}

.guide-facts > div {
  min-width: 0;
  padding: 13px 15px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.guide-facts dt {
  color: var(--ink-soft);
  font: 700 .72rem/1.3 var(--font-data);
  letter-spacing: .05em;
  text-transform: uppercase;
}

.guide-facts dd {
  margin: 4px 0 0;
  font-weight: 700;
}

/* Ordered instructions use a real counter so the visual order matches the task. */
.guide-steps {
  margin: 22px 0 30px;
  padding: 0;
  list-style: none;
  counter-reset: guide-step;
}

.guide-steps > li {
  position: relative;
  min-height: 58px;
  padding: 0 0 24px 64px;
  counter-increment: guide-step;
}

.guide-steps > li::before {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 2px solid var(--ink);
  background: var(--gold);
  box-shadow: 2px 2px 0 var(--ink);
  content: counter(guide-step, decimal-leading-zero);
  font: 700 .8rem/1 var(--font-data);
}

.guide-steps > li:not(:last-child)::after {
  position: absolute;
  top: 46px;
  bottom: 2px;
  left: 21px;
  border-left: 2px dashed var(--line);
  content: "";
}

.guide-step-title {
  display: block;
  margin-bottom: 4px;
  font-family: var(--font-display);
  font-size: 1.08rem;
  line-height: 1.2;
}

.guide-steps p {
  margin: 0;
}

.guide-version-warning {
  margin: 24px 0;
  padding: 17px 18px;
  border: 2px solid var(--peach-deep);
  background:
    repeating-linear-gradient(-45deg, rgba(224, 170, 62, .12) 0 8px, transparent 8px 16px),
    var(--card);
}

.guide-version-warning strong {
  display: block;
  margin-bottom: 5px;
  color: var(--peach-deep);
  font: 700 .9rem/1.25 var(--font-display);
}

.guide-version-warning p {
  margin: 0;
}

.guide-source-list {
  margin: 20px 0 30px;
  padding: 0;
  border-top: 2px solid var(--ink);
  list-style: none;
}

.guide-source-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.guide-source-list a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  overflow-wrap: anywhere;
}

.guide-source-list small {
  color: var(--ink-soft);
  font: 500 .72rem/1.35 var(--font-data);
  text-align: right;
}

.guide-related {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 2px solid var(--ink);
}

.guide-related h2 {
  margin: 0 0 16px;
  border: 0;
  padding: 0;
}

.guide-related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.guide-related-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 132px;
  padding: 16px;
  border: 1px solid var(--ink);
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
}

.guide-related-card:hover {
  border-color: var(--moss-deep);
  background: var(--paper-deep);
  color: var(--ink);
}

.guide-related-card strong {
  font-family: var(--font-display);
  font-size: 1.02rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.guide-related-card span {
  margin-top: 7px;
  color: var(--ink-soft);
  font-size: .88rem;
  line-height: 1.4;
}

.guide-related-card b {
  margin-top: auto;
  padding-top: 12px;
  color: var(--dusk-deep);
  font: 700 .75rem/1 var(--font-data);
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* Character pages: portrait identity plus scan-friendly gift reactions. */
.guide-character-summary {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  margin: 20px 0 30px;
  padding: 18px;
  border: 2px solid var(--ink);
  background: var(--card);
}

.guide-character-avatar,
.guide-character-avatar-fallback {
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  margin: 0;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--paper-deep);
  box-shadow: 3px 3px 0 rgba(46, 39, 55, .16);
  object-fit: contain;
  image-rendering: pixelated;
}

.guide-character-avatar-fallback {
  color: var(--moss-deep);
  font: 700 2rem/1 var(--font-display);
}

.guide-character-summary h2 {
  margin: 0 0 7px;
  border: 0;
  padding: 0;
}

.guide-character-summary p {
  margin: 0;
  color: var(--ink-soft);
}

.guide-gift-group {
  margin: 20px 0;
}

.guide-gift-group h3 {
  margin-bottom: 9px;
}

.guide-gift-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-gift-tag {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  max-width: 100%;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-deep);
  color: var(--ink);
  font-size: .84rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

a.guide-gift-tag {
  min-height: 44px;
  color: var(--dusk-deep);
  text-decoration-thickness: .08em;
}

.guide-gift-tag[data-reaction="loved"] {
  border-color: var(--rose);
  background: rgba(185, 91, 85, .11);
  color: #82403c;
}

.guide-gift-tag[data-reaction="liked"] {
  border-color: var(--moss-deep);
  background: rgba(97, 211, 165, .14);
  color: var(--moss-deep);
}

.guide-gift-tag[data-reaction="disliked"],
.guide-gift-tag[data-reaction="hated"] {
  color: var(--ink-soft);
}

@media (max-width: 880px) {
  .guide-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .guide-sidebar {
    order: -1;
  }

  .guide-toc {
    position: static;
  }

  .guide-toc ol,
  .guide-toc ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .guide-toc li:nth-child(2) a {
    border-top-color: var(--line);
  }

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

@media (max-width: 560px) {
  .guide-page {
    padding-bottom: 40px;
  }

  .guide-hero-inner {
    padding-top: 30px;
    padding-bottom: 28px;
  }

  .guide-hero::after {
    right: -28px;
    opacity: .65;
  }

  .guide-hero h1 {
    font-size: clamp(2rem, 10.5vw, 2.65rem);
  }

  .guide-layout {
    gap: 24px;
    padding-top: 20px;
  }

  .guide-toc ol,
  .guide-toc ul,
  .guide-related-grid,
  .guide-facts {
    grid-template-columns: minmax(0, 1fr);
  }

  .guide-fact-table,
  .guide-fact-table tbody,
  .guide-fact-table tr,
  .guide-fact-table th,
  .guide-fact-table td {
    display: block;
    width: 100%;
  }

  .guide-fact-table caption {
    display: block;
    width: 100%;
  }

  .guide-fact-table {
    border-bottom: 0;
  }

  .guide-fact-table tr {
    border-bottom: 2px solid var(--ink);
  }

  .guide-fact-table th,
  .guide-fact-table td {
    border-right: 0;
  }

  .guide-fact-table th {
    border-bottom-style: dashed;
  }

  .guide-fact-table td {
    border-bottom: 0;
  }

  .guide-comparison-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }

  .guide-comparison-table th:first-child,
  .guide-comparison-table th:not(:first-child),
  .guide-comparison-table td {
    width: 100%;
  }

  .guide-comparison-table th[scope="row"] {
    padding-top: 14px;
    background: var(--ink);
    color: var(--paper);
    font-size: .82rem;
  }

  .guide-comparison-table td[data-label]::before {
    display: block;
    margin-bottom: 4px;
    color: var(--ink-soft);
    content: attr(data-label);
    font: 700 .7rem/1.3 var(--font-data);
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  .guide-source-list li {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .guide-source-list small {
    text-align: left;
  }

  .guide-character-summary {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 14px;
    padding: 14px;
  }

  .guide-character-avatar,
  .guide-character-avatar-fallback {
    width: 72px;
    height: 72px;
  }

  .guide-quick-answer {
    padding: 17px 16px 17px 20px;
    box-shadow: 2px 2px 0 rgba(46, 39, 55, .18);
  }
}

@media (prefers-reduced-motion: reduce) {
  .guide-toc {
    scroll-behavior: auto;
  }
}
