/* Parasbuilds extras: assistant, command palette, hidden terminal, matrix tint.
   Base styles for .pb-ask, .pb-ask-btn and .pb-cmdk live in pb.css; this file extends them.
   Loaded async: nothing here is needed for first paint. */

/* ---------- Assistant launcher ---------- */
.pb-ask-btn { opacity: 0; translate: 0 14px; visibility: hidden; transition: opacity .5s var(--pb-ease), translate .7s var(--pb-ease), visibility 0s .5s, border-color var(--pb-t1), background var(--pb-t1); }
.pb-ask-btn.is-in { opacity: 1; translate: 0 0; visibility: visible; transition: opacity .5s var(--pb-ease), translate .7s var(--pb-ease), visibility 0s, border-color var(--pb-t1), background var(--pb-t1); }
.pb-ask-btn[aria-expanded="true"] { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .2s, visibility 0s .2s; }
.pb-ask-btn:focus-visible { outline: 2px solid var(--pb-accent); outline-offset: 3px; }
@media (hover: hover) { .pb-ask-btn:hover { border-color: rgba(200, 255, 46, .55); background: rgba(16, 16, 21, .95); } }
.pb-ask-btn__txt { white-space: nowrap; }

/* ---------- Assistant panel ---------- */
.pb-ask { transition: opacity .35s var(--pb-ease), transform .5s var(--pb-ease); }
.pb-ask.is-pre { opacity: 0; transform: translateY(16px) scale(.97); }
.pb-ask:focus { outline: none; }
.pb-ask__orb { width: 30px; height: 30px; flex: none; }
.pb-ask__id { min-width: 0; }
.pb-ask__id small { display: block; line-height: 1.35; margin-top: 2px; }
.pb-ask__tools { margin-left: auto; display: flex; gap: 6px; flex: none; }
.pb-ask__head .pb-ask__tools .pb-iconbtn { margin-left: 0; width: 36px; height: 36px; }
.pb-ask__tools .pb-iconbtn svg { width: 17px; height: 17px; }
.pb-ask__lang { font: 500 11px/1 var(--pb-font-mono); letter-spacing: .04em; }
.pb-ask .pb-iconbtn { transition: background var(--pb-t1), color var(--pb-t1), border-color var(--pb-t1); }
.pb-ask .pb-iconbtn[aria-pressed="true"]:not(.pb-ask__mic) { background: var(--pb-accent); color: var(--pb-ink); border-color: transparent; }
.pb-ask__tts .pb-ask__mute { display: none; }
.pb-ask__tts[aria-pressed="false"] .pb-ask__wave { display: none; }
.pb-ask__tts[aria-pressed="false"] .pb-ask__mute { display: inline; }
@media (hover: hover) { .pb-ask .pb-iconbtn:hover { border-color: var(--pb-accent); } }
.pb-ask .pb-iconbtn:focus-visible, .pb-ask__sugg button:focus-visible, .pb-ask__acts button:focus-visible { outline: 2px solid var(--pb-accent); outline-offset: 2px; }

.pb-ask__log { scrollbar-width: thin; scrollbar-color: var(--pb-line-2) transparent; }
.pb-ask__msg { overflow-wrap: anywhere; }
.pb-ask__msg--bot { white-space: normal; max-width: 92%; }
.pb-ask__msg p { margin: 0 0 .45em; }
.pb-ask__msg p:last-child { margin-bottom: 0; }
.pb-ask__msg .pb-ask__note { color: var(--pb-muted); font-size: 13.5px; margin-top: .6em; }
.pb-ask__msg a { text-underline-offset: 3px; }
.pb-ask__msg--bot, .pb-ask__msg--me { animation: pb-ask-in .45s var(--pb-ease) both; }
@keyframes pb-ask-in { from { opacity: 0; transform: translateY(8px); } }

