/* UPC Website Revamp: global search results (pitch). Builds on home.css.
   An inner page, so it does not repeat the home: no band, no hero. The search field is the title; the result types and
   the filters sit in one light row of tools; the results read as a list on columns 1-4 (what matters, on the left)
   and the context (legal basis, AI, alerts) sits on columns 5-6. Decisions: DESIGN-v4.md, "Search results". */

/* ---------- Grid: only the lines that show this page's structure ----------
   Seven lines are noise on a page full of controls. The page has two zones, so three lines stay: line 1 (where every
   text starts), line 5 (results | context) and line 7 (the right edge). The others are hidden, not removed, so the
   remaining ones keep their place on the module. On tablet and phone the context drops below: only the edges stay. */
.page-grid--search span:is(:nth-child(2), :nth-child(3), :nth-child(4), :nth-child(6)) { visibility: hidden; }
@media (max-width: 1023px) { .page-grid--search span:nth-child(5) { visibility: hidden; } }

/* ---------- Search header: the field is the title ---------- */
.shead { padding-top: 32px; overflow-x: clip; }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 8px; width: fit-content; font-size: 14px; color: var(--ink-muted); }
.crumbs li + li::before { content: "/"; margin-right: 8px; color: var(--line-strong); }
.crumbs a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; }
.crumbs a:hover { text-decoration-color: currentColor; }
.shead__title { width: fit-content; margin-top: 48px; font: 500 15px/1.4 var(--font-sans); color: var(--ink-muted); }
/* Lines never cross text: a tight white sheet behind each short text that sits on the grid */
:is(.crumbs ol, .shead__title, .shead__meta, .filters__label) { background: var(--white); box-shadow: 0 0 0 12px var(--white); }

/* One line: the query in the display serif, the Search / Ask AI switch, a round blue button.
   A white field from grid line 1 to line 7, on a hairline that draws in on arrival */
.qbar { position: relative; display: flex; align-items: center; gap: 16px; margin-top: 8px; padding: 6px 0 16px; background: var(--white); box-shadow: 0 0 0 12px var(--white); }
.qbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--ink); transition: background-color var(--t-base) var(--ease), height var(--t-base) var(--ease); }
.qbar:focus-within::after { height: 2px; background: var(--primary); }
.qbar[data-mode="ai"]::after { height: 2px; background: var(--ai); }
.qbar__input { flex: 1; min-width: 0; height: 80px; padding: 0; border: 0; border-radius: 0; background: transparent; font: 300 64px/1.1 var(--font-display); letter-spacing: -.025em; color: var(--navy); -webkit-appearance: none; appearance: none; }
.qbar.is-long .qbar__input { font-size: 44px; }
.qbar__input:focus { outline: none; }
.qbar__input::placeholder { color: var(--line-strong); }
.qbar__input::-webkit-search-cancel-button { -webkit-appearance: none; }
.qbar__modes { flex: none; }
.qbar__go { flex: none; display: grid; place-items: center; width: 56px; height: 56px; border: 0; border-radius: var(--r-pill); background: var(--primary); color: var(--white); font-size: 22px; cursor: pointer; transition: background-color var(--t-base) var(--ease); }
.qbar__go:hover { background: var(--primary-hover); }
.qbar__go i { transition: transform var(--t-base) var(--ease); }
.qbar__go:hover i { transform: translateX(3px); }
.qbar[data-mode="ai"] .qbar__go { background: var(--ai); }
.qbar[data-mode="ai"] .qbar__go:hover { background: var(--ai-hover); }
.qbar .ai-note { left: 0; }
.qbar[data-mode="ai"] .ai-note { display: inline-flex; }
.qbar[data-mode="ai"] + .shead__meta { visibility: hidden; }
.shead__meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 20px; width: fit-content; margin-top: 18px; font-size: 15px; }
.sr-status strong { font-weight: 600; }
/* "Data last updated" stamp on every result list (6.2, Register) */
.sr-stamp { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-muted); }
.sr-stamp i { font-size: 15px; color: var(--teal); }

/* ---------- Tools: types, filters, sort ---------- */
.stools { margin-top: 56px; overflow-x: clip; }
/* Result types as one group of tabs, packed from grid line 1 with an even gap (spread one per column they read as
   loose items, not as one filter); the current one is underlined in its accent
   (teal orders, blue decisions, navy legal texts, grey pages, magenta news) */
