/* Type comes from atlas-fonts.css (Rubik for Latin and Cyrillic, Cairo for Arabic);
   this file only lays out the home feed. */
/* Home feed components (staging). Colours, type, spacing, radii and motion come only from ofinder-tokens.css
   (--color-*, --space-*, --radius-*, --dur-*). Swap the tokens file to restyle. Logical properties only: RTL mirrors itself. */

.pc { display: grid; gap: var(--space-5); padding: var(--space-6); background: var(--color-surface); color: var(--color-text);
  border: 1px solid var(--color-border); border-radius: var(--radius-xl); box-shadow: var(--shadow-2); font-family: var(--font-ui, inherit); }
.pc.is-openable { cursor: pointer; }
.pc.is-openable:active { background: var(--color-surface-3); transition: background var(--dur-1); }
@media (min-width: 1024px) { .pc { padding: var(--space-7); border-radius: var(--radius-2xl); } }

/* Index rail: hairline on top, status at the start edge, post code at the end edge. */
.pc-rail { display: flex; justify-content: space-between; padding-block-start: var(--space-3); border-block-start: 1px solid var(--color-border);
  font-family: var(--font-mono); font-size: var(--fs-code); letter-spacing: var(--tracking-wide); color: var(--color-text-meta); direction: ltr; }
[dir="rtl"] .pc-rail, html[lang="ar"] .pc-rail { direction: rtl; }
@media (max-width: 359px) { .pc-rail { display: none; } }