.pb-ask__list { list-style: none; margin: .55em 0 0; padding: 0; display: grid; gap: 6px; }
.pb-ask__list li { display: grid; gap: 3px; padding: 10px 12px; border: 1px solid var(--pb-line); border-radius: 12px; background: rgba(7, 7, 10, .35); }
.pb-ask__list strong { font-weight: 600; font-size: 14.5px; line-height: 1.3; }
.pb-ask__meta { font: 500 11.5px/1.4 var(--pb-font-mono); color: var(--pb-accent); letter-spacing: .02em; }
.pb-ask__sub { color: var(--pb-muted); font-size: 13.5px; line-height: 1.4; }
.pb-ask__links { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 3px; font: 500 12px/1.4 var(--pb-font-mono); text-transform: uppercase; letter-spacing: .06em; }
.pb-ask__links a { color: var(--pb-text); text-decoration: none; border-bottom: 1px solid var(--pb-line-2); padding: 4px 0 2px; }
@media (hover: hover) { .pb-ask__links a:hover { color: var(--pb-accent); border-color: var(--pb-accent); } }
.pb-ask__list--plain { gap: 5px; }
.pb-ask__list--plain li { display: block; position: relative; padding: 0 0 0 20px; border: 0; background: none; border-radius: 0; }
.pb-ask__list--plain li strong { font-weight: 500; font-size: 14px; }
.pb-ask__list--plain li::before { content: ""; position: absolute; left: 2px; top: .5em; width: 9px; height: 5px; border-left: 1.6px solid var(--pb-accent); border-bottom: 1.6px solid var(--pb-accent); transform: rotate(-45deg); }

.pb-ask__acts { margin-top: 10px; }
.pb-ask__acts button { min-height: 36px; transition: background var(--pb-t1), color var(--pb-t1), border-color var(--pb-t1); }
.pb-ask__acts button.is-primary { background: var(--pb-accent); color: var(--pb-ink); border-color: transparent; font-weight: 600; }
@media (hover: hover) { .pb-ask__acts button.is-primary:hover { background: var(--pb-text); } }

.pb-ask__typing { display: inline-flex; align-items: center; gap: 0; padding: 14px 16px; }

