/* The embed widgets, inside an iframe on someone else's page: one small
   card. /widget/<slug>/ (site_pages.py) and the configurable /w/ (w/w.js,
   body.multi). Colours and font: tokens.css. */

:root { --ink-3: #646f7d; }
@media (prefers-color-scheme: dark) {
  :root { --ink-3: #8390a2; }
}

/* /w/?theme=light|dark: the host site's choice over the visitor's device.
   The colours the widget uses, as in tokens.css. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface: #161c26;
  --surface-2: #1d2531;
  --line: #283241;
  --ink: #f2f5f9;
  --ink-2: #a9b3c1;
  --ink-3: #8390a2;
  --brand: #3f74ff;
  --focus: #7ea2ff;
  --good: #43e08a;
  --mid: #ffb938;
  --low: #ff7676;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="light"] {
    color-scheme: light;
    --surface: #ffffff;
    --surface-2: #f2f4f7;
    --line: #e0e5eb;
    --ink: #0f1622;
    --ink-2: #4b5666;
    --ink-3: #646f7d;
    --brand: #1d5bff;
    --focus: #1d5bff;
    --good: #12924f;
    --mid: #b26a00;
    --low: #d43a3a;
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 12px 14px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font: 15px/1.4 var(--font);
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
h1 { margin: 0; font-size: 17px; font-weight: 800; line-height: 1.25; }
.live {
  flex: none;
  padding: 2px 8px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--good) 14%, transparent);
  color: var(--good);
  font-size: 12px;
  font-weight: 700;
}
.live::before { content: "● "; }

/* the list gives way first, so the footer's link back always shows */
ul { flex: 0 1 auto; min-height: 0; overflow-y: auto; margin: 8px 0 0; padding: 0; list-style: none; }
li {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "name free" "walk free";
  align-items: center;
  column-gap: 12px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}
li a { grid-area: name; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
li > span { grid-area: walk; color: var(--ink-3); font-size: 13px; }
li b {
  grid-area: free;
  min-width: 52px;
  padding: 3px 9px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--lvl, var(--ink-3)) 13%, var(--surface));
  color: var(--lvl, var(--ink-2));
  font-size: 17px;
  font-weight: 800;
  line-height: 1.15;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
li b::after { content: "slobodno"; display: block; color: var(--ink-2); font-size: 11px; font-weight: 600; }
li b:lang(en)::after { content: "free"; }
li b[data-unit]::after { content: attr(data-unit); }
.lvl-good { --lvl: var(--good); }
.lvl-mid { --lvl: var(--mid); }
.lvl-low { --lvl: var(--low); }

.next { flex: none; margin: 8px 0 0; color: var(--ink-2); font-size: 13px; }
.next a { color: var(--ink); font-weight: 600; }

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: none;
  margin-top: auto;
  padding-top: 8px;
  color: var(--ink-3);
  font-size: 12px;
}
.brand { color: var(--ink); font-size: 14px; font-weight: 800; }
.brand b { color: var(--brand); }

/* /w/: one or more sections; the sections give way first, so the footer's
   link back always shows */
.multi main { flex: 0 1 auto; min-height: 0; overflow-y: auto; }
.multi main ul { overflow: visible; margin-top: 2px; }
.multi h2 { margin: 10px 0 0; color: var(--ink-3); font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.multi li:not(:has(b)) { grid-template-areas: "name" "walk"; grid-template-columns: 1fr; }
.multi .empty { margin: 6px 0 0; color: var(--ink-3); font-size: 13px; }

/* the videos: a row each, a tap plays it in the box */
.multi li.vid { display: block; padding: 6px 0; }
.vid button { display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 10px; width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.vid button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.vid img { width: 40px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--line); }
.vid strong { display: block; font-weight: 600; }
.vid small { display: block; overflow: hidden; color: var(--ink-3); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.vid video { display: block; width: 100%; max-height: 520px; aspect-ratio: 9 / 16; border-radius: 12px; background: #000; }
