/**
 * Dimple Whisky — structural CSS.
 *
 * Loaded on every page. Only what theme.json cannot express: layout of the
 * header/footer, the
 * navigation overlay, touch-target sizing, focus visibility and content
 * typography. Colours, type scale and spacing all come from theme.json
 * presets (--wp--preset--*) — no hard-coded colour or font belongs in here.
 */

/* ---------------------------------------------------------------- base --- */

/*
 * Border-box everywhere. Without it a `width: 100%` button with horizontal
 * padding — WooCommerce's "Add to cart" in the product grid — is 51px wider
 * than its column and pushes the page into horizontal scroll on a phone.
 */
*,
*::before,
*::after {
	box-sizing: border-box;
}

:where(img, svg, video, iframe, table, pre) {
	max-width: 100%;
}

img,
figure img {
	height: auto;
}

/* Every interactive element gets a visible focus ring, in brand red. */
:focus-visible {
	outline: 3px solid var(--wp--preset--color--brand);
	outline-offset: 2px;
}

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

.screen-reader-text:focus {
	background-color: var(--wp--preset--color--base);
	clip-path: none;
	color: var(--wp--preset--color--contrast);
	display: block;
	height: auto;
	left: 5px;
	padding: 15px 23px 14px;
	text-decoration: none;
	top: 5px;
	width: auto;
	z-index: 100000;
}

/* -------------------------------------------------------------- header --- */

.dw-header__inner {
	gap: var(--wp--preset--spacing--30);
}

.dw-header__logo {
	flex-shrink: 0;
	margin: 0;
}

/*
 * `width: 155px`, not `width: auto`: with `auto` the used width comes from the
 * image's intrinsic size, which is unknown until the PNG arrives, so the logo's
 * box was 0px at first paint and the whole header — and with it <main> and
 * every page's content — moved down 27px when it loaded. That was the entire
 * desktop CLS of the site (0.0177 on every page, measured at 1350px on a
 * replica of the live site; 0 after this). The width/height attributes on the
 * <img> give the ratio, and this gives the size the ratio applies to.
 * `max-width: 100%` keeps it inside a very narrow viewport.
 */
.dw-header__logo img {
	display: block;
	height: auto;
	max-width: 100%;
	width: 155px;
}

.dw-header__end {
	flex-wrap: nowrap;
	gap: var(--wp--preset--spacing--20);
}

.dw-header__icons {
	gap: 4px;
}

/* ---------------------------------------------------------- navigation --- */

/*
 * My account, Privacy Policy and Terms & Conditions stay in the markup — and so
 * in the mobile overlay, which is where all seven destinations have to be
 * reachable — but are hidden from the desktop bar: the first is the icon next
 * to it at every viewport, the other two live in the footer. 600px is core's
 * own breakpoint for `overlayMenu: mobile`. Cart is not in this list at all —
 * it is never a navigation destination, only the icon in dw-header__icons.
 */
@media (min-width: 600px) {
	.dw-nav .dw-nav__item--overlay-only {
		display: none;
	}
}

.dw-nav .current-menu-item > a,
.dw-nav .current_page_item > a {
	box-shadow: inset 0 -2px 0 0 var(--wp--preset--color--brand);
}

/* The overlay itself: full-screen, generous targets, readable scale. */
.dw-nav .wp-block-navigation__responsive-container.is-menu-open {
	padding: var(--wp--preset--spacing--40) var(--wp--preset--spacing--20);
}

/*
 * The desktop bar is right-aligned, and core hands that alignment down to the
 * overlay too — which squeezed the open menu into a 235px right-hand column
 * with its longest label touching the screen edge. Inside the overlay the list
 * is a full-width stack, aligned to the start.
 */
.dw-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content,
.dw-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container,
.dw-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
	width: 100%;
	align-items: stretch;
	justify-content: flex-start;
	text-align: start;
}

.dw-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
	gap: 0;
}

.dw-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
	width: 100%;
	border-bottom: 1px solid var(--wp--preset--color--border);
}

.dw-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
	display: flex;
	align-items: center;
	width: 100%;
	min-height: 48px;
	font-size: var(--wp--preset--font-size--large);
}

