/* The share rail (templates/seo/share.html, game/sharerail.py): Facebook,
   Reddit, Threads and X at the start edge of every public indexable page
   (owner, 2026-10-24): the game, how to play and the bosses, privacy, terms
   and support. One file for the three kinds of page, so it brings the
   colours of the pixel dungeon (game.css) itself.

   It never moves the page: every rule here is the rail's own, nothing pads a
   column or changes a grid for it. Where the page leaves a margin beside its
   column: a rail of four coins 12px from the edge, at least 12px clear of
   the column. Elsewhere a tab flush with the edge, vertically centred, which
   opens the four in a stack beside it, over the page until it closes. The
   tab is 40 by 56 (owner 2026-10-25: bigger on phones), 44 wide where the
   page's margin holds that much 2px clear of the column (is-wide, set by
   the game, and the server pages by width); where the margin is thinner it
   lies over the edge of the page, which scrolls under it.
   The game measures every screen and says which in data-mode
   (static/js/shell.js: rail, handle or off, and off where a control that
   cannot scroll away would sit under the tab); the server pages switch by
   the width of their widest column (on-site, on-bosses, on-pages below).
   Never in a frame (html[data-framed], templates/seo/frame.html), over a
   dialog of the game, or on paper */

.wd-share {
  --wd-share-ring: #5b4b80;
  --wd-share-face: #241d36;
  --wd-share-ink: #f2ead7;
  /* from the edge: 0 for the tab, 12px for the rail, past a phone's notch */
  --wd-share-at: 0px;
  /* the tab's width: 40, 44 where the margin holds it */
  --wd-share-tab: 40px;
  --wd-share-safe: env(safe-area-inset-left, 0px);
  position: fixed;
  z-index: 40;
  top: 50%;
  inset-inline-start: calc(var(--wd-share-at) + var(--wd-share-safe));
  transform: translateY(-50%);
}
[dir="rtl"] .wd-share {
  --wd-share-safe: env(safe-area-inset-right, 0px);
}
/* Phone home: the quiet edge below its pinned header, including without apps.
   shell.js measures the header; tablets and desktop keep their usual rail. */
.wd-share.is-home-phone {
  top: var(--wd-share-home-top);
  transform: none;
}
/* no transitions at all: under reduced motion game.css gives everything a
   0.01ms one, which would leave the box where it was while shell.js
   measures the rail and then the tab in the same frame */
.wd-share,
.wd-share * {
  transition-property: none !important;
}
.wd-share svg {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 0 #0c0912);
}
.wd-share-ring {
  fill: var(--wd-share-ring);
}
.wd-share-face {
  fill: var(--wd-share-face);
}
.wd-share-mark {
  fill: var(--wd-share-ink);
}

/* the tab, flush with the edge, its rounded side towards the page, a soft
   shadow under it in the dungeon's deepest colour; at 40px its picture (44)
   loses the 4px at the screen's edge. The share icon, 20px, in its middle */
