/* Shared dimensions follow the existing Whale Watching introduction. */
@media screen {
	#primary {
		--wsh-width: min(1180px, calc(100% - 32px));
		--wsh-height: clamp(340px, 31vw, 420px);
		--wsh-inset: 32px;
		--wsh-photo: 52.6%;
		--wsh-title: clamp(36px, 4.5vw, 64px);
		--wsh-paper: #faf7f1;
		--wsh-ink: #133637;
		--wsh-muted: #435d5a;
		--wsh-teal: #174f50;
	}

	/* The reference post lays out its real header and opening blocks on one grid.
	   Travel Planning already suppresses its theme title in favor of the edited block hero. */
	#primary.site-main:not(:has(.ww-intro)) :is(
		.wk-home-hero, .wk-page-hero, .wk-post-hero, .wk-pillar-hero, .sg-hero,
		.dh-hero, .bm-hero, .kp-hero, .zoo-hero, .aq-hero, .kh-hero, .ip-hero,
		.wk-guide-hero, .wk-hotel-hero, .wk-event__hero, .sc-hero, .wk-tour-banner,
		.wkbg-hero, .wlbg-hero, .wwbg-hero, .wk-archive-header, .wk-legal-hero,
		.wna-mast, .wk-tp-hero-grid, .wsh-hotel-hero, .wk-empty:has(.wk-empty-code)
	):not(.wk-pillar-hero:has(~ .wk-pillar-overview .wk-trip-planning)) {
		position: relative !important;
		isolation: isolate;
		display: flex !important;
		flex-direction: column;
		justify-content: center;
		align-items: stretch;
		box-sizing: border-box;
		width: var(--wsh-width) !important;
		max-width: 1180px !important;
		height: auto !important;
		min-height: var(--wsh-height) !important;
		margin: 0 auto !important;
		padding: 0 !important;
		gap: 0;
		overflow: visible;
		border: 0;
		border-radius: 0;
		box-shadow: none;
		background: var(--wsh-paper) !important;
		color: var(--wsh-ink) !important;
		text-align: start;

		&::before, &::after { content: none !important; }
		& > .wk-hotel-hero__shade { display: none; }

		/* Give every element of the copy one column, including free-standing archive navigation. */
		& > :is(.site-shell, [class$="-hero-inner"], .wkbg-hero-inner, .wlbg-hero-inner,
			.wwbg-hero-inner, .wk-tp-herocopy, .wsh-hotel-copy, .wk-event__hero > div:first-child) {
			position: relative !important;
			inset: auto !important;
			z-index: 1;
			display: block !important;
			box-sizing: border-box;
			flex: none;
			align-self: flex-start !important;
			width: calc(100% - var(--wsh-photo)) !important;
			max-width: none !important;
			height: auto !important;
			min-height: 0 !important;
			margin: 0 !important;
			padding: var(--wsh-inset) !important;
			background: transparent !important;
			color: var(--wsh-ink) !important;
			pointer-events: auto;
		}
		& :is([class*="-hero-copy"], .wk-hotel-hero__copy, .wk-hero-content, .whp-header) {
			width: auto !important; max-width: none !important; margin: 0; padding: 0;
		}
		& h1, & h1 span {
			margin: 0 !important;
			max-width: none !important;
			color: var(--wsh-ink) !important;
			font: 700 var(--wsh-title)/1.04 var(--wk-site-font, "DM Sans", system-ui, sans-serif) !important;
			letter-spacing: -.052em !important;
			text-shadow: none !important;
			text-transform: none;
			overflow-wrap: anywhere;
			text-wrap: balance;
		}
		& :is([class*="-deck"], .wk-hotel-hero__dek, .wk-hero-description, .whp-hero-intro,
			.wk-tp-lead, .wsh-intro, .wk-event__deck, .sc-hero-inner > p, .archive-description,
			.wk-legal-hero > .site-shell > p, .wk-empty-copy) {
			margin: .85rem 0 0 !important; max-width: 52ch;
			color: var(--wsh-muted) !important;
			font: 400 clamp(1rem, 1.36vw, 1.13rem)/1.55 var(--wk-site-font, "DM Sans", system-ui, sans-serif) !important;
			text-shadow: none;
		}
		& :is([class*="breadcrumb"], .whp-trail, .wna-crumb, .wk-tp-crumb) {
			margin-block: 0 1rem !important;
			color: var(--wsh-muted) !important;
			font-size: .875rem;
			background: transparent;
		}
		& :is([class*="breadcrumb"], .whp-trail, .wna-crumb, .wk-tp-crumb) :is(a,span,p) {
			color: inherit !important; text-shadow: none;
		}
		& :is(.wk-eyebrow, .wk-legal-eyebrow, .wk-hotel-eyebrow, .wk-guide-access,
			.wk-guide-date, .wk-guide-time, .wk-guide-venue, .wk-legal-updated,
			.wk-hero-meta, .wk-pillar-meta, .wk-hero-meta span, .wk-pillar-meta span) {
			color: var(--wsh-muted) !important; text-shadow: none;
		}
		& :is(.wk-button, .wk-guide-primary, .wk-hotel-button--primary, .sc-book, .wsh-action,
			.whp-primary-action a, .wk-tp-actions .wp-block-button__link) {
			display: inline-flex; align-items: center; justify-content: center;
			min-height: 44px; padding: .65rem 1rem;
			background: var(--wsh-teal) !important; border: 1px solid var(--wsh-teal) !important;
			color: white !important; border-radius: 6px !important; font-weight: 700; text-decoration: none;
		}
		& .wsh-action { margin-block-start: 1rem; }
		& :is(.wk-button.is-ghost, .wk-guide-actions a:not(.wk-guide-primary), .sc-hero-secondary,
			.wk-hotel-button--ghost, .whp-map-action a) {
			background: transparent !important; border-color: transparent !important;
			color: var(--wsh-teal) !important; text-decoration: underline; text-underline-offset: .18em;
		}
		& a:focus-visible { outline: 3px solid #bb671e; outline-offset: 2px; }
		& :is([class$="-fact"], .wk-hotel-badges > span) { background: #edf3ef; color: var(--wsh-ink); }

		& > :is([class*="-hero-media"], figure[class*="-hero-image"], .wk-guide-photo,
			.scv-tour-media-main, .wk-hotel-hero__image, .sc-hero-photo, .wk-event__artwork,
			.wk-tp-photo, .wsh-hotel-photo),
		&:not(:has(> :is([class*="-hero-media"], figure[class*="-hero-image"], .wk-guide-photo,
			.scv-tour-media-main, .wk-hotel-hero__image, .sc-hero-photo, .wk-event__artwork,
			.wk-tp-photo, .wsh-hotel-photo)))::after {
			position: absolute !important; z-index: 0;
			inset: 0 0 0 auto !important;
			box-sizing: border-box;
			display: block; width: var(--wsh-photo) !important; max-width: none !important;
			height: 100% !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important;
			overflow: hidden; border: 0; border-radius: 0; aspect-ratio: auto; object-fit: cover;
		}
		&:not(:has(> :is([class*="-hero-media"], figure[class*="-hero-image"], .wk-guide-photo,
			.scv-tour-media-main, .wk-hotel-hero__image, .sc-hero-photo, .wk-event__artwork,
			.wk-tp-photo, .wsh-hotel-photo)))::after {
			content: "" !important;
			background: #c0d7d4 var(--wsh-fallback) center / cover no-repeat !important;
			pointer-events: none;
		}
		& > :is([class*="-hero-media"], figure[class*="-hero-image"], .wk-guide-photo, .scv-tour-media-main,
			.wk-event__artwork, .wk-tp-photo, .wsh-hotel-photo) :is(img, picture) {
			display: block; width: 100% !important; height: 100% !important; max-width: none;
			object-fit: cover; border-radius: 0;
		}
		& > :is([class*="-hero-media"], figure[class*="-hero-image"], .wk-guide-photo, .wk-tp-photo)::after { content: none; }

		@media (max-width: 760px) {
			min-height: 0 !important;
			& > :is(.site-shell, [class$="-hero-inner"], .wkbg-hero-inner, .wlbg-hero-inner,
				.wwbg-hero-inner, .wk-tp-herocopy, .wsh-hotel-copy, .wk-event__hero > div:first-child) {
				width: 100% !important;
				padding: 22px 16px !important;
			}
			& > :is([class*="-hero-media"], figure[class*="-hero-image"], .wk-guide-photo,
				.scv-tour-media-main, .wk-hotel-hero__image, .sc-hero-photo, .wk-event__artwork,
				.wk-tp-photo, .wsh-hotel-photo),
			&:not(:has(> :is([class*="-hero-media"], figure[class*="-hero-image"], .wk-guide-photo,
				.scv-tour-media-main, .wk-hotel-hero__image, .sc-hero-photo, .wk-event__artwork,
				.wk-tp-photo, .wsh-hotel-photo)))::after {
				position: relative !important; inset: auto !important;
				order: 2; flex: none; width: 100% !important; height: clamp(180px, 55vw, 290px) !important;
			}
		}
	}

	#primary.site-main .wk-hero-details {
		box-sizing: border-box; width: var(--wsh-width); margin-inline: auto;
	}
	#primary .wk-hero-details > .site-shell { width: 100%; padding-inline: var(--wsh-inset); }
	#primary .wk-tp-hero { background: transparent; }
	#primary .wk-trip-planning .wk-tp-hero-grid { gap: 0; }

	/* These two templates keep their copy and navigation as direct children. */
	#primary.site-main :is(.wna-mast, .wk-empty:has(.wk-empty-code)) > :not(style,script) {
		box-sizing: border-box;
		width: calc(100% - var(--wsh-photo)); max-width: none;
		padding-inline: var(--wsh-inset); margin-inline: 0;
	}
	#primary .wna-mast > .wna-crumb, #primary .wk-empty > .wk-empty-code { margin-top: var(--wsh-inset) !important; }
	#primary .wna-mast > :last-child, #primary .wk-empty > :last-child { margin-bottom: var(--wsh-inset); }
	#primary .wna-mast > .wna-quick { justify-content: flex-start; margin-top: 1rem; }
	#primary .wna-mast .wna-quick a { color: var(--wsh-teal); }
	#primary .wk-empty .wk-empty-copy { padding-inline: var(--wsh-inset); }
	#primary .wk-empty .wk-actions-centered { justify-content: flex-start; }

	/* The hotel shell retains the room gallery, navigation, map and sidebar in normal flow. */
	#primary #main-content .whp-shell:has(> .wsh-hotel-hero) {
		width: var(--wsh-width); max-width: 1180px !important; margin-inline: auto; padding-top: 0;
	}
	#primary #main-content .whp-shell > .wsh-hotel-hero { width: 100% !important; }
	#primary #main-content .wsh-hotel-copy .whp-header { padding: 0; margin: 0; }
	#primary #main-content .wsh-hotel-photo :is(figure,a) {
		position: relative; display: block; width: 100%; height: 100%; margin: 0;
	}
	#primary #main-content .wsh-hotel-photo figcaption,
	#primary .wk-event__artwork figcaption {
		position: absolute; inset: auto 0 0; margin: 0; padding: .6rem .8rem;
		background: #0c292bcc; color: white; font-size: .875rem; line-height: 1.4;
	}
	#primary #main-content .wsh-hotel-hero + .whp-gallery {
		margin-top: .75rem; grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
		grid-template-rows: 1fr; height: clamp(125px,16vw,195px);
	}
	#primary #main-content .wsh-hotel-hero + .whp-gallery > figure { grid-row: auto; }

	@media (max-width: 760px) {
		#primary.site-main :is(.wna-mast, .wk-empty:has(.wk-empty-code)) > :not(style,script) { width: 100%; padding-inline: 16px; }
		#primary .wk-hero-details > .site-shell { padding-inline: 16px; }
	}
}

