/* ===========================================================================
 * share.css - karta udostepnionego linku nad landingiem (patrz share.js)
 * ===========================================================================
 * Zmienne kolorow (--green, --ink, --muted, --line, --bg, --bg-soft) i przyciski
 * .btn / .btn--primary pochodza z <style> w index.html - karta ma wygladac jak
 * czesc tej samej strony, nie jak wklejony widget. Wszystkie wlasne klasy maja
 * przedrostek sc-, bo landing styluje gole section/header/h2.
 * Najpierw telefon (390 px), szerzej tylko wieksza mapa i kolumny statystyk.
 * ======================================================================== */

:root {
  --sc-card: #FFFFFF;
  --sc-shadow: 0 1px 2px rgba(15, 23, 32, .05), 0 10px 30px rgba(15, 23, 32, .07);
  --sc-tint: rgba(34, 197, 94, .14);
  --sc-live-ink: #15803D;
  --sc-pause-bg: rgba(245, 158, 11, .16);
  --sc-pause-ink: #B45309;
  --sc-map-bg: #EEF2F5;
}
@media (prefers-color-scheme: dark) {
  :root {
    --sc-card: #161B22;
    --sc-shadow: none;
    --sc-tint: rgba(34, 197, 94, .18);
    --sc-live-ink: #4ADE80;
    --sc-pause-ink: #FBBF24;
    --sc-map-bg: #1C232C;
  }
}

.sc-root[hidden] { display: none; }

/* Gdy karta stoi na gorze, naglowek landingu nie potrzebuje 56 px oddechu. */
body.sc-on header { padding-top: 36px; }

.sc-wrap { max-width: 560px; margin: 0 auto; padding: 14px 16px 4px; }

/* -- Pasek marki ----------------------------------------------------------- */
.sc-brand {
  display: flex; align-items: center; gap: 9px;
  margin: 2px 2px 12px;
  font-weight: 700; font-size: 17px; letter-spacing: -.01em; color: var(--ink);
}
.sc-brand img { width: 28px; height: 28px; border-radius: 7px; display: block; }
.sc-accent { color: var(--green); }

/* -- Karta --------------------------------------------------------------- */
.sc {
  background: var(--sc-card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--sc-shadow);
  overflow: hidden;
}
.sc-pad { padding: 16px 18px; }
.sc-pad + .sc-pad { padding-top: 4px; }
.sc--center { text-align: center; }

.sc-title {
  margin: 12px 0 0;
  font-size: 22px; line-height: 1.25; letter-spacing: -.015em;
  overflow-wrap: anywhere;
}
.sc-title--sm { margin: 0; font-size: 18px; line-height: 1.3; }
.sc--center .sc-title { margin-top: 0; }

/* Naglowek tylko dla czytnikow ekranu (karta posta nie ma widocznego tytulu). */
.sc-sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.sc-author, .sc-club, .sc-livehead { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sc-author-txt { flex: 1; min-width: 0; }
.sc-name { font-weight: 650; font-size: 15.5px; line-height: 1.3; overflow-wrap: anywhere; }
.sc-meta { color: var(--muted); font-size: 13.5px; line-height: 1.4; overflow-wrap: anywhere; }

/* -- Awatary: inicjaly pod spodem, zdjecie na wierzchu --------------------------- */
.sc-av {
  position: relative; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%; overflow: hidden;
  background: var(--sc-tint); color: var(--green-dark);
  font-weight: 700; font-size: 16px; line-height: 1;
}
.sc-av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sc-av--club { width: 56px; height: 56px; border-radius: 14px; font-size: 20px; }
.sc-av--lg { display: flex; width: 76px; height: 76px; margin: 4px auto 14px; font-size: 26px; }

/* -- Mapa (od krawedzi do krawedzi karty) ------------------------------------- */
.sc-map {
  position: relative; height: 240px;
  background: var(--sc-map-bg);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  /* Wlasny kontekst warstw: panele Leafleta (z-index 400-1000) nie wychodza poza mape. */
  z-index: 0; isolation: isolate;
}
.sc-map-wait {
  position: absolute; inset: 0; margin: 0; padding: 16px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  color: var(--muted); font-size: 14px;
}
/* Trzy klasy, bo leaflet.css dochodzi PO tym arkuszu z taka sama waga (dwie). */
.sc .sc-map .leaflet-control-attribution { font-size: 10.5px; }

/* Biezaca pozycja na zywo. Leaflet nadaje ikonie position:absolute i 22x22 px. */
.sc-pos-icon { background: none; border: 0; }
.sc-pos {
  position: absolute; inset: 2px; border-radius: 50%;
  background: var(--green); border: 3px solid #FFFFFF;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .35);
}
.sc-pos::after {
  content: ''; position: absolute; inset: -5px; border-radius: 50%;
  border: 2px solid var(--green);
  animation: sc-pulse 1.8s ease-out infinite;
}
.sc-pos--paused { background: #F59E0B; }
.sc-pos--paused::after { display: none; }

/* -- Statystyki ------------------------------------------------------------- */
.sc-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 14px 12px; margin: 0;
}
.sc-stat { min-width: 0; }
.sc-stat dt { margin: 0 0 2px; font-size: 12.5px; color: var(--muted); }
.sc-stat dd {
  margin: 0; font-size: 19px; font-weight: 650; letter-spacing: -.01em;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}

/* -- Zdjecia, tekst, liczniki ------------------------------------------------ */
.sc-photos {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px;
  margin-top: 16px; border-radius: 12px; overflow: hidden;
}
.sc-photos img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--bg-soft); }
.sc-photos--1 { grid-template-columns: 1fr; }
.sc-photos--1 img { aspect-ratio: 16 / 10; }
.sc-photos--3 img:first-child { grid-column: span 2; aspect-ratio: 2 / 1; }

