/*
 * Landscape PDF layer
 *
 * The canonical PDF is rendered with screen media so the same wide-container
 * compositions used by the desktop report remain authoritative. Every rule in
 * this file is scoped to the export marker added by export_trip_report_pdf.py.
 */

@page trip-report-landscape {
  size: A4 landscape;
  margin: 8mm;
}

html[data-trip-pdf="landscape"] {
  --trip-pdf-source-width: 1295px;
  --trip-pdf-source-height: 890px;
  --trip-pdf-scale: 0.82;
  --trip-pdf-output-width: calc(var(--trip-pdf-source-width) * var(--trip-pdf-scale));
  --trip-pdf-gutter: 58px;
  background: #fff;
}

html[data-trip-pdf="landscape"] {
  width: var(--trip-pdf-output-width) !important;
  min-width: var(--trip-pdf-output-width) !important;
}

html[data-trip-pdf="landscape"] body[data-page="trip_report"] {
  width: var(--trip-pdf-source-width) !important;
  min-width: var(--trip-pdf-source-width) !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  background: #fff !important;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

html[data-trip-pdf="landscape"] body[data-page="trip_report"] {
  zoom: var(--trip-pdf-scale);
}

html[data-trip-pdf="landscape"] body[data-page="trip_report"] *,
html[data-trip-pdf="landscape"] body[data-page="trip_report"] *::before,
html[data-trip-pdf="landscape"] body[data-page="trip_report"] *::after {
  box-sizing: border-box;
}

html[data-trip-pdf="landscape"] .site-header,
html[data-trip-pdf="landscape"] .site-footer,
html[data-trip-pdf="landscape"] .skip-link,
html[data-trip-pdf="landscape"] .trip-story__index,
html[data-trip-pdf="landscape"] .trip-chapter-nav,
html[data-trip-pdf="landscape"] .trip-chapter-nav-mobile,
html[data-trip-pdf="landscape"] .trip-story-actions,
html[data-trip-pdf="landscape"] .trip-site-technical > summary {
  display: none !important;
}

html[data-trip-pdf="landscape"] .site-frame,
html[data-trip-pdf="landscape"] .page-shell,
html[data-trip-pdf="landscape"] .trip-story,
html[data-trip-pdf="landscape"] .trip-story__content {
  width: var(--trip-pdf-source-width) !important;
  max-width: none !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
}

html[data-trip-pdf="landscape"] .site-frame {
  container-name: trip-report-shell;
  container-type: inline-size;
}

html[data-trip-pdf="landscape"] .trip-story {
  page: trip-report-landscape;
  display: block !important;
  background: var(--trip-paper);
}

html[data-trip-pdf="landscape"] p,
html[data-trip-pdf="landscape"] li,
html[data-trip-pdf="landscape"] dd {
  widows: 3;
  orphans: 3;
}

html[data-trip-pdf="landscape"] h1,
html[data-trip-pdf="landscape"] h2,
html[data-trip-pdf="landscape"] h3,
html[data-trip-pdf="landscape"] h4,
html[data-trip-pdf="landscape"] .trip-section-label,
html[data-trip-pdf="landscape"] figure,
html[data-trip-pdf="landscape"] figcaption,
html[data-trip-pdf="landscape"] .trip-site-technical__body,
html[data-trip-pdf="landscape"] .trip-field-note-feature {
  break-inside: avoid;
  page-break-inside: avoid;
}

html[data-trip-pdf="landscape"] h1,
html[data-trip-pdf="landscape"] h2,
html[data-trip-pdf="landscape"] h3,
html[data-trip-pdf="landscape"] h4,
html[data-trip-pdf="landscape"] .trip-section-label {
  break-after: avoid;
  page-break-after: avoid;
}

/* One desktop composition per sheet. */
html[data-trip-pdf="landscape"] .trip-story-hero,
html[data-trip-pdf="landscape"] .trip-story-intro,
html[data-trip-pdf="landscape"] .trip-team-thanks,
html[data-trip-pdf="landscape"] .trip-methods,
html[data-trip-pdf="landscape"] .trip-makatea,
html[data-trip-pdf="landscape"] #rarotonga,
html[data-trip-pdf="landscape"] .trip-island-hero,
html[data-trip-pdf="landscape"] .trip-tide-story,
html[data-trip-pdf="landscape"] .trip-site-heading,
html[data-trip-pdf="landscape"] .trip-site-brief,
html[data-trip-pdf="landscape"] .trip-field-note-page,
html[data-trip-pdf="landscape"] .trip-research,
html[data-trip-pdf="landscape"] .trip-glossary {
  margin-top: 0 !important;
}

html[data-trip-pdf="landscape"] .trip-story-hero,
html[data-trip-pdf="landscape"] .trip-story-intro,
html[data-trip-pdf="landscape"] .trip-team-thanks,
html[data-trip-pdf="landscape"] .trip-methods,
html[data-trip-pdf="landscape"] .trip-makatea,
html[data-trip-pdf="landscape"] #rarotonga,
html[data-trip-pdf="landscape"] .trip-island-hero,
html[data-trip-pdf="landscape"] .trip-tide-story,
html[data-trip-pdf="landscape"] .trip-site-brief,
html[data-trip-pdf="landscape"] .trip-field-note-page,
html[data-trip-pdf="landscape"] .trip-research,
html[data-trip-pdf="landscape"] .trip-glossary {
  break-after: page;
  page-break-after: always;
}

html[data-trip-pdf="landscape"] .trip-story-hero {
  width: 100% !important;
  height: var(--trip-pdf-source-height) !important;
  min-height: var(--trip-pdf-source-height) !important;
  max-height: var(--trip-pdf-source-height) !important;
}

html[data-trip-pdf="landscape"] .trip-story-hero-photo img {
  min-height: 0 !important;
}

/* Opening landmarks keep their wide-screen grids with a tighter vertical beat. */
html[data-trip-pdf="landscape"] .trip-story-intro {
  min-height: 0 !important;
}

html[data-trip-pdf="landscape"] .trip-story-intro__column {
  grid-template-rows: 312px 365px minmax(172px, auto) !important;
}

html[data-trip-pdf="landscape"] .trip-story-intro__column > header {
  padding-top: 42px !important;
  padding-bottom: 18px !important;
}

html[data-trip-pdf="landscape"] .trip-story-intro__column > header::before {
  top: 42px !important;
}

html[data-trip-pdf="landscape"] .trip-story-intro__copy {
  padding-top: 32px !important;
}

html[data-trip-pdf="landscape"] .trip-team-thanks {
  height: var(--trip-pdf-source-height);
  overflow: hidden;
}

html[data-trip-pdf="landscape"] .trip-team-thanks__top {
  grid-template-rows: 478px !important;
  min-height: 478px !important;
  max-height: 478px !important;
}

html[data-trip-pdf="landscape"] .trip-team-thanks__message {
  grid-template-rows: 292px 186px !important;
  height: 478px !important;
}

/* The rail sequence reads like a document page number in the downloaded PDF. */
html[data-trip-pdf="landscape"] .trip-team-thanks__rail span:first-child {
  display: none !important;
}

html[data-trip-pdf="landscape"] .trip-team-thanks__gratitude h2 {
  font-size: 82px !important;
}

html[data-trip-pdf="landscape"] .trip-team-thanks__gratitude > p {
  top: 149px !important;
}

html[data-trip-pdf="landscape"] .trip-team-thanks__hiseas {
  padding-block: 8px !important;
}

html[data-trip-pdf="landscape"] .trip-team-thanks__roster li {
  padding-top: 7px !important;
  padding-bottom: 5px !important;
}

html[data-trip-pdf="landscape"] .trip-team-thanks__roster p {
  min-height: 0 !important;
}

html[data-trip-pdf="landscape"] .trip-team-thanks__pledge {
  padding-block: 18px !important;
}

html[data-trip-pdf="landscape"] .trip-methods {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: auto !important;
  height: var(--trip-pdf-source-height);
  min-height: 0 !important;
  padding-block: 34px !important;
  gap: 18px !important;
  overflow: hidden;
}

html[data-trip-pdf="landscape"] .trip-methods .trip-section-heading,
html[data-trip-pdf="landscape"] .trip-methods > ol,
html[data-trip-pdf="landscape"] .trip-methods-feature {
  grid-column: 1 !important;
  grid-row: auto !important;
}

html[data-trip-pdf="landscape"] .trip-methods > ol {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

html[data-trip-pdf="landscape"] .trip-methods li,
html[data-trip-pdf="landscape"] .trip-methods li + li {
  padding-block: 12px 14px !important;
}

html[data-trip-pdf="landscape"] .trip-methods-feature {
  display: grid !important;
  grid-template-columns: minmax(0, 2.12fr) minmax(280px, 0.88fr) !important;
  gap: 18px !important;
}

html[data-trip-pdf="landscape"] .trip-methods-feature__media {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

html[data-trip-pdf="landscape"] .trip-methods-view {
  aspect-ratio: 4 / 3 !important;
}

html[data-trip-pdf="landscape"] .trip-makatea {
  height: var(--trip-pdf-source-height);
  min-height: 0 !important;
  overflow: hidden;
}

html[data-trip-pdf="landscape"] .trip-makatea__aerial img { height: 230px !important; }
html[data-trip-pdf="landscape"] .trip-makatea__diagram { height: 190px !important; }
html[data-trip-pdf="landscape"] .trip-makatea__story { padding-block: 35px !important; }
html[data-trip-pdf="landscape"] .trip-makatea__evidence li { padding: 18px !important; }

/* Rarotonga already resolves as one desktop spread. */
html[data-trip-pdf="landscape"] #rarotonga {
  padding: 0 !important;
  break-inside: avoid;
  page-break-inside: avoid;
}

html[data-trip-pdf="landscape"] #rarotonga .trip-island-hero {
  break-before: auto;
  break-after: auto;
  page-break-before: auto;
  page-break-after: auto;
}

html[data-trip-pdf="landscape"] #rarotonga .trip-rarotonga-evidence {
  margin-top: 0 !important;
  padding: 24px var(--trip-pdf-gutter) 0 !important;
}

