/*
Theme Name: Drop and Pair
Description: Block theme for Drop and Pair.
Version: 0.1.0
Requires at least: 6.5
Requires PHP: 8.1
Text Domain: drop-and-pair
*/

/*
 * Look: direction C3, "ticket booth". Colours, fonts and sizes live in theme.json;
 * this file holds dark mode and the shared classes every block's markup uses.
 */

:root {
	color-scheme: light dark;
}

/*
 * Dark mode follows the system setting. Rather than a second set of classes, the
 * theme.json presets are re-pointed, so anything using paper/ink/line just works.
 * Stub colours are deliberately left alone: they're the same in both modes.
 */
@media (prefers-color-scheme: dark) {
	:root {
		--wp--preset--color--paper: #1d1b2b;
		--wp--preset--color--ink: #f6f4ee;
		--wp--preset--color--ink-muted: #b4b0c4;
		--wp--preset--color--line: #3b3852;
		--wp--custom--ticket: #26233a;
	}
}

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

.dp-header__inner {
	gap: 10px 28px;
	padding-block: 18px 12px;
	border-bottom: 4px double currentColor;
}

.dp-wordmark {
	display: block;
	color: inherit;
	line-height: 0;
}

.dp-wordmark:hover,
.dp-wordmark:focus-visible {
	color: inherit;
}

.dp-wordmark__svg {
	display: block;
	width: auto;
	height: 72px;
	overflow: visible;
}

/* Text sits inside the SVG so the track can be placed over exact letters; the
   fixed textLength in the markup keeps each word the same width in any font. */
.dp-wordmark__text {
	font-family: var(--wp--preset--font-family--sans);
	font-size: 30px;
	font-weight: 800;
}

.dp-wordmark__amp {
	opacity: 0.55;
}

.dp-wordmark__track {
	fill: none;
	stroke: var(--wp--preset--color--accent);
	stroke-width: 2.6;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.dp-nav {
	font-size: var(--wp--preset--font-size--small);
	padding-bottom: 6px;
}

.dp-nav,
.dp-nav .wp-block-navigation__container {
	flex-wrap: wrap;
	gap: 0;
}

/* Core sets the link colour with a doubled class, hence the extra specificity. */
.dp-nav .wp-block-navigation-item a.wp-block-navigation-item__content {
	color: var(--wp--preset--color--ink-muted);
	text-decoration: none;
}

.dp-nav .wp-block-navigation-item a.wp-block-navigation-item__content:hover,
.dp-nav .wp-block-navigation-item a.wp-block-navigation-item__content[aria-current="page"] {
	color: var(--wp--preset--color--ink);
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--accent);
	text-decoration-thickness: 2px;
	text-underline-offset: 4px;
}

/* Middots between the links, as in "rides · parks · pairings". */
.dp-nav .wp-block-navigation-item + .wp-block-navigation-item::before {
	content: "·";
	padding-inline: 0.6em;
	color: var(--wp--preset--color--ink-muted);
}

@media (max-width: 600px) {
	.dp-wordmark__svg {
		height: 56px;
	}

	/* On phones the nav gets its own row under the wordmark. */
	.dp-nav {
		flex-basis: 100%;
	}
}

/* ---------- Main and footer ---------- */

.dp-main {
	padding-block: 24px 48px;
}

.dp-footer__inner {
	gap: 8px 24px;
	padding-block: 14px 28px;
	border-top: 2px dashed currentColor;
}

.dp-footer__inner > p {
	margin: 0;
}

.dp-footer__tagline {
	font-weight: 700;
}

/* ---------- Shared pieces used by the blocks ---------- */

/* Small grey monospace: field names, "ADMIT ONE", section labels. */
.dp-label {
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--wp--preset--color--ink-muted);
}

.dp-dashed {
	border: 2px dashed currentColor;
	border-radius: 6px;
}

/* Fact table, e.g. "the ride": key column in grey, values in monospace. */
.dp-table {
	width: 100%;
	border-collapse: collapse;
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--small);
}

.dp-table th,
.dp-table td {
	border-top: 1px solid var(--wp--preset--color--line);
	padding: 7px 16px 7px 0;
	text-align: left;
	vertical-align: top;
}

.dp-table th:last-child,
.dp-table td:last-child {
	padding-right: 0;
}

.dp-table tr:last-child th,
.dp-table tr:last-child td {
	border-bottom: 1px solid var(--wp--preset--color--line);
}

.dp-table th {
	width: 46%;
	font-weight: 400;
	color: var(--wp--preset--color--ink-muted);
}

/*
 * A list table that stacks on narrow screens: each row becomes a block, its first
 * cell (the name) on one line and the other columns as labelled items under it, so
 * nothing scrolls sideways. The header row stays for screen readers only; each cell
 * after the first carries its column name in data-label. Used by the park's rides
 * and the ride browser.
 */