.pc-head { display: flex; align-items: flex-start; gap: var(--space-4); }
.pc-who { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--space-5); color: inherit; text-decoration: none; }
.pc-avatar.avatar { width: 48px; height: 48px; flex: none; border: 1px solid var(--color-border); background: var(--color-primary-tint); color: var(--color-primary); }
@media (min-width: 1024px) { .pc-avatar.avatar { width: 56px; height: 56px; } }
.pc-names { display: grid; gap: var(--space-1); min-width: 0; }
.pc-name-row { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.pc-name { font-size: var(--fs-body-lg); font-weight: var(--weight-semi); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-time { font-size: var(--fs-label); color: var(--color-text-meta); }
.pc-time::after { content: " · \1F30D"; }
.pc-follow { min-height: var(--touch-min); padding-inline: var(--space-4); color: var(--color-primary); font-weight: var(--weight-semi); background: none; border: 0; cursor: pointer; }
.pc-menu > summary { width: var(--touch-min); height: var(--touch-min); }

.pc-body { margin: 0; font-size: var(--fs-body); line-height: var(--lh-body); white-space: pre-line; overflow-wrap: anywhere; }
html[lang="ar"] .pc-body, .pc-body:lang(ar) { font-size: var(--fs-body-lg); line-height: var(--lh-body-ar); }
.pc-body.is-clamped { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pc-tag { color: var(--color-accent); font-weight: var(--weight-medium); unicode-bidi: isolate; }

.pc-foot { display: flex; align-items: center; gap: var(--space-2); margin-inline: calc(var(--space-4) * -1); }
.pc-metric { display: inline-flex; align-items: center; gap: var(--space-3); min-height: var(--touch-min); padding-inline: var(--space-4); color: var(--color-text-meta);
  font: inherit; font-size: var(--fs-label); font-variant-numeric: tabular-nums; background: none; border: 0; border-radius: var(--radius-md); cursor: pointer; }
.pc-views { cursor: default; }
.pc-metric .ico { inline-size: 20px; block-size: 20px; }
.pc-metric:active { background: var(--color-surface-3); transition: background var(--dur-1); }
.pc-like.is-on { color: var(--color-accent); }
.pc-like.is-on .ico, .pc-save.is-on .ico { fill: currentColor; }
.pc-save { margin-inline-start: auto; }
.pc-save.is-on { color: var(--color-primary); }
.pc-metric:focus-visible, .pc-opt:focus-visible, .pc-link:focus-visible { outline: 0; box-shadow: var(--ring-focus); }
.pc-pending { margin: 0; }

/* Poll panel */
.pc-poll { margin: 0; min-inline-size: 0; display: block; padding: var(--space-6); border: 1.5px solid var(--color-primary);
  border-radius: var(--radius-xl); background: var(--color-primary-tint); }
.pc-poll-q { float: inline-start; inline-size: 100%; padding: 0; margin-block-end: var(--space-5); font-size: var(--fs-body-lg); font-weight: var(--weight-semi); text-wrap: balance; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pc-poll-options { clear: both; display: grid; gap: var(--space-4); }
.pc-poll-meta { margin-block-start: var(--space-5) !important; }
.pc-opt { position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: center; gap: var(--space-4); inline-size: 100%; min-block-size: var(--control-h);
  padding-inline: var(--space-6); font: inherit; font-size: var(--fs-body); font-weight: var(--weight-medium); text-align: start; color: var(--color-text);
  background: var(--color-surface-3); border: 0; border-radius: var(--radius-md); }
button.pc-opt { cursor: pointer; }
button.pc-opt:hover { background: var(--color-surface-2); }
.pc-opt-label { flex: 1; min-inline-size: 0; overflow-wrap: anywhere; unicode-bidi: isolate; }
.pc-opt-fill { position: absolute; z-index: -1; inset-block: 0; inset-inline-start: 0; border-radius: var(--radius-md); background: var(--color-primary-tint);
  transition: inline-size var(--dur-5) var(--ease-out); }
.pc-opt:nth-child(2) .pc-opt-fill { transition-delay: var(--stagger-1); }
.pc-opt:nth-child(3) .pc-opt-fill { transition-delay: calc(var(--stagger-1) * 2); }
.pc-opt:nth-child(4) .pc-opt-fill { transition-delay: calc(var(--stagger-1) * 3); }
.pc-opt:nth-child(5) .pc-opt-fill { transition-delay: calc(var(--stagger-1) * 4); }
.pc-opt-pct { margin-inline-start: auto; font-size: var(--fs-body-sm); font-weight: var(--weight-semi); font-variant-numeric: tabular-nums; color: var(--color-text-meta); }
.pc-opt.is-mine { background: var(--color-primary); color: var(--color-on-primary); }
.pc-opt.is-mine .pc-opt-fill { background: transparent; }
.pc-opt.is-mine .pc-opt-pct { color: var(--color-on-primary); }
/* The chosen option keeps its colour under the pointer too (plain :hover washed it out to surface-2). */
button.pc-opt.is-mine:hover { background: var(--color-primary); }
.pc-opt-check { display: inline-grid; place-items: center; inline-size: 20px; block-size: 20px; flex: none; }
.pc-opt-check .ico { inline-size: 20px; block-size: 20px; stroke-width: 2.6; }
.pc-opt.is-pending { opacity: .85; }
.pc-poll-meta { margin: 0; font-size: var(--fs-label); color: var(--color-text-meta); font-variant-numeric: tabular-nums; }
.pc-link { padding: 0; font: inherit; font-size: var(--fs-label); font-weight: var(--weight-medium); color: var(--color-primary); background: none; border: 0; text-decoration: underline; cursor: pointer; }

/* Home page controls */
.pc-chips { display: flex; gap: var(--space-4); max-width: 720px; margin-block-end: var(--space-5); overflow-x: auto; scrollbar-width: none; }
.pc-chips button { min-height: 32px; padding-inline: var(--space-6); font: inherit; font-size: var(--fs-label); color: var(--color-text); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-pill); cursor: pointer; white-space: nowrap; }
.pc-chips button[aria-pressed="true"] { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); }
#page-community .community-feed { gap: var(--space-5); max-width: var(--feed-col); }

/* Composer extras */
.composer-tools { display: flex; gap: var(--space-4); }
.composer-tool { display: inline-flex; align-items: center; gap: var(--space-3); min-height: var(--touch-min); padding-inline: var(--space-6); font: inherit; font-weight: var(--weight-medium); color: var(--color-primary); background: var(--color-primary-tint); border: 1px solid var(--color-border); border-radius: var(--radius-pill); cursor: pointer; }
.composer-tool .ico { inline-size: 20px; block-size: 20px; }
.composer-tool:disabled { opacity: .45; cursor: not-allowed; }
.composer-tool[aria-pressed="true"] { background: var(--color-primary); color: var(--color-on-primary); }
.composer-poll { display: grid; gap: var(--space-4); }
.composer-poll-options { display: grid; gap: var(--space-4); }
.pc-poll-row { display: flex; gap: var(--space-3); align-items: center; }
.pc-poll-input { flex: 1; min-height: var(--control-h); padding-inline: var(--space-5); font: inherit; color: var(--color-text); background: var(--color-surface); border: 1px solid var(--color-border-strong); border-radius: var(--radius-md); }

@media (prefers-reduced-motion: reduce) { .pc-opt-fill { transition: none; } }

/* A shared opportunity inside a post: the cover on top, then category, title and deadline. */
.pc .community-shared-card { display: grid; grid-template-columns: 1fr; gap: 0; padding: 0; overflow: hidden; border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-surface-2); color: inherit; text-decoration: none; }
.pc .community-shared-card:hover { border-color: var(--color-primary); }
.pc .community-shared-card img { inline-size: 100%; block-size: auto; aspect-ratio: 5 / 3; border-radius: 0; object-fit: contain; background: var(--paper); }
.pc .community-shared-copy { padding: var(--space-5) var(--space-6); gap: var(--space-2); }
.pc .community-shared-copy small { color: var(--color-primary); font-weight: var(--weight-semi); text-transform: none; }
.pc .community-shared-copy strong { font-size: var(--fs-body-lg); line-height: var(--lh-heading); }
.pc .community-shared-copy span { color: var(--color-text-meta); font-size: var(--fs-label); }

/* ---------------------------------------------------------------- motion (ux-animation pass)
   Ideas from dribbble.com/tags/ux-animation, applied to the Home feed: press micro-interactions
   (like/save), a staggered feed entrance, and a draw-in confirmation on poll votes. All movement is
   transform/opacity only, so it stays on the compositor; everything switches off for reduced motion.
   app.js adds each class once, at the moment of the press or the render, and removes it on animationend. */

/* Post like: the heart pops when it is pressed, never when a page is shown again. */
.pc-like .ico { transition: transform var(--dur-3) var(--ease-out); }
.pc-like.just-liked .ico-heart { animation: pc-heart-set var(--dur-4) var(--ease-spring); }
@keyframes pc-heart-set { 40% { transform: scale(1.28); } }

/* Post save: the bookmark dips, then settles into place. */
.pc-save .ico { transition: transform var(--dur-3) var(--ease-out); }
.pc-save.just-saved .ico-bookmark { animation: pc-bookmark-set var(--dur-4) var(--ease-spring); }
@keyframes pc-bookmark-set { 35% { transform: translateY(2px) scale(.82); } 70% { transform: translateY(-1px) scale(1.08); } }

/* Feed entrance: new cards rise in with a short stagger (delay set inline per card by app.js). */
.pc.pc-enter { animation: pc-in var(--dur-4) var(--ease-out) backwards; }
@keyframes pc-in { from { opacity: 0; transform: translateY(14px); } }

/* Poll vote: the chosen row's check draws itself and the percentage fades in beside it. */
.pc-opt.just-voted .pc-opt-check .ico { stroke-dasharray: 24; stroke-dashoffset: 24; animation: pc-draw-check var(--dur-4) var(--ease-out) var(--dur-2) forwards; }
@keyframes pc-draw-check { to { stroke-dashoffset: 0; } }
.pc-opt.just-voted .pc-opt-pct { animation: pc-pct-in var(--dur-4) var(--ease-out) var(--dur-2) backwards; }
@keyframes pc-pct-in { from { opacity: 0; transform: translateY(3px); } }

@media (prefers-reduced-motion: reduce) {
  .pc.pc-enter, .pc-like.just-liked .ico-heart, .pc-save.just-saved .ico-bookmark,
  .pc-opt.just-voted .pc-opt-check .ico, .pc-opt.just-voted .pc-opt-pct { animation: none !important; }
  .pc-like .ico, .pc-save .ico { transition: none; }
  .pc-opt.just-voted .pc-opt-check .ico { stroke-dashoffset: 0; }
}

/* ---------------------------------------------------------------- Full-bleed posts (staging restyle)
   Posts are not boxed cards. On a phone they run edge to edge and are told apart by a thin divider; on a wide
   screen they stay in the centred feed column, still without a box. Tokens only, logical properties only (RTL mirrors).
   Remove this block to go back to the boxed card. */
.pc { gap: var(--space-4); padding: var(--space-6) 0 var(--space-2); background: transparent; border: 0; border-radius: 0; box-shadow: none;
  border-block-end: 1px solid var(--color-border); }
.pc-kind-opportunity { padding-block-end: var(--space-6); }
.pc.is-openable:active { background: var(--color-surface-2); }
#page-community .community-feed, #page-post .community-feed, #pf-panel-posts { gap: 0; }
@media (min-width: 1024px) { .pc { padding: var(--space-7) 0 var(--space-3); } }
/* Phone: out of the page gutter to the screen edges, then the gutter back as inner padding. */
@media (max-width: 720px) {
  #page-community .community-feed, #page-post .community-feed, #pf-panel-posts {
    inline-size: 100vw; max-inline-size: 100vw; margin-inline: calc(50% - 50vw); }
  .pc { padding-inline: var(--gutter-mobile, 16px); }
  .pc-foot { margin-inline: calc(var(--space-4) * -1 + 0px); }
  .pc .community-shared-card, .pc-poll { border-radius: var(--radius-md); }
  /* A picture or a shared opportunity cover runs to the screen edges too. */
  .pc .community-shared-card { margin-inline: calc(var(--gutter-mobile, 16px) * -1); border-radius: 0; border-inline: 0; }
}
/* "Write a comment" pill under a post in the feed */
.pc-cpill { display: flex; align-items: center; gap: var(--space-4); inline-size: 100%; min-height: var(--touch-min); padding: 0; margin-block-end: var(--space-4);
  font: inherit; text-align: start; color: var(--color-text-meta); background: none; border: 0; cursor: pointer; }