/* Island and tide spreads need only modest vertical compression. */
html[data-trip-pdf="landscape"] .trip-island-chapter:not(#rarotonga) {
  padding-top: 0 !important;
}

html[data-trip-pdf="landscape"] .trip-island-chapter:not(#rarotonga) > .trip-island-hero {
  width: 106.85% !important;
  margin-top: 0 !important;
  zoom: 0.9364;
}

html[data-trip-pdf="landscape"] .trip-island-hero__copy {
  padding-top: 32px !important;
  padding-bottom: 22px !important;
}

html[data-trip-pdf="landscape"] .trip-island-chapter:not(#rarotonga) > .trip-island-hero > :is(.trip-island-hero__copy, .trip-island-visuals) {
  transform: none !important;
}

html[data-trip-pdf="landscape"] .trip-island-hero:has(.trip-island-map) .trip-island-visuals > figure > img {
  aspect-ratio: 16 / 9 !important;
}

html[data-trip-pdf="landscape"] .trip-tide-story {
  width: 109.6% !important;
  zoom: 0.9124;
  min-height: 0 !important;
  padding: 36px var(--trip-pdf-gutter) 28px !important;
}

html[data-trip-pdf="landscape"] .trip-tide-story__masthead {
  padding-bottom: 20px !important;
}

