/* FooSW — shared left tools rail (collapsed strip; expands on hover on desktop,
   tap-to-toggle on narrow touch screens — hover does NOT expand on touch devices) */
:root {
  --foosw-rail-collapsed: 52px;
  --foosw-rail-expanded: 252px;
  --foosw-mobile-content-gutter: 12px;
}

body.foosw-with-tools-rail {
  padding-left: var(--foosw-rail-collapsed);
}

.foosw-tools-rail {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--foosw-rail-collapsed);
  /* Full-screen modals must use z-index *above* this (Core Teams / Draft Strategy use 200000). */
  z-index: 100500;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #1e1836 0%, #12101f 55%, #0e0c18 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 4px 0 28px rgba(0, 0, 0, 0.22);
  transition: width 0.22s ease, box-shadow 0.22s ease;
  overflow: hidden;
  /* Avoid the rail stealing horizontal swipes meant for range inputs beside it */
  touch-action: pan-y;
}

/* ── Desktop only: expand rail on hover (primary input can hover) ───────────
   Touch phones/tablets report hover: none, so this block does not apply there
   (avoids sticky :hover widening the rail when using sliders). */
@media (hover: hover) {
  .foosw-tools-rail:hover {
    width: var(--foosw-rail-expanded);
    box-shadow: 8px 0 36px rgba(0, 0, 0, 0.3);
  }

  .foosw-tools-rail:hover .foosw-tools-rail-brand .fts-brand-txt {
    display: block;
  }

  .foosw-tools-rail:hover .fts-l {
    opacity: 1;
    max-width: 220px;
  }
}

.foosw-tools-rail-brand {
  flex-shrink: 0;
  padding: 14px 6px 10px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  user-select: none;
  position: relative;
}

.foosw-tools-rail-brand .fts-brand-ico {
  font-size: 22px;
  line-height: 1;
  display: block;
}

.foosw-tools-rail-brand .fts-brand-txt {
  display: none;
  margin-top: 6px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(200, 190, 255, 0.45);
}

.foosw-tools-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.foosw-tools-rail-footer {
  flex-shrink: 0;
  padding: 6px 6px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.fts {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  color: rgba(245, 240, 255, 0.92);
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease;
  border: 1px solid transparent;
}

.fts:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.06);
}

.fts-i {
  font-size: 17px;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
  line-height: 1;
}

.fts-l {
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  transition: opacity 0.16s ease, max-width 0.22s ease;
}

/* Show labels when rail is explicitly open (mobile) */
.foosw-tools-rail.foosw-tools-rail--open .fts-l {
  opacity: 1;
  max-width: 220px;
}

.foosw-tools-rail.foosw-tools-rail--open .foosw-tools-rail-brand .fts-brand-txt {
  display: block;
}

.fts-home:hover { background: rgba(120, 100, 200, 0.2); }
.fts-gold:hover { background: rgba(200, 160, 40, 0.18); color: #ffe8a8; }
.fts-teal:hover { background: rgba(14, 150, 140, 0.22); color: #b8fff8; }
.fts-purple:hover { background: rgba(124, 58, 237, 0.25); color: #e9d5ff; }
.fts-orange:hover { background: rgba(217, 119, 6, 0.2); color: #ffddaa; }
.fts-cyan:hover { background: rgba(8, 145, 178, 0.2); color: #a5f3fc; }
.fts-green:hover { background: rgba(22, 163, 74, 0.2); color: #bbf7d0; }
.fts-build:hover { background: rgba(217, 119, 6, 0.18); color: #fed7aa; }
.fts-shop:hover { background: rgba(236, 72, 153, 0.2); color: #fce7f3; }

/* Fan picks / shop — hidden for now (remove this block to show again) */
.fts-shop,
a.card[href="shop.html"] {
  display: none !important;
}

.fts-beer {
  background: rgba(255, 221, 0, 0.06);
  border-color: rgba(200, 160, 40, 0.25);
  color: #ffe066;
}
.fts-beer:hover {
  background: rgba(255, 221, 0, 0.14);
  color: #fff3a0;
}

/* Full-width sticky headers on tool pages (undo body side-padding inset) */
body.foosw-with-tools-rail .foosw-rail-shift-header {
  margin-left: calc(-1 * var(--foosw-rail-collapsed));
  width: calc(100% + var(--foosw-rail-collapsed));
  box-sizing: border-box;
  padding-left: calc(var(--foosw-rail-collapsed) + var(--foosw-rail-header-pad, 16px));
}

/* ═══ Mobile / narrow screens ═══════════════════════════════════════════ */
@media (max-width: 720px) {
  /* Extra gutter so sliders and inputs aren’t flush against the rail */
  body.foosw-with-tools-rail {
    padding-left: calc(var(--foosw-rail-collapsed) + var(--foosw-mobile-content-gutter));
    padding-right: var(--foosw-mobile-content-gutter);
    box-sizing: border-box;
  }

  body.foosw-with-tools-rail .foosw-rail-shift-header {
    padding-left: calc(var(--foosw-rail-collapsed) + var(--foosw-mobile-content-gutter) + var(--foosw-rail-header-pad, 16px)) !important;
  }

  .foosw-tools-rail {
    width: var(--foosw-rail-collapsed);
  }

  /* Accordion hint: chevron on the brand row (tap opens menu) */
  .foosw-tools-rail-brand {
    cursor: pointer;
    padding-right: 18px;
  }

  .foosw-tools-rail-brand::after {
    content: "▸";
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: 700;
    color: rgba(200, 190, 255, 0.55);
    transition: transform 0.2s ease;
    pointer-events: none;
  }

  .foosw-tools-rail.foosw-tools-rail--open .foosw-tools-rail-brand::after {
    transform: translateY(-50%) rotate(90deg);
  }

  .foosw-tools-rail.foosw-tools-rail--open {
    width: var(--foosw-rail-expanded);
    box-shadow: 8px 0 36px rgba(0, 0, 0, 0.35);
  }

  /* ── “Buy me a beer” dedupe on small screens ────────────────────────────
     Pages with body.foosw-beer-top already show beer in the sticky top bar /
     nav — hide the duplicate in the rail footer and the floating FAB. */
  body.foosw-beer-top .foosw-tools-rail-footer {
    display: none !important;
  }

  a.donate-fab,
  .donate-fab,
  a.fab[href*="buymeacoffee.com"] {
    display: none !important;
  }

  /* Smaller, less intrusive top beer / nav beer */
  a.nl-beer,
  .foosw-rail-shift-header a[href*="buymeacoffee.com"],
  .ph-nav a[href*="buymeacoffee.com"],
  .nav a.nl-beer {
    font-size: 10px !important;
    font-weight: 700 !important;
    padding: 4px 8px !important;
    letter-spacing: 0 !important;
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* After scrolling down on mobile, hide sticky-header beer (shown again near top of page) */
body.foosw-with-tools-rail.foosw--beer-header-hidden .nl-beer,
body.foosw-with-tools-rail.foosw--beer-header-hidden .foosw-rail-shift-header a[href*="buymeacoffee.com"],
body.foosw-with-tools-rail.foosw--beer-header-hidden .ph-nav a[href*="buymeacoffee.com"] {
  display: none !important;
}
