/*
 * Shared components. Page-specific rules live in styles/pages/.
 */

/* ---- Footer (websiteBottom.html) ---- */
.websiteBottom {
  left: 0;
  right: 0;
  bottom: 0;
  text-align: center;
  background-color: var(--color-slate);
  color: var(--color-text-on-dark);
  font-size: var(--font-size-2xl);
  padding: var(--space-4);
  z-index: var(--z-base);
}

.websiteBottom a,
.websiteBottom p.websiteBottom-copy {
  color: var(--color-text-inverse);
  text-decoration: none;
}

.websiteBottom .websiteBottom-sep {
  color: var(--color-text-on-dark);
  display: inline;
}

/* ---- Layout ---- */
.content {
  padding: var(--space-4);
}

/* ---- Buttons (game and guess pages) ---- */
.btn {
  border: 2px solid var(--color-border-strong);
  background-color: var(--color-surface);
  color: var(--color-ink);
  padding: var(--space-3-5) var(--space-7);
  font-size: var(--font-size-lg);
  cursor: pointer;
}

.greenBtn {
  border-color: var(--color-success-legacy);
  color: var(--color-success-pure);
}

.greenBtn:hover {
  background-color: var(--color-success-legacy);
  color: var(--color-text-inverse);
}

.blueBtn {
  border-color: var(--color-info-legacy);
  color: var(--color-info-pure);
}

.blueBtn:hover {
  background: var(--color-info-legacy);
  color: var(--color-text-inverse);
}

.orangeBtn {
  border-color: var(--color-warning-legacy);
  color: var(--color-warning-pure);
}

.orangeBtn:hover {
  background: var(--color-warning-legacy);
  color: var(--color-text-inverse);
}

.redBtn {
  border-color: var(--color-danger-legacy);
  color: var(--color-danger-pure);
  animation: blinking 1300ms infinite;
}

.redBtn:hover {
  background: var(--color-danger-legacy);
  color: var(--color-text-inverse);
}

@keyframes blinking {
  0% {
    background: var(--color-surface);
    color: var(--color-danger-legacy);
  }
  85% {
    background: var(--color-surface);
    color: var(--color-danger-legacy);
  }
  100% {
    background: var(--color-danger-legacy);
    color: var(--color-text-inverse);
  }
}

/* Mission picker buttons built by index.js */
.image-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin: auto;
  background-color: var(--color-surface-subtle);
  border: 1px solid var(--color-text-neutral);
  border-radius: var(--radius-xs);
  padding: var(--space-2) var(--space-4);
  transition: background-color 0.3s ease-in-out;
  font-weight: bold;
  font-size: medium;
}

.image-button:hover {
  background-color: var(--color-neutral-mid);
}

/* ---- Loading spinner ---- */
.loader {
  margin: auto;
  border: 6px solid var(--color-surface-muted);
  border-radius: var(--radius-round);
  border-top: 6px solid var(--color-link);
  width: 20px;
  height: 20px;
  -webkit-animation: spin 2s linear infinite;
  animation: spin 2s linear infinite;
}

@-webkit-keyframes spin {
  0% { -webkit-transform: rotate(0deg); }
  100% { -webkit-transform: rotate(360deg); }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ---- Toggle switch (worldmap settings) ---- */
.switch {
  position: relative;
  display: flex;
  width: 30px;
  height: 17px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--color-muted-control);
  -webkit-transition: .4s;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 13px;
  width: 13px;
  left: 2px;
  bottom: 2px;
  background-color: var(--color-surface);
  -webkit-transition: .4s;
  transition: .4s;
}

input:checked + .slider {
  background-color: var(--color-neutral-mid);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--color-info-legacy);
}

input:checked + .slider:before {
  -webkit-transform: translateX(13px);
  -ms-transform: translateX(13px);
  transform: translateX(13px);
}

.slider.round {
  border-radius: var(--radius-pill);
}

.slider.round:before {
  border-radius: var(--radius-round);
}

/* ---- Mission description "see more" (worldmap) ---- */
#missionAIDescription {
  overflow: hidden;
  height: 3em; /* number of lines shown before "see more" */
  transition: height 0.5s;
}

#missionAIDescription.expanded {
  height: auto;
}

#seeMoreButton {
  background: none;
  color: var(--color-link);
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  outline: inherit;
  font-weight: bold;
}

/* ---- Share modal (share.html) ---- */
#shareModal .modern-popup-content {
  padding: var(--space-5);
  text-align: center;
}

#shareModal #gameTokenLabel {
  margin-bottom: var(--space-3);
  font-weight: var(--font-weight-semibold);
}

#shareModal #contentToShare {
  width: 100%;
  margin-bottom: var(--space-4);
  padding: var(--space-2-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xs);
  resize: vertical;
  min-height: 70px;
  font-family: var(--font-mono);
  font-size: var(--font-size-base);
  box-sizing: border-box;
}