html[data-trip-pdf="landscape"] .trip-tide-story .tidal-report-plate {
  min-height: 0 !important;
}

/* The site-series heading becomes the masthead of the first site sheet. */
html[data-trip-pdf="landscape"] .trip-site-heading {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 6px !important;
  align-items: start !important;
  height: 180px;
  margin-bottom: -106px;
  padding: 24px var(--trip-pdf-gutter) 12px !important;
  border-bottom: 0;
  background: var(--trip-paper);
}

html[data-trip-pdf="landscape"] .trip-site-heading h3 {
  margin: 0 !important;
  max-width: 12ch;
  font-size: 49px !important;
  line-height: 1.08 !important;
}

html[data-trip-pdf="landscape"] .trip-site-heading > p:last-child {
  display: none;
}

html[data-trip-pdf="landscape"] .trip-site-heading + .trip-site-list > .trip-site-brief:first-child {
  border-top: 0 !important;
  transform: translateY(106px);
  transform-origin: top left;
}

/* Keep Avarua's final evidence line inside its own sheet. Its 816px content box
   plus the general 106px first-site offset is taller than the 890px page. */
html[data-trip-pdf="landscape"] .trip-site-heading + .trip-site-list > .trip-site-brief[data-site-code="HS108"] {
  transform: translateY(74px) !important;
}

html[data-trip-pdf="landscape"] .trip-site-list > .trip-site-brief:not(:first-child) {
  transform: translateX(-40px) scale(1.08, 1.1);
  transform-origin: top left;
}

html[data-trip-pdf="landscape"] .trip-site-list > .trip-site-brief[data-site-code="HS114"] {
  transform: none !important;
}

html[data-trip-pdf="landscape"] .trip-site-heading + .trip-site-list > .trip-site-brief[data-site-code="HS116"] {
  transform: translateY(76px) !important;
}

