/*
 * Social News Kit: structural CSS only. Each design sets the look through the
 * --kit-* variables and its own stylesheet. Spring curves were generated with
 * Motion's CSS spring generator, so the motion costs no JavaScript.
 */
:root {
  /* duration + easing pairs: use as `transition: transform var(--spring-snap)` */
  --spring-snap: 500ms linear(0, 0.1402, 0.3764, 0.584, 0.7361, 0.838, 0.9029, 0.9428, 0.9668, 0.9809, 0.9892, 0.9939, 0.9966, 0.9981, 0.9989, 0.9994, 1);
  --spring-soft: 650ms linear(0, 0.0676, 0.2212, 0.4046, 0.5821, 0.7345, 0.8537, 0.9394, 0.9954, 1.0278, 1.0427, 1.0459, 1.042, 1.0346, 1.0262, 1.0181, 1.0113, 1.0061, 1.0023, 0.9999, 0.9986, 1);
  --spring-pop: 1350ms linear(0, 0.0466, 0.1662, 0.3299, 0.5121, 0.6918, 0.8539, 0.9882, 1.0898, 1.158, 1.1949, 1.2053, 1.1948, 1.1697, 1.1357, 1.0983, 1.0615, 1.0285, 1.0012, 0.9807, 0.967, 0.9597, 0.9579, 0.9602, 0.9655, 0.9725, 0.9802, 0.9877, 0.9945, 1, 1.0041, 1.0069, 1.0083, 1.0086, 1.0081, 1.007, 1.0056, 1.004, 1.0024, 1.0011, 0.9999, 0.9991, 0.9986, 1, 1);

  --kit-accent: #e33;            /* progress bars, CTA, active states */
  --kit-accent-ink: #fff;        /* text on the accent */
  --kit-font: inherit;           /* viewer and toast typeface */
  --kit-title-font: inherit;     /* story headline typeface */
  --kit-radius: 14px;
  --reader-scale: 1;             /* text-size control multiplies article type by this */
  --read: 0;                     /* 0..1 reading progress, set on scroll */
  --tts: 0;                      /* 0..1 listen progress */
}

.kit-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.kit-lock { overflow: hidden; }
[hidden] { display: none !important; }

/* ---- Sticky header: sticky at full size, fixed once slim (the kit's placeholder holds its place) ---- */
:where([data-stickyhead]) { position: sticky; top: 0; z-index: 60; }
[data-stickyhead].is-compact { position: fixed; top: 0; left: 0; right: 0; }