.pb-ask__status { margin: 0; padding: 0 16px; max-height: 0; overflow: hidden; font: 500 11.5px/1.5 var(--pb-font-mono); color: var(--pb-muted); transition: max-height var(--pb-t2) var(--pb-ease), padding var(--pb-t2) var(--pb-ease); }
.pb-ask__status.is-on { max-height: 60px; padding: 2px 16px 8px; }
.pb-ask__sugg { padding-top: 2px; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
.pb-ask__sugg button { min-height: 36px; flex: none; transition: background var(--pb-t1), color var(--pb-t1); }

.pb-ask__bar { align-items: center; }
.pb-ask__bar .pb-iconbtn { flex: none; }
.pb-ask__send { background: var(--pb-accent); color: var(--pb-ink); border-color: transparent; }
@media (hover: hover) { .pb-ask__send:hover { background: var(--pb-text); } }
.pb-ask__mic.is-off { opacity: .45; cursor: help; }
.pb-ask__bar input::placeholder { color: var(--pb-muted); }

@media (max-width: 520px) {
	.pb-ask { height: 100dvh; transform-origin: 50% 100%; }
	.pb-ask__head { padding-top: max(14px, env(safe-area-inset-top)); }
	.pb-ask__bar { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
	.pb-ask__msg { font-size: 15px; }
	.pb-ask__tools .pb-iconbtn, .pb-ask__head .pb-ask__tools .pb-iconbtn { width: 40px; height: 40px; }
	body.admin-bar .pb-ask { height: calc(100dvh - 46px); }
}
/* Logged-in admins: keep the panel clear of the WordPress toolbar. */
@media (min-width: 521px) { body.admin-bar .pb-ask { height: min(620px, calc(100svh - 36px - 32px)); } }

/* ---------- Command palette ---------- */
.pb-cmdk__scrim { position: absolute; inset: 0; background: rgba(7, 7, 10, .62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: opacity .3s var(--pb-ease); }
.pb-cmdk__box { z-index: 1; display: flex; flex-direction: column; max-height: calc(100svh - 12vh - 24px); transition: opacity .3s var(--pb-ease), transform .45s var(--pb-ease); }
.pb-cmdk.is-pre .pb-cmdk__scrim { opacity: 0; }
.pb-cmdk.is-pre .pb-cmdk__box { opacity: 0; transform: translateY(-10px) scale(.98); }
.pb-cmdk__in { position: relative; flex: none; }
.pb-cmdk__search { position: absolute; left: 20px; top: 50%; width: 18px; height: 18px; margin-top: -9px; color: var(--pb-muted); pointer-events: none; }
.pb-cmdk__box .pb-cmdk__in input { padding: 0 64px 0 50px; }
.pb-cmdk__box .pb-cmdk__in input::placeholder { color: var(--pb-muted); }
.pb-cmdk__esc { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font: 500 10px/1 var(--pb-font-mono); padding: 5px 6px; border: 1px solid var(--pb-line-2); border-radius: 5px; color: var(--pb-muted); text-transform: uppercase; background: none; cursor: pointer; }
.pb-cmdk__esc::before { content: ""; position: absolute; inset: -10px -8px; }
@media (hover: hover) { .pb-cmdk__esc:hover { color: var(--pb-text); border-color: var(--pb-accent); } }
.pb-cmdk__list { flex: 1; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--pb-line-2) transparent; overscroll-behavior: contain; }
.pb-cmdk__list li.pb-cmdk__gh { display: block; padding: 14px 14px 6px; cursor: default; font: 500 10px/1 var(--pb-font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--pb-muted); }
.pb-cmdk__list li.pb-cmdk__gh:first-child { padding-top: 8px; }
.pb-cmdk__list li.pb-cmdk__opt { align-items: center; transition: background .12s, color .12s; }
.pb-cmdk__lbl { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-cmdk__list li small { flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-cmdk__list li.is-sel small { color: var(--pb-accent); }
.pb-cmdk__list li.is-sel { box-shadow: inset 2px 0 0 var(--pb-accent); }
.pb-cmdk__list li.pb-cmdk__empty { display: block; cursor: default; color: var(--pb-muted); font-size: 14px; text-align: center; padding: 26px 14px; }
.pb-cmdk__hint { flex: none; flex-wrap: wrap; align-items: center; }
.pb-cmdk__hint span { display: inline-flex; align-items: center; gap: 5px; }
.pb-cmdk__hint kbd { font: 500 10px/1 var(--pb-font-mono); padding: 3px 5px; min-width: 18px; text-align: center; border: 1px solid var(--pb-line-2); border-radius: 4px; color: var(--pb-text); }
@media (max-width: 600px) {
	.pb-cmdk { padding: max(10px, env(safe-area-inset-top)) 10px 10px; align-items: start; }
	.pb-cmdk__box { max-height: calc(100svh - 20px); }
	.pb-cmdk__list { max-height: none; }
	.pb-cmdk__hint { display: none; }
	body.admin-bar .pb-cmdk { padding-top: 56px; }
	body.admin-bar .pb-cmdk__box { max-height: calc(100svh - 66px); }
}

/* ---------- Hidden terminal ---------- */
.pb-term { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10003; height: min(48vh, 460px); display: flex; flex-direction: column; background: rgba(5, 7, 5, .97); border-top: 1px solid rgba(200, 255, 46, .4); box-shadow: 0 -30px 90px -20px rgba(0, 0, 0, .9); color: #d7e6c6; font: 400 13px/1.6 var(--pb-font-mono); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); transition: transform .5s var(--pb-ease), opacity .3s; }
.pb-term[hidden] { display: none; }
.pb-term.is-pre { transform: translateY(100%); opacity: .6; }
.pb-term::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(200, 255, 46, .025) 0 1px, transparent 1px 3px); }
.pb-term__bar { position: relative; display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 8px 0 14px; flex: none; border-bottom: 1px solid rgba(243, 242, 238, .08); color: var(--pb-muted); font-size: 11px; letter-spacing: .04em; }
.pb-term__dots { display: inline-flex; gap: 6px; }
.pb-term__dots i { width: 10px; height: 10px; border-radius: 50%; background: rgba(243, 242, 238, .14); }
.pb-term__dots i:first-child { background: var(--pb-accent); box-shadow: 0 0 10px rgba(200, 255, 46, .6); }
.pb-term__title { color: var(--pb-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-term__keys { margin-left: auto; text-transform: uppercase; letter-spacing: .1em; font-size: 10px; white-space: nowrap; }
.pb-term__x { width: 32px; height: 32px; display: grid; place-items: center; flex: none; padding: 0; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--pb-text); cursor: pointer; }
.pb-term__x svg { width: 16px; height: 16px; }
@media (hover: hover) { .pb-term__x:hover { border-color: var(--pb-line-2); } }
.pb-term__x:focus-visible { outline: 2px solid var(--pb-accent); outline-offset: 1px; }
.pb-term__out { position: relative; flex: 1; min-height: 0; overflow-y: auto; padding: 12px 16px 4px; white-space: pre-wrap; overflow-wrap: anywhere; scrollbar-width: thin; scrollbar-color: rgba(200, 255, 46, .25) transparent; overscroll-behavior: contain; }
.pb-term__ln { min-height: 1.6em; }
.pb-term__ln--cmd { color: var(--pb-text); margin-top: 6px; }
.pb-term__ln--cmd:first-child { margin-top: 0; }
.pb-term__ln--ok { color: var(--pb-accent); }
.pb-term__ln--err { color: #ff7a7a; }
.pb-term__ln--dim { color: var(--pb-muted); }
.pb-term__out a { color: var(--pb-accent); text-decoration: underline; text-decoration-color: rgba(200, 255, 46, .35); text-underline-offset: 3px; }
.pb-term__out a:focus-visible { outline: 1px solid var(--pb-accent); outline-offset: 2px; }
.pb-term__ps { color: var(--pb-accent); white-space: nowrap; }
.pb-term__line { position: relative; display: flex; align-items: center; gap: 1ch; flex: none; padding: 6px 16px max(12px, env(safe-area-inset-bottom)); }
.pb-term__line > .pb-term__ps { flex: none; }
.pb-term__field { position: relative; flex: 1; min-width: 0; display: block; }
.pb-term__field input { display: block; width: 100%; height: 1.6em; margin: 0; padding: 0; border: 0; outline: none; background: none; color: var(--pb-text); font: inherit; caret-color: transparent; border-radius: 0; -webkit-appearance: none; appearance: none; }
.pb-term__field input:focus-visible { outline: none; }
.pb-term__caret { position: absolute; left: 0; top: 50%; width: 1ch; height: 1.3em; margin-top: -.65em; background: var(--pb-accent); mix-blend-mode: difference; pointer-events: none; animation: pb-term-blink 1.05s steps(1) infinite; }
.pb-term__caret.is-typing { animation: none; }
.pb-term:not(:focus-within) .pb-term__caret { animation: none; background: none; outline: 1px solid var(--pb-accent); outline-offset: -1px; mix-blend-mode: normal; }
.pb-term:focus-within { border-top-color: var(--pb-accent); }
@keyframes pb-term-blink { 50% { opacity: 0; } }
@media (max-width: 520px) {
	.pb-term { height: 62svh; font-size: 12.5px; }
	.pb-term__keys { display: none; }
	.pb-term__out { padding: 10px 12px 4px; }
	.pb-term__line { padding-left: 12px; padding-right: 12px; }
}
@media (max-width: 400px) { .pb-term__user { display: none; } }
/* iOS zooms into inputs under 16px: keep the terminal input at 16px on touch devices. */
@media (hover: none) and (pointer: coarse) { .pb-term__line, .pb-ask__bar input { font-size: 16px; } }

/* ---------- Matrix lime tint (terminal: theme) ---------- */
html.pb-matrix { --pb-bg: #050a06; --pb-surface: #0b130c; --pb-text: #e4fbd0; --pb-muted: #86a079; --pb-line: rgba(200, 255, 46, .12); --pb-line-2: rgba(200, 255, 46, .24); }
html.pb-matrix body.pb-site::after { content: ""; position: fixed; inset: 0; z-index: 9989; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(200, 255, 46, .03) 0 1px, transparent 1px 3px); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	.pb-ask-btn, .pb-ask-btn.is-in, .pb-ask, .pb-cmdk__box, .pb-cmdk__scrim, .pb-term { transition: none; }
	.pb-ask-btn { translate: none; }
	.pb-ask.is-pre, .pb-cmdk.is-pre .pb-cmdk__box, .pb-term.is-pre { transform: none; }
	.pb-ask__msg--bot, .pb-ask__msg--me { animation: none; }
	.pb-term__caret { animation: none; }
}

@media print { .pb-term, .pb-ask-btn, .pb-ask, .pb-cmdk { display: none !important; } }
