/*
 * Storefront currency switcher.
 *
 * Deliberately token-driven: the child theme (tokens.css) defines --avh-*, so the switcher picks
 * up the AverionHair palette automatically and falls back to neutral values on any other theme.
 */

.avh-currency-switcher {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	font-family: inherit;
	line-height: 1.2;
}

/* --- Dropdown ------------------------------------------------------------------------------ */

.avh-currency-switcher .avh-currency-select {
	appearance: none;
	-webkit-appearance: none;
	margin: 0;
	padding: 0.4em 2em 0.4em 0.75em;
	border: 1px solid var(--avh-nude-deep, #d8d2c8);
	border-radius: 999px;
	background-color: transparent;
	background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
	background-position: right 1.05em top 50%, right 0.75em top 50%;
	background-size: 0.32em 0.32em, 0.32em 0.32em;
	background-repeat: no-repeat;
	color: inherit;
	font: inherit;
	font-size: 0.85em;
	letter-spacing: 0.04em;
	cursor: pointer;
	transition: border-color 160ms ease, color 160ms ease;
}

.avh-currency-switcher .avh-currency-select:hover,
.avh-currency-switcher .avh-currency-select:focus-visible {
	border-color: var(--avh-gold, #c29a4f);
	color: var(--avh-gold, #c29a4f);
	outline: none;
}

.avh-currency-switcher .avh-currency-go {
	padding: 0.4em 0.9em;
	border: 1px solid currentColor;
	border-radius: 999px;
	background: none;
	color: inherit;
	font: inherit;
	font-size: 0.85em;
	cursor: pointer;
}

/* --- Inline buttons ------------------------------------------------------------------------ */

.avh-currency-switcher--inline {
	gap: 0;
	border: 1px solid var(--avh-nude-deep, #d8d2c8);
	border-radius: 999px;
	padding: 2px;
}

/* Controls are anchors (they must work on a cached page, with or without JS), so the browser's
   link styling has to be undone rather than inherited. */
a.avh-currency-option,
a.avh-currency-toggle,
a.avh-currency-menu__item {
	text-decoration: none;
	box-shadow: none;
}

.avh-currency-option {
	display: inline-block;
	padding: 0.35em 0.85em;
	border: 0;
	border-radius: 999px;
	background: none;
	color: inherit;
	font: inherit;
	font-size: 0.8em;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background-color 160ms ease, color 160ms ease;
}

.avh-currency-option:hover {
	color: var(--avh-gold, #c29a4f);
}

.avh-currency-option.is-active {
	background: var(--avh-gold, #c29a4f);
	color: var(--avh-cream, #fff);
}

/* --- Busy state ---------------------------------------------------------------------------- */

.avh-currency-switcher.is-busy {
	opacity: 0.55;
	pointer-events: none;
}

/* --- Checkout notice ----------------------------------------------------------------------- */

.avh-gateway-notice {
	margin: 0 0 1rem;
	padding: 0.75rem 1rem;
	border-left: 3px solid var(--avh-gold, #c29a4f);
	background: var(--avh-cream, #f7f1e6);
	font-size: 0.9em;
}

.avh-gateway-notice a {
	color: var(--avh-gold-deep, #a37e39);
	font-weight: 600;
}

/* Postcode fields we have switched off must stay hidden even if a theme re-shows the row. */
.woocommerce .avh-postcode-hidden,
.wc-block-components-address-form .avh-postcode-hidden {
	display: none !important;
}

/* --- Navbar toggle -------------------------------------------------------------------------- */

.avh-currency-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	padding: 0.35em 0.5em 0.35em 0.85em;
	border: 1px solid var(--avh-nude-deep, #d8d2c8);
	border-radius: 999px;
	background: none;
	color: inherit;
	font: inherit;
	font-size: 0.8em;
	letter-spacing: 0.06em;
	line-height: 1;
	text-transform: uppercase;
	cursor: pointer;
	transition: border-color 160ms ease, color 160ms ease;
}

.avh-currency-toggle:hover,
.avh-currency-toggle:focus-visible {
	border-color: var(--avh-gold, #c29a4f);
	color: var(--avh-gold, #c29a4f);
	outline: none;
}

.avh-currency-toggle__active {
	font-weight: 600;
}

/* The currency one tap away, so the control explains itself without a label. */
.avh-currency-toggle__next {
	padding: 0.25em 0.5em;
	border-radius: 999px;
	background: var(--avh-nude, #ece0cf);
	color: var(--avh-black, #191410);
	font-size: 0.85em;
	opacity: 0.75;
}

.avh-currency-toggle:hover .avh-currency-toggle__next {
	background: var(--avh-gold, #c29a4f);
	color: var(--avh-cream, #f7f1e6);
	opacity: 1;
}

/* --- Navbar menu ---------------------------------------------------------------------------- */

.avh-currency-switcher--menu {
	position: relative;
}

.avh-currency-menu__button {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	padding: 0.4em 0.8em;
	border: 1px solid var(--avh-nude-deep, #d8d2c8);
	border-radius: 999px;
	background: none;
	color: inherit;
	font: inherit;
	font-size: 0.8em;
	letter-spacing: 0.06em;
	line-height: 1;
	text-transform: uppercase;
	cursor: pointer;
}

.avh-currency-menu__button:hover,
.avh-currency-switcher--menu.is-open .avh-currency-menu__button {
	border-color: var(--avh-gold, #c29a4f);
	color: var(--avh-gold, #c29a4f);
}

.avh-currency-menu__button svg {
	transition: transform 160ms ease;
}

.avh-currency-switcher--menu.is-open .avh-currency-menu__button svg {
	transform: rotate(180deg);
}

.avh-currency-menu__list {
	position: absolute;
	z-index: 999;
	top: calc(100% + 6px);
	right: 0;
	min-width: 9rem;
	margin: 0;
	padding: 0.3rem;
	list-style: none;
	border: 1px solid var(--avh-nude-deep, #d8d2c8);
	border-radius: 10px;
	background: var(--avh-cream, #fff);
	box-shadow: var(--shadow-lifted, 0 12px 30px rgba(25, 20, 16, 0.14));
}

.avh-currency-menu__list li {
	margin: 0;
	list-style: none;
}

.avh-currency-menu__item {
	display: flex;
	align-items: center;
	gap: 0.55em;
	width: 100%;
	padding: 0.5em 0.7em;
	border: 0;
	border-radius: 7px;
	background: none;
	color: var(--avh-black, #191410);
	font: inherit;
	font-size: 0.85em;
	text-align: left;
	cursor: pointer;
}

.avh-currency-menu__item:hover {
	background: var(--avh-nude, #ece0cf);
}

.avh-currency-menu__item.is-active {
	color: var(--avh-gold-deep, #a37e39);
	font-weight: 600;
}

/* --- Floating switcher ----------------------------------------------------------------------
   Self-placing: pinned to the viewport on every storefront page, positioned from the control
   panel. Offsets arrive as --avh-float-x / --avh-float-y on the wrapper, and the safe-area insets
   are added on top so the control clears an iPhone home indicator rather than sitting under it. */

.avh-currency-float {
	position: fixed;
	z-index: 9990;
	display: inline-flex;
	padding: 0.35rem 0.5rem;
	border: 1px solid var(--avh-nude-deep, #d8d2c8);
	border-radius: 999px;
	background: var(--avh-cream, #fdfaf5);
	box-shadow: var(--shadow-lifted, 0 10px 30px rgba(25, 20, 16, 0.16));
	transition: box-shadow 200ms ease, transform 200ms ease;
}

.avh-currency-float:hover {
	box-shadow: 0 14px 38px rgba(25, 20, 16, 0.22);
}

/* The control inside already carries its own pill border - don't draw a second one. */
.avh-currency-float .avh-currency-toggle,
.avh-currency-float .avh-currency-menu__button,
.avh-currency-float .avh-currency-switcher--inline {
	border-color: transparent;
}

.avh-currency-float .avh-currency-select {
	border: 0;
	background: none;
	font: inherit;
	font-size: 0.85em;
}

/* --- Positions --------------------------------------------------------------------------- */

.avh-currency-float--top_left,
.avh-currency-float--top_center,
.avh-currency-float--top_right {
	top: calc(var(--avh-float-y, 20px) + env(safe-area-inset-top, 0px));
}

.avh-currency-float--bottom_left,
.avh-currency-float--bottom_center,
.avh-currency-float--bottom_right {
	bottom: calc(var(--avh-float-y, 20px) + env(safe-area-inset-bottom, 0px));
}

.avh-currency-float--top_left,
.avh-currency-float--middle_left,
.avh-currency-float--bottom_left {
	left: calc(var(--avh-float-x, 20px) + env(safe-area-inset-left, 0px));
}

.avh-currency-float--top_right,
.avh-currency-float--middle_right,
.avh-currency-float--bottom_right {
	right: calc(var(--avh-float-x, 20px) + env(safe-area-inset-right, 0px));
}

.avh-currency-float--top_center,
.avh-currency-float--bottom_center {
	left: 50%;
	transform: translateX(-50%);
}

.avh-currency-float--middle_left,
.avh-currency-float--middle_right {
	top: 50%;
	transform: translateY(-50%);
}

/* A menu pinned to the bottom of the screen has to open upwards, or it opens off-screen. */
.avh-currency-float--bottom_left .avh-currency-menu__list,
.avh-currency-float--bottom_center .avh-currency-menu__list,
.avh-currency-float--bottom_right .avh-currency-menu__list,
.avh-currency-float--middle_left .avh-currency-menu__list,
.avh-currency-float--middle_right .avh-currency-menu__list {
	top: auto;
	bottom: calc(100% + 6px);
}

.avh-currency-float--top_left .avh-currency-menu__list,
.avh-currency-float--middle_left .avh-currency-menu__list,
.avh-currency-float--bottom_left .avh-currency-menu__list {
	right: auto;
	left: 0;
}

/* --- Small screens ------------------------------------------------------------------------ */

.avh-currency-float--desktop-only {
	display: none;
}

@media (min-width: 782px) {
	.avh-currency-float--desktop-only {
		display: inline-flex;
	}
}

/* Centre-pinned controls have no room to spare on a phone; keep them off the edges. */
@media (max-width: 480px) {
	.avh-currency-float {
		max-width: calc(100vw - 1.5rem);
	}
}

@media (prefers-reduced-motion: reduce) {
	.avh-currency-float {
		transition: none;
	}
}

/* --- First-visit welcome --------------------------------------------------------------------
   Rendered for everyone and revealed by JS from the cookies, so it survives a full-page cache.
   It starts [hidden], which means it must never be given a `display` that would override that. */

.avh-currency-welcome {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.25rem;
}

.avh-currency-welcome[hidden] {
	display: none;
}

.avh-currency-welcome__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(25, 20, 16, 0.55);
	animation: avh-welcome-fade 220ms ease both;
}

.avh-currency-welcome__panel {
	position: relative;
	width: min(30rem, 100%);
	max-height: calc(100vh - 2.5rem);
	overflow-y: auto;
	padding: 2rem 1.75rem 1.5rem;
	border-radius: 16px;
	background: var(--avh-cream, #fdfaf5);
	box-shadow: 0 24px 60px rgba(25, 20, 16, 0.3);
	text-align: center;
	animation: avh-welcome-rise 260ms cubic-bezier(0.16, 0.84, 0.44, 1) both;
}

.avh-currency-welcome__close {
	position: absolute;
	top: 0.75rem;
	right: 0.75rem;
	display: inline-flex;
	padding: 0.5rem;
	border: 0;
	border-radius: 999px;
	background: none;
	color: var(--avh-muted, #6b6459);
	cursor: pointer;
}

.avh-currency-welcome__close:hover {
	color: var(--avh-black, #191410);
}

.avh-currency-welcome__title {
	margin: 0 0 0.5rem;
	font-size: 1.35rem;
	line-height: 1.2;
}

.avh-currency-welcome__text {
	margin: 0 0 1.5rem;
	color: var(--avh-muted, #6b6459);
	font-size: 0.9rem;
	line-height: 1.55;
}

.avh-currency-welcome__list {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
	gap: 0.6rem;
	margin: 0 0 1.25rem;
	padding: 0;
	list-style: none;
}

.avh-currency-welcome__list li {
	margin: 0;
	list-style: none;
}

.avh-currency-welcome__option {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.15rem;
	height: 100%;
	padding: 0.9rem 0.6rem;
	border: 1px solid var(--avh-nude-deep, #d8d2c8);
	border-radius: 12px;
	background: #fff;
	color: inherit;
	text-decoration: none;
	transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.avh-currency-welcome__option:hover,
.avh-currency-welcome__option:focus-visible {
	border-color: var(--avh-gold, #c29a4f);
	box-shadow: 0 6px 18px rgba(25, 20, 16, 0.1);
	transform: translateY(-2px);
	outline: none;
}

/* What they are already seeing - geolocation may have chosen it for them. */
.avh-currency-welcome__option.is-current {
	border-color: var(--avh-gold, #c29a4f);
	background: var(--avh-nude, #fbf4e8);
}

.avh-currency-welcome__symbol {
	font-size: 1.5rem;
	line-height: 1.1;
}

.avh-currency-welcome__code {
	font-size: 0.85rem;
	font-weight: 600;
	letter-spacing: 0.08em;
}

.avh-currency-welcome__name {
	color: var(--avh-muted, #6b6459);
	font-size: 0.7rem;
	line-height: 1.3;
}

.avh-currency-welcome__skip {
	border: 0;
	background: none;
	color: var(--avh-muted, #6b6459);
	font: inherit;
	font-size: 0.8rem;
	text-decoration: underline;
	cursor: pointer;
}

.avh-currency-welcome__skip:hover {
	color: var(--avh-black, #191410);
}

/* The panel scrolls inside itself; the page behind it must not. */
.avh-welcome-open,
.avh-welcome-open body {
	overflow: hidden;
}

@keyframes avh-welcome-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes avh-welcome-rise {
	from { opacity: 0; transform: translateY(14px) scale(0.98); }
	to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.avh-currency-welcome__backdrop,
	.avh-currency-welcome__panel {
		animation: none;
	}
	.avh-currency-welcome__option:hover {
		transform: none;
	}
}

/* --- Picker rows ---------------------------------------------------------------------------- */

.avh-currency-menu__list {
	min-width: 12rem;
}

.avh-currency-menu__symbol {
	flex: 0 0 1.2em;
	font-size: 1em;
	text-align: center;
	opacity: 0.75;
}

.avh-currency-menu__code {
	font-weight: 600;
	letter-spacing: 0.06em;
}

.avh-currency-menu__name {
	flex: 1 1 auto;
	overflow: hidden;
	color: var(--avh-muted, #6b6459);
	font-size: 0.85em;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* The active row is ticked, not merely highlighted - the highlight is also the hover state, so on
   its own it cannot tell you which currency you are actually in. */
.avh-currency-menu__tick {
	flex: 0 0 auto;
	color: var(--avh-gold, #c29a4f);
}

.avh-currency-menu__item.is-active .avh-currency-menu__code {
	color: var(--avh-gold-deep, #a37e39);
}
