/* ==========================================================================
   The Saucy Mare — theme styles not expressible in theme.json
   ========================================================================== */

html {
	scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}
}

body {
	-webkit-font-smoothing: antialiased;
}

:where(section[id], .wp-block-group[id]) {
	scroll-margin-top: 5rem;
}

:focus-visible {
	outline: 2px solid var(--wp--preset--color--gold);
	outline-offset: 3px;
}

.skip-link.screen-reader-text:focus {
	background: var(--wp--preset--color--parchment);
	color: var(--wp--preset--color--ink);
}

/* Header ------------------------------------------------------------------ */

.tsm-header {
	position: sticky;
	top: 0;
	z-index: 50;
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	background: color-mix(in srgb, var(--wp--preset--color--abyss) 78%, transparent);
	border-bottom: 1px solid color-mix(in srgb, var(--wp--preset--color--seafoam) 18%, transparent);
}

.admin-bar .tsm-header {
	top: var(--wp-admin--admin-bar--height, 32px);
}

@media (max-width: 600px) {
	.admin-bar .tsm-header {
		top: 0;
	}
}

.tsm-brand-ship {
	width: 2.25rem;
	height: 2.1rem;
	flex: none;
	background: var(--wp--preset--color--gold);
	-webkit-mask: var(--tsm-ship) center / contain no-repeat;
	mask: var(--tsm-ship) center / contain no-repeat;
}

/* Hero -------------------------------------------------------------------- */

.tsm-hero {
	position: relative;
	isolation: isolate;
	overflow: hidden;
}

/* The pirate ship logo as a huge, faint watermark. */
.tsm-hero::before {
	content: "";
	position: absolute;
	z-index: -1;
	right: -8%;
	bottom: 4%;
	width: min(70vw, 820px);
	aspect-ratio: 481 / 444;
	background: var(--tsm-ship) center / contain no-repeat;
	opacity: 0.07;
	transform: rotate(-4deg);
	pointer-events: none;
}

/* A rolling swell along the bottom edge of the hero. */
.tsm-hero::after {
	content: "";
	position: absolute;
	z-index: -1;
	left: 0;
	right: 0;
	bottom: -1px;
	height: 70px;
	background: var(--wp--preset--color--abyss);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 70' preserveAspectRatio='none'%3E%3Cpath d='M0 40 C150 10 300 70 450 40 S750 10 900 40 S1100 70 1200 40 V70 H0Z'/%3E%3C/svg%3E") bottom / 100% 100% no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 70' preserveAspectRatio='none'%3E%3Cpath d='M0 40 C150 10 300 70 450 40 S750 10 900 40 S1100 70 1200 40 V70 H0Z'/%3E%3C/svg%3E") bottom / 100% 100% no-repeat;
	pointer-events: none;
}

.tsm-avatar img,
.tsm-avatar .wp-block-site-logo img {
	border-radius: 50%;
	aspect-ratio: 1;
	object-fit: cover;
	background: var(--wp--preset--color--parchment);
	border: 4px solid var(--wp--preset--color--gold);
	box-shadow: 0 0 0 10px color-mix(in srgb, var(--wp--preset--color--gold) 14%, transparent), 0 18px 40px rgb(0 0 0 / 0.35);
}

.tsm-avatar.wp-block-site-logo,
.tsm-avatar .wp-block-site-logo {
	display: flex;
	justify-content: center;
}

.tsm-eyebrow {
	letter-spacing: 0.22em;
	text-transform: uppercase;
}

.tsm-tagline a {
	color: inherit;
}

/* Profile link buttons (block style "Profile link") ----------------------- */

.wp-block-button.is-style-tsm-link {
	width: 100%;
}

