/* =====================================================================
   Day by day: Vasya's notes as stories (blog/stories.js, UX run-03).

   The row of day rings (the blog index under the masthead; post and tag
   pages after the post) and the story player dialog. v2 tokens from
   css/toys.css, Geist + Geist Mono already linked by the blog pages; one
   cobalt accent; light and dark follow the tokens. Loaded after
   blog/blog.css.
   ===================================================================== */

/* ---------- the row ---------- */

.stories { margin: 0 0 28px; }
.stories-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin: 0 0 6px; }
.stories-title { margin: 0; font-size: 1.25rem; font-weight: 800; line-height: 1.15; letter-spacing: -0.015em; }
.stories-hint { margin: 0; color: var(--t-ink-2); font-size: 0.9375rem; line-height: 1.4; text-wrap: pretty; }

/* One line of rings, newest left; it scrolls sideways inside itself on narrow screens (never
   the page). The row keeps a ring's height before the feed arrives, so nothing below moves. */
.stories-row {
  display: flex;
  gap: 6px;
  min-height: 142px;
  margin: 0 -6px;
  padding: 8px 6px 6px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  list-style: none;
}
.stories-row::-webkit-scrollbar { display: none; }
.stories-row > li { flex: 0 0 auto; scroll-snap-align: start; }

.st-ring {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 86px;
  margin: 0;
  padding: 6px 0 8px;
  border: 0;
  border-radius: var(--t-r-m);
  background: transparent;
  color: var(--t-ink);
  font-family: var(--t-display);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.st-ring:focus-visible { outline: 4px solid var(--t-ink); outline-offset: 0; }
/* The face: a tear-off calendar day. Read days sit quiet on the card colour inside a hairline
   ring; a day with unread notes is a cobalt object with a lip inside a cobalt ring. */
.st-face {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  width: 64px;
  height: 64px;
  margin: 6px 0 8px;
  border-radius: 50%;
  background: var(--t-card);
  color: var(--t-ink-2);
  box-shadow: 0 0 0 3px var(--t-surface), 0 0 0 5px var(--t-line);
  transition: transform var(--t-slow) var(--t-spring);
}
.st-num { font: 800 1.5rem/1 var(--t-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.st-mon { margin-top: 2px; font: 500 0.625rem/1 var(--t-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.st-unread .st-face {
  background: var(--t-cobalt);
  color: #fff;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.18), 0 0 0 3px var(--t-surface), 0 0 0 6px var(--t-cobalt);
}
/* Today is still filling in: the mint «live» dot of the brand tile. */
.st-today .st-face::after {
  content: "";
  position: absolute;
  top: 1px;
  right: 1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--t-mint);
  box-shadow: 0 0 0 3px var(--t-surface);
}
.st-day { font-size: 0.875rem; font-weight: 600; line-height: 1.25; white-space: nowrap; }
.st-meta { color: var(--t-ink-2); font: 500 0.6875rem/1.3 var(--t-mono); white-space: nowrap; }
.st-unread .st-meta { color: var(--toy-text); }
.st-sr, .st-status:empty {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .st-ring:hover .st-face { transform: translateY(-3px) rotate(-2deg); }
}
@media (prefers-reduced-motion: no-preference) {
  .st-ring:active .st-face { transform: scale(0.94); transition-duration: var(--t-fast); }
}

/* Waiting for the feed: quiet faces where the rings will be (replaced by the render). */
.st-skel { width: 86px; padding: 12px 11px 0; }
.st-skel::before { content: ""; display: block; width: 64px; height: 64px; border-radius: 50%; background: var(--t-surface-2); }
.st-skel::after { content: ""; display: block; width: 48px; height: 10px; margin: 14px auto 0; border-radius: 5px; background: var(--t-surface-2); }

/* Index: a full-width band between the masthead and the posts. */
@media (min-width: 600px) {
  .st-face { width: 68px; height: 68px; }
  .st-skel::before { width: 68px; height: 68px; }
  .st-skel { padding-inline: 9px; }
  .stories-row { gap: 10px; min-height: 146px; }
}
@media (min-width: 1100px) {
  .blog-index { grid-template-areas: "intro topics" "stories stories" "posts posts"; }
  .blog-index > .stories { grid-area: stories; margin-bottom: 32px; }
}
/* Post and tag pages: after the post, on the reading column. */
.blog-page > .stories { width: 100%; max-width: 1040px; margin: 56px auto 0; padding-top: 28px; box-shadow: inset 0 1.5px 0 var(--t-line); }

/* ---------- the player ---------- */

html.st-locked { overflow: hidden; }
.st-player {
  --st-track: rgba(20, 20, 20, 0.16);
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--t-ink);
  overflow: hidden;
}
.st-player[open] { display: grid; place-items: center; }
.st-player::backdrop { background: rgba(12, 12, 12, 0.88); }
@media (prefers-color-scheme: dark) {
  .st-player { --st-track: rgba(255, 255, 255, 0.2); }
}

.st-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  overflow: hidden;
  background: var(--t-card);
  font-family: var(--t-display);
}
@media (min-width: 600px) {
  .st-card {
    width: min(460px, 100% - 32px);
    height: min(880px, 100% - 40px);
    padding: 12px 14px 14px;
    border-radius: var(--t-r-l);
    box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.12), 0 30px 80px -30px rgba(0, 0, 0, 0.7);
  }
}
@media (prefers-reduced-motion: no-preference) {
  .st-player[open] .st-card { animation: st-in 0.42s var(--t-spring) both; }
  .st-main.st-swap { animation: st-swap 0.32s var(--t-out) both; }
}
@keyframes st-in { from { transform: translateY(28px) scale(0.97); } }
@keyframes st-swap { from { transform: translateX(14px); } }

/* One segment per note of the day; the current one fills while you read. */
.st-segs { display: flex; gap: 4px; min-height: 4px; padding: 2px 2px 6px; }
.st-seg { flex: 1; height: 4px; overflow: hidden; border-radius: 2px; background: var(--st-track); }
.st-fill { display: block; height: 100%; background: var(--t-ink); transform: scaleX(0); transform-origin: left center; }
.st-done .st-fill { transform: scaleX(1); }
@media (prefers-reduced-motion: no-preference) {
  .st-current .st-fill { animation: st-fill 20s linear forwards; }
  .st-player[data-paused] .st-current .st-fill { animation-play-state: paused; }
}
@media (prefers-reduced-motion: reduce) {
  .st-current .st-fill { transform: scaleX(1); opacity: 0.45; }
}
@keyframes st-fill { to { transform: scaleX(1); } }

.st-head { display: flex; align-items: center; gap: 10px; min-height: 52px; }
.st-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--t-r-btn);
  background: var(--t-cobalt);
  color: #fff;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.2);
  font: 800 1.125rem/1 var(--t-display);
}
.st-who { display: flex; flex: 1; flex-direction: column; min-width: 0; margin: 0; }
.st-name { font-size: 0.9375rem; font-weight: 700; line-height: 1.2; }
.st-when { overflow: hidden; color: var(--t-ink-2); font: 500 0.75rem/1.4 var(--t-mono); text-overflow: ellipsis; white-space: nowrap; }