@media (max-width: 600px) {
	.dp-table--stack,
	.dp-table--stack tbody,
	.dp-table--stack tr,
	.dp-table--stack td {
		display: block;
	}

	.dp-table--stack thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}

	.dp-table--stack tr {
		display: flex;
		flex-wrap: wrap;
		gap: 2px 16px;
		padding: 9px 0;
		border-top: 1px solid var(--wp--preset--color--line);
	}

	.dp-table--stack tr:last-child {
		border-bottom: 1px solid var(--wp--preset--color--line);
	}

	.dp-table--stack td,
	.dp-table--stack tr:last-child td {
		padding: 0;
		border: 0;
	}

	.dp-table--stack td:first-child {
		flex-basis: 100%;
		font-weight: 600;
	}

	.dp-table--stack td:empty {
		display: none;
	}

	.dp-table--stack td[data-label]::before {
		content: attr(data-label) " ";
		color: var(--wp--preset--color--ink-muted);
	}
}

/*
 * A pairing ticket: main part plus a coloured tear-off stub, with a dashed
 * perforation between them. Set the stub colour with --dp-stub, e.g.
 * style="--dp-stub: var(--wp--preset--color--stub-read)".
 */
.dp-ticket {
	display: grid;
	grid-template-columns: 1fr 44px;
	background: var(--wp--custom--ticket);
	color: var(--wp--preset--color--ink);
	border: 1.5px solid currentColor;
	border-radius: 6px;
	overflow: hidden;
}

.dp-ticket__main {
	padding: 12px 14px;
	min-width: 0;
}

.dp-ticket__admit {
	font-family: var(--wp--preset--font-family--mono);
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--wp--preset--color--ink-muted);
}

.dp-ticket__stub {
	display: grid;
	place-items: center;
	border-left: 2px dashed currentColor;
	background: var(--dp-stub, var(--wp--preset--color--stub-before));
	color: var(--wp--custom--stub-ink);
}

/* Moment name runs bottom to top, like the side of a real ticket stub. */
.dp-ticket__stub > span {
	writing-mode: vertical-rl;
	transform: rotate(180deg);
	font-family: var(--wp--preset--font-family--mono);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	white-space: nowrap;
}

/* Tickets in a grid: three across, one on phones, as in mockup C3. Used by ride, pairing and archive pages. */
.dp-ticket-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 16px;
}

.dp-ticket-grid .dp-ticket__title {
	font-size: var(--wp--preset--font-size--medium);
	margin: 4px 0;
}

.dp-ticket-grid .dp-ticket__title a {
	text-decoration: none;
}

.dp-ticket-grid .dp-ticket__title a:hover {
	text-decoration: underline;
}

.dp-ticket-grid .dp-ticket__blurb {
	margin: 0;
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.45;
	color: var(--wp--preset--color--ink-muted);
}

.dp-ticket-grid .dp-ticket__match {
	margin-top: 8px;
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--x-small);
}

.dp-ticket-grid .dp-label {
	margin-top: 6px;
}

@media (max-width: 760px) {
	.dp-ticket-grid {
		grid-template-columns: 1fr;
	}
}

/* Archives: park groups and links in the park table. */
.dp-archive-group {
	margin-top: 32px;
}

.dp-park-list {
	list-style: none;
	padding: 0;
	margin: 0;
}

.dp-park-list li {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	padding: 8px 0;
	border-top: 1px solid var(--wp--preset--color--line);
}

.dp-moment-desc {
	margin: 0 0 12px;
	color: var(--wp--preset--color--ink-muted);
}

