/*
 * Drop Dive Core — shared front-end styles (buttons, icons, placeholders).
 * Colours and fonts come from the theme's global styles (theme.json) with
 * safe fallbacks, so blocks still look right with another theme.
 */

:root {
	--dd-bg: var(--wp--preset--color--bg-primary, #050b12);
	--dd-bg-2: var(--wp--preset--color--bg-secondary, #0b1721);
	--dd-surface: var(--wp--preset--color--surface, #102231);
	--dd-ocean: var(--wp--preset--color--ocean-dark, #0a2a44);
	--dd-ocean-blue: var(--wp--preset--color--ocean-blue, #0f4c75);
	--dd-accent: var(--wp--preset--color--accent, #1679bd);
	--dd-accent-hover: #0f66a3;
	--dd-accent-bright: var(--wp--preset--color--accent-bright, #3aabe5);
	--dd-steel: var(--wp--preset--color--steel, #8fa8ba);
	--dd-white: var(--wp--preset--color--white, #fff);
	--dd-text: var(--wp--preset--color--text-primary, #f2f6f9);
	--dd-text-2: var(--wp--preset--color--text-secondary, #a9b8c4);
	--dd-border: var(--wp--preset--color--border, #1e3342);
	--dd-font-display: var(--wp--preset--font-family--display, "Oswald", "Arial Narrow", sans-serif);
	--dd-font-body: var(--wp--preset--font-family--body, "Inter", system-ui, sans-serif);
	--dd-gutter: var(--wp--preset--spacing--gutter, clamp(1rem, 0.4rem + 3vw, 3rem));
	--dd-content: var(--wp--style--global--content-size, 1320px);
	--dd-wide: var(--wp--style--global--wide-size, 1600px);
	--dd-header-h: var(--wp--custom--header--height-mobile, 68px);
	--dd-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
	--dd-radius: var(--wp--custom--radius--button, 2px);
	--dd-radius-card: var(--wp--custom--radius--card, 4px);
}

@media (min-width: 1280px) {
	:root {
		--dd-header-h: var(--wp--custom--header--height, 88px);
	}
}

:where([class^="dd-"], [class*=" dd-"], [class^="dd-"] *, [class*=" dd-"] *),
:where([class^="dd-"], [class*=" dd-"])::before,
:where([class^="dd-"], [class*=" dd-"])::after {
	box-sizing: border-box;
}

.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute !important;
	width: 1px;
	word-wrap: normal !important;
}

.dd-icon {
	display: inline-block;
	flex: none;
	vertical-align: middle;
}

/* Buttons rendered by plugin blocks — mirror the theme's button element. */
.dd-btn {
	align-items: center;
	background: var(--dd-accent);
	border: 1px solid transparent;
	border-radius: var(--dd-radius);
	color: var(--dd-white);
	cursor: pointer;
	display: inline-flex;
	font-family: var(--dd-font-display);
	font-size: 0.875rem;
	font-weight: 500;
	gap: 0.6em;
	justify-content: center;
	letter-spacing: 0.12em;
	line-height: 1.2;
	min-height: 44px;
	padding: calc(1rem - 1px) calc(1.75rem - 1px);
	text-decoration: none;
	text-transform: uppercase;
	transition: background-color 220ms var(--dd-ease), border-color 220ms var(--dd-ease), box-shadow 220ms var(--dd-ease), color 220ms var(--dd-ease);
	white-space: nowrap;
}

.dd-btn:hover,
.dd-btn:focus-visible {
	background: var(--dd-accent-hover);
	box-shadow: 0 0 0 1px rgba(58, 171, 229, 0.35), 0 8px 28px -10px rgba(58, 171, 229, 0.55);
	color: var(--dd-white);
	text-decoration: none;
}

.dd-btn--outline {
	background: transparent;
	border-color: rgba(255, 255, 255, 0.6);
}

.dd-btn--outline:hover,
.dd-btn--outline:focus-visible {
	background: rgba(255, 255, 255, 0.1);
	border-color: var(--dd-white);
	box-shadow: none;
}

.dd-btn--block {
	width: 100%;
}

.dd-btn__arrow {
	transition: transform 220ms var(--dd-ease);
}

.dd-btn:hover .dd-btn__arrow,
.dd-btn:focus-visible .dd-btn__arrow {
	transform: translateX(4px);
}

:where(.dd-btn, .dd-play, .dd-video__play, .dd-header__toggle, .dd-menu__toggle):focus-visible {
	outline: 2px solid var(--dd-accent-bright);
	outline-offset: 3px;
}

/* "IMAGE REQUIRED" placeholder. */
.dd-placeholder {
	background:
		repeating-linear-gradient(100deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 38px),
		linear-gradient(135deg, #0f4c75 0%, #0a2a44 48%, #050b12 100%);
	color: rgba(242, 246, 249, 0.82);
	display: grid;
	height: 100%;
	min-height: 140px;
	outline: 1px dashed rgba(58, 171, 229, 0.55);
	outline-offset: -10px;
	place-items: center;
	text-align: center;
	width: 100%;
}

.dd-placeholder__inner {
	align-items: center;
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	max-width: 30ch;
	padding: 1.25rem;
}

.dd-placeholder__title {
	font-family: var(--dd-font-display);
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.22em;
	text-transform: uppercase;
}

.dd-placeholder__label {
	font-family: var(--dd-font-body);
	font-size: 0.75rem;
	line-height: 1.45;
	opacity: 0.8;
}

/* Website without a photo yet: just the ocean background, no notice. */
.dd-placeholder.is-blank {
	outline: none;
}

/* Background placeholders keep their label out of the way of the content. */
/* Background placeholders: label in the top-right corner, away from text. */
.dd-section__media .dd-placeholder,
.dd-video__media .dd-placeholder,
.dd-site__media .dd-placeholder {
	align-items: start;
	justify-items: end;
	text-align: right;
}

.dd-section__media .dd-placeholder__inner,
.dd-video__media .dd-placeholder__inner,
.dd-site__media .dd-placeholder__inner {
	align-items: flex-end;
	padding: 2rem var(--dd-gutter);
}

.dd-section--hero .dd-section__media .dd-placeholder__inner {
	padding-top: calc(var(--dd-header-h) + 1.5rem);
}

@media (max-width: 767px) {
	.dd-section__media .dd-placeholder__label,
	.dd-video__media .dd-placeholder__label {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.dd-btn,
	.dd-btn__arrow {
		transition: none;
	}
}

/* Lightbox (video). */
.dd-lightbox {
	background: transparent;
	border: 0;
	height: 100%;
	max-height: none;
	max-width: none;
	padding: 0;
	width: 100%;
}

.dd-lightbox::backdrop {
	backdrop-filter: blur(6px);
	background: rgba(3, 7, 12, 0.92);
}

.dd-lightbox__frame {
	aspect-ratio: 16 / 9;
	background: #000;
	left: 50%;
	position: absolute;
	top: 50%;
	transform: translate(-50%, -50%);
	width: min(92vw, calc(88vh * 16 / 9), 1400px);
}

.dd-lightbox__frame.is-portrait {
	aspect-ratio: auto;
	background: #fff;
	border-radius: 8px;
	height: min(88vh, 860px);
	overflow: hidden;
	width: min(92vw, 480px);
}

.dd-lightbox__frame iframe,
.dd-lightbox__frame video {
	border: 0;
	display: block;
	height: 100%;
	width: 100%;
}

.dd-lightbox__close {
	align-items: center;
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid rgba(255, 255, 255, 0.4);
	border-radius: 50%;
	color: #fff;
	cursor: pointer;
	display: flex;
	height: 48px;
	justify-content: center;
	position: absolute;
	right: max(16px, 2vw);
	top: max(16px, 2vw);
	width: 48px;
	z-index: 2;
}

.dd-lightbox__close:hover,
.dd-lightbox__close:focus-visible {
	background: var(--dd-accent);
	border-color: var(--dd-accent);
	outline: none;
}

/* Filter buttons (packages, gallery). */
.dd-filter {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}

.dd-filter__btn {
	background: transparent;
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: var(--dd-radius);
	color: var(--dd-text-2);
	cursor: pointer;
	font-family: var(--dd-font-display);
	font-size: 0.75rem;
	letter-spacing: 0.14em;
	min-height: 40px;
	padding: 0.5rem 1rem;
	text-transform: uppercase;
	transition: background-color 200ms var(--dd-ease), color 200ms var(--dd-ease), border-color 200ms var(--dd-ease);
}

.dd-filter__btn:hover {
	border-color: rgba(255, 255, 255, 0.5);
	color: var(--dd-white);
}

.dd-filter__btn[aria-pressed="true"] {
	background: var(--dd-accent);
	border-color: var(--dd-accent);
	color: var(--dd-white);
}

[data-dd-filter-tags][hidden] {
	display: none !important;
}

/* Generic photo card (species, sites in card mode). */
.dd-cards {
	display: grid;
	gap: clamp(0.75rem, 1.4vw, 1.25rem);
	grid-template-columns: repeat(var(--dd-cols, 3), minmax(0, 1fr));
}

.dd-card {
	background: var(--dd-surface);
	border-radius: var(--dd-radius-card);
	isolation: isolate;
	overflow: hidden;
	position: relative;
}

.dd-card__link {
	color: inherit;
	display: block;
	height: 100%;
	text-decoration: none;
}

.dd-card__media {
	aspect-ratio: 1 / 1;
	overflow: hidden;
}

.dd-card__media img {
	display: block;
	height: 100%;
	object-fit: cover;
	transition: transform 800ms var(--dd-ease);
	width: 100%;
}

.dd-card__media .dd-placeholder__label {
	display: none;
}

.dd-card__link:hover .dd-card__media img,
.dd-card__link:focus-visible .dd-card__media img {
	transform: scale(1.05);
}

.dd-card--species .dd-card__body {
	background: linear-gradient(0deg, rgba(5, 11, 18, 0.92) 0%, rgba(5, 11, 18, 0.55) 60%, rgba(5, 11, 18, 0) 100%);
	bottom: 0;
	left: 0;
	padding: 3rem 1.25rem 1.1rem;
	position: absolute;
	right: 0;
}

.dd-card__title {
	color: var(--dd-white);
	font-family: var(--dd-font-display);
	font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
	font-weight: 500;
	letter-spacing: 0.04em;
	line-height: 1.1;
	margin: 0;
	text-transform: uppercase;
}

.dd-card__text {
	color: var(--dd-text-2);
	font-size: 0.8125rem;
	line-height: 1.4;
	margin: 0.35rem 0 0;
}

.dd-card__link:focus-visible {
	outline: 2px solid var(--dd-accent-bright);
	outline-offset: -2px;
}

.dd-card__media.is-more {
	align-items: center;
	background: linear-gradient(135deg, var(--dd-ocean-blue), var(--dd-bg));
	color: var(--dd-accent-bright);
	display: flex;
	justify-content: center;
}

@media (max-width: 1023px) {
	.dd-cards {
		grid-template-columns: repeat(min(var(--dd-cols, 3), 2), minmax(0, 1fr));
	}
}

@media (max-width: 559px) {
	.dd-cards {
		grid-template-columns: 1fr;
	}

	.dd-card--species .dd-card__media {
		aspect-ratio: 16 / 10;
	}
}

/* Sub navigation (section tabs, dive-site nav). */
.dd-subnav ul {
	border-bottom: 1px solid var(--dd-border);
	display: flex;
	gap: clamp(1rem, 3vw, 2.75rem);
	list-style: none;
	margin: 0;
	overflow-x: auto;
	padding: 0;
	scrollbar-width: none;
}

.dd-subnav ul::-webkit-scrollbar {
	display: none;
}

.dd-subnav a {
	border-bottom: 2px solid transparent;
	color: var(--dd-text-2);
	display: block;
	font-family: var(--dd-font-display);
	font-size: 0.8125rem;
	font-weight: 500;
	letter-spacing: 0.14em;
	margin-bottom: -1px;
	padding: 1rem 0;
	text-decoration: none;
	text-transform: uppercase;
	white-space: nowrap;
}

.dd-subnav a:hover,
.dd-subnav a:focus-visible,
.dd-subnav a[aria-current],
.dd-subnav a.is-active {
	border-bottom-color: var(--dd-accent-bright);
	color: var(--dd-white);
}

.dd-empty {
	align-items: center;
	background: linear-gradient(160deg, rgba(22, 121, 189, 0.16), rgba(5, 11, 18, 0.4));
	border: 1px dashed rgba(58, 171, 229, 0.5);
	color: var(--dd-text-2);
	display: flex;
	flex-direction: column;
	font-size: 0.875rem;
	gap: 0.4rem;
	justify-content: center;
	min-height: 12rem;
	padding: 2rem 1rem;
	text-align: center;
}

.dd-empty .dd-icon {
	color: var(--dd-accent-bright);
}

.dd-empty__title {
	color: var(--dd-white);
	font-family: var(--wp--preset--font-family--display);
	font-size: 0.8125rem;
	letter-spacing: 0.18em;
	text-transform: uppercase;
}

.dd-empty__link {
	color: var(--dd-accent-bright);
	margin-top: 0.5rem;
}

/* Image lightbox (gallery). */
.dd-lightbox__frame.is-image {
	aspect-ratio: auto;
	background: transparent;
	height: auto;
	max-height: 86vh;
	text-align: center;
	width: min(92vw, 1600px);
}

.dd-lightbox__frame.is-image img {
	height: auto;
	max-height: 80vh;
	max-width: 100%;
	object-fit: contain;
	width: auto;
}

.dd-lightbox__caption {
	color: var(--dd-text-2);
	font-size: 0.875rem;
	margin-top: 0.75rem;
}

.dd-lightbox__nav {
	align-items: center;
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid rgba(255, 255, 255, 0.35);
	border-radius: 50%;
	color: #fff;
	cursor: pointer;
	display: flex;
	height: 52px;
	justify-content: center;
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 52px;
	z-index: 2;
}

.dd-lightbox__nav.is-prev { left: max(12px, 2vw); }
.dd-lightbox__nav.is-next { right: max(12px, 2vw); }

.dd-lightbox__nav:hover,
.dd-lightbox__nav:focus-visible {
	background: var(--dd-accent);
	border-color: var(--dd-accent);
}