.types { position: relative; }
.types::after { content: ""; position: absolute; left: 0; right: -100vw; bottom: 0; height: 1px; background: var(--line); }
.types ul { display: flex; flex-wrap: wrap; gap: 0 36px; }
.types li { --c: var(--navy); }
.types a { position: relative; display: flex; align-items: baseline; gap: 8px; padding: 14px 0 16px; font: 500 15px/1.3 var(--font-sans); color: var(--ink-muted); transition: color var(--t-fast) var(--ease); }
.types__name { display: inline-flex; align-items: baseline; gap: 8px; background: var(--white); box-shadow: 0 0 0 6px var(--white); }
.types__name::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--c); transform: translateY(-2px); }
.types li:first-child .types__name::before { display: none; }
.types__n { font: 500 13px/1 var(--font-mono); color: var(--ink-muted); background: var(--white); }
.types a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; height: 3px; background: var(--c); transform: scaleX(0); transform-origin: left; transition: transform var(--t-base) var(--ease); }
.types a:hover { color: var(--ink); }
.types a[aria-current="true"] { color: var(--ink); font-weight: 600; }
.types a[aria-current="true"] .types__n { color: var(--ink); }
.types a[aria-current="true"]::after { transform: none; }
.types a:focus-visible { outline-offset: -3px; }

/* Filters (3.3.2): one row of dropdowns, the chips of the applied filters, then sort and share on the right */
.filters { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 8px; margin-top: 22px; }
.filters__label { margin-right: 8px; font-size: 13px; color: var(--ink-muted); }
.filters .filters__toggle { display: none; }
.filters__drops { display: flex; flex-wrap: wrap; gap: 8px; }
.fdrop { position: relative; }
.fdrop__btn { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 12px 0 15px; border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: var(--white); font: 500 14px/1 var(--font-sans); color: var(--ink); white-space: nowrap; cursor: pointer; transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.fdrop__btn i { font-size: 13px; transition: transform var(--t-base) var(--ease); }
.fdrop__btn:hover { border-color: var(--ink); }
.fdrop__btn[aria-expanded="true"] { border-color: var(--ink); box-shadow: 0 0 0 3px var(--primary-tint); }
.fdrop__btn[aria-expanded="true"] i { transform: rotate(180deg); }
.fdrop__btn.is-on { background: var(--navy); border-color: var(--navy); color: var(--white); }
.fdrop__n:empty { display: none; }
.fdrop__n { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--white); color: var(--navy); font: 600 12px/1 var(--font-sans); }
/* The panel: square like the other menus, a scrollable list of checkboxes with their counts */
.fdrop__panel { position: absolute; left: 0; top: calc(100% + 8px); z-index: var(--z-menu); width: max-content; min-width: 280px; max-width: 340px; max-height: 360px; overflow-y: auto; overscroll-behavior: contain; padding: 8px 18px 10px; background: var(--white); border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(0, 30, 51, .10); }
.fdrop__panel[hidden] { display: none; }
.fdrop__panel.is-right { left: auto; right: 0; }
.facet { margin: 0; padding: 0; border: 0; min-width: 0; }
.facet label { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 40px; font-size: 15px; line-height: 1.3; cursor: pointer; }
.facet label + label { border-top: 1px solid var(--surface); }
.facet label:hover > span:first-of-type { text-decoration: underline; text-underline-offset: 3px; }
.facet input { appearance: none; -webkit-appearance: none; display: grid; place-items: center; width: 18px; height: 18px; margin: 0; border: 1.5px solid var(--line-strong); border-radius: 4px; background: var(--white); cursor: pointer; transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
.facet input::after { content: ""; width: 9px; height: 5px; border: 2px solid var(--white); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); opacity: 0; }
.facet input:checked { background: var(--navy); border-color: var(--navy); }
.facet input:checked::after { opacity: 1; }
.facet input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.facet__n { padding-left: 12px; font: 500 13px/1 var(--font-mono); color: var(--ink-muted); }
.rule-name { font: 500 14px/1.3 var(--font-mono); }
/* Applied filters on their own line under the row, so nothing else moves when one is added */
.applied { order: 3; flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.applied:empty { display: none; }
.fchip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 8px 0 12px; border: 0; border-radius: var(--r-pill); background: var(--primary-tint); color: var(--primary-hover); font: 500 13px/1 var(--font-sans); cursor: pointer; transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.fchip i { font-size: 14px; }
.fchip:hover { background: var(--primary-hover); color: var(--white); }
.clear-all { margin-left: 4px; font-size: 13px; font-weight: 500; color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
.filters__right { order: 2; display: flex; align-items: center; gap: 8px; margin-left: auto; }
.sort { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-muted); }
.sort__box { position: relative; display: inline-flex; }
.sort select { appearance: none; -webkit-appearance: none; min-height: 38px; padding: 0 34px 0 14px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--white); font: 500 13px/1 var(--font-sans); color: var(--ink); cursor: pointer; }
.sort select:hover { border-color: var(--ink); }
.sort__box i { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; pointer-events: none; }

