/* Our own dropdowns (Bugpot CO6PTW), drawn by assets/js/dropdown.js in place of every front-end <select>.
   The look is the forms' own: rounded-sm, a border of rgb(var(--ln-ink) / .2), the accent as the focus ring,
   Barlow. It reads the page tokens, so it follows light and dark mode. The checkout and the Submit a story
   form have fields of their own shape, and the button follows them. */

.tnd { position: relative; display: block; width: 100%; max-width: 100%; }
.tnd[hidden] { display: none; }

/* The real select stays under the button, invisible, so the browser's own "please choose one"
   message points at the button, and the form still sends the value. */
.tnd .tnd__native { position: absolute !important; inset: 0 !important; width: 100% !important; height: 100% !important; margin: 0 !important; padding: 0 !important; border: 0 !important; opacity: 0 !important; pointer-events: none !important; }

.tnd .tnd__btn {
	position: relative;
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	box-sizing: border-box;
	height: auto;
	min-height: 42px;
	margin: 0;
	padding: 10px 40px 10px 14px;
	border: 1px solid rgb(var(--ln-ink) / .2);
	border-radius: .125rem;
	background: rgb(var(--sf-panel));
	color: rgb(var(--tx-ink));
	font: 400 .875rem/1.25rem Barlow, system-ui, sans-serif;
	letter-spacing: normal;
	text-align: left;
	text-transform: none;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.tnd .tnd__btn:hover { border-color: rgb(var(--ln-ink) / .38); }
.tnd .tnd__btn:focus { outline: 0; }
.tnd .tnd__btn:focus-visible,
.tnd .tnd__native:focus + .tnd__btn,
.tnd.is-open .tnd__btn { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tnd .tnd__btn.is-invalid, .woocommerce-invalid .tnd .tnd__btn { border-color: #d64545; }
.tnd .tnd__btn:disabled { opacity: .55; cursor: not-allowed; }
.tnd__val { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tnd__btn i {
	position: absolute;
	right: 16px;
	top: 50%;
	width: 7px;
	height: 7px;
	margin-top: -6px;
	border-right: 2px solid rgb(var(--tx-muted));
	border-bottom: 2px solid rgb(var(--tx-muted));
	transform: rotate(45deg);
	transition: transform .15s, margin .15s, border-color .15s;
	pointer-events: none;
}
.tnd .tnd__btn:hover i, .tnd.is-open .tnd__btn i { border-color: rgb(var(--tx-ink)); }
.tnd.is-open .tnd__btn i { transform: rotate(-135deg); margin-top: -1px; }

/* ---------- the list ---------- */
.tnd__pop {
	position: fixed;
	z-index: 100000;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	max-width: calc(100vw - 16px);
	background: rgb(var(--sf-panel));
	color: rgb(var(--tx-ink));
	border: 1px solid rgb(var(--ln-ink) / .22);
	border-top: 2px solid var(--accent);
	border-radius: 0 0 4px 4px;
	box-shadow: 0 14px 34px rgba(0, 0, 0, .2);
	font: 400 .9rem/1.3 Barlow, system-ui, sans-serif;
	letter-spacing: normal;
	text-align: left;
	text-transform: none;
	animation: tnd-in .12s ease-out;
}
.tnd__pop.is-up { border-top-width: 1px; border-bottom: 2px solid var(--accent); border-radius: 4px 4px 0 0; animation-name: tnd-up; }
:root[data-theme="dark"] .tnd__pop { box-shadow: 0 14px 34px rgba(0, 0, 0, .6); }
.tnd__pop--sheet { border-radius: 4px; }
.tnd__veil { position: fixed; inset: 0; z-index: 99999; background: rgba(0, 0, 0, .4); }

.tnd__sw { flex: none; padding: 8px; border-bottom: 1px solid rgb(var(--ln-ink) / .14); }
.tnd__search {
	display: block;
	width: 100%;
	box-sizing: border-box;
	height: 38px;
	margin: 0;
	padding: 0 12px;
	border: 1px solid rgb(var(--ln-ink) / .28);
	border-radius: 3px;
	background: rgb(var(--sf-panel));
	color: rgb(var(--tx-ink));
	font: 400 16px/1.2 Barlow, system-ui, sans-serif; /* 16px, so a phone does not zoom in on it */
	box-shadow: none;
}
.tnd__search::placeholder { color: rgb(var(--tx-sdark)); }
.tnd__search:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tnd__none { margin: 0; padding: 14px; color: rgb(var(--tx-sdark)); font-size: .88rem; }

.tnd__list { position: relative; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 0; outline: 0; -webkit-overflow-scrolling: touch; }
.tnd__group + .tnd__group, .tnd__opt + .tnd__group { margin-top: 4px; padding-top: 4px; border-top: 1px solid rgb(var(--ln-ink) / .14); }
.tnd__glabel { margin: 0; padding: 8px 14px 3px; font: 700 .7rem/1.2 Rajdhani, sans-serif; text-transform: uppercase; letter-spacing: .12em; color: rgb(var(--tx-sdark)); }
.tnd__opt { position: relative; display: block; padding: 9px 38px 9px 14px; border-left: 3px solid transparent; cursor: pointer; overflow-wrap: anywhere; }
.tnd__opt[hidden], .tnd__group[hidden] { display: none; }
.tnd__opt small { display: block; margin-top: 2px; font-size: .78rem; line-height: 1.4; color: rgb(var(--tx-sdark)); }
.tnd__opt.is-active { background: rgb(var(--sf-tint)); border-left-color: var(--accent); }
.tnd__opt[aria-selected="true"] .tnd__name { font-weight: 700; }
.tnd__opt[aria-selected="true"]::after {
	content: "";
	position: absolute;
	right: 14px;
	top: 50%;
	width: 5px;
	height: 10px;
	margin-top: -7px;
	border-right: 2px solid #8a4800; /* a darker orange on the light page, where #f49731 is too pale to read as a tick */
	border-bottom: 2px solid #8a4800;
	transform: rotate(45deg);
}
:root[data-theme="dark"] .tnd__opt[aria-selected="true"]::after { border-color: var(--accent); }
.tnd__opt.is-off { opacity: .45; cursor: default; }

@keyframes tnd-in { from { opacity: 0; transform: translateY(-4px); } }
@keyframes tnd-up { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) {
	.tnd__pop { animation: none; }
	.tnd .tnd__btn, .tnd__btn i { transition: none; }
}

/* ---------- Submit a story: its fields are a little taller, a warm grey, with a 4px corner ---------- */
.sts-select:has(> .tnd)::after { display: none; } /* the form drew its own arrow over the select */
.sts-select .tnd .tnd__btn { min-height: 0; padding: .8rem 2.6rem .8rem .95rem; background: rgb(var(--sf-warm)); border-color: rgb(var(--ln-ink) / .16); border-radius: 4px; font-size: .95rem; line-height: 1.5; }
.sts-select .tnd .tnd__btn:hover { border-color: rgb(var(--ln-ink) / .32); }
.sts-select .tnd .tnd__btn:focus-visible,
.sts-select .tnd .tnd__native:focus + .tnd__btn,
.sts-select .tnd.is-open .tnd__btn { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); background: rgb(var(--sf-panel)); box-shadow: none; }

/* ---------- Checkout (and the other .cko forms): 48px fields, a line under them that turns amber ---------- */
.cko .tnd .tnd__btn { min-height: 48px; height: 48px; padding: 0 44px 0 14px; font: 400 .98rem/1.3 Barlow, system-ui, sans-serif; background: rgb(var(--sf-field)); border: 1px solid transparent; border-bottom-color: rgb(var(--ln-ink) / .22); border-radius: 4px 4px 0 0; }
.cko .tnd .tnd__btn:hover { background: rgb(var(--sf-field-h)); border-color: transparent; border-bottom-color: rgb(var(--ln-ink) / .22); }
.cko .tnd .tnd__btn:focus-visible,
.cko .tnd .tnd__native:focus + .tnd__btn,
.cko .tnd.is-open .tnd__btn { background: rgb(var(--sf-panel)); border-color: rgb(var(--tx-ink)); border-bottom-color: var(--accent); border-radius: 4px; outline: 2px solid rgba(244, 151, 49, .35); outline-offset: 0; box-shadow: none; }
.cko .woocommerce-invalid .tnd .tnd__btn, .cko .tnd .tnd__btn.is-invalid { border-bottom-color: #d64545; }

/* ---------- The basket's shipping calculator sits on a dark card ---------- */
.bkp-sum .tnd .tnd__btn { height: 42px; min-height: 42px; padding: 0 34px 0 12px; background: #16181d; border: 1px solid rgba(255, 255, 255, .14); border-radius: 4px; color: #fff; font: 400 .9rem Barlow, system-ui, sans-serif; letter-spacing: normal; text-transform: none; }
.bkp-sum .tnd .tnd__btn:hover { border-color: rgba(255, 255, 255, .3); }
.bkp-sum .tnd .tnd__btn i { right: 14px; border-color: var(--accent); }
.bkp-sum .tnd .tnd__btn:focus-visible, .bkp-sum .tnd .tnd__native:focus + .tnd__btn, .bkp-sum .tnd.is-open .tnd__btn { border-color: var(--accent); box-shadow: none; }
