/* Discovery tour card and the top-right view toolbar (assets/discovery-tour.js). */
@property --fill{syntax:"<percentage>";inherits:false;initial-value:100%}

.view-toolbar{position:absolute;top:20px;right:20px;z-index:7;display:flex;gap:4px;padding:5px;border-radius:4px;background:var(--glass,#fdfdfc);-webkit-backdrop-filter:blur(7px);backdrop-filter:blur(7px);border:1px solid var(--glass-border,#c9d2d6);box-shadow:0 4px 14px rgba(22,37,47,.10)}
html[data-theme="night"] .view-toolbar{box-shadow:0 4px 16px rgba(0,0,0,.45)}
.view-button{display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 11px;border-radius:3px;font-size:12px;color:#4d6878;transition:background-color .18s ease,color .18s ease,transform .14s ease}
.view-button.icon-only{width:32px;padding:0;justify-content:center}
.view-button:hover{background:rgba(120,150,170,.14)}
.view-button:active{transform:scale(.95)}
.view-button svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.view-button .i-play{fill:currentColor;stroke:none}
.view-button .i-pause,.view-button.is-playing .i-play,.view-button .i-collapse,.view-button[aria-pressed="true"] .i-expand{display:none}
.view-button.is-playing .i-pause,.view-button[aria-pressed="true"] .i-collapse{display:inline}
.view-button.is-playing{color:var(--prediction);background:color-mix(in srgb,var(--prediction) 13%,transparent)}
html[data-theme="night"] .view-button{color:#b9cde0}
html[data-theme="night"] .view-button.is-playing{color:var(--prediction)}

/* Card: one title, one explanation, one dot per discovery. */
/* --panel-reserve is the width the query panel occupies, so the card never crowds it.
   The card grows on wide screens and yields on narrow ones; its body scrolls when short. */
.tour-card{--panel-reserve:404px;position:absolute;right:24px;bottom:24px;z-index:7;
  width:min(clamp(312px,31vw,560px),calc(100vw - var(--panel-reserve) - 48px));
  max-height:calc(100dvh - 48px);display:flex;flex-direction:column;
  padding:clamp(12px,1vw,20px) clamp(14px,1.2vw,24px) clamp(10px,.8vw,16px);border-radius:5px;color:#243b49;background:var(--glass,#fdfdfc);-webkit-backdrop-filter:blur(7px);backdrop-filter:blur(7px);border:1px solid var(--glass-border,#c9d2d6);box-shadow:0 6px 20px rgba(22,37,47,.12)}
.tour-body{min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin}
html[data-theme="night"] .tour-card{color:#dce7f2;box-shadow:0 6px 22px rgba(0,0,0,.5)}
.tour-card:not([hidden]){animation:tour-in .6s cubic-bezier(.2,.8,.2,1)}
@keyframes tour-in{from{opacity:0;transform:translateY(16px) scale(.98)}}
.tour-close{position:absolute;top:8px;right:10px;z-index:1;width:24px;height:24px;border-radius:50%;font-size:17px;line-height:1;color:#7f929e;transition:background-color .18s}
.tour-close:hover{background:rgba(120,150,170,.16)}
.tour-title{margin:2px 0 0;padding-right:26px;font-size:19px;font-weight:600;line-height:1.45}
.tour-title b{font-weight:700;color:inherit}
.tour-why{margin:12px 0 0;padding-top:12px;border-top:1px solid rgba(120,150,170,.22);font-size:13px;line-height:1.7;color:#41606f}
html[data-theme="night"] .tour-why{color:#b7cadb}
.tour-foot{display:flex;align-items:center;gap:8px;min-height:26px;margin-top:13px}
.tour-dots{display:flex;align-items:center;gap:7px}
.tour-dots i{width:7px;height:7px;border-radius:50%;background:rgba(120,150,170,.32);transition:transform .3s ease}
.tour-dots i.on{--fill:100%;background:linear-gradient(90deg,var(--prediction) var(--fill),rgba(120,150,170,.32) var(--fill));transform:scale(1.35)}
.tour-actions{display:none;gap:6px;margin-left:auto}
.tour-card.is-paused .tour-actions{display:flex}
.tour-action{padding:6px 11px;border-radius:3px;font-size:11.5px;border:1px solid rgba(120,150,170,.38);transition:background-color .18s,transform .14s}
.tour-action:hover{background:rgba(120,150,170,.14)}
.tour-action:active{transform:scale(.96)}
.tour-action.primary{color:#fff;background:var(--prediction);border-color:transparent}
.tour-action.primary:hover{background:color-mix(in srgb,var(--prediction) 86%,#000)}
html.touring .graph-hint,html.is-fullscreen .graph-hint{opacity:0}

/* Full screen keeps the query panel until the tour actually plays; then the view is a wallpaper.
   The panel keeps its state while hidden, and `touring` alone never hides it in the windowed view. */
#search-panel{transition:opacity .35s ease,transform .45s cubic-bezier(.2,.8,.2,1),visibility .45s}
html.is-fullscreen.touring #search-panel{opacity:0;transform:translateX(-28px);visibility:hidden;pointer-events:none}
html.is-fullscreen.touring .view-toolbar,html.is-fullscreen.touring .tour-close,html.is-fullscreen.touring .tour-actions{display:none}
html.is-fullscreen .tour-card{--panel-reserve:0px;right:clamp(24px,3vw,64px);bottom:clamp(24px,3vw,64px);width:min(clamp(360px,34vw,780px),calc(100vw - 48px));max-height:calc(100dvh - 48px);padding:clamp(16px,1.4vw,30px) clamp(18px,1.7vw,36px) clamp(12px,1vw,22px)}
html.is-fullscreen .tour-title{font-size:clamp(18px,1vw + 13px,34px)}
html.is-fullscreen .tour-why{font-size:clamp(13px,.45vw + 11px,20px)}

/* Fluid type: scales between the small-laptop and large-display sizes. */
.tour-title{font-size:clamp(16px,.55vw + 13px,23px)}
.tour-why{font-size:clamp(12px,.3vw + 10.5px,15px)}

@media(max-width:1000px){
  .view-toolbar{top:16px;right:16px}
  .tour-card{--panel-reserve:365px;right:16px;bottom:16px}
}
/* One column: the panel sits above, the card spans the foot of the screen. */
@media(max-width:700px){
  .view-toolbar{top:auto;bottom:12px;right:12px}
  .view-button span{display:none}.view-button{width:32px;padding:0;justify-content:center}
  .tour-card{--panel-reserve:0px;left:12px;right:12px;bottom:62px;width:auto;max-height:calc(100dvh - 86px)}
}
/* Short screens: cap the query panel so the card below it always has room. */
@media(max-height:680px){
  #search-panel{max-height:min(calc(100dvh - 40px),54dvh)}
  #search-panel .panel-content{max-height:none}
  .tour-card{max-height:calc(100dvh - 32px)}
}
/* One column and short: the panel and the card split the height, with room between them. */
@media(max-height:680px) and (max-width:700px){
  #search-panel{max-height:40dvh}
  .tour-card{bottom:56px;max-height:calc(52dvh - 40px)}
}
@media (prefers-reduced-motion: reduce){.tour-card{animation:none!important}}