/* Quiet actions: text with an icon (PDF, cite, copy link); a box only where they stand alone */
.act { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 2px; border: 0; background: none; font: 500 13px/1 var(--font-sans); color: var(--ink-muted); white-space: nowrap; cursor: pointer; transition: color var(--t-fast) var(--ease); }
.act i { font-size: 16px; }
.act:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.act[aria-pressed="true"] { color: var(--primary-hover); }
.act--box { min-height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--white); color: var(--ink); }
.act--box:hover { border-color: var(--ink); text-decoration: none; }
.act--box[aria-expanded="true"] { background: var(--ink); border-color: var(--ink); color: var(--white); }

/* ---------- Reading sheet ---------- */
.results { margin-top: 72px; }
.results__grid { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); align-items: start; background: var(--white); box-shadow: 0 0 0 24px var(--white); }
/* The lines stop around the sheet in an uneven staircase, as on the home (left lines cut most) */
.results__grid::before, .results__grid::after { content: ""; position: absolute; left: 0; right: 0; z-index: -1; pointer-events: none; }
.results__grid::before { top: -72px; height: 48px; background:
    linear-gradient(var(--white), var(--white)) 0% 100% / 13px 46px no-repeat,
    linear-gradient(var(--white), var(--white)) 16.667% 100% / 13px 37px no-repeat,
    linear-gradient(var(--white), var(--white)) 33.333% 100% / 13px 31px no-repeat,
    linear-gradient(var(--white), var(--white)) 50% 100% / 13px 21px no-repeat,
    linear-gradient(var(--white), var(--white)) 66.667% 100% / 13px 15px no-repeat,
    linear-gradient(var(--white), var(--white)) 83.333% 100% / 13px 8px no-repeat,
    linear-gradient(var(--white), var(--white)) 100% 100% / 13px 3px no-repeat; }
.results__grid::after { top: calc(100% + 24px); height: 96px; background:
    linear-gradient(var(--white), var(--white)) 0% 0 / 13px 91px no-repeat,
    linear-gradient(var(--white), var(--white)) 16.667% 0 / 13px 76px no-repeat,
    linear-gradient(var(--white), var(--white)) 33.333% 0 / 13px 60px no-repeat,
    linear-gradient(var(--white), var(--white)) 50% 0 / 13px 44px no-repeat,
    linear-gradient(var(--white), var(--white)) 66.667% 0 / 13px 29px no-repeat,
    linear-gradient(var(--white), var(--white)) 83.333% 0 / 13px 13px no-repeat,
    linear-gradient(var(--white), var(--white)) 100% 0 / 13px 3px no-repeat; }
/* Clear air between the two zones: the results stop well before line 5, where the context boxes start */
.sr-main { grid-column: 1 / 5; min-width: 0; padding-right: 112px; }
.proto-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 32px; font-size: 14px; color: var(--ink-muted); }
.proto-note[hidden] { display: none; }
.proto-note a { color: var(--primary); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }

/* Groups: a small label in capitals with its colour dot and a line in its colour; results grouped by type, most relevant first */
.group { --c: var(--navy); }
/* Space only after a group that is shown: hidden groups (other types) stay in the page, so a plain + .group would
   push the first visible group down in the type views */
