/* Every public page uses the same content column; inner prose keeps its reading limits. */
html:not(.raid-map-embedded) body[data-fieldguide-page] .shell > main#main {
  width: 100%;
  max-width: none;
  min-width: 0;
}

/* Real headings share one grid cell with the decorative plate, without covering tools. */
body[data-fieldguide-page] .fieldguide-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0 0 1.5rem;
}

/* This sizing plate gives the artwork a wide proportion, but a taller title can grow it. */
body[data-fieldguide-page] .fieldguide-hero::before {
  content: '';
  grid-area: 1 / 1;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  aspect-ratio: 5 / 1;
  min-height: 12rem;
  pointer-events: none;
}

body[data-fieldguide-page] .fieldguide-panorama {
  grid-area: 1 / 1;
  align-self: stretch;
  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border-block: 1px solid #b395605c;
  background: #202729;
  overflow: hidden;
}

body[data-fieldguide-page] .fieldguide-panorama > img {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  aspect-ratio: auto;
  object-fit: cover;
  object-position: var(--panorama-position, center 50%);
  border: 0;
  border-radius: 0;
  mask-image: none;
}

/* Fine corner marks sit inside the artwork, so narrow screens never gain overflow. */
body[data-fieldguide-page] .fieldguide-panorama::before,
body[data-fieldguide-page] .fieldguide-panorama::after {
  content: '';
  position: absolute;
  z-index: 1;
  width: 1.5rem;
  height: 1.5rem;
  pointer-events: none;
  opacity: .7;
}

body[data-fieldguide-page] .fieldguide-panorama::before {
  top: .5rem;
  left: .5rem;
  border-top: 1px solid #e7ce96;
  border-left: 1px solid #e7ce96;
}

body[data-fieldguide-page] .fieldguide-panorama::after {
  right: .5rem;
  bottom: .5rem;
  border-right: 1px solid #e7ce96;
  border-bottom: 1px solid #e7ce96;
}

body[data-fieldguide-page] .fieldguide-panorama > figcaption {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Text rests directly on the artwork; only the lettering receives a light shadow. */
body[data-fieldguide-page] #main .fieldguide-hero > :is(.page-heading, .map-page-heading, .evolving-head) {
  grid-area: 1 / 1;
  align-self: stretch;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  margin: 0;
  border: 0;
  background: none;
  text-shadow: 0 1px 2px #000, 0 2px 7px #000c;
  grid-template-columns: none;
}

body[data-fieldguide-page] #main .fieldguide-hero > :is(.page-heading, .map-page-heading, .evolving-head)::after {
  content: none;
}

body[data-fieldguide-page] #main .fieldguide-hero-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: .75rem 1.5rem;
  width: 100%;
  min-width: 0;
}

body[data-fieldguide-page] #main .fieldguide-hero-footer > div:first-child {
  min-width: 0;
  flex: 1 1 22rem;
}

body[data-fieldguide-page] #main .fieldguide-hero > :is(.page-heading, .map-page-heading, .evolving-head) h1 {
  max-width: 30ch;
  margin: 0;
  font-size: clamp(2rem, 3.1vw, 2.85rem);
  line-height: 1.14;
  letter-spacing: -.025em;
  text-wrap: balance;
  overflow-wrap: break-word;
  color: #f5e4bf;
}

body[data-fieldguide-page] #main .fieldguide-hero > :is(.page-heading, .map-page-heading, .evolving-head) .eyebrow {
  margin: 0 0 .45rem;
  color: #e3cca3;
  font-size: .72rem;
  line-height: 1.5;
  letter-spacing: .1em;
}

body[data-fieldguide-page] #main .fieldguide-hero > :is(.page-heading, .map-page-heading, .evolving-head) p:not(.eyebrow) {
  max-width: 70ch;
  margin: .55rem 0 0;
  color: #f0eadb;
  font-size: .94rem;
  line-height: 1.65;
}

body[data-fieldguide-page] #main .fieldguide-hero-footer > :is(a, button, .page-actions, .raid-backlinks, .guide-date) {
  max-width: 100%;
  white-space: normal;
  color: #f1ddb3;
}

body[data-fieldguide-page] #main .fieldguide-hero > :is(.page-heading, .map-page-heading, .evolving-head) :is(.page-actions, .raid-backlinks) {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  line-height: 1.55;
}

body[data-fieldguide-page] #main .fieldguide-hero > :is(.page-heading, .map-page-heading, .evolving-head) a {
  color: #f1ddb3;
}

body[data-fieldguide-page] #main .fieldguide-hero > :is(.page-heading, .map-page-heading, .evolving-head) button.secondary {
  background: #132125dc;
  border-color: #c0a374;
  color: #f1ddb3;
}

body[data-fieldguide-page] #main .fieldguide-hero > :is(.page-heading, .map-page-heading, .evolving-head) :is(a, button):focus-visible {
  outline: 2px solid #e1cff6;
  outline-offset: 4px;
}

/* Supporting directories read as open chapter indexes rather than boxed menus. */
body[data-fieldguide-page="index"] .overview-paths,
body[data-fieldguide-page="mapping"] .guide-index,
body[data-fieldguide-page="discord"] .guild-news-actions {
  gap: .65rem 1.35rem;
  line-height: 1.65;
}

body[data-fieldguide-page="resources"] .directory-topic .resource-card p,
body[data-fieldguide-page="watch"] .reference-list .resource-card p,
body[data-fieldguide-page="library"] .shared-file p {
  max-width: 66ch;
  line-height: 1.7;
}

body[data-fieldguide-page="legal"] .legal-section > p,
body[data-fieldguide-page="mapping"] .mapping-section > p {
  max-width: 76ch;
}

body[data-fieldguide-page="tradeskills"] .ts-heading-mark {
  display: none;
}

/* A raid encounter's embedded map stays entirely map-focused. */
html.raid-map-embedded .fieldguide-hero,
html.raid-map-embedded .fieldguide-panorama {
  display: none !important;
}

@media (max-width: 760px) {
  body[data-fieldguide-page] .fieldguide-hero {
    margin-bottom: 1.1rem;
  }

  body[data-fieldguide-page] .fieldguide-hero::before {
    aspect-ratio: 4 / 1;
    min-height: 11rem;
  }

  body[data-fieldguide-page] #main .fieldguide-hero > :is(.page-heading, .map-page-heading, .evolving-head),
  body[data-fieldguide-page] #main .fieldguide-hero-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: .85rem;
  }

  body[data-fieldguide-page] #main .fieldguide-hero > :is(.page-heading, .map-page-heading, .evolving-head) {
    padding: 1rem;
  }

  body[data-fieldguide-page] #main .fieldguide-hero-footer > div:first-child {
    flex-basis: auto;
  }

  body[data-fieldguide-page] #main .fieldguide-hero > :is(.page-heading, .map-page-heading, .evolving-head) h1 {
    font-size: clamp(1.95rem, 6.3vw, 2.5rem);
  }

  body[data-fieldguide-page] .fieldguide-panorama::before,
  body[data-fieldguide-page] .fieldguide-panorama::after {
    width: 1rem;
    height: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-fieldguide-page] .fieldguide-hero,
  body[data-fieldguide-page] .fieldguide-panorama,
  body[data-fieldguide-page] .fieldguide-panorama > img {
    animation: none;
    transition: none;
  }
}
