/* Chrome: page-global html/body rules, the top bar, the sticky header and the fixed tape transport. */

/* ---------- global (chrome owns html/body) ---------- */
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 8px); }
html, body { overflow-x: clip; }
body { padding-bottom: calc(var(--transport-h) + env(safe-area-inset-bottom, 0px)); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.gw-skip { position: absolute; left: 12px; top: -80px; z-index: var(--z-dialog); background: var(--ink); color: var(--white); padding: 12px 16px; font: 500 14px/1 var(--mono); }
.gw-skip:focus { top: 12px; }

/* ---------- top bar: the list hears first (scrolls away) ---------- */
.gw-drop { background: var(--ink); color: var(--paper); border-bottom: 1.5px solid var(--ink); }
.gw-drop-in {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-height: var(--topbar-h); margin-top: 0; margin-bottom: 0;
  font: 500 12px/1.2 var(--mono); letter-spacing: .04em; text-transform: uppercase; text-align: center;
}
.gw-drop-in a { color: var(--orange); text-underline-offset: 3px; }
.gw-drop-in a:hover { text-decoration-thickness: 2px; }
.gw-drop-in a:focus-visible { outline-color: var(--orange); outline-offset: 3px; }
.gw-drop-rec { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 2px rgba(242, 107, 29, .25); animation: gw-rec 2s steps(2, jump-none) infinite; }
@keyframes gw-rec { 50% { opacity: .25; } }
.gw-drop-short { display: none; }

/* ---------- sticky header ---------- */
.gw-head { position: sticky; top: 0; z-index: var(--z-header); background: var(--paper); border-bottom: 1.5px solid var(--ink); }
.gw-head-in { display: flex; align-items: center; gap: 32px; height: var(--header-h); }
.gw-brand { display: block; flex: none; }
.gw-brand img { height: 30px; width: auto; }
.gw-nav { margin-left: auto; }
.gw-nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.gw-nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; color: var(--ink); text-decoration: none;
  font: 800 14px/1 var(--display); font-stretch: 90%; letter-spacing: .04em; text-transform: uppercase; border-radius: 999px;
}
.gw-nav a:hover { background: var(--shell); }
.gw-nav a[aria-current="true"] { background: var(--ink); color: var(--paper); }
.gw-use { flex: none; }
.gw-menu-btn { display: none; }
.gw-menu[hidden] { display: none; }

@media (max-width: 860px) {
  .gw-head-in { gap: 10px; }
  .gw-nav { display: none; }
  .gw-brand { margin-right: auto; }
  .gw-brand img { height: 24px; }
  .gw-use { min-height: 40px; padding: 0 12px; font-size: 14px; box-shadow: 3px 3px 0 var(--ink); }
  .gw-menu-btn {
    display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px; border: 1.5px solid var(--ink);
    background: var(--white); color: var(--ink); font: 500 12px/1 var(--mono); text-transform: uppercase; cursor: pointer;
  }
  .gw-menu-ico { display: grid; gap: 4px; width: 16px; }
  .gw-menu-ico i { display: block; height: 2px; background: currentColor; transition: transform .15s; }
  .gw-menu-btn[aria-expanded="true"] .gw-menu-ico i:first-child { transform: translateY(3px) rotate(45deg); }
  .gw-menu-btn[aria-expanded="true"] .gw-menu-ico i:last-child { transform: translateY(-3px) rotate(-45deg); }
  .gw-menu { position: absolute; left: 0; right: 0; top: 100%; background: var(--paper); border-bottom: 1.5px solid var(--ink); box-shadow: 0 10px 0 rgba(20, 22, 27, .12); }
  .gw-menu ol { list-style: none; margin: 0; padding: 8px 0 14px; }
  .gw-menu li + li { border-top: 1px solid var(--rule); }
  .gw-menu a {
    display: flex; align-items: baseline; gap: 14px; padding: 14px 0; color: var(--ink); text-decoration: none;
    font: 900 34px/1 var(--display); font-stretch: 82%; letter-spacing: -.02em; text-transform: uppercase;
  }
  .gw-menu-no { font: 500 12px/1 var(--mono); letter-spacing: .04em; color: var(--graphite); min-width: 22px; }
}
@media (max-width: 560px) {
  .gw-drop-in { gap: 8px; font-size: 11px; }
  .gw-drop-long { display: none; }
  .gw-drop-short { display: inline; }
  .gw-menu-txt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
/* the transport bar carries "Use one now" on phones; one CTA per screen */
@media (max-width: 760px) { .gw-head .gw-use { display: none; } }
@media (max-width: 370px) { .gw-drop-rec { display: none; } }

/* ---------- fixed tape transport (bottom) ---------- */
.gw-tp {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-transport);
  height: calc(var(--transport-h) + env(safe-area-inset-bottom, 0px)); padding: 0 14px env(safe-area-inset-bottom, 0px);
  display: flex; align-items: center; gap: 14px;
  background: var(--shell); color: var(--ink); border-top: 1.5px solid var(--ink);
  box-shadow: inset 0 1.5px 0 var(--white);
}
.gw-tp > * { flex: none; }