.wd-share.is-wide {
  --wd-share-tab: 44px;
}
.wd-share-handle {
  position: relative;
  display: block;
  width: var(--wd-share-tab);
  height: 56px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  filter: drop-shadow(0 2px 0 #0c0912) drop-shadow(0 4px 10px rgba(12, 9, 18, 0.7));
}
.wd-share-handle svg {
  filter: none;
}
.wd-share-handle .wd-share-icon {
  position: absolute;
  top: 18px;
  inset-inline-start: calc((var(--wd-share-tab) - 20px) / 2);
  width: 20px;
  height: 20px;
}
[dir="rtl"] .wd-share-handle svg {
  transform: scaleX(-1);
}
.wd-share-handle[aria-expanded="true"],
.wd-share-handle:focus-visible {
  --wd-share-ring: #e8b730;
}

.wd-share-list {
  display: none;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.wd-share-list > li {
  display: block;
  margin: 0;
  padding: 0;
}
.wd-share-link {
  display: block;
  width: 44px;
  height: 44px;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
/* quiet until pointed at: then the network's colour */
.wd-share-link.is-facebook {
  --wd-share-brand: #0866ff;
}
.wd-share-link.is-reddit {
  --wd-share-brand: #ff4500;
}
.wd-share-link.is-threads,
.wd-share-link.is-x {
  --wd-share-brand: #000;
}
.wd-share-link:focus-visible {
  --wd-share-face: var(--wd-share-brand);
  --wd-share-ink: #fff;
}
@media (hover: hover) {
  .wd-share-link:hover {
    --wd-share-face: var(--wd-share-brand);
    --wd-share-ink: #fff;
  }
  .wd-share-handle:hover {
    --wd-share-ring: #e8b730;
  }
}
.wd-share-link:focus-visible,
.wd-share-handle:focus-visible {
  outline: 2px solid #f08a24;
  outline-offset: 2px;
}
/* the tab's outline inside it, so not even focus reaches the page */
.wd-share-handle:focus-visible {
  outline-offset: -2px;
}
@media (prefers-reduced-motion: no-preference) {
  .wd-share-link:active,
  .wd-share-handle:active {
    transform: translateY(1px);
  }
}

/* the tab's stack, open beside it over the page */
.wd-share.is-open .wd-share-list {
  display: flex;
  position: absolute;
  top: 50%;
  inset-inline-start: calc(var(--wd-share-tab) + 6px);
  transform: translateY(-50%);
  padding: 6px;
  border: 2px solid #5b4b80;
  background: #14101f;
  box-shadow: 0 4px 0 #0c0912;
}

/* the rail: the four in the margin, no tab */
.wd-share[data-mode="rail"] {
  --wd-share-at: 12px;
}
.wd-share[data-mode="rail"] .wd-share-handle {
  display: none;
}
.wd-share[data-mode="rail"] .wd-share-list {
  display: flex;
  position: static;
  transform: none;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}
/* The server pages from the width where their widest column, centred, starts
   68px or more from the edge (12 + 44 + 12), with 16px to spare for a
   scrollbar. The store pages (pages.css): main 760px with 20px sides. Below
   that the tab, 44 wide where the column starts 46px or more from the edge
   (2px clear, the same 16 to spare), else 40 */
@media (min-width: 828px) {
  .wd-share.on-pages {
    --wd-share-tab: 44px;
  }
}
@media (min-width: 1036px) {
  .wd-share.on-site {
    --wd-share-tab: 44px;
  }
}
@media (min-width: 1196px) {
  .wd-share.on-bosses {
    --wd-share-tab: 44px;
  }
}
@media (min-width: 872px) {
  .wd-share.on-pages {
    --wd-share-at: 12px;
  }
  .wd-share.on-pages .wd-share-handle {
    display: none;
  }
  .wd-share.on-pages .wd-share-list {
    display: flex;
    position: static;
    transform: none;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
  }
}
/* how to play (site.css): the header and the foot 960px with 16px sides */
@media (min-width: 1080px) {
  .wd-share.on-site {
    --wd-share-at: 12px;
  }
  .wd-share.on-site .wd-share-handle {
    display: none;
  }
  .wd-share.on-site .wd-share-list {
    display: flex;
    position: static;
    transform: none;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
  }
}
/* the bosses (site.css): their column 1120px with 16px sides from 1024px */
@media (min-width: 1240px) {
  .wd-share.on-bosses {
    --wd-share-at: 12px;
  }
  .wd-share.on-bosses .wd-share-handle {
    display: none;
  }
  .wd-share.on-bosses .wd-share-list {
    display: flex;
    position: static;
    transform: none;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
  }
}

/* nowhere: a frame (any site's, the catalog's too), the game before its
   first screen, in a run on a phone and where a control of its screen that
   cannot scroll away would sit under the tab, a dialog or sheet of the game
   over the screen, typing with the phone's keyboard up, print */
.wd-share[data-mode="off"],
html[data-framed] .wd-share,
body:has(#layer > .veil) .wd-share,
body.is-editing .wd-share[data-mode="handle"] {
  display: none;
}
/* the badge of WordleLike.games scrolling under the tab: the tab steps aside
   while it passes (templates/seo/share.html) */
.wd-share.is-aside {
  visibility: hidden;
}
@media print {
  .wd-share {
    display: none !important;
  }
}
