/*
 * Sence Ben v7 — "Sence ben … mıyım?" forum layout.
 *  - .qcard: one question = small thumbnail (tap = full screen) + question + who asked + two vote buttons.
 *  - Stage (body.split-mode, set by app.js): ONE compact question strip on top (never grows or shrinks),
 *    the comments take the rest of the screen. Left/right swipe (anywhere, also over the comments) = next/previous question.
 *  - Same layout on phones, tablets and desktop. Trend tab = forum-style list (.trend-list).
 *  - Lightbox for the photo / question details.
 */
.trend-list[hidden], .feed-viewport[hidden], .post-back[hidden] { display: none !important; }

/* ---------- the question card (all views) ---------- */
.qcard {
  position: relative;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  grid-template-areas: 'thumb main opts' 'vote vote vote' 'foot foot foot';
  column-gap: 12px;
  row-gap: 10px;
  min-width: 0;
  padding: 13px 12px 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 4px 15px #23352708;
}
.q-thumb {
  grid-area: thumb;
  position: relative;
  align-self: start;
  width: 76px;
  height: 76px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 14px;
  background: #e9ede4;
  cursor: zoom-in;
}
.q-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.q-thumb-zoom {
  position: absolute;
  right: 4px;
  bottom: 4px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 7px;
  background: #0f1d15b8;
  color: #fff;
}
.q-thumb-zoom svg { width: 12px; height: 12px; }
.q-thumb-empty {
  display: grid;
  place-items: center;
  color: var(--accent-deep);
  background: linear-gradient(135deg, #e6f1e1, #f7faf3);
  cursor: pointer;
}
.q-thumb-empty svg { width: 30px; height: 30px; }
.q-thumb:focus-visible { outline: 2px solid var(--accent-deep); outline-offset: 2px; }
.q-main { grid-area: main; min-width: 0; align-self: center; }
.q-title {
  display: -webkit-box;
  margin: 0 0 5px;
  overflow: hidden;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.03em;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}
.q-by { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; color: var(--muted); font-size: 12px; white-space: nowrap; }
.q-author { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.q-author strong { max-width: 130px; overflow: hidden; color: var(--ink); font-weight: 700; text-overflow: ellipsis; }
.q-author .avatar { width: 18px; height: 18px; font-size: 7.5px; }
.q-author .avatar svg { width: 11px; height: 11px; }
.q-by .decision-tag { margin-left: 2px; }
.q-body { margin: 7px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.4; overflow-wrap: anywhere; white-space: pre-line; }
.q-options { grid-area: opts; align-self: start; margin: -7px -7px 0 0; }
.qcard .voting { grid-area: vote; padding: 0; }
.qcard .vote-button { min-height: 44px; }
.q-foot {
  grid-area: foot;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  margin: 0 -12px;
  padding: 0 12px;
  border-top: 1px solid #f0eeeb;
}
.q-foot .post-actions { display: flex; align-items: center; gap: 4px; }
.q-foot .total-votes { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.feed { display: grid; gap: 14px; }

/* ---------- stage: strip on top, comments below ---------- */
body.split-mode {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--white);
}
body.split-mode > .topbar { position: relative; flex: none; }
body.split-mode > .mobile-nav { position: relative; inset: auto; flex: none; }
body.split-mode .vote-result { display: none; }
body.split-mode .layout.is-swipe-feed {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  background: var(--white);
}
body.split-mode .is-swipe-feed .feed-intro,
body.split-mode .is-swipe-feed .categories-card { display: none; }
body.split-mode .is-swipe-feed .main-content {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  --strip-h: 140px;
}
body.split-mode .is-swipe-feed .feed-nav { flex: none; }
body.split-mode .is-swipe-feed .feed-viewport {
  flex: none;
  display: flex;
  height: var(--strip-h);
  min-height: 0;
  container-type: inline-size;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: pan-y;
  scrollbar-width: none;
  outline-offset: -3px;
  background: #fff;
}
body.split-mode .is-swipe-feed .feed-viewport::-webkit-scrollbar { display: none; }
body.split-mode .is-swipe-feed .feed { display: flex; flex: none; width: max-content; gap: 0; }
body.split-mode .is-swipe-feed :is(.qcard, .empty-feed, .feed-status:not(:empty)) { flex: none; width: 100cqw; height: 100%; margin: 0; }
body.split-mode .is-swipe-feed :is(.empty-feed, .feed-status:not(:empty)) {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 0;
  border-radius: 0;
}
body.split-mode .is-swipe-feed .empty-feed h2 { font-size: 17px; }
body.split-mode .is-swipe-feed .empty-actions { margin-top: 2px; }

/* the compact card */
body.split-mode .is-swipe-feed .qcard {
  grid-template-columns: 64px minmax(0, 1fr) auto;
  grid-template-areas: 'thumb main opts' 'vote vote vote';
  grid-template-rows: minmax(0, 1fr) auto;
  column-gap: 11px;
  row-gap: 8px;
  padding: 10px 6px 10px 12px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
body.split-mode .is-swipe-feed .qcard .voting { margin-right: 6px; }
body.split-mode .is-swipe-feed .q-thumb { width: 64px; height: 64px; align-self: center; border-radius: 12px; }
body.split-mode .is-swipe-feed .q-thumb-empty svg { width: 26px; height: 26px; }
body.split-mode .is-swipe-feed .q-title { margin-bottom: 3px; font-size: 15.5px; line-height: 1.18; -webkit-line-clamp: 3; }
body.split-mode .is-swipe-feed .q-by { font-size: 11.5px; }
body.split-mode .is-swipe-feed .q-body,
body.split-mode .is-swipe-feed .q-foot,
body.split-mode .is-swipe-feed .vote-meter { display: none; }
body.split-mode .is-swipe-feed .q-options { align-self: start; width: 36px; min-height: 36px; margin: -4px 0 0; }
body.split-mode .is-swipe-feed .vote-buttons { gap: 8px; }
body.split-mode .is-swipe-feed .vote-button { min-height: 40px; padding: 3px 9px; gap: 6px; border-radius: 11px; font-size: 13px; }
body.split-mode .is-swipe-feed .vote-button strong { font-size: 13px; }
body.split-mode .is-swipe-feed .vote-icon { width: 21px; height: 21px; background: transparent; }
body.split-mode .is-swipe-feed .vote-icon svg { width: 15px; height: 15px; }
body.split-mode .is-swipe-feed .feed-viewport { border-bottom: 1px solid var(--line); }

/* comments (always the main area) */
body.split-mode .mobile-discussion {
  display: grid;
  flex: 1 1 0;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  background: var(--white);
  touch-action: pan-y;
}
body.split-mode.split-empty .mobile-discussion { display: none; }
.mobile-discussion-header { display: flex; align-items: center; gap: 8px; padding: 9px 14px 4px; }
.mobile-discussion-header h2 { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: -.02em; }
.mobile-discussion-header h2:focus-visible { outline-offset: 2px; }
.mobile-discussion-count {
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 11.5px;
  font-weight: 800;
  text-align: center;
}
.mobile-discussion-count:empty { display: none; }
.mobile-discussion-content { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; }
.mobile-discussion-content > .discussion-placeholder { grid-row: 1; margin: 0; padding: 10px 14px; color: var(--muted); font-size: 13px; }
.mobile-discussion-content > .comment-thread {
  min-height: 0;
  padding: 2px 14px 8px;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.mobile-discussion-content.thread-in > .comment-thread { animation: thread-in .24s ease both; }
@keyframes thread-in { from { opacity: 0; transform: translateX(var(--enter-x, 0)); } }
.mobile-discussion-content .discussion-post-title { display: none; }
.mobile-discussion-content .comment-status { margin: 4px 0; color: var(--muted); font-size: 13px; }
.mobile-discussion-content .comment-more { width: 100%; min-height: 44px; }
.mobile-discussion-content > .comment-composer { padding: 7px 12px 8px; border-top: 1px solid var(--line); background: var(--white); }
.mobile-discussion-content > .comment-composer > .button { width: 100%; min-height: 44px; }
.mobile-discussion-content .comment-form { grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 7px; }
.mobile-discussion-content .comment-form > .field { grid-area: 1 / 1; }
.mobile-discussion-content .comment-input-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.mobile-discussion-content .comment-form textarea {
  min-height: 44px;
  max-height: 88px;
  padding: 10px 12px;
  border-radius: 15px;
  font-size: 16px; /* prevents iOS zoom-on-focus */
  resize: none;
  field-sizing: content;
}
.mobile-discussion-content .comment-form > .form-secondary { grid-area: 1 / 2; }
.mobile-discussion-content .comment-form > .form-secondary .button { min-height: 44px; padding-inline: 12px; }
.mobile-discussion-content .comment-form > .form-message { grid-area: 2 / 1 / 3 / -1; }
.mobile-discussion-content .comment-form > .form-message:empty { display: none; }
.mobile-discussion-content .comment { padding-block: 7px; }
.mobile-discussion-content .comment p { line-height: 1.4; }

/* the post-back row (opened from Trend, or a shared link) */
body.split-mode .is-swipe-feed .post-back { flex: none; align-self: flex-start; min-height: 38px; margin: 2px 6px 0; }

/* ---------- phones ---------- */
@media (max-width: 650px) {
  body.split-mode .layout.is-swipe-feed { display: flex; align-items: stretch; }
  body.split-mode .is-swipe-feed .main-content { width: 100%; }
  body.split-mode .is-swipe-feed .feed-nav { display: none; }
  /* keyboard open: the topbar and bottom bar make room, the strip + thread stay */
  body.comment-focus.split-mode > .topbar,
  body.comment-focus.split-mode > .mobile-nav { display: none; }
  body.comment-focus.split-mode .is-swipe-feed .post-back { display: none; }
  body.comment-focus.split-mode { height: var(--split-vvh, 100dvh); }
}
@media (max-width: 650px) {
  .swipe-prev, .swipe-next { width: 11px; height: 38px; }
  body.split-mode .swipe-arrow { opacity: .5; }
  body.split-mode .swipe-arrow.is-edge { opacity: 0; }
}
@media (max-width: 650px) and (max-height: 700px) {
  body.split-mode .is-swipe-feed .main-content { --strip-h: 134px; }
  body.split-mode .is-swipe-feed .q-title { font-size: 15px; }
}

/* ---------- tablets and desktop ---------- */
@media (min-width: 651px) {
  body.split-mode .layout.is-swipe-feed {
    display: grid;
    grid-template: 'nav main' minmax(0, 1fr) / 156px minmax(0, 840px);
    justify-content: center;
    align-items: stretch;
    column-gap: 26px;
    padding: 14px 22px 16px;
  }
  body.split-mode .is-swipe-feed .left-sidebar { position: static; align-self: start; max-height: 100%; overflow-y: auto; }
  body.split-mode .is-swipe-feed .right-sidebar { display: none; }
  body.split-mode .is-swipe-feed .main-content { --strip-h: 148px; }
  body.split-mode .is-swipe-feed .feed-nav { margin: 0 0 10px; min-height: 46px; }
  body.split-mode .is-swipe-feed .feed-viewport {
    border: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 4px 15px #23352708;
  }
  body.split-mode .is-swipe-feed .qcard {
    grid-template-columns: 84px minmax(0, 1fr) auto;
    column-gap: 16px;
    padding: 14px 10px 14px 18px;
  }
  body.split-mode .is-swipe-feed .qcard .voting { margin-right: 8px; }
  body.split-mode .is-swipe-feed .q-thumb { width: 84px; height: 84px; border-radius: 14px; }
  body.split-mode .is-swipe-feed .q-title { margin-bottom: 5px; font-size: clamp(18px, 1.7vw, 22px); -webkit-line-clamp: 2; }
  body.split-mode .is-swipe-feed .q-by { font-size: 12.5px; }
  body.split-mode .is-swipe-feed .q-author .avatar { width: 20px; height: 20px; font-size: 8px; }
  body.split-mode .is-swipe-feed .vote-button { min-height: 44px; font-size: 14px; }
  body.split-mode .is-swipe-feed .vote-button strong { font-size: 14px; }
  body.split-mode .mobile-discussion {
    border: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 18px 18px;
    box-shadow: 0 4px 15px #23352708;
  }
  body.split-mode .mobile-discussion-header { padding: 12px 20px 6px; }
  body.split-mode .mobile-discussion-header h2 { font-size: 16px; }
  .mobile-discussion-content > .comment-thread { padding: 2px 20px 10px; }
  .mobile-discussion-content > .comment-composer { padding: 10px 16px 12px; }
  body.split-mode .is-swipe-feed .post-back { margin: 0 0 8px; }

  /* ‹ › buttons sit left of the ⋯ button, on the title row; the title leaves room for them */
  body.split-mode .is-swipe-feed .q-main { padding-right: 84px; }
  .swipe-arrow {
    top: 16px;
    transform: none;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #fff;
    color: var(--accent-deep);
    box-shadow: 0 3px 12px #19392a26;
    font-size: 26px;
    opacity: .96;
    pointer-events: auto;
  }
  .swipe-next { right: 46px; left: auto; }
  .swipe-prev { right: 86px; left: auto; }
  .swipe-arrow:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: #fff; }
  .swipe-arrow:active:not(:disabled) { background: var(--accent-deep); color: #fff; }
  .swipe-arrow:focus-visible { outline: 2px solid var(--accent-deep); outline-offset: 3px; }
  .swipe-arrow.is-edge, .swipe-arrow:disabled { opacity: 0; pointer-events: none; }
}
@media (min-width: 651px) and (max-width: 900px) {
  body.split-mode .layout.is-swipe-feed { grid-template-columns: 148px minmax(0, 1fr); column-gap: 18px; padding-inline: 18px; }
}
@media (min-width: 1100px) {
  body.split-mode .layout.is-swipe-feed { grid-template-columns: 170px minmax(0, 860px); column-gap: 30px; }
  body.split-mode .is-swipe-feed .main-content { --strip-h: 152px; }
}
@media (min-width: 651px) and (max-height: 760px) {
  body.split-mode .is-swipe-feed .main-content { --strip-h: 132px; }
  body.split-mode .is-swipe-feed .q-thumb { width: 72px; height: 72px; }
  .swipe-arrow { top: 12px; }
  body.split-mode .is-swipe-feed .qcard { grid-template-columns: 72px minmax(0, 1fr) auto; padding-block: 10px; }
  body.split-mode .is-swipe-feed .vote-button { min-height: 40px; }
}

/* ---------- Trend: forum-style list ---------- */
body.trend-list-view .right-sidebar,
body.trend-list-view .feed-intro { display: none; }
.trend-list { min-width: 0; }
.trend-header { padding: 4px 4px 12px; }
.trend-header h2 { margin: 0; font: 400 28px/1.05 var(--serif); letter-spacing: -.02em; }
.trend-header p { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.4; }
.trend-rows { margin: 0; padding: 0; overflow: hidden; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.trend-item + .trend-item { border-top: 1px solid #f0eeeb; }
.trend-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 62px;
  padding: 11px 12px;
  border: 0;
  background: #fff;
  color: var(--ink);
  text-align: left;
}
.trend-row:hover { background: #f5f9f3; }
.trend-row:active { background: var(--accent-soft); }
.trend-row:focus-visible { outline: 2px solid var(--accent-deep); outline-offset: -3px; }
.trend-rank { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-deep); font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.trend-item:nth-child(-n+3) .trend-rank { background: var(--accent); color: #fff; }
.trend-text { display: grid; gap: 3px; min-width: 0; }
.trend-title { font-size: 15.5px; font-weight: 750; line-height: 1.28; letter-spacing: -.02em; overflow-wrap: anywhere; }
.trend-count { color: var(--accent-deep); font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.trend-meta { color: var(--muted); font-size: 12px; }
.trend-chevron { color: #9aa79d; }
.trend-chevron svg { width: 18px; height: 18px; }
.trend-status { margin: 14px 0; color: var(--muted); font-size: 13.5px; text-align: center; }
.trend-more { display: grid; place-items: center; padding: 14px 0 4px; }
@media (max-width: 650px) {
  .trend-header h2 { font-size: 26px; }
  .layout:has(.trend-list:not([hidden])) { padding-top: 6px; }
}
@media (min-width: 651px) {
  body.trend-list-view .layout {
    grid-template: 'nav main' 1fr / 156px minmax(0, 820px);
    justify-content: center;
    column-gap: 28px;
  }
  body.trend-list-view .main-content { grid-area: main; }
  .trend-row { min-height: 66px; padding-inline: 18px; }
  .trend-title { font-size: 16.5px; }
}
@media (min-width: 1100px) {
  body.trend-list-view .layout { grid-template-columns: 170px minmax(0, 820px); }
}

/* ---------- ask form: "Sence ben ___ mıyım?" ---------- */
.ask-field { display: grid; gap: 8px; }
.ask-label { color: var(--ink); font-size: 13px; font-weight: 750; }
.ask-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1.5px solid #cfe4d7;
  border-radius: 14px;
  background: #fff;
}
.ask-line:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px #1a7a4f22; }
.ask-prefix, .ask-suffix { flex: none; color: var(--accent-deep); font-size: 16px; font-weight: 800; letter-spacing: -.02em; }
.ask-line input { flex: 1 1 0; min-width: 0; min-height: 40px; padding: 0 2px; border: 0; border-bottom: 2px dashed #b9d4c2; border-radius: 0; background: transparent; font-size: 16px; font-weight: 650; outline: 0; }
.ask-line input:focus { border-bottom-color: var(--accent); }
.ask-preview { color: var(--muted); font-size: 13px; line-height: 1.35; }
.ask-ideas { display: flex; flex-wrap: wrap; gap: 6px; }
.ask-idea { min-height: 32px; padding: 4px 11px; border: 1px solid #d3e6da; border-radius: 999px; background: var(--accent-soft); color: var(--accent-deep); font-size: 12.5px; font-weight: 700; }
.ask-idea:hover { background: #d7ebdf; }

/* ---------- lightbox (photo / details) ---------- */
body.lightbox-open { overflow: hidden; }
.lightbox {
  --lb-fade: 1;
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  background: rgb(8 14 10 / calc(.94 * var(--lb-fade)));
  color: #fff;
  animation: hint-fade .18s ease both;
  touch-action: none;
}
.lightbox-stage { flex: 1 1 0; display: grid; place-items: center; min-height: 0; padding: 56px 8px 6px; transition: transform .18s ease; }
.lightbox-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; user-select: none; -webkit-user-drag: none; }
.lightbox-close {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: 10px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: #ffffff26;
  color: #fff;
}
.lightbox-close svg { width: 22px; height: 22px; }
.lightbox-close:hover { background: #ffffff40; }
.lightbox-caption { flex: none; max-height: 34%; padding: 10px 18px calc(16px + env(safe-area-inset-bottom)); overflow: auto; background: linear-gradient(transparent, #00000066 30%); touch-action: pan-y; }
.lightbox-caption h2 { margin: 0 0 4px; font-size: 17px; line-height: 1.25; letter-spacing: -.02em; }
.lightbox-caption p { margin: 0 0 6px; color: #e4ebe6; font-size: 14px; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.lightbox-by { color: #bccabf; font-size: 12.5px; }
.lightbox-extra { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.lightbox-extra .post-link, .lightbox-extra .income-pill { min-height: 32px; }
.lightbox-text .lightbox-stage { display: none; }
.lightbox-text { justify-content: center; }
.lightbox-text .lightbox-caption { max-height: none; margin: auto 0; padding: 24px 22px; background: none; text-align: center; }
.lightbox-text .lightbox-caption h2 { font-size: clamp(22px, 6vw, 30px); }
.lightbox-text .lightbox-extra { justify-content: center; }
@media (min-width: 651px) {
  .lightbox-caption { max-width: 760px; width: 100%; margin: 0 auto; }
}
@media (prefers-reduced-motion: reduce) {
  .lightbox, .mobile-discussion-content.thread-in > .comment-thread { animation: none; }
  .lightbox-stage { transition: none; }
}
