/* Luxe More – site search (header box, drop-down, phone sheet). Colours from the theme presets. */

.lm-search, .lm-search__box, .lm-search-scrim {
	--s-ink: var(--wp--preset--color--ink, #2E1A0E);
	--s-velvet: var(--wp--preset--color--velvet, #211209);
	--s-text: var(--wp--preset--color--contrast, #2E1A0E);
	--s-muted: var(--wp--preset--color--muted, #6E5B4B);
	--s-line: var(--wp--preset--color--line, #E2D2BE);
	--s-paper: var(--wp--preset--color--paper, #FDF4E9);
	--s-base: var(--wp--preset--color--base, #F6E8DA);
	--s-gold: var(--wp--preset--color--gold, #A9803F);
	--s-gold-ink: var(--lm-gold-ink, #7A5A24);
	--s-ease: var(--lm-ease, cubic-bezier(.2, .7, .2, 1));
}
.lm-search { position: relative; display: flex; align-items: center; flex: none; }
.lm-search [hidden], .lm-search__box [hidden] { display: none !important; }

/* the magnifier button (tablets, phones, narrow laptops) */
.lm-search__toggle {
	display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%;
	background: transparent; color: var(--s-text); cursor: pointer; transition: color .2s, background-color .2s;
}
.lm-search__toggle:hover { color: var(--s-gold-ink); }
.lm-search__toggle svg { width: 20px; height: 20px; }

/* ---------- the field ---------- */
.lm-search__form {
	display: flex; align-items: center; gap: .5rem; height: 38px; margin: 0; padding: 0 .35rem 0 .8rem;
	background: var(--s-paper); border: 1px solid var(--s-line); border-radius: 999px; box-sizing: border-box;
	transition: width .28s var(--s-ease), border-color .2s, box-shadow .2s;
}
.lm-search__form:focus-within { border-color: var(--s-gold); box-shadow: 0 0 0 3px rgba(169, 128, 63, .16); }
.lm-search__icon { display: grid; color: var(--s-muted); flex: none; }
.lm-search__icon svg { width: 17px; height: 17px; }
.lm-search__input {
	flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: transparent; color: var(--s-text);
	font: inherit; font-size: .875rem; line-height: 1; -webkit-appearance: none; appearance: none; border-radius: 0;
}
.lm-search__input::placeholder { color: var(--s-muted); opacity: .9; }
.lm-search__input::-webkit-search-cancel-button, .lm-search__input::-webkit-search-decoration { -webkit-appearance: none; }
.lm-search__input:focus-visible { outline: 0; }
.lm-search__clear {
	display: grid; place-items: center; width: 26px; height: 26px; flex: none; padding: 0; border: 0; border-radius: 50%;
	background: var(--s-base); color: var(--s-muted); cursor: pointer;
}
.lm-search__clear:hover { color: var(--s-text); }
.lm-search__cancel { display: none; }

/* ---------- wide screens: a small box next to "ติดต่อเรา", wider while in use ---------- */
@media (min-width: 1280px) {
	.lm-search__toggle { display: none; }
	.lm-search__box { position: relative; width: 220px; height: 38px; }
	.lm-search__box .lm-search__form { position: absolute; top: 0; right: 0; width: 100%; z-index: 2; }
	.lm-search.is-active .lm-search__box .lm-search__form { width: 320px; box-shadow: 0 0 0 3px rgba(169, 128, 63, .16), 0 10px 30px -18px rgba(46, 26, 14, .45); }
	.lm-search__box .lm-search__panel {
		position: absolute; top: calc(100% + 10px); right: 0; z-index: 3; width: 600px; max-width: calc(100vw - 32px);
		max-height: min(72vh, 660px); overflow-y: auto; overscroll-behavior: contain;
		background: var(--s-paper); border: 1px solid var(--s-line); border-radius: 18px;
		box-shadow: 0 24px 60px -24px rgba(46, 26, 14, .4), 0 2px 6px rgba(46, 26, 14, .06);
		animation: lm-search-drop .22s var(--s-ease);
	}
}
@keyframes lm-search-drop { from { opacity: 0; transform: translateY(-6px); } }
@media (max-width: 1279px) {
	.lm-search__box:not(.is-sheet) { display: none; }
}

/* ---------- the sheet (opened from the magnifier) ---------- */
.lm-search-scrim { position: fixed; inset: 0; z-index: 100000; background: rgba(46, 26, 14, .45); backdrop-filter: blur(2px); animation: lm-search-fade .2s ease; }
@keyframes lm-search-fade { from { opacity: 0; } }
html.lm-search-open { overflow: hidden; }
.lm-search__box.is-sheet {
	position: fixed; z-index: 100001; left: 0; right: 0; top: 0; display: flex; flex-direction: column;
	background: var(--s-paper); color: var(--s-text); font-family: var(--wp--preset--font-family--body, inherit);
	box-shadow: 0 20px 60px -20px rgba(46, 26, 14, .45);
}
.lm-search__box.is-sheet .lm-search__form { height: 48px; flex: none; }
.lm-search__box.is-sheet .lm-search__input { font-size: 16px; } /* 16px keeps iOS from zooming in */
.lm-search__box.is-sheet .lm-search__cancel {
	display: block; flex: none; padding: .4rem .5rem; border: 0; background: transparent; color: var(--s-gold-ink);
	font: inherit; font-size: .9375rem; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.lm-search__box.is-sheet .lm-search__panel { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
@media (max-width: 599px) {
	.lm-search__box.is-sheet { bottom: 0; padding-top: env(safe-area-inset-top, 0px); animation: lm-search-up .28s var(--s-ease); }
	.lm-search__box.is-sheet .lm-search__form { margin: .75rem 1rem .25rem; }
	.lm-search__box.is-sheet .lm-search__panel { padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px)); }
}
@keyframes lm-search-up { from { transform: translateY(24px); opacity: 0; } }
@media (min-width: 600px) and (max-width: 1279px) {
	.lm-search__box.is-sheet {
		max-height: 86vh; padding: 1.1rem max(1.25rem, calc((100vw - 760px) / 2)) 1rem; border-radius: 0 0 22px 22px;
		animation: lm-search-drop .25s var(--s-ease);
	}
	.lm-search__box.is-sheet .lm-search__panel { margin-top: .5rem; }
}
@media (prefers-reduced-motion: reduce) {
	.lm-search__box.is-sheet, .lm-search__panel, .lm-search-scrim { animation: none !important; }
	.lm-search__form { transition: none; }
}

/* ---------- contents ---------- */
.lm-search__list { padding: .5rem 0 .6rem; font-size: .9375rem; color: var(--s-text); }
.lm-search__group { margin: 0 0 .35rem; }
.lm-search__label {
	display: flex; align-items: center; justify-content: space-between; gap: 1rem;
	margin: .65rem 1.1rem .4rem; font-size: .75rem; font-weight: 600; letter-spacing: .02em; color: var(--s-muted);
}
.lm-search__wipe { padding: 0; border: 0; background: none; color: var(--s-gold-ink); font: inherit; cursor: pointer; }
.lm-search__note { margin: .9rem 1.1rem; color: var(--s-muted); font-size: .875rem; }

/* product and article rows */
.lm-search__item {
	display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: .85rem;
	margin: 0 .45rem; padding: .45rem .65rem; border-radius: 12px; color: inherit; text-decoration: none;
}
.lm-search__item.is-active, .lm-search__term.is-active, .lm-search__chip.is-active { background: var(--s-base); }
.lm-search__item.is-active .lm-search__name { color: var(--s-gold-ink); }
.lm-search__thumb { width: 48px; height: 48px; border-radius: 10px; overflow: hidden; background: var(--s-base); display: grid; place-items: center; color: var(--s-muted); }
.lm-search__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lm-search__item--read { grid-template-columns: 40px minmax(0, 1fr); }
.lm-search__thumb--read { width: 40px; height: 40px; }
.lm-search__text { display: grid; gap: .1rem; min-width: 0; }
.lm-search__name { font-weight: 500; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.lm-search__name mark, .lm-search__chip mark, .lm-search__term mark { background: rgba(169, 128, 63, .22); color: inherit; border-radius: 3px; padding: 0 1px; }
.lm-search__meta { display: flex; align-items: center; gap: .3rem; min-width: 0; font-size: .75rem; color: var(--s-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lm-search__meta span { overflow: hidden; text-overflow: ellipsis; }
.lm-search__dot { width: 11px; height: 11px; flex: none; border-radius: 50%; background: var(--c, var(--s-line)); box-shadow: inset 0 0 0 1px rgba(46, 26, 14, .18); display: inline-block; }
.lm-search__meta .lm-search__dot + .lm-search__dot { margin-left: -6px; }
.lm-search__price { display: grid; justify-items: end; gap: .1rem; font-size: .875rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lm-search__price b { font-weight: 600; }
.lm-search__price del { color: var(--s-muted); font-size: .75rem; }
.lm-search__price em { font-style: normal; font-size: .8125rem; font-weight: 500; color: var(--s-gold-ink); }
.lm-search__price small { font-size: .6875rem; color: var(--s-muted); padding: .05rem .45rem; border: 1px solid var(--s-line); border-radius: 999px; }

/* chips: recent searches, categories, colours */
.lm-search__chips { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0 1.1rem .35rem; }
.lm-search__chip {
	display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .8rem; border: 1px solid var(--s-line); border-radius: 999px;
	background: #fff; color: var(--s-text); font: inherit; font-size: .8125rem; line-height: 1.2; text-decoration: none; cursor: pointer;
	transition: border-color .2s, background-color .2s;
}
.lm-search__chip:hover { border-color: var(--s-text); }
.lm-search__chip small { color: var(--s-muted); font-size: .6875rem; font-variant-numeric: tabular-nums; }
.lm-search__chip .lm-search__ico { display: grid; color: var(--s-muted); }

/* suggested words (colours, meanings) */
.lm-search__term {
	display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: .65rem;
	margin: 0 .45rem; padding: .55rem .65rem; border-radius: 12px; color: inherit; text-decoration: none;
}
.lm-search__term .lm-search__ico { display: grid; color: var(--s-muted); }
.lm-search__term .lm-search__dot { width: 14px; height: 14px; margin: 0 3px; }
.lm-search__term small { font-size: .75rem; color: var(--s-muted); }

/* compatibility notes */
.lm-search__hint {
	display: flex; gap: .6rem; align-items: flex-start; margin: .6rem 1.1rem .4rem; padding: .7rem .85rem;
	border-radius: 12px; background: var(--s-base); font-size: .8125rem; line-height: 1.55;
}
.lm-search__hint .lm-search__ico { display: grid; color: var(--s-gold); flex: none; }

/* "see all" */
.lm-search__all {
	display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: .6rem .75rem .15rem; padding: .8rem 1rem;
	border-radius: 12px; background: var(--s-ink); color: var(--s-paper); font-size: .875rem; font-weight: 500; text-decoration: none;
}
.lm-search__all:hover, .lm-search__all.is-active { background: var(--s-velvet); color: var(--s-paper); }
.lm-search__all .lm-search__ico { display: grid; }

/* nothing found */
.lm-search__none { margin: .8rem 1.1rem .6rem; font-size: .875rem; color: var(--s-muted); }
.lm-search__none p { margin: .2rem 0; }
.lm-search__none-title { color: var(--s-text) !important; font-weight: 600; font-size: .9375rem; }
.lm-search__contact { color: var(--s-gold-ink); font-weight: 500; }

.lm-search__item:focus-visible, .lm-search__chip:focus-visible, .lm-search__term:focus-visible, .lm-search__all:focus-visible { outline: 2px solid var(--s-gold); outline-offset: -2px; }

/* Phone search: quieter browsing, generous rows, optional colour filters. */
@media (max-width: 599px) {
	.lm-search__box.is-sheet .lm-search__form {
		height: 56px; margin: 1rem 1.25rem 0; padding: 0; gap: .65rem;
		border: 0; border-bottom: 1px solid var(--s-line); border-radius: 0; background: transparent;
	}
	.lm-search__box.is-sheet .lm-search__form:focus-within { border-color: var(--s-gold); box-shadow: none; }
	.lm-search__box.is-sheet .lm-search__cancel { padding: .65rem 0 .65rem .25rem; font-size: .8125rem; color: var(--s-muted); }
	.lm-search__box.is-sheet .lm-search__clear { width: 32px; height: 40px; background: transparent; }
	.lm-search__box.is-sheet .lm-search__panel { min-height: 0; }
	.lm-search__list { padding: 1.75rem 0 1rem; }
	.lm-search__group { margin-bottom: 1.75rem; }
	.lm-search__label { margin: 0 1.25rem .9rem; font-size: .75rem; font-weight: 500; letter-spacing: .04em; }
	.lm-search__chips { gap: .5rem; padding: 0 1.25rem; }
	.lm-search__chip { min-height: 40px; box-sizing: border-box; background: transparent; padding: .6rem .8rem; }
	.lm-search__group--browse .lm-search__chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.25rem; }
	.lm-search__group--browse .lm-search__chip {
		justify-content: space-between; gap: .3rem; min-height: 58px; padding: .7rem 0;
		border: 0; border-bottom: 1px solid var(--s-line); border-radius: 0; line-height: 1.5;
	}
	.lm-search__group--browse .lm-search__chip span { min-width: 0; }
	.lm-search__group--browse .lm-search__chip small { flex: none; font-size: .625rem; }
	.lm-search__group--colours .lm-search__label { margin-bottom: 0; }
	.lm-search__disclosure {
		display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 44px;
		padding: .5rem 0; border: 0; background: transparent; color: var(--s-text); font: inherit; cursor: pointer;
	}
	.lm-search__disclosure::after { content: '+'; font-size: 1.25rem; font-weight: 400; color: var(--s-gold-ink); }
	.lm-search__disclosure[aria-expanded="true"]::after { content: '−'; }
	.lm-search__disclosure:focus-visible { outline: 2px solid var(--s-gold); outline-offset: 2px; }
	.lm-search__group--colours .lm-search__chips { padding-top: .75rem; }
	.lm-search__item {
		grid-template-columns: 64px minmax(0, 1fr) auto; gap: .85rem;
		margin: 0 1.25rem; padding: .8rem 0; border-radius: 0; border-bottom: 1px solid var(--s-line);
	}
	.lm-search__item:last-child { border-bottom: 0; }
	.lm-search__thumb { width: 64px; height: 64px; border-radius: 6px; }
	.lm-search__name { font-size: .8125rem; line-height: 1.6; }
	.lm-search__text { gap: .35rem; }
	.lm-search__meta { font-size: .6875rem; }
	.lm-search__price { font-size: .8125rem; }
	.lm-search__item--read { grid-template-columns: 48px minmax(0, 1fr); }
	.lm-search__thumb--read { width: 48px; height: 48px; }
	.lm-search__term { margin: 0 1.25rem; padding: .8rem 0; }
	.lm-search__all { margin: 1.5rem 1.25rem .5rem; border-radius: 6px; }
	.lm-search__note, .lm-search__none, .lm-search__hint { margin-left: 1.25rem; margin-right: 1.25rem; }
}

/* ---------- header room on phones: the other language only ("EN" on Thai pages, "TH" on English ones) ---------- */
@media (max-width: 600px) {
	.lm-header .lm-header__tools .lm-lang__item.is-current, .lm-header .lm-header__tools .lm-lang__sep { display: none; }
	.lm-header .lm-header__row { gap: .45rem; } /* this file loads before the theme's, so one class more */
	.lm-header .lm-header__row .lm-header__tools { gap: .4rem; }
	.lm-search__toggle { width: 28px; height: 28px; }
}