.wp-block-navigation__responsive-container-open,
.wp-block-navigation__responsive-container-close {
	min-width: 44px;
	min-height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* ---------------------------------------------------- touch targets ------ */

/*
 * 44px minimum on mobile, for anything tappable. inline-flex is what makes
 * min-height apply to the inline <a> elements core renders as buttons.
 */
@media (max-width: 767px) {
	.wp-block-button__link,
	.wp-element-button,
	button,
	input[type="submit"],
	input[type="button"],
	input[type="reset"] {
		min-height: 44px;
	}

	.wp-block-button__link,
	.wp-element-button {
		display: inline-flex;
		align-items: center;
		justify-content: center;
	}

	input[type="text"],
	input[type="email"],
	input[type="tel"],
	input[type="url"],
	input[type="number"],
	input[type="password"],
	input[type="search"],
	select,
	textarea {
		min-height: 44px;
		font-size: 16px; /* stops iOS zooming the page on focus */
	}

	.wp-block-navigation-item__content {
		min-height: 44px;
		display: flex;
		align-items: center;
	}
}

/* ------------------------------------------------------------ content --- */

.dw-page .wp-block-post-title,
.dw-404 h1 {
	overflow-wrap: break-word;
	hyphens: auto;
}

.dw-prose > * + * {
	margin-block-start: var(--wp--preset--spacing--30);
}

.dw-prose h2,
.dw-prose h3,
.dw-prose h4 {
	margin-block-start: var(--wp--preset--spacing--40);
	margin-block-end: var(--wp--preset--spacing--20);
}

.dw-prose h2:first-child,
.dw-prose h3:first-child {
	margin-block-start: 0;
}

.dw-prose ul,
.dw-prose ol {
	padding-inline-start: 1.4em;
	margin-block: var(--wp--preset--spacing--20);
}

.dw-prose li + li {
	margin-block-start: 0.5em;
}

.dw-prose li > ul,
.dw-prose li > ol {
	margin-block: 0.5em;
}

.dw-prose table {
	width: 100%;
	border-collapse: collapse;
	display: block;
	overflow-x: auto;
}

.dw-prose th,
.dw-prose td {
	border: 1px solid var(--wp--preset--color--border);
	padding: 0.5em 0.75em;
	text-align: start;
}

/*
 * FAQ: the page is a run of question/answer pairs. Give each question room
 * above it and keep its answer visually attached to it.
 */
.dw-prose h3 + p,
.dw-prose h4 + p {
	margin-block-start: var(--wp--preset--spacing--20);
}

.dw-prose .wp-block-details {
	border-block-end: 1px solid var(--wp--preset--color--border);
	padding-block: var(--wp--preset--spacing--20);
}

.dw-prose .wp-block-details summary {
	cursor: pointer;
	font-weight: 600;
	min-height: 44px;
	display: flex;
	align-items: center;
}

/* -------------------------------------------------------------- search --- */

.dw-search .wp-block-search__inside-wrapper {
	max-width: 420px;
	margin-inline: auto;
	border: 1px solid var(--wp--preset--color--border);
}

.dw-search .wp-block-search__input {
	border: 0;
	padding: 0.65em 0.8em;
}

.dw-404 {
	text-align: center;
}

/* -------------------------------------------------------------- footer --- */

.dw-footer a:where(:not(.wp-element-button)) {
	color: var(--wp--preset--color--dark-contrast);
}

.dw-footer a:where(:not(.wp-element-button)):hover,
.dw-footer a:where(:not(.wp-element-button)):focus {
	color: var(--wp--preset--color--base);
}

.dw-footer .wp-block-navigation a {
	color: var(--wp--preset--color--dark-contrast);
	text-decoration: none;
}

.dw-footer .wp-block-navigation a:hover,
.dw-footer .wp-block-navigation a:focus {
	color: var(--wp--preset--color--base);
	text-decoration: underline;
}

.dw-footer .wp-block-navigation .wp-block-navigation-item__content {
	min-height: 44px;
	display: flex;
	align-items: center;
}

.dw-footer__disclaimer {
	max-width: 62ch;
	margin-inline: auto;
	color: var(--wp--preset--color--dark-contrast);
}

.dw-footer__social .wp-social-link,
.dw-footer__social .wp-social-link .wp-block-social-link-anchor {
	min-width: 44px;
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