.group:not([hidden]) ~ .group { margin-top: 64px; }
.group[hidden] { display: none; }
.group[data-group="order"] { --c: var(--teal); }
.group[data-group="decision"] { --c: var(--primary); }
.group[data-group="page"] { --c: var(--line-strong); }
.group[data-group="news"] { --c: var(--magenta); }
.group__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding-bottom: 12px; border-bottom: 2px solid var(--c); }
.group__title { display: flex; align-items: center; gap: 10px; margin: 0; font: 600 13px/1.3 var(--font-sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink); }
.group__title::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.group__n { font: 500 13px/1 var(--font-mono); letter-spacing: 0; color: var(--ink-muted); }
.group__title .sample { letter-spacing: 0; text-transform: none; }
.group__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; }
.group__foot[hidden] { display: none; }
.group__count { font-size: 14px; color: var(--ink-muted); }
.more[hidden] { display: none; }
.more { display: inline-flex; align-items: center; gap: 8px; padding: 0; border: 0; background: none; font: 600 14px/1.4 var(--font-sans); color: var(--primary); cursor: pointer; }
.more i { font-size: 16px; transition: transform var(--t-base) var(--ease); }
.more:hover { color: var(--primary-hover); text-decoration: underline; text-underline-offset: 4px; }
.more:hover i { transform: translateX(4px); }

/* Result card (6.2): users judge a result without opening it. One column, read top to bottom:
   type, date, court and language; the parties (serif); case number and type of action; headnote; rules; quiet actions */
.hits > li[hidden] { display: none; }
.hit { padding: 24px 0 22px; border-bottom: 1px solid var(--line); }
/* Hover, subtle (same gesture as the hearings board on the home): the card lights up with a faint tint of its type colour,
   a little wider than the text so the text never touches the edge, and a thin line in that colour appears on its left.
   The same with keyboard focus inside the card; no hover on touch screens */