/* mini cassette */
.gw-tp-deck { width: 62px; }
.gw-tp-shell { display: block; aspect-ratio: 1.58; background: var(--ink); border-radius: 5px; padding: 6px 7px 9px; }
.gw-tp-win { display: flex; justify-content: space-between; align-items: center; height: 100%; padding: 0 5px; background: var(--paper); border-radius: 999px; }
.gw-tp-reel { position: relative; width: 17px; aspect-ratio: 1; display: grid; place-items: center; }
.gw-tp-pack { position: absolute; width: calc(var(--pack, .8) * 100%); aspect-ratio: 1; border-radius: 50%; background: #5A3B24; }
.gw-tp-hub { position: relative; width: 11px; aspect-ratio: 1; border-radius: 50%; border: 1.5px solid var(--ink); background: repeating-conic-gradient(var(--ink) 0 20deg, var(--white) 20deg 60deg); transform: rotate(var(--spin, 0deg)); }

/* mechanical counter */
.gw-tp-counter { display: flex; gap: 2px; padding: 4px; background: var(--ink); border-radius: 3px; box-shadow: inset 0 0 0 1.5px #3A3E47; }
.gw-tp-digit {
  width: 17px; height: 26px; overflow: hidden; border-radius: 2px;
  background: linear-gradient(#2A2D34, #14161B 30% 70%, #2A2D34); color: var(--paper);
  font: 500 17px/26px var(--mono); text-align: center;
}
.gw-tp-strip { display: block; transform: translateY(calc(var(--d, 0) * -26px)); transition: transform .28s cubic-bezier(.3, 1.4, .5, 1); }
.gw-tp-strip i { display: block; font-style: normal; height: 26px; }
.gw-tp-digit:last-child { color: var(--orange); }

/* now playing */
.gw-tp-now { display: flex; align-items: center; gap: 8px; margin: 0; width: 212px; min-width: 0; white-space: nowrap; }
.gw-tp-code { font: 500 12px/1 var(--mono); }
.gw-tp-title { overflow: hidden; text-overflow: ellipsis; font: 800 15px/1 var(--display); font-stretch: 88%; text-transform: uppercase; letter-spacing: .01em; }

/* prev / next */
.gw-tp-skip { display: flex; gap: 4px; }
.gw-tp-btn { width: 40px; height: 36px; display: grid; place-items: center; border: 1.5px solid var(--ink); border-radius: 3px; background: var(--white); box-shadow: 0 3px 0 var(--ink); color: var(--ink); cursor: pointer; padding: 0; }
.gw-tp-btn:hover { background: var(--paper); }
.gw-tp-btn:active { transform: translateY(3px); box-shadow: none; }
.gw-tp-btn[disabled] { opacity: .4; cursor: default; transform: none; box-shadow: 0 3px 0 var(--ink); }
.gw-tp-btn svg { width: 16px; height: 16px; }
.gw-tp-btn path { fill: var(--ink); stroke: var(--ink); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }

/* tape rail with walking Gant */
.gw-tp-rail { position: relative; flex: 1 1 auto; min-width: 120px; height: 100%; }
.gw-tp-tape { position: absolute; left: 0; right: 0; bottom: 14px; height: 6px; background: var(--white); border: 1.5px solid var(--ink); border-radius: 3px; overflow: hidden; }
.gw-tp-played { position: absolute; inset: 0; background: var(--orange); clip-path: inset(0 calc((1 - var(--p, 0)) * 100%) 0 0); }
.gw-tp-ticks { position: absolute; left: 0; right: 0; bottom: 8px; height: 4px; }
.gw-tp-ticks i { position: absolute; bottom: 0; width: 1.5px; height: 4px; background: var(--ink); }
.gw-tp-gant { position: absolute; bottom: 19px; left: calc(var(--p, 0) * 100%); width: 38px; transform: translateX(-50%); transition: left .12s linear; }
.gw-tp-gant svg { display: block; width: 100%; height: auto; transform: scaleX(var(--dir, 1)); }
.gw-tp-gant.is-walking svg g rect:nth-child(2), .gw-tp-gant.is-walking svg g rect:nth-child(4) { animation: gw-step .32s steps(2, jump-none) infinite; }
.gw-tp-gant.is-walking svg g rect:nth-child(3), .gw-tp-gant.is-walking svg g rect:nth-child(5) { animation: gw-step .32s steps(2, jump-none) infinite reverse; }
@keyframes gw-step { from { transform: translateY(0); } to { transform: translateY(-7px); } }

/* get new tapes + use */
.gw-tp-get { min-height: 38px; padding: 0 12px; font-size: 13px; background: var(--paper); box-shadow: 3px 3px 0 var(--ink); white-space: nowrap; }
.gw-tp-use { min-height: 38px; padding: 0 14px; font-size: 14px; box-shadow: 3px 3px 0 var(--ink); }

@media (max-width: 1100px) { .gw-tp-now { width: 170px; } }
@media (max-width: 760px) {
  .gw-tp { gap: 8px; padding-left: 10px; padding-right: 10px; }
  .gw-tp-deck, .gw-tp-get { display: none; }
  .gw-tp-now { flex: 1 1 auto; width: auto; gap: 6px; }
  .gw-tp-title { font-size: 14px; }
  /* the rail condenses to a progress line along the bar's top edge */
  .gw-tp-rail { position: absolute; left: 0; right: 0; top: -1.5px; height: 4px; min-width: 0; }
  .gw-tp-tape { inset: 0; height: 4px; border: 0; border-radius: 0; background: transparent; }
  .gw-tp-ticks, .gw-tp-gant { display: none; }
  .gw-tp-btn { width: 38px; }
  .gw-tp-use { padding: 0 10px; font-size: 13px; }
  .gw-tp-digit { width: 14px; font-size: 15px; }
}
@media (max-width: 360px) { .gw-tp-code { display: none; } }