.sc-postimg { display: block; width: 100%; max-height: 460px; object-fit: cover; background: var(--bg-soft); }
.sc-text { margin: 12px 0 0; font-size: 15.5px; white-space: pre-line; overflow-wrap: anywhere; }
.sc-lead { margin: 8px auto 0; max-width: 420px; color: var(--muted); font-size: 15.5px; }
.sc-counts, .sc-members { margin: 14px 0 0; font-size: 14px; color: var(--muted); }
.sc-private, .sc-ended {
  margin: 14px 0 0; padding: 11px 14px; border-radius: 12px;
  background: var(--bg-soft); border: 1px solid var(--line);
}
.sc-private { font-size: 14px; color: var(--muted); }
.sc-ended { font-weight: 600; }
.sc-ended[hidden], .sc-updated[hidden], [data-sc-conn][hidden] { display: none; }

/* -- Na zywo -------------------------------------------------------------- */
.sc-chipbox { margin-left: auto; flex: none; }
.sc-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 11px; border-radius: 999px;
  font-size: 13px; font-weight: 600; line-height: 1.35; white-space: nowrap;
}
.sc-chip--live { background: var(--sc-tint); color: var(--sc-live-ink); }
.sc-chip--paused { background: var(--sc-pause-bg); color: var(--sc-pause-ink); }
.sc-chip--done { background: var(--bg-soft); color: var(--muted); border: 1px solid var(--line); }
.sc-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.sc-dot::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%; background: currentColor;
  animation: sc-pulse 1.6s ease-out infinite;
}
@keyframes sc-pulse {
  from { transform: scale(1); opacity: .6; }
  to { transform: scale(2.6); opacity: 0; }
}
.sc-updated { margin: 0 0 12px; font-size: 13.5px; color: var(--muted); }

/* -- Komunikaty --------------------------------------------------------------- */
.sc-msghead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.sc-msg { margin: 0; font-size: 16.5px; line-height: 1.5; }
.sc--msg[aria-busy="true"] .sc-msg { color: var(--muted); }
.sc-retrybox { margin-top: 14px; }

/* -- Przyciski (wyglad z .btn landingu) -------------------------------------- */
.sc-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
/* Napis w jednej linii: gdy dwa przyciski sie nie mieszcza, drugi schodzi nizej
   na cala szerokosc, zamiast lamac "Open in MapYou" na dwie linie. */
.sc-cta .btn { flex: 1 1 150px; text-align: center; white-space: nowrap; }
.sc button.btn { font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.sc-note { margin: 10px 0 0; font-size: 13px; line-height: 1.45; color: var(--muted); text-align: center; }

@media (min-width: 600px) {
  .sc-wrap { padding-top: 28px; }
  .sc-map { height: 300px; }
  .sc-pad { padding: 18px 22px; }
}

/* Ograniczony ruch: bez pulsowania i bez podskoku przyciskow (mape uspokaja share.js). */
@media (prefers-reduced-motion: reduce) {
  .sc-dot::after, .sc-pos::after { animation: none; display: none; }
  .sc .btn { transition: none; }
  .sc .btn:hover { transform: none; }
}
