/* Append after the original R6 and Nada presentation styles on the two
   restored History routes. Content, map coordinates and hidden states belong
   to the retained renderer/controllers; this file changes presentation only. */

body:is(.nada, .hw-nada) #r6-root {
  --r6-ink: #39291f;
  --r6-muted: #6b5a4c;
  --r6-paper: #fcfaf5;
  --r6-line: #e0d6c4;
  width: 100%;
  max-width: 1380px;
  min-width: 0;
  box-sizing: border-box;
  margin-inline: auto;
  padding: clamp(18px, 2.3vw, 32px);
}

body:is(.nada, .hw-nada) #r6-root :is(button, select) {
  min-height: 44px;
  font-size: 14px;
  line-height: 1.45;
  border-color: #b9a58c;
}

body:is(.nada, .hw-nada) #r6-root button {
  white-space: normal;
  overflow-wrap: anywhere;
}

body:is(.nada, .hw-nada) #r6-root button:hover:not(:disabled) {
  background: #f2e9db;
}

body:is(.nada, .hw-nada) #r6-root button:is([aria-pressed="true"], [aria-selected="true"]),
body:is(.nada, .hw-nada) #r6-root button:is([aria-pressed="true"], [aria-selected="true"]):hover:not(:disabled) {
  color: #fcfaf5;
  background: #8c1734;
  border-color: #8c1734;
}

body:is(.nada, .hw-nada) #r6-root :focus-visible {
  outline-color: #8c1734;
}

body:is(.nada, .hw-nada) #r6-root :is(.r6-topline, .r6-kicker) {
  font-size: 12px !important;
  line-height: 1.6 !important;
}

body:is(.nada, .hw-nada) #r6-root .r6-topline {
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
}

body:is(.nada, .hw-nada) #r6-root .r6-topline > * {
  min-width: 0;
  max-width: 100%;
}

body:is(.nada, .hw-nada) #r6-root #r6-text-toggle {
  min-height: 44px;
  padding: 10px 14px !important;
  font-size: 14px !important;
}

body:is(.nada, .hw-nada) #r6-root :is(label, .r6-guide p, .r6-note, figcaption) {
  font-size: 13px;
  line-height: 1.65;
}

body:is(.nada, .hw-nada) #r6-root :is(.r6-refs, #r6-connections) {
  font-size: 14px;
  line-height: 1.7;
}

body:is(.nada, .hw-nada) #r6-root #r6-connections > span {
  font-size: 12px;
}

body:is(.nada, .hw-nada) #r6-root #r6-selector button {
  flex: 1 1 110px;
  padding: 10px 12px;
}

body:is(.nada, .hw-nada) #r6-root #r6-tabs {
  gap: 6px;
}

body:is(.nada, .hw-nada) #r6-root #r6-tabs button {
  padding: 10px 12px;
  font-size: 14px;
}

body:is(.nada, .hw-nada) #r6-root .r6-workbench {
  grid-template-columns: minmax(240px, .85fr) minmax(0, 1.7fr);
  gap: clamp(24px, 3vw, 48px);
}

body:is(.nada, .hw-nada) #r6-root :is(.r6-dossier, #r6-specimen, #r6-panel, .r6-chapter-control) {
  min-width: 0;
}

body:is(.nada, .hw-nada) #r6-root :is(h2, h3, h4, p, dd, li, figcaption) {
  overflow-wrap: anywhere;
}

body:is(.nada, .hw-nada) #r6-root #r6-specimen dt {
  font-size: 12px;
}

body:is(.nada, .hw-nada) #r6-root .r6-chapter-control > span {
  font-size: 13px;
  line-height: 1.5;
}

body:is(.nada, .hw-nada) #r6-root .r6-chapter-nav button {
  font-size: 14px !important;
  flex: 0 1 auto;
}

body:is(.nada, .hw-nada) #r6-root .r6-map {
  aspect-ratio: 2;
  min-height: 0;
}

/* Keep each geographic centre intact. A 44px transparent button surrounds
   the smaller visual marker; the labelled native place selector remains
   available where nearby geographic markers overlap. */
body:is(.nada, .hw-nada) #r6-root .r6-pin {
  display: grid;
  place-items: center;
  isolation: isolate;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 12px;
  line-height: 1;
  box-shadow: none;
}

body:is(.nada, .hw-nada) #r6-root .r6-pin::before {
  content: "";
  position: absolute;
  width: 28px;
  height: 28px;
  border: 1px solid var(--r6-ink);
  border-radius: 50%;
  background: #fcfaf5;
  z-index: -1;
}

body:is(.nada, .hw-nada) #r6-root .r6-pin:hover:not(:disabled),
body:is(.nada, .hw-nada) #r6-root .r6-pin[aria-pressed="true"],
body:is(.nada, .hw-nada) #r6-root .r6-pin[aria-pressed="true"]:hover:not(:disabled) {
  background: transparent;
}

body:is(.nada, .hw-nada) #r6-root .r6-pin[aria-pressed="true"]::before {
  border-color: #8c1734;
  background: #8c1734;
  box-shadow: 0 0 0 3px #fcfaf5cc;
}

/* The dossier replaces the scene illustration at NS-H03. Retain the scene's
   existing sources/bookmark/reading actions without revealing hidden nodes. */
body.hw-nada.r6-history-active .hw-story > .hw-story-actions:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
}

body.hw-nada :is(.hw-story-actions, .hw-header) .hw-button {
  min-height: 44px;
  font-size: 13px;
}

@media (max-width: 1000px) {
  body:is(.nada, .hw-nada) #r6-root .r6-workbench {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  body:is(.nada, .hw-nada) #r6-root #r6-specimen figure > img {
    height: 300px;
    object-fit: contain;
  }
}

@media (max-width: 600px) {
  body:is(.nada, .hw-nada) #r6-root {
    padding: 16px;
  }

  body:is(.nada, .hw-nada) #r6-root h2 {
    font-size: clamp(36px, 10vw, 44px);
  }

  body:is(.nada, .hw-nada) #r6-root #r6-selector button,
  body:is(.nada, .hw-nada) #r6-root #r6-tabs button {
    flex: 1 1 calc(50% - 6px);
    font-size: 14px;
    padding: 10px 8px;
  }

  body:is(.nada, .hw-nada) #r6-root #r6-specimen dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  body:is(.nada, .hw-nada) #r6-root #r6-specimen dl > div:last-child {
    grid-column: 1 / -1;
  }

  body:is(.nada, .hw-nada) #r6-root #r6-specimen figure > img {
    height: 240px;
  }

  body:is(.nada, .hw-nada) #r6-root .r6-evidence {
    padding-left: 12px;
  }

  body:is(.nada, .hw-nada) #r6-root .r6-place-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body:is(.nada, .hw-nada) #r6-root .r6-place-controls select {
    grid-column: 1 / -1;
  }
}