.wp-block-button.is-style-tsm-link .wp-block-button__link {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	width: 100%;
	min-height: 3.75rem;
	padding: 1rem 1.25rem;
	box-shadow: 0 10px 24px rgb(0 0 0 / 0.25);
	transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.wp-block-button.is-style-tsm-link .wp-block-button__link:hover,
.wp-block-button.is-style-tsm-link .wp-block-button__link:focus-visible {
	transform: translateY(-2px);
	box-shadow: 0 14px 30px rgb(0 0 0 / 0.35);
}

[class*="tsm-icon-"] .wp-block-button__link::before {
	content: "";
	width: 1.15rem;
	height: 1.15rem;
	flex: none;
	background: currentColor;
	-webkit-mask-size: contain;
	mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
}

.tsm-link-stack.wp-block-buttons {
	flex-direction: column;
	gap: 1rem;
}

/* Chart card (block style) ------------------------------------------------ */

.wp-block-group.is-style-tsm-card {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	height: 100%;
	border-radius: 18px;
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--gold) 35%, transparent);
	box-shadow: 0 10px 24px rgb(0 0 0 / 0.25);
}

/* A compass rose in the corner of the card. */
.wp-block-group.is-style-tsm-card::before {
	content: "";
	position: absolute;
	z-index: -1;
	right: -40px;
	top: -40px;
	width: 220px;
	height: 220px;
	opacity: 0.16;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%23e8b54d' stroke-width='1'%3E%3Ccircle cx='50' cy='50' r='46'/%3E%3Ccircle cx='50' cy='50' r='38' stroke-dasharray='2 3'/%3E%3Cpath d='M50 2 L56 44 L98 50 L56 56 L50 98 L44 56 L2 50 L44 44Z' fill='%23e8b54d' fill-opacity='.35'/%3E%3Cpath d='M50 18 L53 47 L82 50 L53 53 L50 82 L47 53 L18 50 L47 47Z' transform='rotate(45 50 50)'/%3E%3C/svg%3E") center / contain no-repeat;
}

.tsm-links .wp-block-columns {
	align-items: stretch !important;
}

.tsm-links .wp-block-column {
	display: flex;
	flex-direction: column;
}

/* Voyage map -------------------------------------------------------------- */

:where(.tsm-map) {
	margin-left: auto;
	margin-right: auto;
}

.tsm-map + .tsm-ports {
	margin-top: var(--wp--preset--spacing--50);
}

.tsm-map__canvas {
	position: relative;
}

.tsm-map__svg {
	display: block;
	width: 100%;
	height: auto;
	overflow: visible;
}

.tsm-map__graticule {
	fill: color-mix(in srgb, var(--wp--preset--color--tide) 35%, transparent);
	stroke: color-mix(in srgb, var(--wp--preset--color--seafoam) 25%, transparent);
	stroke-width: 0.8;
}

.tsm-map__country {
	fill: color-mix(in srgb, var(--wp--preset--color--seafoam) 26%, var(--wp--preset--color--ocean));
	stroke: var(--wp--preset--color--abyss);
	stroke-width: 0.4;
	transition: fill 0.25s ease;
}

.tsm-map__country.is-visited {
	fill: var(--wp--preset--color--gold);
}

.tsm-map__country.is-visited:hover {
	fill: var(--wp--preset--color--parchment);
}

.tsm-map__isle {
	fill: var(--wp--preset--color--gold);
	stroke: var(--wp--preset--color--abyss);
	stroke-width: 1;
}

.tsm-map__route {
	fill: none;
	stroke: var(--wp--preset--color--parchment);
	stroke-width: 1.4;
	stroke-linecap: round;
	opacity: 0.75;
}

.tsm-map__route.is-sailed {
	opacity: 0.22;
}

.tsm-map__route.is-current {
	opacity: 0.9;
}

/* Once every voyage has been sailed, the full set of routes stays on the map. */
.tsm-map.is-complete .tsm-map__route {
	opacity: 0.55;
	transition: opacity 0.8s ease;
}

.tsm-map__pin {
	fill: var(--wp--preset--color--ink);
	stroke: var(--wp--preset--color--parchment);
	stroke-width: 0.6;
}

.tsm-map__hub rect {
	fill: var(--wp--preset--color--seafoam);
	stroke: var(--wp--preset--color--abyss);
	stroke-width: 0.8;
}

