/* AI search: header trigger (desktop) + dialog. See inc/ai-search.php, assets/js/ai-search.js. */

@property --aisx-a { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

:root {
	--aisx-c1: #2B6BD6;
	--aisx-c2: #22C3EE;
	--aisx-c3: #8B7CFF;
	--aisx-ink-3: #66748C;
}

@keyframes aisx-spin { to { --aisx-a: 360deg; } }
@keyframes aisx-twinkle { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.55); opacity: .55; } }
@keyframes aisx-blob {
	0%, 100% { border-radius: 50% 50% 50% 50% / 50% 50% 50% 50%; }
	33% { border-radius: 58% 42% 46% 54% / 44% 56% 44% 56%; }
	66% { border-radius: 44% 56% 58% 42% / 56% 44% 52% 48%; }
}
@keyframes aisx-ripple { from { box-shadow: 0 0 0 0 rgba(43, 107, 214, .45); } to { box-shadow: 0 0 0 14px rgba(43, 107, 214, 0); } }
@keyframes aisx-scan { from { background-position: 150% 0; } to { background-position: -50% 0; } }
@keyframes aisx-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@keyframes aisx-dot { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
@keyframes aisx-word { from { opacity: 0; filter: blur(4px); } to { opacity: 1; filter: none; } }
@keyframes aisx-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- header trigger ---------- */
.aisx-trigger {
	position: relative; isolation: isolate; display: inline-flex; align-items: center; gap: 8px; height: 44px; margin-block: auto;
	padding-inline: 12px 8px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .05);
	box-shadow: inset 0 0 0 1px rgba(200, 211, 229, .18); color: #fff; cursor: pointer;
	font-family: var(--font-display); font-weight: 500; font-size: .95rem; white-space: nowrap;
	transition: background-color .25s, box-shadow .25s, transform .25s var(--ease-out);
}
.aisx-trigger__ring {
	position: absolute; inset: 0; z-index: -1; border-radius: inherit; padding: 1.5px; pointer-events: none;
	background: conic-gradient(from var(--aisx-a), transparent 0 52%, var(--aisx-c1) 66%, var(--aisx-c2) 78%, var(--aisx-c3) 90%, transparent 100%);
	-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
	mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
	animation: aisx-spin 3.6s linear infinite;
}
.aisx-trigger__ic { flex: none; color: #BFD4FF; overflow: visible; }
.aisx-trigger__ic path { fill: currentColor; transform-box: fill-box; transform-origin: center; }
.aisx-trigger__ic .s1 { animation: aisx-twinkle 2.8s ease-in-out infinite; }
.aisx-trigger__ic .s2 { color: var(--aisx-c2); fill: var(--aisx-c2); animation: aisx-twinkle 2.8s ease-in-out 1.4s infinite; }
.aisx-trigger__ai {
	display: inline-grid; place-items: center; height: 22px; padding-inline: 7px; border-radius: 999px;
	background: linear-gradient(135deg, var(--aisx-c1), var(--aisx-c3)); color: #fff;
	font-family: var(--font-body); font-weight: 800; font-size: .7rem; letter-spacing: .06em;
}
.aisx-trigger:hover { background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 1px rgba(200, 211, 229, .26), 0 0 28px -6px rgba(90, 143, 227, .75); }
.aisx-trigger:active { transform: scale(.97); }
.aisx-trigger:focus-visible { outline: 2px solid var(--blue-300); outline-offset: 3px; }

/* The header shows the burger up to 1100px: the search is a desktop tool. */
@media (max-width: 1100px) { .aisx-trigger { display: none; } }
/* Narrow desktops: a tighter menu so nothing is pushed off the row; under 1380px the trigger is icon + AI tag only. */
@media (min-width: 1101px) and (max-width: 1600px) {
	.site-head__logo { padding-inline: var(--gutter) 22px; }
	.nav__list { gap: clamp(0px, calc((100vw - 1380px) / 18), 12px); }
	.site-head .nav__link { padding-inline: 7px; }
	.site-head__actions { padding-inline: 18px var(--gutter); }
}
@media (min-width: 1101px) {
	.site-head__logo { flex: none; }
}
@media (min-width: 1101px) and (max-width: 1300px) {
	.site-head__logo { padding-inline: var(--gutter) 14px; }
	.site-head .site-head__logo img { width: 104px; }
	.site-head .nav__link { padding-inline: 5px; }
	.nav__link.nav__link { font-size: .88rem; }
	.site-head__actions { padding-inline: 12px var(--gutter); gap: 8px; }
	.site-head__cta { padding-inline: 14px; }
}
@media (min-width: 1101px) and (max-width: 1380px) {
	.aisx-trigger { padding-inline: 10px 7px; gap: 6px; }
	.aisx-trigger__txt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
	.nav__link { font-size: .92rem; }
}

/* ---------- dialog ---------- */
html.aisx-lock { overflow: hidden; }
.aisx {
	position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0;
	border: 0; background: transparent; overflow: hidden; color: var(--ink); font-family: var(--font-body);
}
.aisx::backdrop { background: rgba(5, 13, 32, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity .25s; }
.aisx.is-open::backdrop { opacity: 1; }

.aisx__frame {
	position: relative; width: min(780px, calc(100vw - 32px)); margin: min(10vh, 96px) auto 0;
	opacity: 0; transform: translateY(-14px) scale(.98); transition: opacity .22s, transform .38s var(--ease-out);
}
.aisx.is-open .aisx__frame { opacity: 1; transform: none; }
.aisx__glow {
	position: absolute; inset: -3px; border-radius: 28px; pointer-events: none; opacity: .4; filter: blur(22px);
	background: conic-gradient(from var(--aisx-a), var(--aisx-c1), var(--aisx-c2), var(--aisx-c3), var(--aisx-c1));
	animation: aisx-spin 7s linear infinite; transition: opacity .4s;
}
.aisx.is-thinking .aisx__glow { opacity: .75; animation-duration: 2.2s; }
.aisx__panel {
	position: relative; display: flex; flex-direction: column; max-height: calc(100vh - min(10vh, 96px) - 40px);
	background: #fff; border-radius: 24px; overflow: hidden;
	box-shadow: 0 40px 120px -30px rgba(5, 13, 32, .7), 0 0 0 1px rgba(11, 27, 51, .06);
}
.aisx__x {
	position: absolute; top: 0; inset-inline-start: calc(100% + 12px); display: grid; place-items: center; width: 40px; height: 40px;
	border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer; transition: background-color .2s;
}
.aisx__x:hover { background: rgba(255, 255, 255, .26); }
.aisx__x:focus-visible { outline: 2px solid var(--blue-300); outline-offset: 2px; }

/* the bar */
.aisx__bar { position: relative; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.aisx__orb {
	position: relative; flex: none; width: 38px; height: 38px; border-radius: 50%;
	background: conic-gradient(from var(--aisx-a), var(--aisx-c1), var(--aisx-c2), var(--aisx-c3), var(--aisx-c1));
	animation: aisx-spin 5s linear infinite, aisx-blob 6s ease-in-out infinite;
}
.aisx__orb > span {
	position: absolute; inset: 5px; border-radius: inherit;
	background: radial-gradient(circle at 34% 30%, rgba(255, 255, 255, .95) 0 14%, rgba(255, 255, 255, .25) 38%, rgba(255, 255, 255, 0) 62%);
}
.aisx.is-thinking .aisx__bar .aisx__orb { animation: aisx-spin 1.1s linear infinite, aisx-blob 1.6s ease-in-out infinite, aisx-ripple 1.1s ease-out infinite; }
.aisx__orb--sm { width: 30px; height: 30px; }
.aisx__input {
	flex: 1; min-width: 0; height: 48px; border: 0; outline: 0; background: transparent; color: var(--navy-900);
	font: 500 1.24rem/1.2 var(--font-body); -webkit-appearance: none; appearance: none;
}
.aisx__input::placeholder { color: #8A96AB; opacity: 1; }
.aisx__input::-webkit-search-cancel-button, .aisx__input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.aisx__clear { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border: 0; border-radius: 50%; background: #F1F4F8; color: var(--ink-2); cursor: pointer; }
.aisx__clear:hover { background: var(--blue-100); color: var(--navy-800); }
.aisx__clear[hidden] { display: none; }
.aisx__go {
	display: inline-flex; align-items: center; gap: 8px; height: 42px; flex: none; padding-inline: 14px 16px; border: 0; border-radius: 999px;
	background: var(--navy-800); color: #fff; font: 700 .93rem var(--font-body); cursor: pointer;
	transition: background-color .2s, transform .2s var(--ease-out), box-shadow .2s;
}
.aisx__go:hover { background: var(--blue-500); box-shadow: 0 12px 24px -14px rgba(30, 86, 191, .9); }
.aisx__go:active { transform: scale(.97); }
.aisx__go:focus-visible, .aisx__clear:focus-visible, .aisx__chip:focus-visible { outline: 2px solid var(--blue-400); outline-offset: 2px; }
.aisx__go-ic, .aisx__cap-ic { fill: currentColor; overflow: visible; }
.aisx__go-ic { color: #BFD4FF; }
.aisx__scan {
	position: absolute; inset-inline: 0; bottom: -1px; height: 2px; pointer-events: none; opacity: 0; transition: opacity .3s;
	background: linear-gradient(90deg, transparent 0, var(--aisx-c2) 35%, var(--aisx-c1) 50%, var(--aisx-c3) 65%, transparent 100%) no-repeat;
	background-size: 45% 100%;
}
.aisx.is-thinking .aisx__scan { opacity: 1; animation: aisx-scan 1.15s linear infinite; }

/* the body */
.aisx__body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 18px 12px; }
.aisx__hint { margin: 4px 4px 0; color: var(--aisx-ink-3); font-size: .97rem; }
.aisx__cap { display: flex; align-items: center; gap: 6px; margin: 16px 4px 10px; color: var(--aisx-ink-3); font-size: .8rem; font-weight: 700; letter-spacing: .02em; }
.aisx__cap-ic { width: 15px; height: 15px; color: var(--aisx-c1); }
.aisx__cap--list { margin-top: 12px; }
.aisx__chips { display: flex; flex-wrap: wrap; gap: 8px; padding-inline: 2px; }
.aisx__chip {
	padding: 8px 14px; border: 1px solid var(--blue-200); border-radius: 999px; background: var(--blue-50); color: var(--navy-800);
	font: 600 .92rem var(--font-body); cursor: pointer; transition: background-color .2s, border-color .2s, transform .2s var(--ease-out);
}
.aisx__chip:hover { background: var(--blue-100); border-color: var(--blue-300); }
.aisx__chip:active { transform: scale(.97); }

/* thinking */
.aisx__think { padding: 6px 4px 4px; }
.aisx__step { display: flex; align-items: center; gap: 3px; margin: 6px 0 14px; color: var(--navy-700); font-weight: 600; font-size: .98rem; }
.aisx__step span { margin-inline-end: 3px; }
.aisx__step i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; animation: aisx-dot 1.2s infinite; }
.aisx__step i:nth-of-type(2) { animation-delay: .15s; }
.aisx__step i:nth-of-type(3) { animation-delay: .3s; }
.aisx__skel { display: grid; gap: 10px; }
.aisx__skel span {
	display: block; height: 66px; border-radius: 14px;
	background: linear-gradient(90deg, #F2F5FA 0, #F2F5FA 35%, #E3EDFB 50%, #F2F5FA 65%, #F2F5FA 100%); background-size: 200% 100%;
	animation: aisx-shimmer 1.3s linear infinite;
}
.aisx__skel span:nth-child(2) { animation-delay: .12s; opacity: .8; }
.aisx__skel span:nth-child(3) { animation-delay: .24s; opacity: .6; }

/* answer */
.aisx__answer { position: relative; margin: 2px 0 6px; padding: 2px 18px 16px; border-radius: 18px; background: linear-gradient(135deg, var(--blue-50) 0%, #F6F4FF 100%); box-shadow: inset 0 0 0 1px var(--blue-100); }
.aisx__answer .aisx__cap { margin: 14px 0 6px; }
.aisx__answer.is-soft { background: #F7F8FA; box-shadow: inset 0 0 0 1px var(--line); }
.aisx__text { margin: 0; color: var(--navy-900); font-size: 1.08rem; line-height: 1.6; }
.aisx__w { opacity: 0; animation: aisx-word .5s ease-out forwards; animation-delay: calc(var(--w, 0) * 26ms); }

/* results */
.aisx__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.aisx__list.is-ai { margin-top: 10px; }
.aisx-item__link {
	position: relative; display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; align-items: center; gap: 14px; width: 100%;
	padding: 9px 10px; border: 0; border-radius: 14px; background: none; color: inherit; font: inherit; text-align: start; text-decoration: none; cursor: pointer;
	transition: background-color .15s;
}
.aisx-item[aria-selected="true"] .aisx-item__link { background: var(--blue-50); box-shadow: inset 0 0 0 1px var(--blue-100); }
.aisx-item[aria-selected="true"] .aisx-item__link::before {
	content: ''; position: absolute; inset-block: 14px; inset-inline-start: 0; width: 3px; border-radius: 3px;
	background: linear-gradient(var(--aisx-c2), var(--aisx-c1), var(--aisx-c3));
}
.aisx-item__media {
	display: grid; place-items: center; width: 54px; height: 54px; border-radius: 12px; overflow: hidden;
	background: #fff; box-shadow: inset 0 0 0 1px var(--line); color: var(--blue-500);
}
.aisx-item__media img { width: 100%; height: 100%; object-fit: contain; }
.aisx-item__media--category img { object-fit: cover; }
.aisx-item__media--page, .aisx-item__media--post, .aisx-item__media--category { background: var(--blue-50); box-shadow: none; }
.aisx-item__media--ask { background: none; box-shadow: none; }
.aisx-item__body { display: grid; gap: 2px; min-width: 0; }
.aisx-item__title, .aisx-item__why { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aisx-item__title { color: var(--navy-900); font-weight: 700; font-size: .99rem; }
.aisx-item__why { color: var(--aisx-ink-3); font-size: .87rem; }
.aisx-item__tags { display: flex; align-items: center; gap: 6px; }
.aisx-item__type, .aisx-item__prod { padding: 3px 9px; border-radius: 999px; font-size: .74rem; font-weight: 700; white-space: nowrap; }
.aisx-item__type { background: #F1F4F8; color: var(--aisx-ink-3); }
.aisx-item__prod { background: var(--blue-100); color: var(--blue-600); }
.aisx-item--ask .aisx-item__title { color: var(--blue-600); }
.aisx-item__key { display: grid; place-items: center; width: 28px; height: 26px; border-radius: 7px; box-shadow: inset 0 0 0 1px var(--blue-200); color: var(--blue-600); }
.aisx__list.is-ai .aisx-item { opacity: 0; animation: aisx-in .45s var(--ease-out) forwards; animation-delay: calc(var(--i, 0) * 55ms + 220ms); }

.aisx__more { margin-top: 6px; }

/* footer */
.aisx__foot {
	display: flex; justify-content: space-between; gap: 16px; padding: 10px 20px; border-top: 1px solid var(--line);
	background: #FAFBFD; color: var(--aisx-ink-3); font-size: .78rem;
}

@media (prefers-reduced-motion: reduce) {
	.aisx-trigger__ring, .aisx-trigger__ic path, .aisx__glow, .aisx__orb, .aisx.is-thinking .aisx__bar .aisx__orb,
	.aisx__scan, .aisx__skel span, .aisx__step i { animation: none !important; }
	.aisx__w, .aisx__list.is-ai .aisx-item { animation: none; opacity: 1; }
	.aisx__frame { transition: opacity .15s; transform: none; }
}
body.dg-noanim .aisx-trigger__ring, body.dg-noanim .aisx__glow, body.dg-noanim .aisx__orb, html.a11y-noanim .aisx-trigger__ring, html.a11y-noanim .aisx__glow, html.a11y-noanim .aisx__orb { animation: none; }
.aisx__body { scrollbar-width: thin; scrollbar-color: var(--blue-200) transparent; }
.aisx__body::-webkit-scrollbar { width: 8px; }
.aisx__body::-webkit-scrollbar-thumb { background: var(--blue-200); border-radius: 8px; border: 2px solid #fff; }