#shareModal #shareButtons {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
  flex-wrap: wrap;
  max-width: 100%;
  margin: 0;
}

.share-btn {
  flex: 1;
  min-width: 100px;
  max-width: 140px;
  padding: var(--space-2-5) var(--space-3);
  font-size: var(--font-size-sm);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: var(--font-weight-semibold);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1-5);
  color: var(--color-text-inverse);
  box-shadow: var(--shadow-sm);
}

.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-raised);
  opacity: 0.9;
}

.share-btn img {
  width: 16px;
  height: 16px;
  margin-right: var(--space-1-5);
}

.share-btn--copy {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1.5px solid var(--color-border);
}

.share-btn--share {
  background: var(--color-share-blue);
}

.share-btn--facebook {
  background: #1877f2; /* Facebook brand blue */
}

.share-btn--email {
  background: var(--color-share-green);
}

/* ---- Store cart icon (store/cart.js) ---- */
.cart-icon {
  vertical-align: -3px;
  margin-right: var(--space-1);
}

/* ---- Chips (mission popup: languages, regions, leadership, guesses) ---- */
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.chip-list--tight {
  gap: var(--space-1-5);
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 var(--space-3);
  box-sizing: border-box;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: var(--color-surface-soft);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
}

.chip--sm {
  min-height: 26px;
  padding: 0 var(--space-2-5);
  font-size: var(--font-size-xs);
}

.chip--language {
  background: var(--color-surface-tint);
  color: var(--color-accent-strong);
}

.chip--region {
  background: transparent;
  border-color: var(--color-border-soft);
  font-weight: var(--font-weight-semibold);
}

.chip--leader,
.chip--leader-past,
.chip--guess {
  background: var(--color-surface-soft);
  color: var(--color-text);
}

/* ---- Disclosure: a row that shows or hides the content below it ---- */
.disclosure {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  min-height: 36px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-link);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  cursor: pointer;
}

.disclosure:hover {
  color: var(--color-link-hover);
}

.disclosure__chevron {
  transition: transform 0.2s ease;
}

.disclosure[aria-expanded="true"] .disclosure__chevron {
  transform: rotate(180deg);
}

/* ---- Mission popup text ---- */
.mission-meta {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.mission-meta--below {
  margin-top: var(--space-2);
}

.mission-meta--above {
  margin-bottom: var(--space-1);
}

.mission-note {
  color: var(--color-text-faint);
  font-style: italic;
  font-size: var(--font-size-xs);
}

.mission-empty {
  color: var(--color-text-muted);
  font-style: italic;
}

.leadership-past-row {
  margin-bottom: var(--space-2-5);
}

.mission-description {
  font-family: var(--font-display);
  font-size: var(--font-size-lg-plus);
  line-height: 1.6;
  color: var(--color-text-secondary);
  margin: 0;
}

.mission-detail {
  margin-bottom: var(--space-3);
}

.mission-detail__label {
  color: var(--color-text-secondary);
  display: block;
  margin-bottom: var(--space-1);
}

.mission-detail__value {
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ---- Ad slot (ads-controller.js renderAdPlacement) ---- */
.ad-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-lg);
  padding: 0;
  overflow: hidden;
  box-sizing: border-box;
  background: var(--color-surface);
  text-decoration: none;
  cursor: pointer;
}

.ad-frame__creative {
  display: inline-block;
  width: 100%;
}

.ad-frame__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  box-sizing: border-box;
  padding: var(--space-2-5) var(--space-3-5);
  font-size: 11px;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ad-label);
  text-align: left;
}

.ad-frame__cta {
  flex-shrink: 0;
  font-size: var(--font-size-base);
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-link);
}

/* Sponsor promo code (renderAdPlacement createPromoLine), between the
   creative and the label row. */
.ad-frame__promo {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  column-gap: 0.3em;
  width: 100%;
  box-sizing: border-box;
  padding: var(--space-2) var(--space-3-5);
  border-bottom: 1px solid var(--color-border-soft);
  background: var(--color-accent-a07);
  font-size: var(--font-size-base);
  line-height: 1.35;
  color: var(--color-text);
  text-align: center;
}

.ad-frame__promo-code {
  color: var(--color-accent-strong);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.02em;
}

.ad-creative {
  display: block;
  max-width: 100%;
}

/* Fill the frame: a 330px phone creative in a wider slot would otherwise
   leave a blank strip beside it. */
.ad-frame__creative .ad-creative {
  width: 100%;
  height: auto;
}

.ad-video {
  position: relative;
}