.tsm-map__hub text {
	fill: var(--wp--preset--color--seafoam);
	font-family: var(--wp--preset--font-family--body);
	font-size: 9px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.tsm-map__caption {
	min-height: 1.6em;
	margin-top: calc(1.5rem - 15px);
	text-align: center;
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: 0.06em;
	color: var(--wp--preset--color--seafoam);
}

.tsm-map__home-dot {
	fill: var(--wp--preset--color--rust);
	stroke: var(--wp--preset--color--parchment);
	stroke-width: 1.2;
}

.tsm-map__home-pulse {
	fill: none;
	stroke: var(--wp--preset--color--parchment);
	stroke-width: 1;
	transform-origin: center;
	transform-box: fill-box;
	animation: tsm-pulse 2.4s ease-out infinite;
}

.tsm-map__ship {
	pointer-events: none;
	filter: drop-shadow(0 2px 3px rgb(0 0 0 / 0.5));
}

.tsm-map__ship-flip {
	transition: transform 0.6s ease;
}

.tsm-map__ship-flip.is-westbound {
	transform: scaleX(-1);
}

.tsm-map__ship-bob {
	transform-origin: 0 0;
	animation: tsm-bob 3.2s ease-in-out infinite;
}

.tsm-map__tooltip {
	position: absolute;
	transform: translate(-50%, calc(-100% - 12px));
	padding: 0.3rem 0.65rem;
	border-radius: 8px;
	background: var(--wp--preset--color--parchment);
	color: var(--wp--preset--color--ink);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	white-space: nowrap;
	pointer-events: none;
	box-shadow: 0 6px 16px rgb(0 0 0 / 0.3);
}

@keyframes tsm-bob {
	0%, 100% { transform: rotate(-3deg) translateY(0); }
	50% { transform: rotate(3deg) translateY(-1.5px); }
}

@keyframes tsm-pulse {
	from { transform: scale(0.6); opacity: 1; }
	to { transform: scale(2.6); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
	.tsm-map__ship-bob,
	.tsm-map__home-pulse {
		animation: none;
	}
}

/* Ports of call ----------------------------------------------------------- */

.tsm-ports__count {
	display: flex;
	align-items: baseline;
	justify-content: center;
	flex-wrap: wrap;
	gap: 0.6rem;
	margin: 0 0 1.25rem;
	text-align: center;
}

.tsm-ports__number {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--huge);
	line-height: 1;
	color: var(--wp--preset--color--gold);
}

.tsm-ports__label {
	letter-spacing: 0.18em;
	text-transform: uppercase;
	font-size: var(--wp--preset--font-size--small);
}

.tsm-ports__list {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tsm-ports__item {
	padding: 0.35rem 0.85rem;
	border-radius: 999px;
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--gold) 45%, transparent);
	font-size: var(--wp--preset--font-size--small);
	transition: background-color 0.3s ease, color 0.3s ease;
}

.tsm-ports__visits {
	margin-left: 0.3rem;
	font-weight: 600;
	color: var(--wp--preset--color--gold);
}

.tsm-ports__item.is-current .tsm-ports__visits {
	color: inherit;
}

.tsm-ports__meta {
	margin: -0.75rem 0 1.25rem;
	text-align: center;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--seafoam);
}

.tsm-ports__item.is-current {
	background: var(--wp--preset--color--gold);
	color: var(--wp--preset--color--ink);
}

.tsm-editor-note {
	margin-top: 0.75rem;
	font-size: 12px;
	opacity: 0.7;
	text-align: center;
}

/* About ------------------------------------------------------------------- */

.tsm-about {
	position: relative;
	isolation: isolate;
	overflow: hidden;
}

.tsm-facts {
	margin: 0;
	padding: 0;
	list-style: none;
}

.tsm-facts li {
	display: flex;
	flex-direction: column;
	padding: 0.85rem 0;
	border-bottom: 1px dashed color-mix(in srgb, var(--wp--preset--color--ink) 30%, transparent);
}

.tsm-facts li:first-child {
	padding-top: 0;
}

.tsm-facts strong {
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--wp--preset--color--rust);
}

/* Footer ------------------------------------------------------------------ */

.tsm-footer .wp-block-social-links .wp-social-link {
	transition: transform 0.2s ease;
}

.tsm-footer .wp-block-social-links .wp-social-link:hover {
	transform: translateY(-2px);
}

/* Inner pages (blog posts, archive) -------------------------------------- */

.tsm-post-card {
	border-bottom: 1px solid color-mix(in srgb, var(--wp--preset--color--seafoam) 20%, transparent);
}