.hit { position: relative; isolation: isolate; }
.hit::before { content: ""; position: absolute; inset: 0 -24px; z-index: -1; background: color-mix(in srgb, var(--c) 5%, var(--white)); box-shadow: inset 2px 0 0 var(--c); opacity: 0; transition: opacity 250ms var(--ease); pointer-events: none; }
@media (hover: hover) { .hit:hover::before { opacity: 1; } }
.hit:focus-within::before { opacity: 1; }
.hit__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 14px; color: var(--ink-muted); }
.hit__date { font: 500 13px/1.3 var(--font-mono); color: var(--ink); }
.hit__court { color: var(--ink); }
.hit__path { font-size: 13px; }
.hit__title { margin: 12px 0 0; font: 400 24px/1.22 var(--font-display); letter-spacing: -.01em; text-wrap: balance; }
.hit__title a { text-decoration: underline; text-decoration-color: transparent; text-decoration-thickness: 1px; text-underline-offset: 5px; transition: text-decoration-color var(--t-fast) var(--ease); }
.hit__title a:hover { text-decoration-color: currentColor; }
.hit__v { font-style: italic; color: var(--ink-muted); }
.hit__plus { font: 500 14px/1 var(--font-sans); color: var(--ink-muted); white-space: nowrap; }
.hit__anon { color: var(--ink-muted); }
.hit__ref { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-top: 6px; font-size: 14px; color: var(--ink-muted); }
.hit__ref .ref { color: var(--ink); }
.hit__text { margin-top: 12px; max-width: 68ch; font-size: 15px; line-height: 1.6; color: var(--ink); }
.hit__label { margin-right: 8px; font: 600 11px/1 var(--font-sans); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-muted); }
.sr-main mark { padding: 0 2px; background: rgba(146, 194, 230, .5); color: inherit; }
.hit__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-top: 16px; }
.hit__rules { display: flex; flex-wrap: wrap; gap: 6px; }
.hit__actions { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.tag--legal { background: #E8EBF3; color: var(--navy); }
.tag--inforce { background: var(--teal-tint); color: var(--teal); }
.tag--page { background: var(--surface); color: var(--ink-muted); }
.tag--news { background: var(--magenta-tint); color: var(--magenta); }
.tag--future { background: #E8EBF3; color: var(--navy); }
/* Procedural terms with a short definition (6.2, plain language help) */
.term { padding: 0; border: 0; background: none; font: inherit; color: inherit; text-decoration: underline dotted; text-decoration-color: var(--line-strong); text-underline-offset: 3px; cursor: help; }
.term:hover { text-decoration-color: currentColor; }

/* AI summary in the results (2.5, 3.3.2): folded, labelled in violet, with its disclaimer and feedback */
.ai-sum { margin-top: 14px; max-width: 68ch; border-left: 3px solid var(--ai); background: var(--ai-tint); }
.ai-sum summary { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px; list-style: none; cursor: pointer; font-size: 13px; color: var(--ai); }
.ai-sum summary::-webkit-details-marker { display: none; }
.ai-sum summary .tag { background: var(--white); }
.ai-sum__hint { font-weight: 500; }
.ai-sum summary > i { margin-left: auto; font-size: 14px; transition: transform var(--t-base) var(--ease); }
.ai-sum[open] summary > i { transform: rotate(180deg); }
.ai-sum[open] .ai-sum__hint { visibility: hidden; }
.ai-sum__body { display: grid; gap: 10px; padding: 0 16px 14px; font-size: 15px; line-height: 1.55; }
.ai-sum__note { display: flex; gap: 6px; font-size: 13px; color: var(--ink-muted); }
.ai-sum__note i { flex: none; margin-top: 2px; color: var(--ai); }
.ai-sum__fb { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 13px; color: var(--ink-muted); }

/* Loading: the result list gives way to a short skeleton (the pulse of the AI assistant's loading state) */
.sr-loading { display: grid; }
.sr-loading[hidden] { display: none; }
.results.is-loading :is(.group, .sr-empty, .follow) { display: none !important; }
.sk { display: block; height: 12px; border-radius: var(--r-pill); background: var(--surface); animation: pulse 1.2s var(--ease) infinite; }
.sk--head { width: 140px; height: 14px; margin-bottom: 14px; }
.sk-card { display: grid; gap: 12px; padding: 24px 0 22px; border-top: 1px solid var(--line); }
.sk--meta { width: 38%; }
.sk--title { width: 72%; height: 22px; animation-delay: .1s; }
.sk--text { width: 94%; animation-delay: .2s; }
.sk--short { width: 58%; }
.sk--tags { width: 28%; height: 26px; animation-delay: .3s; }

/* Error: the CMS does not answer. A warning in the warning tint, what still works, and a way to try again */
.sr-alert { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; margin-bottom: 48px; padding: 20px 22px 22px; background: var(--warning-tint); border-left: 3px solid var(--warning); }
.sr-alert[hidden] { display: none; }
.sr-alert > i { font-size: 24px; color: var(--warning); }
.sr-alert__t { margin: 0; font: 600 17px/1.35 var(--font-sans); color: var(--ink); }
.sr-alert p { margin-top: 6px; font-size: 15px; line-height: 1.55; }
.sr-alert .pill { margin-top: 14px; min-height: 40px; padding: 0 16px; background: var(--white); }
.sr-alert .pill:hover { background: var(--ink); }
.sr-stamp.is-error i { color: var(--warning); }
.types a.is-off { color: var(--line-strong); }
.types a.is-off .types__n { color: var(--line-strong); }
.fdrop__btn:disabled { border-color: var(--line); color: var(--line-strong); cursor: not-allowed; }

/* Prototype only: links to see each state during the pitch */
.sr-states { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 10px; font-size: 13px; color: var(--ink-muted); }
.sr-states :is(a, button) { font: inherit; font-weight: 500; color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }

.sr-empty { display: grid; justify-items: start; gap: 12px; margin-top: 8px; padding: 32px; background: var(--surface); }
.sr-empty[hidden] { display: none; }
.sr-empty h3 { font: 400 26px/1.15 var(--font-display); }
.sr-empty p { color: var(--ink-muted); }
.sr-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 40px; font-size: 13px; color: var(--ink-muted); }

/* ---------- Context column (5-6): the Rules of Procedure applied (Jan, objectives), AI, alerts ---------- */
/* The context column scrolls with the page (a fixed version was tried and dropped) */
.sside { grid-column: 5 / 7; }
.sside__in { display: grid; gap: 32px; align-content: start; }
/* Context reads as reference, not as more results: it sits in boxes (the results stay open on white), and the texture is
   inverted: the rule is named in small sans, and its text is quoted in the serif, like an excerpt of the legal text */
.basis { padding: 20px 22px 18px; background: #F1F4F9; }
.sside__h { display: flex; align-items: center; gap: 8px; margin: 0; font: 600 12px/1.3 var(--font-sans); letter-spacing: .08em; text-transform: uppercase; color: var(--navy); }
.sside__h i { font-size: 16px; }
.basis[hidden] { display: none; }
.rule-card { padding: 14px 0; }
.rule-card + .rule-card { border-top: 1px solid rgba(24, 39, 82, .1); }
.rule-card__k { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.rule-card__k .ref { font-size: 13px; color: var(--navy); }
.rule-card__t { margin: 4px 0 0; font: 600 15px/1.35 var(--font-sans); color: var(--ink); }
.rule-card__t a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.rule-card__x { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; margin-top: 8px; font: 400 17px/1.45 var(--font-display); color: var(--ink); }
.rule-card__x::before { content: "\201C"; }
.rule-card__m { margin-top: 10px; font-size: 13px; font-weight: 600; color: var(--teal); }
.basis .more { margin-top: 6px; }
.ai-box { display: grid; justify-items: start; gap: 8px; padding: 18px 20px 20px; background: var(--ai-tint); border-left: 3px solid var(--ai); }
.ai-box .tag { background: var(--white); }
.ai-box__t, .follow__t { margin: 4px 0 0; font: 400 21px/1.15 var(--font-display); letter-spacing: -.01em; }
.ai-box p, .follow p { font-size: 14px; line-height: 1.5; color: var(--ink-muted); }
.pill--ai-text { min-height: 44px; margin-top: 4px; padding: 0 18px; background: var(--ai); color: var(--white); }
.pill--ai-text:hover { background: var(--ai-hover); }
/* Alerts, at the end of the list: one light strip, the text on the left and the action on the right */
.follow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; margin-top: 56px; padding: 22px 24px; background: var(--surface); }
.follow > div { flex: 1 1 280px; display: grid; justify-items: start; gap: 6px; }
.follow .act--box { background: var(--white); }

/* Rule and term preview (hover or focus): a small navy card, square like the other overlays */
.tip { position: absolute; z-index: var(--z-menu); width: max-content; max-width: min(360px, calc(100vw - 32px)); padding: 14px 16px 16px; background: var(--navy); color: var(--white); font-size: 14px; line-height: 1.5; box-shadow: var(--shadow-overlay); pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.tip.is-on { opacity: 1; transform: none; }
.tip__k { display: block; margin-bottom: 6px; font: 500 13px/1.35 var(--font-mono); color: var(--sky); }
.tip__m { display: block; margin-top: 10px; padding-top: 8px; border-top: 1px solid rgba(146, 194, 230, .25); font-size: 13px; color: var(--on-navy-muted); }

.toast { position: fixed; left: 50%; bottom: calc(32px + env(safe-area-inset-bottom, 0px)); z-index: var(--z-cookie); display: inline-flex; align-items: center; gap: 8px; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: var(--r-pill); background: var(--ink); color: var(--white); font-size: 14px; line-height: 1.35; box-shadow: var(--shadow-overlay); opacity: 0; transform: translate(-50%, 12px); pointer-events: none; transition: opacity var(--t-base) var(--ease), transform var(--t-base) var(--ease); }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast i { color: var(--mint); font-size: 18px; }

/* ---------- Motion (same language as the home: lines draw, content rises) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js .qbar::after { transform: scaleX(0); transform-origin: left; transition: transform 1400ms var(--ease-draw) 300ms, background-color var(--t-base) var(--ease), height var(--t-base) var(--ease); }
  .js.is-loaded .qbar::after { transform: none; }
  .js :is(.shead__title, .qbar__input, .qbar__modes, .qbar__go, .shead__meta) { opacity: 0; transform: translateY(16px); transition: opacity 800ms var(--ease), transform 900ms var(--ease-draw); }
  .js .qbar__input { transition-delay: 120ms; }
  .js :is(.qbar__modes, .qbar__go) { transition-delay: 400ms; }
  .js .shead__meta { transition-delay: 550ms; }
  .js.is-loaded :is(.shead__title, .qbar__input, .qbar__modes, .qbar__go, .shead__meta) { opacity: 1; transform: none; }
  .js .types::after { transform: scaleX(0); transform-origin: left; transition: transform 1400ms var(--ease-draw) 600ms; }
  .js.is-loaded .types::after { transform: none; }
  .js :is(.types li, .filters) { opacity: 0; transition: opacity 700ms var(--ease); }
  .js .types li:nth-child(1) { transition-delay: 650ms; }
  .js .types li:nth-child(2) { transition-delay: 700ms; }
  .js .types li:nth-child(3) { transition-delay: 750ms; }
  .js .types li:nth-child(4) { transition-delay: 800ms; }
  .js .types li:nth-child(5) { transition-delay: 850ms; }
  .js .types li:nth-child(6) { transition-delay: 900ms; }
  .js .filters { transition-delay: 950ms; }
  .js.is-loaded :is(.types li, .filters) { opacity: 1; }
  .js .group .hits > li { opacity: 0; transform: translateY(16px); transition: opacity 700ms var(--ease), transform 700ms var(--ease-draw); }
  .js .group.is-in .hits > li { opacity: 1; transform: none; }
  .js .group .hits > li:nth-child(2) { transition-delay: 90ms; }
  .js .group .hits > li:nth-child(3) { transition-delay: 180ms; }
  .js .group .hits > li:nth-child(n+4) { transition-delay: 270ms; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1279px) {
  .sr-main { padding-right: 72px; }
  .qbar__input { font-size: 56px; }
}
@media (max-width: 1023px) {
  .shead__title { margin-top: 36px; }
  .qbar { flex-wrap: wrap; gap: 12px; }
  .qbar__input { flex-basis: 100%; height: 64px; font-size: 48px; }
  .qbar.is-long .qbar__input { font-size: 36px; }
  .qbar .qbar__modes { order: 1; }
  .qbar__go { order: 2; margin-left: auto; width: 48px; height: 48px; }
  .stools { margin-top: 40px; }
  /* Types scroll sideways rather than squeeze */
  .types ul { flex-wrap: nowrap; gap: 0 28px; overflow-x: auto; scrollbar-width: none; margin-right: calc(-1 * var(--gutter)); padding-right: var(--gutter); }
  .types ul::-webkit-scrollbar { display: none; }
  .types li { flex: none; }
  .results__grid { display: block; }
  .sr-main { padding-right: 0; }
  .sside { margin-top: 72px; }
  .sside__in { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
  .basis { grid-column: 1 / -1; }
}
@media (max-width: 767px) {
  .shead { padding-top: 20px; }
  .shead__title { margin-top: 28px; }
  .qbar__input { height: 52px; font-size: 36px; }
  .qbar.is-long .qbar__input { font-size: 28px; }
  /* Filters on mobile: one button opens a filter panel (3.3.2); inside, each filter folds open in place */
  .filters__label { display: none; }
  .filters .filters__toggle { display: inline-flex; }
  .filters__drops { display: none; order: 5; flex-basis: 100%; flex-direction: column; gap: 0; padding: 8px 16px; border: 1px solid var(--line); background: var(--white); }
  .filters.is-open .filters__drops { display: flex; }
  .fdrop + .fdrop { border-top: 1px solid var(--line); }
  .fdrop__btn { width: 100%; justify-content: space-between; min-height: 52px; padding: 0; border: 0; border-radius: 0; background: none; font-size: 16px; }
  .fdrop__btn[aria-expanded="true"] { box-shadow: none; }
  .fdrop__btn.is-on { background: none; color: var(--ink); }
  .fdrop__btn.is-on .fdrop__n { background: var(--navy); color: var(--white); }
  .fdrop__btn .fdrop__n { margin-left: auto; margin-right: 8px; }
  .fdrop__panel { position: static; width: auto; min-width: 0; max-width: none; max-height: none; padding: 0 0 8px; border: 0; box-shadow: none; }
  .filters__right { width: 100%; margin-left: 0; justify-content: space-between; }
  .applied { order: 4; flex-basis: 100%; }
  .sside__in { grid-template-columns: 1fr; }
  .follow { padding: 20px; }
  .hit__title { font-size: 21px; }
  .hit__foot { align-items: flex-start; }
}