.ad-video__mute {
  position: absolute;
  right: var(--space-2);
  bottom: var(--space-2);
  padding: var(--space-1-5) var(--space-2-5);
  border: none;
  border-radius: var(--radius-md);
  background: var(--overlay-dark-60);
  color: var(--color-text-inverse);
  cursor: pointer;
  font-weight: var(--font-weight-semibold);
}

/* Cloudflare Stream embed */
.ad-embed {
  position: relative;
  width: 320px;
  height: 400px;
  margin: 0 auto;
}

.ad-embed__frame {
  border: none;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-xl);
}

/* Covers all but the bottom 50px, which holds the player's own controls */
.ad-embed__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(100% - 50px);
  cursor: pointer;
  z-index: 1;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

/* ---- Utilities ---- */
.u-bg-transparent {
  background: transparent !important;
}

.u-flex-1 {
  flex: 1;
}

.u-flex-center {
  display: flex;
  justify-content: center;
  width: 100%;
}

.u-leading-relaxed {
  line-height: 1.6;
}

.u-mb-1-5 {
  margin-bottom: var(--space-1-5);
}

.u-mb-4 {
  margin-bottom: var(--space-4);
}

.u-mb-5 {
  margin-bottom: var(--space-5);
}

.u-mb-6 {
  margin-bottom: var(--space-6);
}

.u-no-pointer {
  pointer-events: none;
}

.u-text-center {
  text-align: center;
}

.u-bold {
  font-weight: var(--font-weight-bold);
}

/* ---- AdSense containers built by worldmap-app.js ---- */
.adsense-container {
  text-align: center;
  margin: var(--space-2-5) auto;
  width: 100%;
  max-width: 100%;
}

.adsense-slot-280 {
  height: 280px;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

/* Staging stand-ins for AdSense slots */
.ad-placeholder__name {
  font-weight: var(--font-weight-bold);
}

.ad-placeholder__meta {
  font-size: var(--font-size-xs);
  margin-top: var(--space-1);
}

/* Flags drawn as cloth waving from a pole (MissionFlags.wave in
   /prepare/flags.js, on the Prepare pages and in the store): the
   #prepFlagWave filter ripples the edges, ::after lays light and shadow
   folds across, and ::before adds a soft shine. The hoist is the white strip with grommets. */
.prep-wave { position: relative; display: block; width: 100%; aspect-ratio: 3 / 2; filter: url(#prepFlagWave) drop-shadow(0 2px 3px rgba(0, 0, 0, .18)); }
.prep-wave img.prep-wave__flag { position: absolute; top: 6%; left: 5.7%; width: 92.3%; height: 88%; max-width: none; aspect-ratio: auto; padding: 0; margin: 0; border-radius: 0; box-shadow: none; object-fit: cover; display: block; }
.prep-wave--small img.prep-wave__flag, .prep-wave--flat img.prep-wave__flag { left: 2%; width: 96%; }
.prep-wave::before, .prep-wave::after { content: ""; position: absolute; top: 6%; bottom: 6%; left: 2%; right: 2%; pointer-events: none; }
.prep-wave::after { mix-blend-mode: soft-light;
  background: linear-gradient(100deg, rgba(0, 0, 0, .45) 0%, rgba(255, 255, 255, .55) 14%, rgba(0, 0, 0, .40) 31%, rgba(255, 255, 255, .60) 48%, rgba(0, 0, 0, .45) 66%, rgba(255, 255, 255, .50) 82%, rgba(0, 0, 0, .35) 100%); }
.prep-wave::before { z-index: 1; mix-blend-mode: screen;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0) 4%, rgba(255, 255, 255, .16) 14%, rgba(255, 255, 255, 0) 26%, rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, .18) 48%, rgba(255, 255, 255, 0) 58%, rgba(255, 255, 255, 0) 74%, rgba(255, 255, 255, .14) 82%, rgba(255, 255, 255, 0) 92%); }
.prep-wave--flat { filter: none; }
.prep-wave--flat img.prep-wave__flag { object-fit: contain; }
.prep-wave--flat::before, .prep-wave--flat::after { content: none; }
.prep-wave__hoist { position: absolute; top: 6%; bottom: 6%; left: 2%; width: 3.7%;
  background:
    radial-gradient(circle closest-side, #f6f6f6 0 30%, #6f767d 34% 44%, #eef0f2 50% 60%, #8d949b 68% 78%, transparent 84%) 50% 5% / 100% 6.3% no-repeat,
    radial-gradient(circle closest-side, #f6f6f6 0 30%, #6f767d 34% 44%, #eef0f2 50% 60%, #8d949b 68% 78%, transparent 84%) 50% 95% / 100% 6.3% no-repeat,
    linear-gradient(90deg, #e4e4e4, #fbfbfb 35%, #f1f1f1 85%, #c9c9c9 100%); }
