/* ===========================================================================
   SITE SEARCH (8 Oct 2026): the masthead's search bar, the drawer's search,
   the dropdown they share, and the /search page. Driven by site-search.js.

   Plain classes, outside Tailwind: tw-output.css is a built file and only has
   the utilities its last build saw, so nothing here depends on one. Unlayered
   rules beat Tailwind's reset whatever their specificity, which is what lets
   a plain class style an <input> or a <button> here.

   Every text box is 16px or larger: iOS zooms the whole page into a smaller
   one on focus.
   =========================================================================== */

.osc-visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---- the magnifier in the masthead -------------------------------------- */
.osc-search-trigger {
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; width: 40px; height: 40px; padding: 0;
  border: 0; border-radius: 999px; background: transparent;
  color: #111827; cursor: pointer;
  transition: color .18s ease, background-color .18s ease, transform .12s ease;
}
.osc-search-trigger:hover,
.osc-search-trigger[aria-expanded="true"] { color: #2563eb; background: rgba(37, 99, 235, .09); }
.osc-search-trigger:active { transform: scale(.92); }
.osc-search-trigger:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.osc-search-trigger-icon { width: 24px; height: 24px; transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.osc-search-trigger[aria-expanded="true"] .osc-search-trigger-icon { transform: scale(1.08); }

/* The phone's own button, opposite the hamburger. Below the lg breakpoint the
   account controls (and the wide-screen button among them) are hidden. */
.osc-search-trigger--phone { display: none; }
@media (max-width: 1023.98px) {
  .osc-search-trigger--phone { display: inline-flex; width: 36px; height: 36px; margin-right: 12px; }
}

/* ---- the bar that hangs under the header -------------------------------- */
/* Inside .header, which is position: fixed, so top: 100% is its lower edge in
   either state -- full height, or shrunk on scroll. The header centres its
   text and shows a pointer everywhere; neither belongs here. */
.osc-search-panel {
  position: absolute; left: 0; right: 0; top: 100%;
  padding: 14px 16px 16px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 22px 44px -18px rgba(15, 23, 42, .32);
  text-align: left; cursor: auto;
  opacity: 1; transform: translateY(0);
  transition: opacity .22s ease-out, transform .3s cubic-bezier(.16, 1, .3, 1), display .3s allow-discrete;
}
.osc-search-panel[hidden] {
  display: none;
  opacity: 0; transform: translateY(-12px);
  pointer-events: none;
  /* Leaving is quicker than arriving: the reader has already moved on. */
  transition-duration: .16s, .18s, .18s;
  transition-timing-function: ease-in;
}

/* EASED IN AND OUT, AND NOTHING WAITS FOR IT (8 Oct 2026, the owner: the bar
   "suddenly appears"). The script only sets and clears the hidden attribute,
   at once; everything else is CSS. @starting-style gives a newly shown bar
   somewhere to come from, and transition-behavior: allow-discrete keeps a
   closing one on screen until it has faded. A browser without either simply
   shows and hides it at once, as before -- and no state hangs on an
   animation finishing, which in a background tab it never does
   ([[osc-animation-must-not-gate-state]] in the newsroom notes). */
@starting-style {
  .osc-search-panel:not([hidden]) { opacity: 0; transform: translateY(-12px); }
}

/* Behind the open bar, the page dims a little, so the bar reads as a layer
   rather than as something pasted over the page. Under the header (z-50),
   over everything else; a click on it closes the search. */
.osc-search-backdrop {
  position: fixed; inset: 0; z-index: 45;
  background: rgba(15, 23, 42, .2);
  opacity: 1;
  transition: opacity .24s ease, display .24s allow-discrete;
}
.osc-search-backdrop[hidden] { display: none; opacity: 0; transition-duration: .18s; }
@starting-style {
  .osc-search-backdrop:not([hidden]) { opacity: 0; }
}
.osc-search-panel .osc-search-scope { max-width: 760px; margin: 0 auto; }

/* ---- the box ----------------------------------------------------------- */
.osc-search-scope { position: relative; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.osc-search-form { position: relative; display: flex; align-items: center; margin: 0; }
.osc-search-form-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; color: #6b7280; pointer-events: none;
}
.osc-search-input {
  width: 100%; height: 48px; margin: 0;
  padding: 0 46px 0 44px;
  font: 400 17px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #111827; background: #fff;
  border: 1.5px solid #d1d5db; border-radius: 12px;
  -webkit-appearance: none; appearance: none;
}
.osc-search-input::placeholder { color: #9ca3af; }
.osc-search-input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); }
.osc-search-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.osc-search-close {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: 8px; background: transparent;
  font: 400 26px/1 Arial, sans-serif; color: #6b7280; cursor: pointer;
}
.osc-search-close:hover { color: #111827; background: #f3f4f6; }
.osc-search-close:focus-visible { outline: 2px solid #2563eb; outline-offset: 1px; }

/* Working: a thin sweep along the bottom of the box, shown only when an
   answer is slow. Decoration only -- nothing waits on it. */
.osc-search-scope.is-searching .osc-search-form::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 1px; height: 2px;
  background: linear-gradient(90deg, transparent, #2563eb, transparent) no-repeat;
  background-size: 40% 100%;
  animation: osc-search-sweep 0.9s linear infinite;
}
@keyframes osc-search-sweep { from { background-position: -40% 0; } to { background-position: 140% 0; } }
@media (prefers-reduced-motion: reduce) {
  .osc-search-scope.is-searching .osc-search-form::after { animation: none; background-size: 100% 100%; opacity: .5; }
}

/* ---- the dropdown ------------------------------------------------------- */
.osc-search-results {
  margin-top: 10px;
  max-height: min(64vh, 620px);
  overflow-y: auto; overscroll-behavior: contain;
  background: #fff;
  border: 1px solid #e5e7eb; border-radius: 12px;
  text-align: left;
  opacity: 1; transform: translateY(0);
  transition: opacity .18s ease-out, transform .24s cubic-bezier(.16, 1, .3, 1), display .24s allow-discrete;
}
.osc-search-results[hidden] {
  display: none;
  opacity: 0; transform: translateY(-6px);
  pointer-events: none;
  transition-duration: .12s, .12s, .12s;
}
@starting-style {
  .osc-search-results:not([hidden]) { opacity: 0; transform: translateY(-6px); }
}

.osc-sr-group + .osc-sr-group { border-top: 1px solid #f0f1f3; }
.osc-sr-group-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 11px 14px 4px;
  font: 700 11px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  letter-spacing: .08em; text-transform: uppercase; color: #6b7280;
}
.osc-sr-group-count { font-weight: 600; letter-spacing: 0; color: #9ca3af; }

.osc-search-results .osc-sr-opt {
  display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 12px; align-items: start;
  padding: 9px 14px 10px 11px;
  border-left: 3px solid transparent;
  color: #111827; text-decoration: none;
  transition: background-color .12s ease, border-color .12s ease;
}
.osc-search-results .osc-sr-opt.is-active { background: #eff6ff; border-left-color: #2563eb; }
.osc-sr-opt-thumb {
  display: flex; align-items: center; justify-content: center;
  width: 56px; height: 42px; overflow: hidden;
  border-radius: 6px; background: #f3f4f6;
}
.osc-sr-opt-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* No photograph: the first letter of what it is, coloured by kind, so a story
   and a wiki entry can be told apart at a glance and not by colour alone --
   the line under the title says which it is too. */
.osc-sr-opt-thumb.is-letter { font: 700 18px/1 Georgia, "Times New Roman", serif; color: #1e40af; background: #e0e7ff; }
.osc-sr-opt--wiki .osc-sr-opt-thumb.is-letter { color: #92400e; background: #fef3c7; }
.osc-sr-opt-body { display: block; min-width: 0; }
.osc-sr-opt-title { display: block; font: 600 15.5px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; color: #111827; }
.osc-sr-opt-meta { display: block; margin-top: 2px; font: 500 12px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; color: #6b7280; }
.osc-sr-opt-text {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-top: 3px;
  font: 400 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; color: #4b5563;
}
.osc-search-results .osc-sr-all-opt {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-top: 1px solid #e5e7eb;
  font: 600 14px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: #1d4ed8; text-decoration: none;
}
.osc-search-results .osc-sr-all-opt { transition: background-color .12s ease; }
.osc-search-results .osc-sr-all-opt.is-active { background: #eff6ff; }
.osc-sr-none { padding: 16px; font: 400 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; color: #4b5563; }

.osc-search-results mark,
.osc-search-page mark { background: #fef08a; color: inherit; padding: 0 1px; border-radius: 2px; }

/* ---- in the drawer -------------------------------------------------------- */
/* The drawer scrolls itself, so the results grow it rather than scrolling in
   a box of their own. */
.osc-search-scope--drawer { width: calc(100% - 2.5rem); margin: -10px auto 24px; }
.osc-search-form--drawer .osc-search-input { height: 46px; font-size: 16px; padding-right: 14px; border-radius: 10px; }
.osc-search-results--drawer { max-height: none; overflow: visible; }
.menu .osc-search-results .osc-sr-opt { grid-template-columns: 44px minmax(0, 1fr); gap: 10px; }
.menu .osc-search-results .osc-sr-opt-thumb { width: 44px; height: 34px; }

/* ---- /search -------------------------------------------------------------- */
.osc-search-page {
  max-width: 880px; margin: 0 auto; padding: 28px 16px 72px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #111827;
}
.osc-search-page-title { margin: 0 0 16px; font: 700 clamp(1.8rem, 3vw, 2.4rem)/1.1 Georgia, "Times New Roman", serif; color: #111827; }
/* The header is fixed: scrolled back to after a change of tab or page, the
   form would otherwise land underneath it. */
.osc-search-page-form { position: relative; display: flex; align-items: center; gap: 10px; margin: 0; scroll-margin-top: 140px; }
@media (max-width: 1023.98px) { .osc-search-page-form { scroll-margin-top: 96px; } }
.osc-search-page-icon {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; color: #6b7280; pointer-events: none;
}
.osc-search-page-input {
  flex: 1 1 auto; min-width: 0; height: 54px; margin: 0;
  padding: 0 16px 0 50px;
  font: 400 18px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #111827; background: #fff;
  border: 1.5px solid #d1d5db; border-radius: 12px;
  -webkit-appearance: none; appearance: none;
}
.osc-search-page-input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); }
.osc-search-page-go {
  flex: 0 0 auto; height: 54px; padding: 0 22px;
  border: 0; border-radius: 12px; background: #2563eb; color: #fff;
  font: 700 16px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; cursor: pointer;
}
.osc-search-page-go:hover { background: #1d4ed8; }
.osc-search-page-go:focus-visible { outline: 2px solid #1e3a8a; outline-offset: 2px; }
/* Dimmed only when an answer is slow (site-search.js waits 180ms before
   saying it is busy), so quick typing does not flicker; the new results fade
   up from there. */
.osc-search-page-results { transition: opacity .2s ease; }
.osc-search-page-results[aria-busy="true"] { opacity: .5; }

.osc-sr-tabs { display: flex; gap: 4px; margin: 22px 0 4px; border-bottom: 1px solid #e5e7eb; overflow-x: auto; }
.osc-sr-tab {
  transition: color .15s ease, border-color .2s ease;
  display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
  padding: 10px 14px; margin-bottom: -1px;
  border-bottom: 2.5px solid transparent;
  font: 600 15px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: #4b5563; text-decoration: none;
}
.osc-sr-tab:hover { color: #111827; }
.osc-sr-tab.is-on { color: #1d4ed8; border-bottom-color: #2563eb; }
.osc-sr-tab-count { padding: 3px 7px; border-radius: 999px; background: #f3f4f6; font-size: 12px; color: #6b7280; transition: background-color .2s ease, color .2s ease; }
.osc-sr-tab.is-on .osc-sr-tab-count { background: #dbeafe; color: #1d4ed8; }

.osc-sr-section { margin-top: 26px; }
.osc-sr-heading {
  display: flex; align-items: baseline; gap: 10px; margin: 0 0 4px;
  font: 700 13px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  letter-spacing: .08em; text-transform: uppercase; color: #374151;
}
.osc-sr-count { font-weight: 500; font-size: 13px; letter-spacing: 0; text-transform: none; color: #9ca3af; }
.osc-sr-list { list-style: none; margin: 0; padding: 0; }
.osc-sr-item + .osc-sr-item { border-top: 1px solid #ece8dd; }
.osc-sr-link { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 16px 0; color: inherit; text-decoration: none; }
.osc-sr-item.has-thumb .osc-sr-link { grid-template-columns: 160px minmax(0, 1fr); }
.osc-sr-thumb { display: block; width: 160px; height: 107px; object-fit: cover; border-radius: 8px; background: #f3f4f6; }
.osc-sr-body { display: block; min-width: 0; }
.osc-sr-meta {
  display: block;
  font: 600 12px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  letter-spacing: .05em; text-transform: uppercase; color: #6b7280;
}
.osc-sr-title { display: block; margin-top: 4px; font: 700 20px/1.3 Georgia, "Times New Roman", serif; color: #111827; }
.osc-sr-link:hover .osc-sr-title,
.osc-sr-link:focus-visible .osc-sr-title { color: #1d4ed8; text-decoration: underline; text-underline-offset: 3px; }
.osc-sr-link:focus-visible { outline: 2px solid #2563eb; outline-offset: 4px; border-radius: 6px; }
.osc-sr-text { display: block; margin-top: 6px; font: 400 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; color: #4b5563; }
.osc-sr-all { display: inline-block; margin-top: 8px; font: 600 15px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; color: #1d4ed8; text-decoration: none; }
.osc-sr-all:hover { text-decoration: underline; }
.osc-sr-pages {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 18px; padding-top: 14px; border-top: 1px solid #e5e7eb;
  font: 600 14px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
.osc-sr-page { color: #1d4ed8; text-decoration: none; }
.osc-sr-page:hover { text-decoration: underline; }
.osc-sr-page-of { color: #6b7280; font-weight: 500; }
.osc-sr-intro,
.osc-sr-empty { margin-top: 22px; font: 400 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; color: #4b5563; }
.osc-sr-empty p + p { margin-top: 6px; }

@media (max-width: 640px) {
  .osc-search-page { padding-top: 18px; }
  .osc-search-page-go { padding: 0 16px; }
  .osc-sr-item.has-thumb .osc-sr-link { grid-template-columns: 88px minmax(0, 1fr); gap: 12px; }
  .osc-sr-thumb { width: 88px; height: 66px; }
  .osc-sr-title { font-size: 17px; }
  .osc-sr-text { font-size: 14px; }
}

/* ---- a reader who has asked for less motion --------------------------------- */
/* Last in the file, so it outranks the rules above at equal specificity.
   Nothing moves; the bar and the dropdown only fade, and briefly. */
@media (prefers-reduced-motion: reduce) {
  .osc-search-panel, .osc-search-panel[hidden],
  .osc-search-results, .osc-search-results[hidden] {
    transform: none;
    transition-property: opacity, display;
    transition-duration: .12s, .12s;
  }
  .osc-search-trigger:active,
  .osc-search-trigger[aria-expanded="true"] .osc-search-trigger-icon { transform: none; }
}
