/* ==========================================================================================================================================
   THE HEADER SEARCH FIELD (2026-11-18, Rob: "When on desktop / web I want the header to have a search/mic text field in the header on rova too to
   match youtube's ... the same theme as the right header buttons ... centered in the header with the button on the end of the text field ... matches
   the rova header buttons size (animated and responsive) so when you shrink/expand the screen it animates back to just the normal search button ...
   it should animate out of it's slot, after the + button into the search text box and the opposite ... REALLY SMOOTH AND BUTTERY").
   Markup: lib/view.php (form.tsq, after the brand). Behaviour: assets/topsearch.js.

   WHO DECIDES WIDE OR NARROW. Before the script runs: this file's 1024px media query (so the first paint is already right and nothing jumps).
   After: html.tsq-js + html.tsq-wide, set by the script from the SAME 1024px rule, so the class can be flipped inside a View Transition and the
   field grows out of the search disc's slot (and folds back into it) instead of popping.
   The field wears the header discs' own skin (--disc-body / --disc-rim / --disc-shadow, the .rova-disc tokens) at the discs' 40px height.
   ========================================================================================================================================== */
.tsq{display:none}
@media (min-width:1024px){
  html:not(.tsq-js) .tsq{display:flex}
  html:not(.tsq-js) #search-drop, html:not(.tsq-js) .nav-links > #search-link{display:none}
}
html.tsq-js.tsq-wide .tsq{display:flex}
html.tsq-js.tsq-wide #search-drop, html.tsq-js.tsq-wide .nav-links > #search-link{display:none}

.tsq{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);z-index:3;
  width:clamp(410px,43vw,700px);align-items:center;gap:10px;margin:0}
.tsq-box{position:relative;flex:1 1 auto;min-width:0;height:40px;margin-right:50px;box-sizing:border-box;border-radius:999px;
  border:var(--disc-rim-w,1.25px) solid transparent;
  background:var(--disc-body) padding-box no-repeat,var(--disc-rim) border-box no-repeat;
  box-shadow:var(--disc-shadow);
  transition:box-shadow .22s ease,background .22s ease}
.tsq-box:hover{box-shadow:var(--disc-shadow),var(--disc-glow)}
.tsq.is-focus .tsq-box{background:var(--disc-body) padding-box no-repeat,var(--disc-rim-on) border-box no-repeat;
  box-shadow:var(--disc-shadow),0 0 0 3px rgba(245,197,24,.16),0 6px 22px rgba(245,197,24,.22)}
.tsq-in{display:block;width:100%;height:100%;box-sizing:border-box;margin:0;border:0;outline:0;background:transparent;
  padding:0 44px 0 20px;border-radius:999px;color:#f6f1e6;caret-color:#f5c518;
  font-weight:500;font-size:15px;line-height:38px;font-family:inherit;letter-spacing:.005em;-webkit-appearance:none;appearance:none}
.tsq-in::placeholder{color:rgba(246,241,230,.52)}
.tsq-in::-webkit-search-cancel-button,.tsq-in::-webkit-search-decoration{-webkit-appearance:none;appearance:none;display:none}
.tsq-x{position:absolute;right:7px;top:50%;width:30px;height:30px;margin-top:-15px;padding:0;border:0;border-radius:50%;
  display:grid;place-items:center;background:transparent;color:rgba(246,241,230,.7);cursor:pointer;transition:background .15s ease,color .15s ease}
