/*!
 * Waarning PWA chrome — owner C (frontend/assets/pwa.css).
 *
 * Only three small surfaces live here: the offline banner, the install prompt and
 * the "new version" notice. They are injected by /assets/pwa.js into a single
 * fixed dock, so no page markup is required and everything is absent without JS.
 *
 * Palette, type and rhythm are the site's own. Every token has a literal fallback
 * because this file is also loaded before site.css, and on /offline.html.
 * Nothing here may overflow at 390 px.
 */

.wa-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 12px calc(12px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}

.wa-dock > * {
  width: 100%;
  max-width: 560px;
  pointer-events: auto;
}

@media (min-width: 760px) {
  .wa-dock {
    align-items: flex-end;
    padding-right: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }
  .wa-dock > * {
    max-width: 400px;
  }
}

/* ---------- shared card ---------- */

.wa-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px 11px 14px;
  background: var(--paper-2, #f8f2e3);
  border: 1px solid var(--line-strong, rgba(23, 35, 29, 0.38));
  border-radius: 12px;
  box-shadow: 0 14px 34px rgba(49, 38, 20, 0.18);
  color: var(--ink, #17231d);
  font-family: var(--sans, "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif);
  font-size: 12.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  animation: wa-rise 220ms ease-out both;
}

.wa-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--rust, #b7472a);
}

.wa-card[data-tone="quiet"]::before {
  background: var(--teal, #2f6f68);
}

.wa-card[data-tone="live"]::before {
  background: var(--p1, #c27a1e);
}

.wa-card__body {
  flex: 1 1 auto;
  min-width: 0;
}

.wa-card__label {
  display: block;
  margin-bottom: 2px;
  font-family: var(--mono, "IBM Plex Mono", ui-monospace, Menlo, monospace);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rust, #b7472a);
}

.wa-card[data-tone="quiet"] .wa-card__label {
  color: var(--teal, #2f6f68);
}

.wa-card[data-tone="live"] .wa-card__label {
  color: var(--amber, #c27a1e);
}

.wa-card__title {
  display: block;
  font-family: var(--display, "Bricolage Grotesque", "Trebuchet MS", sans-serif);
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--ink, #17231d);
}

.wa-card__text {
  margin: 3px 0 0;
  color: var(--ink-2, #2b3a31);
  overflow-wrap: anywhere;
}

.wa-card__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
}

.wa-card__link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 2px;
  color: var(--rust, #b7472a);
  font-size: 12px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.wa-card__link:hover {
  color: var(--ink, #17231d);
}

/* ---------- buttons ---------- */

.wa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--ink, #17231d);
  border-radius: 8px;
  background: var(--ink, #17231d);
  color: var(--paper-2, #f8f2e3);
  font-family: var(--mono, "IBM Plex Mono", ui-monospace, Menlo, monospace);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}

.wa-btn:hover {
  background: var(--rust, #b7472a);
  border-color: var(--rust, #b7472a);
}

.wa-btn--ghost {
  background: transparent;
  border-color: var(--line-strong, rgba(23, 35, 29, 0.38));
  color: var(--ink-2, #2b3a31);
}

.wa-btn--ghost:hover {
  background: transparent;
  border-color: var(--ink, #17231d);
  color: var(--ink, #17231d);
}

.wa-btn--text {
  min-height: 40px;
  padding: 0 8px;
  border-color: transparent;
  background: transparent;
  color: var(--ink-2, #2b3a31);
}

.wa-btn--text:hover {
  background: transparent;
  border-color: transparent;
  color: var(--ink, #17231d);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.wa-btn:focus-visible,
.wa-card__link:focus-visible {
  outline: 2px solid var(--rust, #b7472a);
  outline-offset: 2px;
}

/* ---------- install prompt ---------- */

.wa-install__mark {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-top: 2px;
  color: var(--rust, #b7472a);
}

.wa-install__mark svg {
  width: 26px;
  height: 26px;
  display: block;
}

/* ---------- update notice ---------- */

.wa-update .wa-card__actions {
  margin-top: 8px;
}

/* ---------- visually hidden status ---------- */

.wa-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- page offset while the banner is up ---------- */

/* pwa.js publishes the dock's measured height, so the page reserves exactly the
 * room the banner needs instead of hiding its last lines behind it. */
html.wa-offline body {
  padding-bottom: calc(var(--wa-dock-h, 96px) + 12px);
}

@media (max-width: 420px) {
  .wa-card {
    padding: 10px 10px 10px 13px;
    font-size: 12px;
  }
  .wa-card__title {
    font-size: 14px;
  }
  .wa-card__actions {
    gap: 6px;
  }
  .wa-btn {
    padding: 0 12px;
    font-size: 9.5px;
  }
}

/* ---------- motion & print ---------- */

@keyframes wa-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .wa-card {
    animation: none;
  }
  .wa-btn {
    transition: none;
  }
}

@media print {
  .wa-dock {
    display: none !important;
  }
  html.wa-offline body {
    padding-bottom: 0;
  }
}
