/* RCN "Ask AI" widget (M5) — tokens + component, scoped to .rcn-aiw.
   Command-rail look (mirrors assets/ask.css). No fonts, no images. Never a bare `*`.
   Deployed by rcn-ai-search; mounted by assets/widget.js. */

/* ============================================================ tokens (scoped) */
.rcn-aiw {
	--aiw-navy:#0F172A; --aiw-navy-2:#1e293b; --aiw-red:#e11d2a; --aiw-red-d:#c20e1c;
	--aiw-rail-bg:radial-gradient(140% 60% at 0% 0%, #17233d 0%, #0d1526 55%) #0d1526;
	--aiw-rail-ink:#e6ecf7; --aiw-rail-muted:#7d8ba3; --aiw-rail-line:rgba(148,163,184,.16);
	--aiw-ink:#1e293b; --aiw-muted:#64748b; --aiw-faint:#94a3b8;
	--aiw-line:#e4e9f2; --aiw-soft:#f1f5f9; --aiw-soft-2:#f8fafc; --aiw-surface:#ffffff;
	--aiw-radius:12px; --aiw-radius-sm:9px;
	--aiw-shadow:0 10px 34px rgba(9,14,28,.18), 0 2px 6px rgba(9,14,28,.10);
	--aiw-focus:0 0 0 3px rgba(225,29,42,.28);
	--aiw-ease:cubic-bezier(.22,.61,.36,1);
	/* hard reset vs theme bleed — explicit essentials only, never `*` */
	font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	color: var(--aiw-ink); text-transform: none; letter-spacing: normal; box-sizing: border-box;
	position: relative; display: block; width: 100%;
}
.rcn-aiw *, .rcn-aiw *::before, .rcn-aiw *::after { box-sizing: border-box; }
.rcn-aiw a { text-decoration: none; }

/* ============================================================ core rail */
.rcn-aiw__rail {
	display: flex; align-items: center; gap: 10px;
	background: var(--aiw-rail-bg); border: 1px solid var(--aiw-rail-line);
	border-radius: var(--aiw-radius); padding: 8px 8px 8px 14px; box-shadow: var(--aiw-shadow);
}
.rcn-aiw__spark { flex: 0 0 auto; width: 20px; height: 20px; color: var(--aiw-rail-ink); opacity: .9; }
/* !important: the theme styles bare inputs (white bg, border, padding) and bleeds into the rail */
.rcn-aiw__input {
	flex: 1 1 auto; min-width: 0; height: 40px !important;
	border: 0 !important; outline: 0 !important; background: transparent !important;
	box-shadow: none !important; padding: 0 !important; margin: 0 !important; border-radius: 0 !important;
	color: var(--aiw-rail-ink) !important; font: 500 15px/1.2 inherit !important; letter-spacing: .01em;
}
.rcn-aiw__input::placeholder { color: var(--aiw-rail-muted); }
.rcn-aiw__rail:focus-within { box-shadow: var(--aiw-shadow), var(--aiw-focus); border-color: rgba(225,29,42,.45); }
.rcn-aiw__go {
	flex: 0 0 auto; height: 40px; padding: 0 18px; border: 0; cursor: pointer;
	border-radius: var(--aiw-radius-sm); background: var(--aiw-red); color: #fff;
	font: 700 14px/1 inherit; letter-spacing: .01em; transition: background .15s var(--aiw-ease);
}
.rcn-aiw__go:hover { background: var(--aiw-red-d); }
.rcn-aiw__go:focus-visible { outline: 0; box-shadow: var(--aiw-focus); }

/* ============================================================ dropdown (absolute → no layout shift)
   z-index 1000: the pop can extend past the hero section, and later siblings (trust strip)
   would otherwise paint over it. */
.rcn-aiw__pop {
	position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 1000;
	background: var(--aiw-surface); border: 1px solid var(--aiw-line);
	border-radius: var(--aiw-radius); box-shadow: var(--aiw-shadow);
	padding: 6px; max-height: 340px; overflow: auto; display: none;
}
.rcn-aiw.is-open .rcn-aiw__pop { display: block; }
.rcn-aiw__pophead { padding: 6px 10px 4px; font: 700 11px/1 inherit; letter-spacing: .12em; text-transform: uppercase; color: var(--aiw-faint); }
.rcn-aiw__opt {
	display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
	padding: 9px 10px; border: 0; background: transparent; cursor: pointer;
	border-radius: var(--aiw-radius-sm); color: var(--aiw-ink); font: 500 14px/1.25 inherit; text-decoration: none;
}
.rcn-aiw__opt:hover, .rcn-aiw__opt.is-active { background: var(--aiw-soft); }
.rcn-aiw__opt mark { background: transparent; color: var(--aiw-red); font-weight: 800; }
.rcn-aiw__badge {
	flex: 0 0 auto; font: 700 10px/1 inherit; letter-spacing: .06em; text-transform: uppercase;
	color: var(--aiw-muted); background: var(--aiw-soft); border: 1px solid var(--aiw-line);
	border-radius: 999px; padding: 4px 8px;
}
.rcn-aiw__badge--model { color: #0b7285; background: #e7f5f8; border-color: #cdeaf0; }
.rcn-aiw__badge--brand { color: #5b3ca8; background: #f0ebfb; border-color: #e2d8f6; }
.rcn-aiw__optlabel { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rcn-aiw__opthint { flex: 0 0 auto; color: var(--aiw-faint); font-size: 12.5px; }

/* ============================================================ variant: HERO
   Full width of the hero column so the rail reads as a companion row of the white
   search card above it (a centered narrower box floats awkwardly). z-index lifts
   the open dropdown above the following section. */
.rcn-aiw--hero { max-width: none; margin: 16px 0 0; position: relative; z-index: 90; }
.rcn-aiw--hero .rcn-aiw__lead { color: rgba(255,255,255,.92); font: 600 14px/1.3 inherit; margin: 0 0 8px; text-shadow: 0 1px 2px rgba(0,0,0,.35); }
.rcn-aiw--hero .rcn-aiw__lead b { color: #fff; }

/* ============================================================ variant: HEADER (pill → panel) */
.rcn-aiw--header { display: inline-block; width: auto; }
.rcn-aiw__pill {
	display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; cursor: pointer;
	border: 1px solid var(--aiw-rail-line); border-radius: 999px;
	background: rgba(148,163,184,.10); color: var(--aiw-rail-ink);
	font: 700 13px/1 inherit; letter-spacing: .02em; transition: background .15s var(--aiw-ease);
}
.rcn-aiw__pill:hover { background: rgba(148,163,184,.18); }
.rcn-aiw__pill:focus-visible { outline: 0; box-shadow: var(--aiw-focus); }
.rcn-aiw__pill .rcn-aiw__spark { width: 16px; height: 16px; }
.rcn-aiw--header .rcn-aiw__panel { position: absolute; right: 0; top: calc(100% + 8px); width: 380px; max-width: 92vw; display: none; z-index: 1000; }
.rcn-aiw--header.is-expanded .rcn-aiw__pill { display: none; }
.rcn-aiw--header.is-expanded .rcn-aiw__panel { display: block; }
/* when the pill lives in the primary nav (left side) open the panel leftward-aligned */
.rcn-header__nav .rcn-aiw--header .rcn-aiw__panel { left: 0; right: auto; }

/* ============================================================ variant: FAB (mobile only)
   Direct deep-link to /ask/?ctx= on Browse/archive pages; sits above the theme's
   fixed bottom nav (#rcn-mobnav). Hidden on desktop. */
.rcn-aiw--fab { display: none; }
@media (max-width: 768px) {
	.rcn-aiw--fab { display: block; position: fixed; left: auto; right: 14px; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); width: auto; z-index: 950; }
	.rcn-aiw__fabbtn {
		display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 18px;
		border-radius: 999px; background: var(--aiw-navy); color: #fff !important;
		font: 700 14px/1 inherit; letter-spacing: .01em; text-decoration: none;
		border: 1px solid rgba(148,163,184,.25);
		box-shadow: 0 10px 28px rgba(9,14,28,.38), 0 2px 8px rgba(9,14,28,.22);
	}
	.rcn-aiw__fabbtn .rcn-aiw__spark { width: 18px; height: 18px; color: var(--aiw-red); opacity: 1; }
	.rcn-aiw__fabbtn:active { transform: scale(.97); }
}

/* ============================================================ motion */
@media (prefers-reduced-motion: no-preference) {
	.rcn-aiw__pop { animation: rcn-aiw-in .16s var(--aiw-ease); }
	@keyframes rcn-aiw-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
}

/* ============================================================ 375px */
@media (max-width: 480px) {
	.rcn-aiw--hero { margin-top: 12px; }
	.rcn-aiw__go { padding: 0 14px; }
	.rcn-aiw__input { font-size: 16px !important; } /* ≥16px: no iOS zoom-on-focus */
	.rcn-aiw--header .rcn-aiw__panel { position: fixed; left: 12px; right: 12px; width: auto; top: 66px; }
	/* header pill: icon-only on mobile so it never crowds the theme top bar (text stays in the a11y tree) */
	.rcn-aiw--header .rcn-aiw__pill { gap: 0; padding: 0 10px; font-size: 0; }
	.rcn-aiw--header .rcn-aiw__pill .rcn-aiw__spark { width: 18px; height: 18px; }
}