html[data-trip-pdf="landscape"] .trip-site-list {
  display: block !important;
}

html[data-trip-pdf="landscape"] .trip-site-brief {
  width: calc(100% - (2 * var(--trip-pdf-gutter)));
  min-height: 0 !important;
  max-height: var(--trip-pdf-source-height);
  margin-inline: var(--trip-pdf-gutter) !important;
  padding-top: 28px !important;
  column-gap: 28px !important;
  row-gap: 12px !important;
  overflow: visible !important;
  break-inside: avoid;
  page-break-inside: avoid;
}

/* HS108's comparison-site disclosure fits visibly on its first-site sheet,
   but its unconstrained layout box otherwise creates an empty continuation. */
html[data-trip-pdf="landscape"] .trip-site-brief[data-site-code="HS108"] {
  height: 816px;
  max-height: 816px;
  overflow: hidden !important;
}

/* HS108 carries a comparison-site disclosure in addition to its evidence.
   Give that one sheet a shallower media row and place the two related evidence
   blocks side by side so the complete record ends before the page boundary. */
html[data-trip-pdf="landscape"] .trip-site-brief[data-site-code="HS108"] .trip-site-media > figure > img {
  aspect-ratio: 16 / 7.6 !important;
}

html[data-trip-pdf="landscape"] .trip-site-brief[data-site-code="HS108"] .trip-surface-unavailable {
  grid-column: 1 !important;
}

html[data-trip-pdf="landscape"] .trip-site-brief[data-site-code="HS108"] .trip-site-evidence {
  grid-column: 2 !important;
}

html[data-trip-pdf="landscape"] .trip-site-brief > header h3 {
  font-size: 34px !important;
}

html[data-trip-pdf="landscape"] .trip-site-media {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 16px !important;
  margin-top: 0 !important;
}

html[data-trip-pdf="landscape"] .trip-site-media--single {
  grid-template-columns: minmax(0, 1fr) !important;
}

html[data-trip-pdf="landscape"] .trip-site-media > figure > img {
  aspect-ratio: 16 / 8.8 !important;
}

/* Feature-sheet insertion must not change the desktop alternating media order. */
html[data-trip-pdf="landscape"] .trip-site-brief[data-trip-desktop-parity="even"] .trip-site-media > .trip-site-locator {
  grid-column: 2 !important;
  grid-row: 1 !important;
}

html[data-trip-pdf="landscape"] .trip-site-brief[data-trip-desktop-parity="even"] .trip-site-media > .trip-media--site {
  grid-column: 1 !important;
  grid-row: 1 !important;
}

html[data-trip-pdf="landscape"] .trip-site-brief[data-trip-desktop-parity="odd"] .trip-site-media > .trip-site-locator {
  grid-column: 1 !important;
  grid-row: 1 !important;
}

html[data-trip-pdf="landscape"] .trip-site-brief[data-trip-desktop-parity="odd"] .trip-site-media > .trip-media--site {
  grid-column: 2 !important;
  grid-row: 1 !important;
}

html[data-trip-pdf="landscape"] .trip-site-brief .trip-site-media--single > .trip-site-locator {
  grid-column: 1 !important;
}

html[data-trip-pdf="landscape"] .trip-site-media > .trip-site-locator > figcaption,
html[data-trip-pdf="landscape"] .trip-site-media > .trip-media--site > figcaption {
  gap: 4px !important;
  padding-top: 8px !important;
  font-size: 13px !important;
  line-height: 1.34 !important;
}

html[data-trip-pdf="landscape"] .trip-site-media > figure > figcaption :is(.trip-site-map-key, .trip-site-map-key__item, small) {
  font-size: 12px !important;
  line-height: 1.3 !important;
}

html[data-trip-pdf="landscape"] .trip-site-technical {
  margin-top: 0 !important;
}

html[data-trip-pdf="landscape"] .trip-site-technical__body,
html[data-trip-pdf="landscape"] .trip-site-technical:not([open]) > .trip-site-technical__body {
  display: grid !important;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr);
  gap: 22px;
  padding: 12px 0 0 !important;
  border-top: 1px solid rgba(30, 49, 84, 0.16);
}

html[data-trip-pdf="landscape"] .trip-site-technical__body p,
html[data-trip-pdf="landscape"] .trip-site-technical__body li {
  font-size: 12px !important;
  line-height: 1.35 !important;
}

