/* hscroll.css: the open-out control on every row that scrolls sideways (js/hscroll.js, Nov 20 2026).
   Level 3 of the paper only (mix3, mix4). Tokens only. */

/* the button: stays at the row's right edge while the row scrolls under it */
html[data-tight="3"] .hx-t {
  position: sticky; right: 0; z-index: 3; flex: none; align-self: center; margin-left: auto;
  display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border-radius: 999px;
  border: var(--rule-w) solid var(--rule); background: var(--paper); color: var(--ink);
  box-shadow: -12px 0 10px -6px var(--paper);
  -webkit-tap-highlight-color: transparent; cursor: pointer;
}
html[data-tight="3"] .hx-t svg { width: 14px; height: 14px; transition: transform .2s; }
/* in a row laid out as a grid of columns, the button is the last column, centred on the row */
html[data-tight="3"] [data-hx-sig] > .hx-t { justify-self: end; }

/* opened: the row wraps and every choice shows; the same button, turned over, closes it */
html[data-tight="3"] [data-hx="open"] {
  flex-wrap: wrap !important; overflow-x: visible !important; overflow-y: visible !important;
  white-space: normal !important; row-gap: 8px; scroll-snap-type: none !important;
}
html[data-tight="3"] [data-hx="open"][data-hx-grid] {
  grid-auto-flow: row !important; grid-auto-columns: auto !important;
  grid-template-columns: repeat(auto-fill, minmax(var(--hx-col, 150px), 1fr)) !important; row-gap: 14px;
}
html[data-tight="3"] [data-hx="open"] > * { flex-shrink: 0; }
html[data-tight="3"] [data-hx="open"] > .hx-t { position: static; box-shadow: none; border-color: var(--rule-2); }
html[data-tight="3"] [data-hx="open"] > .hx-t svg { transform: rotate(180deg); }

/* wide cards open two across */
html[data-tight="3"] [data-hx="open"][data-hx-two] { column-gap: 12px; row-gap: 16px; }
html[data-tight="3"] [data-hx="open"][data-hx-two] > *:not(.hx-t) { flex: 0 0 calc(50% - 6px) !important; width: auto !important; min-width: 0 !important; max-width: none !important; margin-left: 0 !important; margin-right: 0 !important; }

/* a row that shares its line with a neighbour: opened, it drops to a line of its own */
html[data-tight="3"] .hx-wrap { flex-wrap: wrap !important; row-gap: 8px; }
html[data-tight="3"] .hx-wrap > [data-hx="open"] { flex: 1 1 100% !important; min-width: 0; }

/* inside the glass pill bars the button is glass too, with no paper fade */
html[data-tight="3"] .pillbar .chips > .hx-t { width: 30px; height: 30px; background: var(--glass-on); color: var(--glass-on-ink); border-color: transparent; box-shadow: none; margin-left: 4px; }
/* the pill opened: a panel instead of a capsule, the lit section inked in place (the pouring capsule rests) */
html[data-tight="3"] .pillbar .chips[data-hx="open"] { border-radius: 22px; padding: 8px; gap: 4px; row-gap: 4px; transform: none !important; }
html[data-flow] .flpill .chips[data-hx="open"] .flink { display: none; }
html[data-flow] .flpill .chips.inked[data-hx="open"] .chip.on { background: var(--glass-on); color: var(--glass-on-ink); }

/* the button that pops up while an opened row runs past the bottom of the screen: closes that row */
html[data-tight="3"] .hx-pop {
  position: fixed; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 40;
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 999px;
  background: var(--glass-on); color: var(--glass-on-ink); border: 1px solid var(--glass-edge); box-shadow: var(--glass-shadow);
  -webkit-tap-highlight-color: transparent; cursor: pointer;
}
html[data-tight="3"] .hx-pop svg { width: 18px; height: 18px; transform: rotate(180deg); }
.hx-pop[hidden] { display: none !important; }
html:not([data-tight="3"]) .hx-pop, html:not([data-tight="3"]) .hx-t { display: none !important; }

@media (prefers-reduced-motion: reduce) { html[data-tight="3"] .hx-t svg { transition: none; } }

/* js/topbtn.js: top and refresh, bottom left above the tab bar (the row-closing button is bottom right) */
html[data-tight="3"] .top-btn {
  position: fixed; left: 16px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 40;
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 999px;
  background: var(--glass-on); color: var(--glass-on-ink); border: 1px solid var(--glass-edge); box-shadow: var(--glass-shadow);
  -webkit-tap-highlight-color: transparent; cursor: pointer;
}
html[data-tight="3"] .top-btn svg { width: 20px; height: 20px; }
html[data-tight="3"] .top-btn.going svg { animation: top-spin .6s linear infinite; }
@keyframes top-spin { to { transform: rotate(360deg); } }
.top-btn[hidden] { display: none !important; }
html:not([data-tight="3"]) .top-btn { display: none !important; }