.tsq-x[hidden],.tsq-mic[hidden]{display:none}
.tsq-x:hover{background:rgba(255,255,255,.1);color:#fff}
.tsq-x svg{width:16px;height:16px}
/* the search disc stands on its own just after the field (Rob 2026-11-18: "separate the text field from the search button"): the header's own 40px disc,
   10px clear of the field, the mic 10px after it. It is still inside .tsq-box in the markup (one form, one submit) and hangs out to the right. */
.tsq-go{position:absolute;right:calc(-50px - var(--disc-rim-w,1.25px));top:calc(-1 * var(--disc-rim-w,1.25px));width:40px;height:40px;
  box-sizing:border-box;border-radius:50%;padding:0;display:grid;place-items:center;cursor:pointer;
  transition:transform .18s cubic-bezier(.2,.7,.2,1),box-shadow .2s ease,filter .2s ease}
.tsq-go:hover{transform:scale(1.06);filter:brightness(1.12);box-shadow:var(--disc-shadow),var(--disc-glow)}
.tsq-go:active{transform:scale(.95)}
.tsq-go svg,.tsq-mic svg{width:19px;height:19px;display:block;filter:drop-shadow(0 1px .5px rgba(0,0,0,.5))}
.tsq-mic{flex:none;width:40px;height:40px;box-sizing:border-box;border-radius:50%;padding:0;display:grid;place-items:center;cursor:pointer;
  transition:transform .18s cubic-bezier(.2,.7,.2,1),box-shadow .2s ease}
.tsq-mic:hover{transform:translateY(-2px);box-shadow:var(--disc-shadow),var(--disc-glow)}
.tsq-mic.is-on{color:#fff;background:radial-gradient(circle at 50% 40%,#ff5d6c,#c8202f) padding-box,var(--disc-rim) border-box;animation:tsqMic 1.1s ease-in-out infinite}
@keyframes tsqMic{0%,100%{box-shadow:var(--disc-shadow),0 0 0 0 rgba(255,93,108,.55)}50%{box-shadow:var(--disc-shadow),0 0 0 9px rgba(255,93,108,0)}}
.tsq.is-listen .tsq-in::placeholder{color:#ff8a95}

/* ---- THE MORPH (View Transitions; html.tsq-wide flipped inside document.startViewTransition) -------------------------------------------------
   The bar's search disc and the field's search disc share one name (only one is ever rendered), so the disc itself glides between its slot
   after the + and its place beside the field; the field (its own name) opens leftward out of the disc, and folds back into it. The nav slides on its own name so the + / messages / bell close the gap smoothly. */
html.tsq-js .tsq-go{view-transition-name:tsq}
html.tsq-js:not(.tsq-wide) #search-link{view-transition-name:tsq}
html.tsq-js .tsq-box{view-transition-name:tsq-field}
html.tsq-js .nav-links{view-transition-name:tsq-nav}
html.tsq-js .tsq-mic{view-transition-name:tsq-mic}
::view-transition-group(tsq){animation-duration:.46s;animation-timing-function:cubic-bezier(.22,.8,.18,1)}
::view-transition-group(tsq-nav),::view-transition-group(tsq-mic){animation-duration:.46s;animation-timing-function:cubic-bezier(.22,.8,.18,1)}
::view-transition-old(tsq),::view-transition-new(tsq){animation-duration:.2s}
::view-transition-new(tsq-field){animation:tsqFieldIn .46s cubic-bezier(.22,.8,.18,1) both}
::view-transition-old(tsq-field){animation:tsqFieldOut .36s cubic-bezier(.4,0,.6,1) both}
@keyframes tsqFieldIn{from{clip-path:inset(0 0 0 100% round 999px);opacity:.4}to{clip-path:inset(0 0 0 0 round 999px);opacity:1}}
@keyframes tsqFieldOut{from{clip-path:inset(0 0 0 0 round 999px);opacity:1}to{clip-path:inset(0 0 0 100% round 999px);opacity:0}}
::view-transition-new(tsq-mic){animation:tsqPopIn .42s cubic-bezier(.2,.9,.25,1.25) both .12s}
::view-transition-old(tsq-mic){animation:tsqPopOut .2s ease both}
::view-transition-old(root),::view-transition-new(root){animation:none}
@keyframes tsqPopIn{from{opacity:0;transform:scale(.4)}to{opacity:1;transform:none}}
@keyframes tsqPopOut{to{opacity:0;transform:scale(.4)}}
/* no View Transitions (older browsers): the field still opens leftward out of its own end */
html.tsq-novt .tsq.is-enter .tsq-box{animation:tsqReveal .46s cubic-bezier(.22,.8,.18,1)}
html.tsq-novt .tsq.is-enter .tsq-mic{animation:tsqPopIn .42s cubic-bezier(.2,.9,.25,1.25) both .12s}
@keyframes tsqReveal{from{clip-path:inset(-6px -60px -6px 100% round 999px)}to{clip-path:inset(-6px -60px -6px 0 round 999px)}}

/* ---- THE SUGGESTIONS PANEL: the Videos search's see-through glass, dropped from the field ------------------------------------------------------ */
.tsq-pop{--tp-bg:rgba(24,21,17,.74);--tp-edge:rgba(255,255,255,.12);--tp-ink:#f6f1e6;--tp-sub:rgba(246,241,230,.62);--tp-hi:rgba(245,197,24,.14);
  --tp-hi-edge:rgba(245,197,24,.35);--tp-label:rgba(246,241,230,.5);--tp-card:rgba(255,255,255,.06);--tp-mark:#ffd77e;
  position:fixed;z-index:95;left:50%;top:72px;width:min(880px,calc(100vw - 32px));max-height:min(620px,calc(100vh - 110px));
  box-sizing:border-box;padding:10px;border-radius:26px;color:var(--tp-ink);
  background:var(--tp-bg);border:1px solid var(--tp-edge);
  -webkit-backdrop-filter:blur(30px) saturate(1.7);backdrop-filter:blur(30px) saturate(1.7);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.14),0 30px 70px rgba(0,0,0,.45),0 8px 24px rgba(0,0,0,.25);
  display:grid;grid-template-columns:minmax(0,1fr);gap:10px;overflow:hidden;
  transform-origin:50% 0;transform:translateX(-50%);animation:tsqPop .2s cubic-bezier(.2,.8,.2,1) both;
  font-size:14px;line-height:1.35;font-family:inherit}
.tsq-pop[hidden]{display:none}
.tsq-pop.has-pv{grid-template-columns:minmax(0,1fr) 330px}
@keyframes tsqPop{from{opacity:0;transform:translateX(-50%) translateY(-8px) scale(.985)}to{opacity:1;transform:translateX(-50%)}}
[data-theme="light"] .tsq-pop{--tp-bg:rgba(255,255,255,.78);--tp-edge:rgba(20,20,28,.08);--tp-ink:#14141a;--tp-sub:rgba(20,20,28,.58);--tp-hi:rgba(214,160,20,.14);
  --tp-hi-edge:rgba(214,160,20,.4);--tp-label:rgba(20,20,28,.46);--tp-card:rgba(20,20,28,.04);--tp-mark:#9a6b00;
  box-shadow:inset 0 1px 0 #fff,0 30px 70px rgba(60,40,10,.18),0 8px 24px rgba(60,40,10,.1)}
@media (prefers-color-scheme:light){:root:not([data-theme="dark"]) .tsq-pop{--tp-bg:rgba(255,255,255,.78);--tp-edge:rgba(20,20,28,.08);--tp-ink:#14141a;
  --tp-sub:rgba(20,20,28,.58);--tp-hi:rgba(214,160,20,.14);--tp-hi-edge:rgba(214,160,20,.4);--tp-label:rgba(20,20,28,.46);--tp-card:rgba(20,20,28,.04);--tp-mark:#9a6b00}}
html.rova-lite .tsq-pop{-webkit-backdrop-filter:none;backdrop-filter:none;--tp-bg:#1a1714}
html.rova-lite[data-theme="light"] .tsq-pop{--tp-bg:#fffdf8}

.tsq-list{min-width:0;overflow-y:auto;overscroll-behavior:contain;max-height:calc(min(620px,100vh - 110px) - 20px);scrollbar-width:thin}
.tsq-sec{padding:10px 12px 4px;font-size:12px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--tp-label)}
.tsq-r{display:flex;align-items:center;gap:12px;min-height:44px;padding:6px 10px;border-radius:14px;cursor:pointer;
  border:1px solid transparent;transition:background .12s ease,border-color .12s ease;text-decoration:none;color:inherit}
.tsq-r.is-sel{background:var(--tp-hi);border-color:var(--tp-hi-edge)}
.tsq-ic{flex:none;width:32px;height:32px;display:grid;place-items:center;color:var(--tp-sub)}
.tsq-ic svg{width:18px;height:18px}
.tsq-tx{min-width:0;flex:1 1 auto;display:flex;flex-direction:column;gap:2px}
.tsq-t{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:15px}
.tsq-t b{font-weight:800}
.tsq-r--v .tsq-t{white-space:normal;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;font-weight:600;font-size:14px;line-height:1.3}
.tsq-m{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;color:var(--tp-sub)}
.tsq-th{flex:none;position:relative;width:112px;height:63px;border-radius:12px;overflow:hidden;background:#000}
.tsq-th img{width:100%;height:100%;object-fit:cover;display:block}
.tsq-th.is-tall img{object-fit:contain;background:#111}
.tsq-th i{position:absolute;right:5px;bottom:5px;padding:1px 5px;border-radius:6px;font:800 11px/16px Inter,system-ui,sans-serif;font-style:normal;color:#fff;background:rgba(0,0,0,.75)}
.tsq-av{flex:none;width:36px;height:36px;border-radius:50%;overflow:hidden;display:grid;place-items:center;background:var(--tp-card);font-weight:800;color:var(--tp-mark)}
.tsq-av img{width:100%;height:100%;object-fit:cover}
.tsq-seal{display:inline-block;width:14px;height:14px;margin-left:4px;vertical-align:-2px;color:#3b9cff}
.tsq-del{flex:none;width:28px;height:28px;border:0;border-radius:50%;padding:0;display:grid;place-items:center;background:transparent;color:var(--tp-sub);cursor:pointer;opacity:0;transition:opacity .12s ease,background .12s ease}
.tsq-r:hover .tsq-del,.tsq-r.is-sel .tsq-del{opacity:1}
.tsq-del:hover{background:var(--tp-card)}
.tsq-del svg{width:14px;height:14px}
.tsq-foot{display:flex;gap:8px;flex-wrap:wrap;padding:8px 6px 4px}
.tsq-chip{display:inline-flex;align-items:center;gap:7px;height:34px;padding:0 14px;border-radius:999px;border:1px solid var(--tp-edge);background:var(--tp-card);
  color:inherit;font:700 13px/1 Inter,system-ui,sans-serif;cursor:pointer;text-decoration:none;transition:background .12s ease,border-color .12s ease}
.tsq-chip:hover,.tsq-chip.is-sel{background:var(--tp-hi);border-color:var(--tp-hi-edge)}
.tsq-chip svg{width:15px;height:15px}
.tsq-empty{padding:18px 14px;color:var(--tp-sub)}

/* the preview: the highlighted video playing (muted), or the highlighted person / post, beside the list */
.tsq-pv{min-width:0;align-self:start;display:flex;flex-direction:column;gap:12px;padding:8px;border-radius:20px;background:var(--tp-card)}
.tsq-pv-m{position:relative;aspect-ratio:16/9;border-radius:16px;overflow:hidden;background:#000}
.tsq-pv-m.is-tall{aspect-ratio:4/5}
.tsq-pv-m img,.tsq-pv-m video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;transition:opacity .22s ease}
.tsq-pv-m.is-tall video,.tsq-pv-m.is-tall img.is-fg{object-fit:contain}
.tsq-pv-m img.is-bg{filter:blur(18px) brightness(.6);transform:scale(1.15)}
.tsq-pv-m video{opacity:0}
.tsq-pv-m video.is-on{opacity:1}
.tsq-pv-m i{position:absolute;right:8px;bottom:8px;z-index:2;padding:2px 7px;border-radius:7px;font:800 12px/18px Inter,system-ui,sans-serif;font-style:normal;color:#fff;background:rgba(0,0,0,.72)}
.tsq-pv-t{font-weight:700;font-size:16px;line-height:1.3;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.tsq-pv-by{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--tp-sub)}
.tsq-pv-by .tsq-av{width:26px;height:26px;font-size:11px}
.tsq-pv-p{display:flex;flex-direction:column;align-items:center;gap:10px;padding:18px 8px;text-align:center}
.tsq-pv-p .tsq-av{width:96px;height:96px;font-size:34px}
.tsq-pv-p b{font-size:17px}
.tsq-pv-q{padding:16px;font-size:15px;line-height:1.45;border-radius:16px;background:var(--tp-card);white-space:pre-wrap;overflow-wrap:anywhere;max-height:260px;overflow:hidden}
.tsq-pv-go{align-self:flex-start}
/* View profile + the View channel TV disc, side by side (2026-11-18, Rob) */
.tsq-pv-acts{display:flex;align-items:center;justify-content:center;gap:8px}
.tsq-chip.is-ic{width:34px;padding:0;justify-content:center}
.tsq-chip.is-ic svg{width:17px;height:17px}

@media (prefers-reduced-motion:reduce){
  .tsq-pop{animation:none}
  .tsq-mic.is-on{animation:none}
  ::view-transition-group(tsq),::view-transition-group(tsq-nav),::view-transition-group(tsq-mic){animation-duration:.01s}
}

/* PREVIEW META INDENT (2026-11-18, Rob: "indent the whole part a little bit. shrink the profile photo with same margin, indent the view count"):
   the video preview's title / channel / views sit 10px in from the card edge, the channel photo is 20px (was 26) with the same 8px gap,
   and the views line starts under the channel name (10 + 20 + 8 = 38px). */
.tsq-pv-body{display:flex;flex-direction:column;gap:6px}
.tsq-pv-t,.tsq-pv-t ~ .tsq-pv-by{padding:0 10px}
.tsq-pv-t ~ .tsq-pv-by .tsq-av{width:20px;height:20px;font-size:9px}
.tsq-pv-t ~ .tsq-m{padding:0 10px 4px 38px}

/* ---- THE SEARCH SHEET (narrow windows; assets/topsearch.js openSheet) -------------------------------------------------------------------------------
   Rob 2026-11-18: "make the responsive version present a search modal on top without a page load". The header field, pinned across the top of the
   header, over a blurred scrim; the other header pieces step aside; the panel runs one column, full width, scrolling inside. */
.tsq-scrim,.tsq-cancel{display:none}
html.tsq-sheet{overflow:hidden}
html.tsq-sheet .tsq-scrim{display:block;position:fixed;inset:0;z-index:1000;background:rgba(8,7,10,.5);-webkit-backdrop-filter:blur(12px) saturate(1.2);backdrop-filter:blur(12px) saturate(1.2);animation:tsqScrim .18s ease both}
html.tsq-sheet .topbar{z-index:1003 !important}
html.tsq-sheet .topbar > :not(.tsq){visibility:hidden}
html.tsq-js.tsq-sheet .tsq{display:flex;position:absolute;left:max(12px,env(safe-area-inset-left,0px));right:max(12px,env(safe-area-inset-right,0px));top:50%;width:auto;
  transform:translateY(-50%);gap:8px;animation:tsqSheet .22s cubic-bezier(.2,.8,.2,1) both}
html.tsq-sheet .tsq-box{margin-right:50px}
html.tsq-sheet .tsq-mic{display:none}
html.tsq-sheet .tsq-cancel{display:block;flex:none;height:40px;padding:0 4px 0 2px;border:0;background:none;color:#f5c518;font:600 15px/40px inherit;font-family:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent}
html.tsq-sheet .tsq-pop{z-index:1002;width:calc(100vw - 24px);max-height:calc(100vh - 92px);max-height:calc(100dvh - 92px);overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;border-radius:22px}
html.tsq-sheet .tsq-pop.has-pv{grid-template-columns:minmax(0,1fr)}
html.tsq-sheet .tsq-pop .tsq-pv{display:none}
@keyframes tsqScrim{from{opacity:0}to{opacity:1}}
@keyframes tsqSheet{from{opacity:0;transform:translateY(-50%) scale(.97)}to{opacity:1;transform:translateY(-50%)}}
@media (prefers-reduced-motion:reduce){html.tsq-sheet .tsq-scrim,html.tsq-js.tsq-sheet .tsq{animation:none}}

/* GOLD LIGHT MODE (2026-11-18, Rob: "the search bar and header buttons should be white and gold"): in light mode the field is a white disc body
   (rova.css .topbar tokens) with the gold rim, so its words go dark, the caret and clear button gold-dark, and the icons lose the black drop
   shadow they needed on the dark disc. Dark mode is untouched. */
[data-theme="light"] .tsq-in{color:#15151b;caret-color:#a87400}
[data-theme="light"] .tsq-in::placeholder{color:rgba(20,20,28,.46)}
[data-theme="light"] .tsq-x{color:rgba(20,20,28,.5)}
[data-theme="light"] .tsq-x:hover{background:rgba(20,20,28,.07);color:#15151b}
[data-theme="light"] .tsq-go svg,[data-theme="light"] .tsq-mic svg{filter:none}
[data-theme="light"] .tsq.is-focus .tsq-box{box-shadow:var(--disc-shadow),0 0 0 3px rgba(224,169,10,.18),0 6px 22px rgba(201,151,28,.18)}
@media (prefers-color-scheme:light){
  :root:not([data-theme="dark"]) .tsq-in{color:#15151b;caret-color:#a87400}
  :root:not([data-theme="dark"]) .tsq-in::placeholder{color:rgba(20,20,28,.46)}
  :root:not([data-theme="dark"]) .tsq-x{color:rgba(20,20,28,.5)}
  :root:not([data-theme="dark"]) .tsq-x:hover{background:rgba(20,20,28,.07);color:#15151b}
  :root:not([data-theme="dark"]) .tsq-go svg,:root:not([data-theme="dark"]) .tsq-mic svg{filter:none}
  :root:not([data-theme="dark"]) .tsq.is-focus .tsq-box{box-shadow:var(--disc-shadow),0 0 0 3px rgba(224,169,10,.18),0 6px 22px rgba(201,151,28,.18)}
}
