/* A single vertical reading stream over the existing v3 components. Natural
   document scrolling keeps expanded text, players, menus and conversations usable. */
body.v3-app[data-reading-cards]{--reading-gap:16px;--reading-radius:18px;background:#f5f8f5}
body.v3-app[data-reading-cards] main{max-width:860px;background:transparent}
body.v3-app[data-reading-cards] :is(.latest-grid,#social-feed-list,#directory-list,.interaction-list,.friend-chat-people){max-width:760px;margin-inline:auto;background:transparent;border:0}
body.v3-app[data-reading-cards] .explore-content :is(#public-cards-list,#results-cards){display:grid;grid-template-columns:minmax(0,1fr);gap:var(--reading-gap);border:0}
body.v3-app[data-reading-cards] .explore-content .latest-card{display:grid;grid-template-columns:minmax(0,1fr) 48px;align-items:center;gap:0;min-height:150px;margin:0;padding:0 12px 0 0;border:1px solid var(--line);border-radius:var(--reading-radius);background:#fff;box-shadow:0 3px 14px #1c422607;overflow:hidden}
body.v3-app[data-reading-cards] .explore-card-open{display:grid;grid-template-columns:64px minmax(0,1fr) 16px;align-items:start;gap:16px;padding:20px;min-height:150px}
body.v3-app[data-reading-cards] .explore-content .latest-image{width:64px;height:64px;min-width:64px;flex-basis:64px;overflow:visible}
body.v3-app[data-reading-cards] .latest-image img{width:64px;height:64px}
body.v3-app[data-reading-cards] .explore-content .latest-copy{gap:7px;align-self:center}
body.v3-app[data-reading-cards] .latest-copy strong{font-size:calc((20px) * var(--app-text-scale, 1));line-height:1.35;white-space:normal;overflow-wrap:anywhere}
body.v3-app[data-reading-cards] .latest-copy small{font-size:calc((14px) * var(--app-text-scale, 1));line-height:1.45;white-space:normal;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;overflow-wrap:anywhere}
body.v3-app[data-reading-cards] .latest-copy .explore-card-summary{font-size:calc((15px) * var(--app-text-scale, 1));color:var(--ink)}
body.v3-app[data-reading-cards] .explore-chevron{align-self:center}
body.v3-app[data-reading-cards] .explore-content .latest-card .heart{justify-self:center;align-self:center}
body.v3-app[data-reading-cards] .explore-content .latest-card:focus-within{outline:2px solid var(--green);outline-offset:3px}

/* Existing post text, exact two-line expander, natural image dimensions and
   YouTube/Shorts players remain inside the card's media edges. */
body.v3-app[data-reading-cards] #social-feed-list{border:0;background:transparent}
body.v3-app[data-reading-cards] #social-feed-list>.activity-feed-card{margin:0 0 var(--reading-gap);padding:12px;border:1px solid var(--line);border-radius:var(--reading-radius);background:#fff;box-shadow:0 3px 14px #1c422607}
body.v3-app[data-reading-cards] #social-feed-list>.activity-feed-card:last-child{margin-bottom:0}
body.v3-app[data-reading-cards] .activity-feed-card>header{margin-bottom:8px}
body.v3-app[data-reading-cards] .activity-feed-card .activity-feed-actions{margin-top:10px;padding-top:6px}
body.v3-app[data-reading-cards] #social-feed-list>.explore-legacy-row{margin-bottom:var(--reading-gap);border:1px solid var(--line);border-radius:var(--reading-radius);background:#fff;overflow:hidden}
body.v3-app[data-reading-cards] #social-feed-list>.explore-legacy-row>.wall-card-link{border:0;padding:18px}

/* Public directory and joined communities keep their current permission and
   join/read controls; only the individual reading surfaces change. */
body.v3-app[data-reading-cards] #directory-list .item-row{min-height:136px;margin:0 0 var(--reading-gap);padding:20px;border:1px solid var(--line);border-radius:var(--reading-radius);background:#fff;box-shadow:0 3px 14px #1c422607}
body.v3-app[data-reading-cards] #directory-list .round-avatar{width:56px;height:56px;flex-basis:56px}
body.v3-app[data-reading-cards] #directory-list strong{font-size:calc((20px) * var(--app-text-scale, 1));line-height:1.4;white-space:normal;overflow-wrap:anywhere}
body.v3-app[data-reading-cards] #directory-list small{font-size:calc((14px) * var(--app-text-scale, 1));white-space:normal;overflow-wrap:anywhere}
body.v3-app[data-reading-cards] #wall-boards:not(.community-open) .interaction-list-row{min-height:120px;margin:0 0 var(--reading-gap);padding:18px;border:1px solid var(--line);border-radius:var(--reading-radius);background:#fff;box-shadow:0 3px 14px #1c422607}
body.v3-app[data-reading-cards] :is(#wall-boards,#saved-root) .interaction-list-copy strong{font-size:calc((18px) * var(--app-text-scale, 1));line-height:1.4;white-space:normal;overflow-wrap:anywhere}
body.v3-app[data-reading-cards] :is(#wall-boards,#saved-root) .interaction-list-copy small{white-space:normal;line-height:1.45;overflow-wrap:anywhere}
body.v3-app[data-reading-cards] #saved-root .interaction-saved-row{margin:0 0 var(--reading-gap);padding:0 8px 0 0;border:1px solid var(--line);border-radius:var(--reading-radius);background:#fff;box-shadow:0 3px 14px #1c422607;min-width:0}
body.v3-app[data-reading-cards] #saved-root .interaction-saved-row>.interaction-list-row{min-height:120px;padding:18px;margin:0;border:0;border-radius:inherit;background:transparent}
body.v3-app[data-reading-cards] #wall-boards.community-open .v3-board-post{border:1px solid var(--line);border-radius:var(--reading-radius);padding:18px;margin-bottom:var(--reading-gap);box-shadow:0 3px 14px #1c422607}
body.v3-app[data-reading-cards] #chat-root .friend-chat-person{min-height:112px;margin:0 0 var(--reading-gap);padding:18px;border:1px solid var(--line);border-radius:var(--reading-radius);background:#fff;box-shadow:0 3px 14px #1c422607}
body.v3-app[data-reading-cards] #chat-root .friend-chat-person strong{font-size:calc((18px) * var(--app-text-scale, 1));line-height:1.4;white-space:normal;overflow-wrap:anywhere}
body.v3-app[data-reading-cards] #chat-root .friend-chat-person small{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;white-space:normal;line-height:1.45;overflow-wrap:anywhere}
body.v3-app[data-reading-cards] #chat-root .friend-chat-person time{flex:none;white-space:nowrap}
body.v3-app[data-reading-cards] :is(.interaction-saved-row,.interaction-list-row,.friend-chat-person):focus-within{outline:2px solid var(--green);outline-offset:3px}
@media(max-width:600px){
 body.v3-app[data-reading-cards]{--reading-gap:12px;--reading-radius:16px}
 body.v3-app[data-reading-cards] .explore-card-open{grid-template-columns:56px minmax(0,1fr) 12px;gap:12px;padding:16px;min-height:140px}
 body.v3-app[data-reading-cards] .explore-content .latest-image,body.v3-app[data-reading-cards] .latest-image img{width:56px;height:56px;min-width:56px;flex-basis:56px}
 body.v3-app[data-reading-cards] .explore-content .latest-card{grid-template-columns:minmax(0,1fr) 44px;padding-right:6px}
 body.v3-app[data-reading-cards] .latest-copy strong{font-size:calc((19px) * var(--app-text-scale, 1))}
 body.v3-app[data-reading-cards] #directory-list .item-row{padding:16px}
 body.v3-app[data-reading-cards] :is(#chat-root .friend-chat-person,#wall-boards:not(.community-open) .interaction-list-row){padding:16px}
 body.v3-app[data-reading-cards] #saved-root .interaction-saved-row>.interaction-list-row{padding:16px}
}

/* Explore-only native document snapping. No wheel/touch/key interception.
   Append after the existing v3 styles only once the production base is verified. */
@supports (scroll-snap-type: y proximity) and selector(html:has(body)) {
  html:has(> body.v3-app[data-reading-cards]:is([data-v3-page=index],[data-v3-page=feed],[data-v3-page=explore-boards])) {
    scroll-snap-type: y proximity;
    scroll-padding-block: calc(70px + env(safe-area-inset-top) / var(--app-scale,1)) calc(112px + env(safe-area-inset-bottom) / var(--app-scale,1));
  }
  body.v3-app[data-reading-cards]:is([data-v3-page=index],[data-v3-page=feed],[data-v3-page=explore-boards]) :is(#public-cards-list>.latest-card,#results-cards>.latest-card,#social-feed-list>.activity-feed-card,#social-feed-list>.explore-legacy-row,#directory-list>.item-row,[data-search-more],#directory-more,#directory-retry) {
    scroll-snap-align: start;
    scroll-snap-stop: normal;
  }
  /* Scroll freely between cards; ease only the browser's nearby alignment.
     Never intercept wheel/touch input or stop at every card. */
  @media (prefers-reduced-motion:no-preference) {
    html:has(> body.v3-app[data-reading-cards]:is([data-v3-page=index],[data-v3-page=feed],[data-v3-page=explore-boards])) {scroll-behavior:smooth;}
  }
  /* Keep the final card's top reachable, including short directory cards. */
  body.v3-app[data-reading-cards]:is([data-v3-page=index],[data-v3-page=feed],[data-v3-page=explore-boards]) main {
    padding-bottom: max(100px, calc(100svh / var(--app-scale,1) - 200px));
  }
  /* Browser-native oversized snap areas permit reading the whole card. Never
     fix card height or add nested vertical scrolling; expansion stays natural. */
  @media (min-width:850px) {
    html:has(> body.v3-app[data-reading-cards]:is([data-v3-page=index],[data-v3-page=feed],[data-v3-page=explore-boards])) {
      scroll-padding-block: 98px 24px;
    }
  }
  /* Do not pull the viewport while typing, using a dialog, or reading a
     community detail. Route selector excludes settings and other pages. */
  html:has(> body.v3-app :is(dialog[open],input:focus,textarea:focus,select:focus,[contenteditable=true]:focus)),
  html:has(> body[data-v3-page=explore-boards] #directory-browse[hidden]) {
    scroll-snap-type: none;
  }
  @media (prefers-reduced-motion:reduce) {
    html:has(> body.v3-app[data-reading-cards]) {scroll-snap-type:none;scroll-behavior:auto;}
  }
}

/* Restoring history must not snap away from the saved reading position. */
html[data-explore-snap-restore],html:has(> body.v3-app[data-app-login=checking]) {scroll-snap-type:none!important;scroll-behavior:auto!important;}
/* Preserve the existing iOS appearance's bottom safe area without overriding settings. */
html[data-app-appearance=ios] body.v3-app[data-reading-cards]:is([data-v3-page=index],[data-v3-page=feed],[data-v3-page=explore-boards]) main {padding-bottom:max(120px,calc(100svh / var(--app-scale,1) - 200px));}
