/*
 * Site PWA kit - styles.
 *
 * Deliberately plain: it inherits the site's fonts, and colors come from CSS
 * variables with safe fallbacks. Override any of these in the theme stylesheet
 * (load this first) or set the variables on :root.
 *
 *   --spwa-bg      bar background      (default: near-black)
 *   --spwa-fg      bar text            (default: white)
 *   --spwa-accent  button background   (default: white)
 *   --spwa-radius  corner radius       (default: 12px)
 */

.spwa-install,
.spwa-notice {
  --spwa-bg: var(--color-text, #15202b);
  --spwa-fg: #ffffff;
  --spwa-accent: #ffffff;
  --spwa-radius: 12px;
}

/* Install bar: bottom of the screen, above the thumb, never over the content. */
.spwa-install {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--spwa-radius);
  background: var(--spwa-bg);
  color: var(--spwa-fg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .28);
  font-size: 13px;
  line-height: 1.35;
}
.spwa-install[hidden] { display: none; }
.spwa-install img { border-radius: 10px; flex-shrink: 0; }
.spwa-install__text { display: grid; gap: 2px; flex: 1; min-width: 0; }
.spwa-install__text span { opacity: .8; }
.spwa-install__go {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  background: var(--spwa-accent);
  color: var(--spwa-bg);
  cursor: pointer;
  white-space: nowrap;
}
.spwa-install__go[hidden] { display: none; }
.spwa-install__close {
  background: none;
  border: 0;
  color: inherit;
  opacity: .7;
  font-size: 22px;
  line-height: 1;
  padding: 4px;
  cursor: pointer;
}

/* Small phones (iPhone SE/mini, 375px and down).
   One flex row cannot hold icon + title + button + close: a longer site name
   wraps to four lines and the bar grows tall enough to cover the hero. So:
   row 1 is icon, text and close; row 2 is the button, full width. */
@media (max-width: 420px) {
  .spwa-install {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px 10px;
    padding: 12px;
  }
  .spwa-install img { grid-row: 1; }
  .spwa-install__text {
    grid-row: 1;
    grid-column: 2;
    font-size: 12.5px;
  }
  .spwa-install__text strong {
    /* Two lines maximum, whatever the site is called. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .spwa-install__close { grid-row: 1; grid-column: 3; align-self: start; }
  .spwa-install__go {
    grid-row: 2;
    grid-column: 1 / -1;
    width: 100%;
    padding: 11px 14px;
  }
}

/* Save button: sits in the page, under the title. */
.spwa-save {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 18px;
}
.spwa-save[hidden] { display: none; }
.spwa-save__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 9px 16px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.spwa-save__btn.is-saved { background: currentColor; }
.spwa-save__btn.is-saved span { mix-blend-mode: difference; }
.spwa-save__hint { font-size: 12.5px; opacity: .75; }

/* "You are reading a saved copy" / "newer version available". */
.spwa-notice {
  position: fixed;
  left: 12px;
  right: 12px;
  top: 12px;
  z-index: 61;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--spwa-radius);
  background: var(--spwa-bg);
  color: var(--spwa-fg);
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .28);
}
.spwa-notice[hidden] { display: none; }
.spwa-notice__go {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--spwa-accent);
  color: var(--spwa-bg);
  cursor: pointer;
  margin-left: auto;
}

/* Phone and tablet only. A desktop visitor is not adding anything to a home
   screen, and the save button means nothing there. Set config 'desktop' => true
   and drop this block if a site wants it everywhere. */
@media (min-width: 901px) and (hover: hover) and (pointer: fine) {
  .spwa-save,
  .spwa-install { display: none !important; }
}
