/* Scroll & Stone - the Stone Feed (horizontal phone-card swipe deck). */

/* ---- Page: lock the feed to the viewport so the deck fills the space the
   sticky header leaves. Otherwise header + a 100dvh deck overflows and the
   9:16 card spills under the mobile browser chrome. ---- */
/* ---- Screen-reader-only text: document semantics (h1/instructions/live
   position region) without changing the visual design. ---- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html, body { height: 100%; }
body { margin: 0; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
.topbar { flex: 0 0 auto; }
body > footer { display: none; }   /* meaningless under a full-screen deck */

/* ---- Deck: horizontal scroll-snap container, fills the space under the header ---- */
.feed-deck {
  width: 100vw;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: scroll;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  display: flex;
  flex-direction: row;
  background: var(--night, #0a0a0a);
}
.feed-deck::-webkit-scrollbar { display: none; }

/* ---- Slide: one full-viewport slot per card ---- */
.feed-card {
  flex: 0 0 100%;
  width: 100vw;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Phone: centred 9:16 rounded card - the shareable artefact ----
   Height is driven off the deck (94%), so the card derives its width and the
   whole 9:16 box always fits in the space under the header. The vw cap stops
   it overflowing sideways on a narrow phone. */
.feed-phone {
  height: min(94%, calc(92vw * 16 / 9));
  aspect-ratio: 9 / 16;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 12px 44px rgba(0, 0, 0, .5);
  background: var(--night, #0a0a0a);
}

/* ---- Hero image: full-bleed background of the whole card ---- */
.feed-hero {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---- Scrim + overlay: dark gradient at bottom, all text/actions on top ---- */
.feed-scrim {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  /* gradient runs from near-opaque night at the bottom to transparent at the top */
  background: linear-gradient(to top,
    rgba(19, 28, 56, .92) 0%,
    rgba(19, 28, 56, .72) 45%,
    transparent 100%);
  padding: 1.5rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ---- Attribution: small credit line inside the scrim ---- */
.feed-credit {
  font-family: var(--utility, "Inter", sans-serif);
  font-size: .6rem;
  letter-spacing: .04em;
  color: rgba(255, 255, 255, .55);
  line-height: 1.3;
  margin-bottom: .5rem;
  text-align: right;
  pointer-events: none;
}
.feed-credit a {
  pointer-events: auto;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---- Gold rule ---- */
.feed-panel::before {
  content: "";
  display: block;
  width: 48px;
  height: 3px;
  background: var(--gold, #c7a24b);
  margin-bottom: .7rem;
}

/* ---- Caption panel: sits inside the scrim, light text over dark gradient ---- */
.feed-panel {
  color: var(--vellum, #f5f1e8);
}

/* ---- Content inside the panel ---- */
.feed-hook {
  font-family: var(--body, "Newsreader", serif);
  font-size: clamp(.92rem, 2.4vw, 1.15rem);
  line-height: 1.34;
  margin-bottom: .55rem;
  color: var(--vellum, #f5f1e8);
}
.feed-panel dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .1rem .75rem;
  margin-bottom: .4rem;
}
.feed-panel dt {
  font-family: var(--utility, "Inter", sans-serif);
  font-size: .65rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gold, #c7a24b);
  padding-top: .3rem;
}
.feed-panel dd {
  font-family: var(--body, "Newsreader", serif);
  font-size: clamp(.88rem, 2.2vw, 1.02rem);
  line-height: 1.3;
  color: var(--vellum, #f5f1e8);
}
.feed-kicker {
  font-family: var(--body, "Newsreader", serif);
  font-style: italic;
  color: var(--gold-soft, #e3c87e);
  margin-top: .3rem;
  font-size: clamp(.82rem, 2vw, .95rem);
}

/* ---- Wordmark: small branding line ---- */
.feed-wordmark {
  font-family: var(--utility, "Inter", sans-serif);
  font-size: .6rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .4);
  margin-top: .4rem;
}

.feed-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  margin-top: .55rem;
  min-width: 0;
  position: relative;
}

.feed-card-footer .feed-wordmark {
  margin: 0;
  white-space: nowrap;
  flex: 0 0 auto;
}

.feed-card-footer .st-tray {
  flex: 0 1 auto;
  min-width: 0;
}

.feed-card-footer .st-status {
  position: absolute;
  left: 1rem;
  right: 0;
  bottom: -1.15rem;
  text-align: right;
}

/* ---- Actions row: read link + share tray ---- */
.feed-actions {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  margin-top: .55rem;
}
.feed-read {
  font-family: var(--utility, "Inter", sans-serif);
  font-size: .82rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  color: var(--vellum, #f5f1e8);
}

.feed-story-btn {
  font-family: var(--utility, "Inter", sans-serif);
  font-size: .82rem;
  padding: .3rem .7rem;
  border: 1.5px solid var(--gold, #c7a24b);
  border-radius: 3px;
  background: transparent;
  color: var(--gold, #c7a24b);
  cursor: pointer;
  text-align: left;
  align-self: flex-start;
}
.feed-story-btn:hover,
.feed-story-btn:focus-visible {
  background: var(--gold, #c7a24b);
  color: var(--night, #131c38);
  outline: none;
}

/* ---- Visible navigation ---- */
.feed-nav-btn {
  position: fixed;
  top: 50%;
  width: clamp(2.75rem, 5vw, 3.25rem);   /* >= 44px touch target */
  height: clamp(3.25rem, 8vw, 4.75rem);
  transform: translateY(-50%);
  border: 1px solid rgba(240, 221, 154, .55);
  border-radius: 4px;
  background: rgba(19, 28, 56, .58);
  color: var(--gold-soft, #e3c87e);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 11;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
  backdrop-filter: blur(5px);
  transition: background .18s, border-color .18s, opacity .18s;
}
.feed-nav-prev { left: clamp(.45rem, 2vw, 1.4rem); }
.feed-nav-next { right: clamp(.45rem, 2vw, 1.4rem); }
.feed-nav-btn::before {
  content: "";
  width: .82rem;
  height: .82rem;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
}
.feed-nav-prev::before { transform: rotate(225deg); margin-left: .28rem; }
.feed-nav-next::before { transform: rotate(45deg); margin-right: .28rem; }
.feed-nav-btn:hover,
.feed-nav-btn:focus-visible {
  background: rgba(19, 28, 56, .78);
  border-color: rgba(240, 221, 154, .85);
  outline: none;
}
.feed-nav-btn:disabled {
  opacity: .28;
  cursor: default;
}

/* ---- Compact progress ---- */
.feed-progress {
  position: fixed;
  bottom: calc(.9rem + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .42rem .62rem;
  border: 1px solid rgba(240, 221, 154, .32);
  border-radius: 4px;
  background: rgba(19, 28, 56, .62);
  color: rgba(255, 255, 255, .72);
  font-family: var(--utility, "Inter", sans-serif);
  font-size: .65rem;
  letter-spacing: .12em;
  line-height: 1;
  pointer-events: none;
  z-index: 10;
  backdrop-filter: blur(5px);
}
.feed-progress-label {
  min-width: 4.9rem;
  text-align: right;
  color: var(--gold-soft, #e3c87e);
}
.feed-progress-bar {
  width: clamp(4.8rem, 18vw, 11rem);
  height: 2px;
  overflow: hidden;
  background: rgba(255, 255, 255, .22);
}
.feed-progress-bar span {
  display: flex;
  width: 100%;
  height: 100%;
  background: var(--gold, #c7a24b);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .18s ease-out;
}

/* ---- Reduced motion: no smooth card-to-card scroll, no progress-bar glide.
   (The deck's scroll-behavior is belt-and-braces - feed.js also passes
   behavior:"auto" to scrollTo() under this query, which is what actually
   wins over CSS scroll-behavior.) ---- */
@media (prefers-reduced-motion: reduce) {
  .feed-deck { scroll-behavior: auto; }
  .feed-progress-bar span { transition: none; }
  .feed-nav-btn { transition: none; }
}
