/*
 * Share cards: the popup that holds a player's card, the button that opens it,
 * and the ask to join that a friend sees. Built for a phone first: on a phone
 * the popup is a sheet that slides up from the bottom, so it never covers the
 * top of what they were reading. From 620px it sits in the middle.
 *
 * It borrows the game's own look: white paper, a 2px ink line, a hard shadow.
 */

.iig-share-open { overflow: hidden; }

.iig-share {
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: auto 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #1e1a16;
  font: 16px/1.45 Poppins, Arial, sans-serif;
  overflow: visible;
}

.iig-share::backdrop { background: rgba(30, 26, 22, .6); }

.iig-share__sheet {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: auto;
  padding: 20px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  border: 2px solid #1e1a16;
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background: #fff;
}

.iig-share[open] .iig-share__sheet { animation: iig-share-up .22s ease-out both; }

@keyframes iig-share-up {
  from { transform: translateY(28px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.iig-share h2 {
  margin: 0 52px 2px 0;
  padding: 0;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -.02em;
}

.iig-share__lead {
  margin: 0 52px 14px 0;
  color: #555;
  font-size: 15px;
}

/* "button." on these, so the game's own "every button inherits its font" rule does not win. */
button.iig-share__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: #1e1a16;
  font: 400 32px/1 Arial, sans-serif;
  cursor: pointer;
}

button.iig-share__close:hover { background: #f0f0f0; }

/* The card itself: the same picture Facebook will show, at the same shape. */
.iig-share__card {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
  margin: 0 0 16px;
  border: 2px solid #1e1a16;
  border-radius: 12px;
  background: #12a7ff;
}

/*
 * Not the card's blue. The button sits right under the picture, and in the same blue it read as part
 * of it. Jamey: "the share to facebook button should not match the same blue as the card". So it is
 * ink with white words, like the badge on the card. (The game's own button rule uses !important.)
 *
 * Then: "it needs a diagonal arrow.. and to be a little less blocky". So it has round ends, like
 * the button on the card, with no heavy bottom edge, and an arrow pointing up and out: this one
 * takes you somewhere else.
 */
.iig-share .iig-share__facebook {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 56px;
  padding: 12px 16px;
  border: 2px solid #1e1a16;
  border-radius: 999px;
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  text-decoration: none !important;
  cursor: pointer;
  background: #1e1a16 !important;
  color: #fff !important;
}

.iig-share__arrow {
  flex: none;
  width: 22px;
  height: 22px;
}

/* Save picture: as plain as Copy link, but a box, as it is the second way to share. */
button.iig-share__save {
  display: block;
  width: 100%;
  min-height: 50px;
  margin: 10px 0 0;
  padding: 10px;
  border: 2px solid #1e1a16;
  border-radius: 10px;
  background: #fff;
  color: #1e1a16;
  font: 700 17px/1.2 Poppins, Arial, sans-serif;
  cursor: pointer;
}
button.iig-share__save:hover { background: #f3f1ee; }
.iig-share--page-font button.iig-share__save { font-family: inherit; }

button.iig-share__copy {
  display: block;
  width: 100%;
  min-height: 48px;
  margin: 6px 0 0;
  padding: 10px;
  border: 0;
  background: none;
  color: #1e1a16;
  font: 600 16px/1.3 Poppins, Arial, sans-serif;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.iig-share__status {
  min-height: 22px;
  margin: 0;
  color: #237a30;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}

/* No words yet, no gap under "Copy link". */
.iig-share__status:empty { display: none; }

/*
 * The site's theme draws a faint line round every button. These three are not boxes: a cross, a line
 * of underlined words, and a button with its own border. The focus ring below still shows.
 */
button.iig-share__close,
button.iig-share__copy,
button.iig-share__save,
button.iig-share-open-button { outline: 0; }

.iig-share a:focus-visible,
.iig-share button:focus-visible,
.iig-share-open-button:focus-visible {
  outline: 3px solid #73182c;
  outline-offset: 3px;
}

/* The button under the results that opens the card at any time. Quieter than the game's main button. */
button.iig-share-open-button {
  display: block;
  width: 100%;
  min-height: 50px;
  margin: 24px 0 0;
  padding: 12px 16px;
  border: 2px solid #1e1a16;
  border-bottom-width: 5px;
  border-radius: 10px;
  background: #fff;
  color: #1e1a16;
  font: 700 17px/1.3 Poppins, Arial, sans-serif;
  text-align: center;
  cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
  button.iig-share-open-button:hover { background: #f0faff; }
  .ii-gw-toolbar button.iig-share-open-button:hover { background: #f3f3f3; }
}

/* The ask to join, for a friend who came in from a share and has now voted. */
.iig-share-join {
  margin: 26px 0 0;
  padding: 20px;
  border: 2px solid #1e1a16;
  border-radius: 14px;
  background: #fff4b8;
}

.iig-share-join h2 {
  margin: 0 0 6px;
  padding: 0;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -.02em;
}

.iig-share-join p {
  margin: 0 0 14px;
  font-size: 16px;
  line-height: 1.5;
}

@media (min-width: 620px) {
  .iig-share {
    width: min(100% - 32px, 600px);
    margin: auto;
  }

  .iig-share__sheet {
    padding: 24px;
    border-bottom: 2px solid #1e1a16;
    border-radius: 18px;
    box-shadow: 0 5px 0 #1e1a16;
  }

  .iig-share h2 { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .iig-share[open] .iig-share__sheet { animation: none; }
}

/*
 * GuessWhere. Its page is the theme's, not the games' own, so the popup takes the page's font there
 * instead of loading another one. Its button, "Share my guess", sits in the game's result panel and is
 * sized to match the panel's own buttons. The ask to join is one line, because the panel is small and
 * sits over the map.
 */
.iig-share.iig-share--page-font,
.iig-share--page-font button.iig-share__copy { font-family: inherit; }

.ii-gw-toolbar button.iig-share-open-button {
  min-height: 44px;
  margin: 0;
  padding: 9px 10px;
  border-bottom-width: 2px;
  border-radius: 14px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
}

.iig-share-join--slim {
  margin: 0;
  padding: 8px 10px;
  border-width: 1px;
  border-radius: 10px;
  color: #1e1a16;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
}

.iig-share-join--slim a {
  color: #1e1a16;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
