/* "Calheta now" live strip. Two skins: night band on the home page, paper card on inner pages. */
.now { --n: 4; font-family: var(--body); color: var(--now-ink); }
.now[hidden], .now-band[hidden], .now-wrap[hidden] { display: none !important; }

/* skins */
.now--night {
  --now-ink: var(--on-dark); --now-muted: var(--on-dark-muted); --now-line: rgba(169, 189, 210, 0.16);
  --now-hover: rgba(255, 255, 255, 0.045); --now-accent: var(--sun); --now-skel: rgba(255, 255, 255, 0.08);
  --now-good: #35d49a; --now-mid: #ffb000; --now-bad: #ff6b6b; --now-unknown: #6f8aa6;
  --now-good-ink: #84f0c6; --now-mid-ink: #ffcf66; --now-bad-ink: #ffa6a3;
  --pad-x: 16px;
}
.now-band { background: linear-gradient(180deg, #06172e 0%, #04101f 100%); padding-block: clamp(20px, 3vw, 30px) clamp(10px, 2vw, 18px); }

.now--paper {
  --now-ink: var(--ink); --now-muted: var(--muted); --now-line: var(--line);
  --now-hover: color-mix(in srgb, var(--link) 6%, transparent); --now-accent: var(--link); --now-skel: var(--paper-2);
  --now-good: #12a06a; --now-mid: #d98a00; --now-bad: #d9443f; --now-unknown: #8aa0b5;
  --now-good-ink: #0b7a4f; --now-mid-ink: #915b00; --now-bad-ink: #b3302c;
  --pad-x: clamp(16px, 2.4vw, 26px);
  position: relative; margin-top: -34px; background: var(--card); border: 1px solid var(--line); border-radius: 22px;
  padding: 18px var(--pad-x) 0; box-shadow: 0 22px 44px -30px rgba(5, 25, 50, 0.45);
}
@media (prefers-color-scheme: dark) {
  .now--paper { --now-good-ink: #84f0c6; --now-mid-ink: #ffcf66; --now-bad-ink: #ffa6a3; --now-good: #35d49a; --now-bad: #ff6b6b; box-shadow: 0 22px 44px -30px rgba(0, 0, 0, 0.8); }
}
.now--paper[data-count="1"] { max-width: 26rem; }
.now[data-count="1"] .now-grid { grid-template-columns: minmax(0, 1fr) !important; }
.now--paper[data-count="2"] { max-width: 44rem; }
.now-wrap + main > .sec:first-child { padding-top: clamp(36px, 5vw, 64px); }

/* head */
.now-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 22px; }
.now-title { margin: 0; display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; font-stretch: 118%; font-size: clamp(1.12rem, 1rem + 0.55vw, 1.4rem); letter-spacing: -0.01em; line-height: 1.1; color: var(--now-ink); }
.now-live { width: 8px; height: 8px; border-radius: 50%; background: var(--now-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--now-accent) 24%, transparent); flex: 0 0 auto; }
.now-meta { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; font-size: 0.86rem; color: var(--now-muted); }
.now-ok { display: inline-flex; align-items: center; gap: 7px; color: var(--now-ink); }
.now-ok i { width: 8px; height: 8px; border-radius: 50%; background: var(--now-good); }

/* warnings */
.now-warn { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; }
.now-warn a { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 10px 14px; border-radius: 12px; background: var(--lv); color: #1a1406; text-decoration: none; font-size: 0.95rem; }
.now-warn a:hover { filter: brightness(1.05); }
.now-warn b { font-weight: 700; }
.now-warn time { margin-left: auto; font-variant-numeric: tabular-nums; }
.lv-yellow { --lv: #ffd84d; }
.lv-orange { --lv: #ff9e45; }
.lv-red { --lv: #ff6259; }

/* instruments */
.now-grid { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); margin: 14px calc(-1 * var(--pad-x)) 0; border-top: 1px solid var(--now-line); }
.now-cell { position: relative; display: grid; align-content: start; gap: 3px; min-width: 0; padding: 16px var(--pad-x) 18px; border-left: 1px solid var(--now-line); color: inherit; text-decoration: none; }
.now-cell:first-child { border-left: 0; }
a.now-cell { transition: background-color 0.2s; }
a.now-cell:hover { background: var(--now-hover); }
a.now-cell:hover .now-k { color: var(--now-ink); text-decoration: underline; text-underline-offset: 3px; }
a.now-cell:focus-visible { outline: 2px solid var(--sun); outline-offset: -3px; border-radius: 8px; }
.now--paper .now-cell:first-child { border-bottom-left-radius: 21px; }
.now--paper .now-cell:last-child { border-bottom-right-radius: 21px; }

.now-k { font-size: 0.84rem; color: var(--now-muted); line-height: 1.3; }
.now-main { display: flex; align-items: center; gap: 12px; min-height: 3.1rem; }
.now-v { font-family: var(--display); font-weight: 800; font-stretch: 125%; font-size: clamp(2rem, 1.55rem + 1.2vw, 2.7rem); line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--now-ink); }
.now-v small { font-size: 0.48em; font-weight: 700; letter-spacing: 0; }
.now-word { font-size: clamp(1.3rem, 1.05rem + 0.8vw, 1.7rem); font-stretch: 112%; letter-spacing: -0.01em; white-space: normal; line-height: 1.05; }
.tone-open { color: var(--now-good-ink); }
.tone-partial { color: var(--now-mid-ink); }
.tone-closed { color: var(--now-bad-ink); }
html:lang(uk) .now-v, html:lang(uk) .now-title { font-stretch: normal; letter-spacing: -0.01em; }
.now-ic { width: 30px; height: 30px; flex: 0 0 auto; color: var(--now-ink); opacity: 0.9; }
.now-s { font-weight: 600; font-size: 0.98rem; line-height: 1.3; color: var(--now-ink); }
.now-x { font-size: 0.86rem; line-height: 1.4; color: var(--now-muted); }
.now-x .nw { white-space: nowrap; }
.now-x .nw:only-child { white-space: normal; }

/* the sea line: the one moving thing */
.now-wave { width: 96px; height: 30px; flex: 0 1 96px; min-width: 48px; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 16%, #000 84%, transparent); mask-image: linear-gradient(90deg, transparent, #000 16%, #000 84%, transparent); }
.now-wave polyline { fill: none; stroke: var(--now-accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
@media (prefers-reduced-motion: no-preference) {
  .now-wave g { animation: now-drift var(--dur, 8s) linear infinite; }
}
@keyframes now-drift { to { transform: translateX(-120px); } }

/* trails */
.now-tr { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 2px; font-size: 0.86rem; }
.now-tr li { display: flex; align-items: flex-start; gap: 8px; min-width: 0; line-height: 1.35; color: var(--now-ink); }
.now-tr i { width: 8px; height: 8px; margin-top: 0.38em; border-radius: 50%; flex: 0 0 auto; background: var(--now-unknown); }
.now-tr .tr-open i { background: var(--now-good); }
.now-tr .tr-partial i { background: var(--now-mid); }
.now-tr .tr-closed i { background: var(--now-bad); }
.now-asof { margin-top: 4px; }

/* loading */
.now-ph { display: block; width: 5.5rem; height: 2.3rem; border-radius: 8px; background: var(--now-skel); }
.now-ph-s { width: 8rem; height: 0.95rem; margin-top: 4px; }
@media (prefers-reduced-motion: no-preference) {
  .now-ph { animation: now-pulse 1.3s ease-in-out infinite alternate; }
}
@keyframes now-pulse { from { opacity: 0.45; } to { opacity: 1; } }

.now .vh { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* phones: two instruments per row */
@media (max-width: 760px) {
  .now-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 0; }
  .now-cell { border-left: 0; border-top: 1px solid var(--now-line); padding-top: 14px; padding-bottom: 16px; }
  .now-cell:nth-child(even) { border-left: 1px solid var(--now-line); }
  .now-cell:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .now--paper .now-cell:first-child, .now--paper .now-cell:last-child { border-radius: 0; }
  .now--paper .now-cell:nth-last-child(1):nth-child(odd), .now--paper .now-cell:nth-last-child(2):nth-child(odd) { border-bottom-left-radius: 21px; }
  .now--paper .now-cell:last-child:nth-child(even), .now--paper .now-cell:last-child:nth-child(odd) { border-bottom-right-radius: 21px; }
  .now-v { font-size: 1.95rem; }
  .now-word { font-size: 1.25rem; }
  .now-main { min-height: 2.6rem; gap: 8px; }
  .now-ic { width: 26px; height: 26px; }
  .now-wave { width: 60px; flex-basis: 60px; min-width: 40px; height: 24px; }
  .now-s { font-size: 0.93rem; }
  .now-x, .now-tr { font-size: 0.8rem; }
  .now-warn time { margin-left: 0; }
  .now--paper { margin-top: -26px; border-radius: 18px; }
}