.pc-cpill .avatar { flex: none; inline-size: 32px; block-size: 32px; }
.pc-cpill-text { flex: 1; min-width: 0; padding: var(--space-4) var(--space-6); font-size: var(--fs-body-sm); color: var(--color-text-meta);
  background: var(--color-surface-3); border-radius: var(--radius-pill); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-cpill:focus-visible { outline: 0; box-shadow: var(--ring-focus); border-radius: var(--radius-pill); }

/* Comments: no box, no borders. Avatar row, a soft bubble for the text, text-link actions, replies behind a thin rail. */
#page-post .community-comments { display: grid; gap: var(--space-4); max-inline-size: none; padding: var(--space-6) var(--gutter-mobile, 16px) var(--space-8);
  background: transparent; border: 0; border-radius: 0; box-shadow: none; }
@media (min-width: 721px) { #page-post .community-comments { padding-inline: 0; max-inline-size: var(--feed-col); } }
#page-post .community-comments .cm-title { margin: 0; font-size: var(--fs-body); font-weight: var(--weight-semi); color: var(--color-text); }
#page-post .community-comment-list { gap: var(--space-5); }
.community-comment, .community-comment.comment-reply { padding: 0; background: transparent; border: 0; border-radius: 0; gap: var(--space-2); }
.community-comment .comment-head { justify-content: flex-start; flex-wrap: nowrap; gap: var(--space-4); }
.community-comment .comment-time { color: var(--color-text-meta); font-size: var(--fs-label); }
.community-comment .comment-body { align-self: start; justify-self: start; max-inline-size: 100%; padding: var(--space-4) var(--space-6);
  background: var(--color-surface-3); border-radius: var(--radius-lg); line-height: var(--lh-body); }
.community-comment .comment-actions { gap: var(--space-5); padding-inline: var(--space-4); }
.community-comment .comment-action { padding: var(--space-2) 0; min-height: 32px; font-size: var(--fs-label); font-weight: var(--weight-medium); color: var(--color-text-meta);
  background: none; border: 0; border-radius: 0; }
.community-comment .comment-action:hover, .community-comment .comment-action:focus-visible { color: var(--color-text); border: 0; }
.community-comment .comment-action.is-liked { color: var(--color-accent); border: 0; }
.community-comment .comment-action.is-danger { color: var(--color-danger, var(--color-accent)); }
.community-comment .comment-replies { margin-inline-start: var(--space-6); padding-inline-start: var(--space-5); border-inline-start: 2px solid var(--color-border); gap: var(--space-4); }

/* The comment field: small avatar + pill (grows with the text) + a Post link once there is text. */
.community-comment-form { display: flex; align-items: center; gap: var(--space-4); }
.community-comment-form.is-reply { margin-block: var(--space-3); }
.community-comment-form .cf-avatar { flex: none; inline-size: 32px; block-size: 32px; align-self: flex-start; }
.community-comment-form .cf-input { flex: 1; min-inline-size: 0; min-block-size: 40px; max-block-size: 160px; padding: 9px var(--space-6); resize: none; overflow-y: auto;
  font: inherit; font-size: var(--fs-body-sm); line-height: 1.5; color: var(--color-text); background: var(--color-surface-3);
  border: 1px solid transparent; border-radius: var(--radius-pill); }
.community-comment-form .cf-input::placeholder { color: var(--color-text-meta); opacity: 1; }
.community-comment-form .cf-input:focus { outline: 0; border-color: var(--color-primary); box-shadow: var(--ring-focus); }
.community-comment-form .cf-send { display: none; flex: none; min-block-size: var(--touch-min); padding-inline: var(--space-4); font: inherit; font-weight: var(--weight-semi);
  color: var(--color-primary); background: none; border: 0; cursor: pointer; }
.community-comment-form.has-text .cf-send { display: inline-flex; align-items: center; }
.community-comment-form .cf-send:disabled { opacity: .5; }

/* Profile counters must fit a 390px phone in every language (Russian labels were 52px too wide and widened the whole page). */
@media (max-width: 480px) {
  #page-member .pf-row .pf-stats { gap: 6px; flex: 1 1 0; min-inline-size: 0; }
  #page-member .pf-row .pf-stat { flex: 1 1 0; min-inline-size: 0; padding-inline: 0; }
  #page-member .pf-row { gap: 12px; }
  #page-member .pf-row .pf-avatar { width: 68px; height: 68px; }
  #page-member .pf-row .pf-stat span { max-inline-size: 100%; font-size: 10px; text-align: center; white-space: nowrap; }
}