/* Pairing page: the moment as a small stub-coloured tag. */
.dp-pairing-intro__moment {
	display: inline-block;
	padding: 2px 10px;
	border-radius: 4px;
	background: var(--dp-stub);
	color: var(--wp--custom--stub-ink);
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.dp-pairing-intro__description {
	font-size: var(--wp--preset--font-size--large);
	margin: 12px 0;
}

/*
 * About page: the pairing types as a two-column list, each name on its own stub
 * colour, like the pairing page's tag. The markup comes from scripts/export-content.js.
 */
.dp-type-list {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 10px 16px;
	align-items: baseline;
	margin: 16px 0 24px;
}

.dp-type-list__name {
	justify-self: start;
	padding: 2px 10px;
	border-radius: 4px;
	background: var(--dp-stub);
	color: var(--wp--custom--stub-ink);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.dp-type-list__desc {
	margin: 0;
}

.dp-type--before { --dp-stub: var(--wp--preset--color--stub-before); }
.dp-type--right-after { --dp-stub: var(--wp--preset--color--stub-right-after); }
.dp-type--wind-down { --dp-stub: var(--wp--preset--color--stub-wind-down); }
.dp-type--eat-and-drink { --dp-stub: var(--wp--preset--color--stub-eat-and-drink); }
.dp-type--do-next { --dp-stub: var(--wp--preset--color--stub-do-next); }
.dp-type--listen { --dp-stub: var(--wp--preset--color--stub-listen); }
.dp-type--read { --dp-stub: var(--wp--preset--color--stub-read); }
.dp-type--watch { --dp-stub: var(--wp--preset--color--stub-watch); }
.dp-type--later { --dp-stub: var(--wp--preset--color--stub-later); }

/* Narrow screens: each name sits above its description. */
@media (max-width: 600px) {
	.dp-type-list {
		grid-template-columns: 1fr;
		gap: 4px;
	}

	.dp-type-list__desc {
		margin-bottom: 10px;
	}
}

.dp-park-rides__table th[scope="col"] {
	font-weight: 600;
}

/* Rides archive: filter form above the table. Works without JS; with it, the button hides. */
.dp-filters {
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: 16px;
	margin-top: 24px;
}

.dp-filters__group {
	border: 0;
	padding: 0;
	margin: 0;
}

.dp-filters__group legend {
	padding: 0;
	margin-bottom: 6px;
}

.dp-filters__pills {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.dp-filters__pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 3px 12px;
	border: 1px solid currentColor;
	border-radius: 999px;
	font-size: var(--wp--preset--font-size--small);
	cursor: pointer;
}

.dp-filters__pill:has(input:checked) {
	background: var(--wp--preset--color--accent);
	border-color: var(--wp--preset--color--accent);
	color: #1a1a1a;
	font-weight: 600;
}

.dp-filters__pill:has(input:focus-visible),
.dp-filters select:focus-visible {
	outline: 3px solid var(--wp--preset--color--accent);
	outline-offset: 2px;
}

.dp-filters__pill input {
	accent-color: var(--wp--preset--color--accent);
	margin: 0;
}

.dp-filters__selects {
	display: grid;
	gap: 12px;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
}

.dp-filters__field {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin: 0;
}

.dp-filters select {
	padding: 6px 8px;
	border: 1px solid currentColor;
	border-radius: 4px;
	background: var(--wp--preset--color--paper);
	color: inherit;
	font: inherit;
	font-size: var(--wp--preset--font-size--small);
}

.dp-filters__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px;
	margin: 0;
}

.dp-filters__apply {
	padding: 6px 16px;
	border: 1.5px solid currentColor;
	border-radius: 4px;
	background: transparent;
	color: inherit;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.dp-filters--auto .dp-filters__apply {
	display: none;
}

.dp-ride-browser__count {
	margin: 16px 0 8px;
}

.dp-ride-browser__table th[scope="col"] {
	width: auto;
	font-weight: 600;
}

/* ---------- Home, search and 404 ---------- */

.dp-hero {
	margin-block: 32px 40px;
	padding-bottom: 28px;
	border-bottom: 4px double currentColor;
}

.dp-hero__title {
	margin-block: 4px 12px;
}

.dp-hero__lede {
	max-width: 40em;
	font-size: var(--wp--preset--font-size--large);
}

.dp-site-totals {
	margin-top: 16px;
}

/* Ride cards aren't a moment, so their stub is plain ink rather than any moment's colour. */
.dp-ride-cards .dp-ticket__stub {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--paper);
}

.dp-home-section {
	margin-top: 48px;
}

.dp-home-section > h2 {
	padding-bottom: 6px;
	border-bottom: 1px solid var(--wp--preset--color--line);
	margin-bottom: 16px;
}

.dp-cta {
	padding: 24px clamp(16px, 4vw, 32px);
}

/* Buttons: solid ink, or an outline, flipping with the colour scheme. */
.wp-block-button__link {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--paper);
	border: 2px solid var(--wp--preset--color--ink);
	border-radius: 6px;
	padding: 10px 20px;
	font-weight: 700;
	text-decoration: none;
}

.wp-block-button.is-style-outline .wp-block-button__link {
	background: transparent;
	color: var(--wp--preset--color--ink);
}

.wp-block-button__link:hover,
.wp-block-button__link:focus-visible {
	background: var(--wp--preset--color--accent);
	border-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--booth);
}

/* Search results. */
.dp-search-form {
	margin-block: 8px 24px;
}

.dp-search-item {
	padding-block: 12px;
	border-top: 1px solid var(--wp--preset--color--line);
}

.dp-search-item .wp-block-post-title {
	margin: 4px 0;
	font-size: var(--wp--preset--font-size--large);
}

.dp-search-item .wp-block-post-title a {
	text-decoration: none;
}

.dp-search-item .wp-block-post-title a:hover {
	text-decoration: underline;
}

.dp-search-result__summary {
	margin: 0;
	color: var(--wp--preset--color--ink-muted);
}

.dp-404 {
	padding-block: 32px;
}