/* ---- Stories / reels viewer ---- */
.kit-sv { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: rgba(8, 8, 10, .92); font-family: var(--kit-font); color: #fff; -webkit-tap-highlight-color: transparent; }
.kit-sv__stage { position: relative; width: min(100vw, calc(100dvh * 9 / 16)); height: 100dvh; max-height: 100dvh; overflow: hidden; background: #111; animation: kit-sv-in var(--spring-snap) both; }
@media (min-width: 720px) { .kit-sv__stage { height: min(92dvh, 860px); width: min(92vw, calc(min(92dvh, 860px) * 9 / 16)); border-radius: var(--kit-radius); } }
@keyframes kit-sv-in { from { transform: scale(.92); opacity: 0; } }
.kit-sv__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.kit-sv__img.is-in { animation: kit-sv-zoom 9s linear both; }
.kit-sv.is-paused .kit-sv__img { animation-play-state: paused; }
@keyframes kit-sv-zoom { from { transform: scale(1.02); } to { transform: scale(1.12); } }
.kit-sv__shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.55) 0, rgba(0,0,0,0) 22%, rgba(0,0,0,0) 46%, rgba(0,0,0,.86) 100%); pointer-events: none; }
.kit-sv__bars { position: absolute; z-index: 3; top: max(10px, env(safe-area-inset-top)); left: 10px; right: 10px; display: flex; gap: 4px; }
.kit-sv__bars i { flex: 1; height: 3px; border-radius: 3px; background: rgba(255,255,255,.34); overflow: hidden; }
.kit-sv__bars b { display: block; height: 100%; background: #fff; transform: scaleX(0); transform-origin: left; }
.kit-sv__top { position: absolute; z-index: 3; top: calc(max(10px, env(safe-area-inset-top)) + 12px); left: 12px; right: 8px; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.kit-sv__logo { height: 22px; width: auto; max-width: 132px; object-fit: contain; }
.kit-sv__brand { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kit-sv__time { opacity: .72; font-weight: 500; margin-right: auto; white-space: nowrap; }
.kit-sv__btn { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: none; color: #fff; cursor: pointer; }
.kit-sv__btn:hover { background: rgba(255,255,255,.14); }
.kit-sv__zone { position: absolute; z-index: 2; top: 0; bottom: 0; width: 34%; border: 0; background: none; cursor: pointer; touch-action: manipulation; -webkit-touch-callout: none; user-select: none; }
.kit-sv__zone--prev { left: 0; }
.kit-sv__zone--next { right: 0; width: 66%; }
.kit-sv__text { position: absolute; z-index: 3; left: 18px; right: 18px; bottom: max(22px, env(safe-area-inset-bottom)); display: grid; gap: 10px; justify-items: start; pointer-events: none; }
.kit-sv__cat { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 4px 9px; border-radius: 999px; background: var(--kit-accent); color: var(--kit-accent-ink); }
.kit-sv__cat:empty { display: none; }
.kit-sv__title { margin: 0; font: 700 clamp(22px, 5.6vw, 28px)/1.18 var(--kit-title-font); text-wrap: balance; text-shadow: 0 1px 12px rgba(0,0,0,.35); }
.kit-sv__cta { pointer-events: auto; display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px; border-radius: 999px; background: #fff; color: #111; font-weight: 700; font-size: 15px; text-decoration: none; transition: transform var(--spring-snap); }
.kit-sv__cta:hover { transform: translateY(-2px); }
.kit-sv__cta:active { transform: scale(.96); }
.kit-sv__rail { display: none; }
.kit-sv--reel .kit-sv__rail { position: absolute; z-index: 3; right: 8px; bottom: 132px; display: grid; gap: 14px; }
.kit-sv--reel .kit-sv__text { right: 72px; }
.kit-sv__act { display: grid; justify-items: center; gap: 2px; min-width: 48px; min-height: 48px; border: 0; background: none; color: #fff; font: 600 12px/1 var(--kit-font); cursor: pointer; transition: transform var(--spring-soft); }
.kit-sv__act:active { transform: scale(.86); }
.kit-sv__act.is-on { color: var(--kit-accent); }
.kit-sv__act.is-on svg { fill: currentColor; }
.kit-sv :focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---- Ticker: stacked headlines, one visible; designs style the frame ---- */
[data-ticker-track] { position: relative; display: grid; min-width: 0; overflow: hidden; }
[data-tick] { grid-area: 1 / 1; min-width: 0; opacity: 0; visibility: hidden; transform: translateY(70%); transition: transform var(--spring-snap), opacity .25s ease, visibility 0s .45s; }
[data-tick].is-active { opacity: 1; visibility: visible; transform: none; transition: transform var(--spring-snap), opacity .25s ease; }
[data-tick].is-leaving { opacity: 0; visibility: visible; transform: translateY(-70%); }
[data-dir="back"] [data-tick] { transform: translateY(-70%); }
[data-dir="back"] [data-tick].is-active { transform: none; }
[data-dir="back"] [data-tick].is-leaving { transform: translateY(70%); }
[data-tick-bar] { transform: scaleX(0); transform-origin: left; }
.is-running [data-tick-bar] { animation: kit-tick var(--tick-dur, 5s) linear both; }
.is-hover [data-tick-bar], .is-paused [data-tick-bar] { animation-play-state: paused; }
@keyframes kit-tick { to { transform: scaleX(1); } }

/* ---- Poll: results bar grows from --pct once .is-voted is set ---- */
[data-poll-opt] { position: relative; overflow: hidden; isolation: isolate; }
[data-poll-opt]::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--kit-poll-bar, color-mix(in srgb, var(--kit-accent) 22%, transparent)); transform: scaleX(0); transform-origin: left; transition: transform var(--spring-soft); }
.is-voted [data-poll-opt]::before { transform: scaleX(calc(var(--pct, 0%) / 100%)); width: 100%; }
.is-voted [data-poll-opt] { cursor: default; }
.kit-poll-pct { margin-left: auto; padding-left: 12px; font-variant-numeric: tabular-nums; font-weight: 700; }

/* ---- Toast ---- */
.kit-toast { position: fixed; z-index: 1100; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translate(-50%, 24px); padding: 11px 18px; border-radius: 999px; background: var(--kit-toast-bg, #141414); color: var(--kit-toast-ink, #fff); font: 600 14px/1.2 var(--kit-font); box-shadow: 0 8px 28px rgba(0,0,0,.22); opacity: 0; pointer-events: none; transition: transform var(--spring-soft), opacity .2s; white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis; }
.kit-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---- Quote share popover ---- */
.kit-quote { position: absolute; z-index: 900; display: flex; gap: 2px; padding: 4px; border-radius: 12px; background: var(--kit-toast-bg, #141414); box-shadow: 0 8px 28px rgba(0,0,0,.25); animation: kit-sv-in var(--spring-snap) both; }
.kit-quote button { min-height: 40px; padding: 0 14px; border: 0; border-radius: 9px; background: none; color: var(--kit-toast-ink, #fff); font: 600 14px/1 var(--kit-font); cursor: pointer; }
.kit-quote button:hover { background: rgba(255,255,255,.16); }

/* ---- Listen: the paragraph being read ---- */
[data-article-body] .is-reading { background: var(--kit-reading, color-mix(in srgb, var(--kit-accent) 14%, transparent)); box-shadow: 0 0 0 6px var(--kit-reading, color-mix(in srgb, var(--kit-accent) 14%, transparent)); border-radius: 4px; transition: background .3s, box-shadow .3s; }

/* ---- Mega menu: the item is the positioning anchor; designs size and dress the panel ---- */
[data-mega] { position: relative; }
[data-mega-panel] { position: absolute; z-index: 60; top: 100%; left: 0; }
[data-mega-panel][hidden] { display: none; }

/* ---- Dialog base: designs position and dress them ---- */
dialog { border: 0; padding: 0; color: inherit; max-width: 100vw; max-height: 100dvh; }
dialog::backdrop { background: rgba(10, 10, 12, .55); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
