/* The Pulse (pulse.html). Screens are panels of rows; every colour is a theme
   token so both themes work, and every mark is a rounded square (5px), never a
   circle or a pill. Only the status dot beside a live state is round. The
   shape of a row: mark, title and meta, then a figure or a plain kind word. */

.pl-stack { margin-top: var(--space-3, 16px); }
.pl-grid { display: grid; grid-auto-rows: auto; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-flow: row dense; gap: 16px; align-items: stretch; }
.pl-screen { --pl-up: var(--ok-deep); --pl-down: var(--orange-hover, #c44220); display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-box); overflow: hidden; }
html[data-theme="dark"] .pl-screen { --pl-up: var(--ok); --pl-down: var(--orange); }
.pl-r2 { grid-row: span 2; }
.pl-c2 { grid-column: span 2; }

.pl-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.pl-head h2 { font: 800 15px/1.2 var(--head); letter-spacing: 0; min-width: 0; }
.pl-state { display: inline-flex; align-items: center; gap: 7px; font: 500 12px/1.2 var(--body); color: var(--pl-up); text-align: right; }
.pl-state::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.pl-list { list-style: none; margin: 0; padding: 0; flex: 1 1 auto; min-height: 0; }
.pl-foot { padding: 10px 14px 12px; border-top: 1px solid var(--line-2); display: flex; }
.pl-row { border-bottom: 1px solid var(--line-2); }
.pl-row:last-child { border-bottom: 0; }
.pl-a { display: flex; align-items: center; gap: 12px; padding: 10px 14px; color: var(--fg); text-decoration: none; min-width: 0; }
.pl-a:hover, .pl-a:focus-visible { background: var(--sub); color: var(--fg); text-decoration: none; }
.pl-t { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pl-title { font: 600 13.5px/1.3 var(--body); color: var(--fg); overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.pl-meta { font: 400 12px/1.35 var(--body); color: var(--fg-3); overflow-wrap: anywhere; }
.pl-end { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font: 600 12.5px/1.2 var(--body); }
.pl-kind { font: 600 10.5px/1.2 var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--fg-3); white-space: nowrap; }
.pl-big { font: 800 26px/1 var(--head); color: var(--fg); letter-spacing: -0.01em; }
.pl-empty { padding: 16px 14px; font-size: 13px; color: var(--fg-3); }

.pl-mark { position: relative; flex: 0 0 32px; width: 32px; height: 32px; box-sizing: border-box; padding: 4px; margin: 0; border-radius: 5px; overflow: hidden; background: #fff; color: #0d1321; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.pl-mark .fav { width: 100%; height: 100%; margin: 0; flex: none; background: transparent; object-fit: contain; border-radius: 0; display: block; }
.pl-mark .fav.fav-mark { display: flex; align-items: center; justify-content: center; font: 700 15px/1 var(--head); color: #0d1321; background: transparent; }
.pl-face { padding: 0; }
.pl-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pl-initial { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font: 700 15px/1 var(--head); color: #0d1321; }
.pl-glyph { padding: 0; border-color: transparent; background: color-mix(in srgb, var(--art) 18%, transparent); color: var(--art); }
.pl-glyph svg { width: 18px; height: 18px; }
.pl-marks { flex: none; display: flex; flex-direction: column; gap: 4px; }
.pl-marks .pl-mark { flex-basis: 28px; width: 28px; height: 28px; }

.pl-market .pl-end { min-width: 44px; }
.pl-pct { font: 800 15px/1 var(--head); }
.pl-delta { font: 600 12px/1 var(--body); }
.up { color: var(--pl-up); } .down { color: var(--pl-down); } .flat { color: var(--fg-3); }
.pl-bar { display: block; height: 4px; margin-top: 7px; border-radius: 2px; background: var(--line); overflow: hidden; }
.pl-bar i { display: block; height: 100%; border-radius: 2px; background: var(--pl-up); }
.pl-bar i.down { background: var(--pl-down); }

.pl-lead { display: block; border-bottom: 1px solid var(--line-2); }
.pl-lead .vid-thumb { width: 100%; }
.pl-lead-body { display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 12px 14px; }

.pl-world { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pl-stat { display: flex; flex-direction: column; gap: 4px; padding: 16px 14px; min-width: 0; }
.pl-bignum { font: 800 30px/1 var(--head); letter-spacing: -0.02em; color: var(--fg); }
.pl-statl { font: 600 13px/1.3 var(--body); color: var(--fg); }
.pl-stats { font: 400 12px/1.3 var(--body); color: var(--fg-3); }
.pl-top { flex-direction: row; align-items: center; gap: 12px; }
.pl-top .pl-mark { flex-basis: 44px; width: 44px; height: 44px; }
.pl-topt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pl-topn { font: 800 18px/1.2 var(--head); overflow-wrap: anywhere; }

@keyframes pl-tint { from { background: color-mix(in srgb, var(--ok) 24%, transparent); } to { background: transparent; } }
.pl-new { animation: pl-tint 2.4s ease-out; }
@media (prefers-reduced-motion: reduce) { .pl-new { animation: none; } }

@media (max-width: 1279px) {
  .pl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 799px) {
  .pl-grid { grid-template-columns: minmax(0, 1fr); }
  .pl-r2, .pl-c2 { grid-row: auto; grid-column: auto; }
  .pl-world { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.pl-big-marks .pl-mark { flex-basis: 72px; width: 72px; height: 72px; padding: 8px; }
.pl-big-marks .pl-initial, .pl-big-marks .pl-mark .fav.fav-mark { font-size: 28px; }
.pl-big-marks .pl-a { padding: 14px; }
.pl-lead .vid-thumb { aspect-ratio: 16 / 9; overflow: hidden; }
.pl-lead .vid-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* The Pulse hero fades into the page instead of ending on a hard edge: a
   gradient from the hero's own ground to the page canvas over its last
   180px, under the copy. Scoped to this page by the pulse root. */
html body:has(.pl-grid) .thero { padding-bottom: 60px; }
html body:has(.pl-grid) .thero::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 180px; z-index: 0; background: linear-gradient(180deg, rgba(7,9,26,0) 0%, var(--canvas) 100%); pointer-events: none; }
html body:has(.pl-grid) .thero .thero-in { position: relative; z-index: 1; }


/* The hero: four figures under the rule and, on the right, the card with the
   countdown as its centrepiece. The figures keep four columns down to the
   phone layout, two on a phone. */
html body:has(.pl-grid) .thero-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pl-card { justify-content: space-between; gap: 0; }
.pl-clockbox { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 0 20px; }
.pl-clock { font: 800 48px/1 var(--head); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: #fff; }
.pl-clock-l { font: 600 14px/1.2 var(--body); opacity: .8; }
.pl-refresh { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-bottom: 20px; border-bottom: 1px solid rgba(255,255,255,.14); }
.pl-upd { margin: 0; font: 400 12.5px/1.3 var(--body); opacity: .72; font-variant-numeric: tabular-nums; }
.pl-embed-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 18px; }
.pl-embed-t { font: 600 14px/1.3 var(--body); }
html body .thero .pl-card .btn:hover, html body .thero .pl-card .btn.ghost:hover { background: var(--orange); border-color: var(--orange); color: #0d1321; }
.pl-card .btn:disabled { opacity: .7; cursor: progress; }
@media (max-width: 640px) {
  html body:has(.pl-grid) .thero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pl-clock { font-size: 34px; }
}

/* The embed panel: the site's scrim and sheet, wide enough for the preview.
   The sheet clips and only its body scrolls, so no scrollbar crosses a
   rounded corner. */
.sheet.pl-embed { width: min(940px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.pl-embed-top { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; }
.pl-embed-top .x { float: none; }
.pl-embed-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 20px 20px; }
.pl-embed-grid { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; align-items: start; }
.pl-fs { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.pl-fs legend, .pl-legend { display: block; padding: 0; margin: 0 0 6px; font: 700 13px/1.2 var(--head); color: var(--fg); }
.pl-opt { display: flex; align-items: center; gap: 10px; min-height: 34px; font: 500 14px/1.3 var(--body); color: var(--fg); cursor: pointer; }
.pl-opt input { width: 16px; height: 16px; margin: 0; accent-color: var(--ink); flex: none; }
.pl-height input { display: block; width: 120px; min-height: 40px; padding: 8px 10px; box-sizing: border-box; font: 500 14px/1 var(--body); color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctl); font-variant-numeric: tabular-nums; }
.pl-embed-prev { min-width: 0; }
.pl-embed-prev iframe { display: block; width: 100%; height: 520px; border: 1px solid var(--line); border-radius: 10px; background: var(--canvas); }
.pl-embed-code { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: start; margin-top: 18px; }
.pl-embed-code textarea { width: 100%; box-sizing: border-box; resize: none; padding: 10px 12px; font: 500 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--fg); background: var(--sub); border: 1px solid var(--line); border-radius: var(--r-ctl); }
.pl-embed-note { margin: 10px 0 0; font: 400 13px/1.4 var(--body); color: var(--fg-3); }
@media (max-width: 760px) {
  .pl-embed-grid { grid-template-columns: minmax(0, 1fr); }
  .pl-embed-code { grid-template-columns: minmax(0, 1fr); }
  .pl-embed-top { padding: 16px 16px 10px; }
  .pl-embed-scroll { padding: 0 16px 16px; }
}

/* The hero's now strip: three cards with a mark, a kind, the item and its
   figure, under the lead and above the stats. */
.pl-now { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.pl-now-c { display: inline-flex; align-items: center; gap: 12px; min-width: 0; max-width: 100%; padding: 10px 14px 10px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--fg); text-decoration: none; }
.pl-now-c:hover { border-color: var(--fg-3); text-decoration: none; }
.pl-now-c .pl-mark, .pl-now-c .fav, .pl-now-c img { width: 40px; height: 40px; border-radius: 5px; flex: none; }
.pl-now-b { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pl-now-k { font: 700 10.5px/1 var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--fg-3); }
.pl-now-t { font: 600 14px/1.25 var(--body); color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.pl-now-m { font: 400 12px/1.2 var(--body); color: var(--fg-2); }
@media (max-width: 760px) { .pl-now-c { width: 100%; } .pl-now-t { max-width: none; white-space: normal; } }