html[data-trip-pdf="landscape"] .trip-surface-summary,
html[data-trip-pdf="landscape"] .trip-surface-unavailable,
html[data-trip-pdf="landscape"] .trip-site-evidence {
  margin: 0 !important;
}

html[data-trip-pdf="landscape"] .trip-site-evidence ul {
  margin: 0 !important;
}

/* Annotated records become a calm, immediately following feature sheet. */
html[data-trip-pdf="landscape"] .trip-field-note-page {
  position: relative;
  display: block;
  height: var(--trip-pdf-source-height);
  min-height: var(--trip-pdf-source-height);
  padding: 0;
  background: var(--trip-paper);
  break-inside: avoid;
  page-break-inside: avoid;
}

html[data-trip-pdf="landscape"] .trip-field-note-page .trip-field-note-feature {
  position: absolute;
  top: 0;
  left: 19px;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr) !important;
  width: calc(100% - 38px);
  margin: 0 !important;
}

html[data-trip-pdf="landscape"] .trip-field-note-page .trip-field-note-feature__copy {
  padding: clamp(0.85rem, 2.4vw, 1.4rem) !important;
  font-size: clamp(0.82rem, 1.25vw, 0.94rem) !important;
}

html[data-trip-pdf="landscape"] .trip-field-note-page .trip-field-note-feature__image {
  aspect-ratio: 3 / 2 !important;
}

/* The closing spreads retain the desktop hierarchy and use the full width. */
html[data-trip-pdf="landscape"] .trip-research {
  height: 820px;
  min-height: 820px;
  max-height: 820px;
  padding: 34px var(--trip-pdf-gutter) !important;
  overflow: hidden;
}

html[data-trip-pdf="landscape"] .trip-research .trip-section-heading {
  padding-bottom: 16px !important;
}

html[data-trip-pdf="landscape"] .trip-research h2 {
  font-size: 52px !important;
}

html[data-trip-pdf="landscape"] .trip-research > ol {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

html[data-trip-pdf="landscape"] .trip-next-work {
  display: grid !important;
  grid-template-columns: minmax(170px, 0.72fr) minmax(0, 2.28fr) !important;
}

html[data-trip-pdf="landscape"] .trip-next-work ul {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

html[data-trip-pdf="landscape"] .trip-research-sources {
  display: grid !important;
  grid-template-columns: minmax(170px, 0.72fr) minmax(0, 2.28fr) !important;
}

html[data-trip-pdf="landscape"] .trip-research-sources ul {
  grid-template-columns: minmax(0, 1fr) !important;
}

html[data-trip-pdf="landscape"] .trip-research-sources li {
  grid-template-columns: minmax(170px, 0.72fr) minmax(0, 2.28fr) !important;
}

html[data-trip-pdf="landscape"] .trip-research > ol > li,
html[data-trip-pdf="landscape"] .trip-research > ol > li + li {
  padding-block: 14px !important;
}

html[data-trip-pdf="landscape"] .trip-next-work,
html[data-trip-pdf="landscape"] .trip-research-sources {
  margin-top: 12px !important;
  padding-top: 12px !important;
}

html[data-trip-pdf="landscape"] .trip-research-sources li {
  padding-block: 6px !important;
}

html[data-trip-pdf="landscape"] .trip-glossary {
  min-height: var(--trip-pdf-source-height);
  padding: 58px var(--trip-pdf-gutter) !important;
  align-items: start;
}

html[data-trip-pdf="landscape"] .trip-glossary > div {
  position: static !important;
}

html[data-trip-pdf="landscape"] .trip-glossary dl div,
html[data-trip-pdf="landscape"] .trip-glossary dl div:nth-child(n) {
  padding-block: 18px 20px !important;
}

/* Final searchable-text floors after the 0.82 landscape scale. */
html[data-trip-pdf="landscape"] .trip-tide-story .tidal-report-trace__key,
html[data-trip-pdf="landscape"] .trip-tide-story .tidal-report-ruler > p,
html[data-trip-pdf="landscape"] .trip-team-thanks__to,
html[data-trip-pdf="landscape"] .trip-team-thanks__roster span,
html[data-trip-pdf="landscape"] .trip-team-thanks__roster p,
html[data-trip-pdf="landscape"] .trip-team-thanks__roster a {
  font-size: 11px !important;
  line-height: 1.25 !important;
}

html[data-trip-pdf="landscape"] .trip-glossary {
  break-after: auto;
  page-break-after: auto;
}