.st-key {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0 10px;
  border: 0;
  border-radius: var(--t-r-btn);
  background: transparent;
  color: var(--t-ink);
  font: 600 0.9375rem/1 var(--t-display);
  cursor: pointer;
  transition: background-color var(--t-base) var(--t-out);
}
.st-key:hover:not(:disabled) { background: var(--t-surface-2); }
.st-key:focus-visible, .st-open:focus-visible, .st-text:focus-visible, .st-all:focus-visible { outline: 3px solid var(--t-ink); outline-offset: 2px; }
.st-key:disabled { opacity: 0.35; cursor: default; }
.st-key svg { display: block; flex: 0 0 auto; }

.st-main { display: flex; flex: 1; flex-direction: column; gap: 14px; min-height: 0; }
/* The picture area takes taps (left third back, the rest on), swipes and holds. */
.st-stage { flex: 0 0 auto; cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: pan-y; -webkit-tap-highlight-color: transparent; }
.st-media { height: clamp(150px, 34svh, 320px); margin: 0; overflow: hidden; border-radius: var(--t-r-m); background: var(--t-surface-2); }
.st-media img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
/* A note without a picture: its title on a cobalt slab. */
.st-slab {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
  min-height: clamp(160px, 30svh, 290px);
  padding: 20px 20px 24px;
  border-radius: var(--t-r-m);
  background: var(--t-cobalt);
  color: #fff;
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.18);
}
.st-slab .st-kicker { color: #fff; }
.st-slab .st-title { margin: 0; color: #fff; font-size: 1.75rem; }

.st-text { flex: 1; min-height: 0; padding: 0 4px 6px; overflow-y: auto; overscroll-behavior: contain; border-radius: var(--t-r-s); }
.st-kicker { margin: 0; color: var(--t-ink-2); font: 500 0.75rem/1.4 var(--t-mono); letter-spacing: 0.06em; text-transform: uppercase; }
.st-title { margin: 6px 0 12px; font-size: 1.5rem; font-weight: 800; line-height: 1.06; letter-spacing: -0.02em; text-wrap: balance; }
.st-body { font-size: 1.0625rem; line-height: 1.55; text-wrap: pretty; }
.st-body p, .st-text > p { margin: 0 0 0.9em; }
.st-body a, .st-all { color: var(--toy-text); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 0.2em; overflow-wrap: anywhere; }
.st-all-key { padding: 0 16px; background: var(--t-ink); color: var(--t-surface); font-weight: 700; }
.st-all-key:hover:not(:disabled) { background: var(--t-ink); text-decoration: underline; text-underline-offset: 0.2em; }
.st-video-note { color: var(--t-ink-2); font: 500 0.8125rem/1.45 var(--t-mono); }

.st-foot { display: flex; align-items: center; gap: 8px; padding-top: 10px; }
.st-foot .st-key { min-width: 48px; min-height: 48px; background: var(--t-surface-2); }
.st-foot .st-key:hover:not(:disabled) { background: var(--t-line); }
.st-open {
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 14px;
  border-radius: var(--t-r-btn);
  background: var(--t-ink);
  color: var(--t-surface) !important;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25);
  font: 700 0.9375rem/1.1 var(--t-display);
  text-align: center;
  text-decoration: none;
}
.st-open:hover { text-decoration: underline; text-underline-offset: 0.2em; }
.st-is-end .st-foot { justify-content: space-between; }
@media (max-width: 360px) {
  .st-share > span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* «Link copied»: a small ink note over the keys. */
.st-status {
  position: absolute;
  bottom: 84px;
  left: 50%;
  margin: 0;
  padding: 9px 14px;
  border-radius: var(--t-r-btn);
  background: var(--t-ink);
  color: var(--t-surface);
  font: 600 0.875rem/1.3 var(--t-display);
  white-space: nowrap;
  transform: translateX(-50%);
}

@media (prefers-reduced-motion: reduce) {
  .st-face, .st-key { transition: none; }
}
