/* Devit cards: titles, themed cards, grid feed, style picker. */

/* composer */
.composer-title { width: 100%; box-sizing: border-box; margin: 0 0 8px; padding: 8px 2px; background: transparent; border: 0;
  border-bottom: 1px solid var(--border); color: var(--text-primary); font: 700 17px var(--font-display); outline: none; }
.composer-title:focus { border-bottom-color: var(--cyan); }
.composer-title::placeholder { color: var(--text-muted); font-weight: 600; }
#composer-style-btn.has-style { color: var(--cyan); }

/* title, cover, footer: list view shows only explicit titles */
.post-card .cc-title { margin: 8px 0 4px; font: 700 17px/1.3 var(--font-display); letter-spacing: -.01em; color: var(--text-primary); overflow-wrap: anywhere; }
.post-card .cc-title--auto, .post-card .cc-cover, .post-card .cc-foot { display: none; }

/* themed card (list + grid). Re-map the text tokens so every child follows. */
.post-card.cc-themed {
  position: relative; background: var(--cc-bg) !important; background-size: var(--cc-bg-size) !important;
  border-radius: var(--cc-radius) !important; font-family: var(--cc-font); color: var(--cc-fg);
  --text-primary: var(--cc-fg);
  --text-secondary: color-mix(in srgb, var(--cc-fg) 80%, transparent);
  --text-muted: color-mix(in srgb, var(--cc-fg) 60%, transparent);
  --border: color-mix(in srgb, var(--cc-fg) 20%, transparent);
  --border-mid: color-mix(in srgb, var(--cc-fg) 28%, transparent);
  --cyan: var(--cc-accent);
}
.post-card.cc-themed .post-content, .post-card.cc-themed .post-author, .post-card.cc-themed .post-time,
.post-card.cc-themed .post-author-handle, .post-card.cc-themed .post-action, .post-card.cc-themed .cc-title { color: var(--cc-fg); }
.post-card.cc-themed .cc-title { font-family: var(--cc-font); }
.post-card.cc-themed .cc-emoji { position: absolute; top: 10px; right: 12px; font-size: 22px; line-height: 1; z-index: 2; }

/* view toggle */
.view-tabs { position: relative; }
.cc-viewtoggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); display: flex; gap: 2px;
  padding: 2px; border: 1px solid var(--border-mid); border-radius: 8px; background: var(--bg-base); }
.cc-viewtoggle button { width: 30px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 13px; }
.cc-viewtoggle button.active { background: var(--bg-float); color: var(--text-primary); }

/* grid */
#feed.feed-grid, .cc-prevgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; padding: 14px; }
#feed.feed-grid > :not(.post-card) { grid-column: 1 / -1; }
.feed-grid .post-card {
  position: relative; display: flex; flex-direction: column; height: 300px; overflow: hidden; cursor: pointer;
  padding: 0 !important; margin: 0 !important; border: 1px solid var(--border) !important;
  border-radius: var(--cc-radius, 12px) !important; box-shadow: none !important;
}
.feed-grid .post-card:not(.cc-themed) { background: var(--bg-surface); }
.feed-grid .post-card:hover { border-color: var(--border-mid) !important; }
.feed-grid .post-card::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 56px; pointer-events: none;
  background: linear-gradient(transparent, var(--cc-fade, var(--bg-surface))); }
.feed-grid .post-card > :not(.cc-cover):not(.cc-emoji) { margin-left: 14px !important; margin-right: 14px !important; }
.feed-grid .post-card > .post-header { margin-top: 12px !important; padding: 0 !important; }
.feed-grid .post-card .post-avatar { width: 26px !important; height: 26px !important; font-size: 11px !important; }
.feed-grid .post-card .post-author { font-size: 12.5px; }
.feed-grid .post-card .post-time { font-size: 11px; }
.feed-grid .post-card .post-more-btn, .feed-grid .post-card .post-actions, .feed-grid .post-card .og-preview-slot, .feed-grid .post-card .post-gallery, .feed-grid .post-card .post-video-wrap,
.feed-grid .post-card .post-file-list, .feed-grid .post-card [class*="poll"], .feed-grid .post-card .pin-badge { display: none !important; }
.feed-grid .post-card .cc-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 16px; margin-top: 10px; }
.feed-grid .post-card .post-content { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; line-height: 1.5; padding: 0 !important; }
.feed-grid .post-card .post-code-file { max-height: 104px; overflow: hidden; margin-top: 8px !important; }
.feed-grid .post-card .cc-cover { display: block; flex: none; height: 118px; overflow: hidden; }
.feed-grid .post-card .cc-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.feed-grid .post-card.cc-has-cover .post-content { -webkit-line-clamp: 2; }
.feed-grid .post-card.cc-has-cover > .post-header { margin-top: 10px !important; }
.feed-grid .post-card .cc-foot { display: flex; align-items: center; justify-content: space-between; position: absolute; left: 14px !important; right: 14px !important; bottom: 10px; z-index: 4;
  font-size: 12px; color: var(--text-muted); }
.cc-stats { display: flex; align-items: center; gap: 12px; }
.cc-rate b { font-weight: 600; } .cc-rate.has { color: var(--text-secondary); } .cc-rate:not(.has) { opacity: .7; }
.cc-ai { width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 12px; }
.cc-ai:hover, .cc-ai.on { color: var(--cyan); background: color-mix(in srgb, var(--cyan) 14%, transparent); }
.cc-ai.busy { opacity: .6; pointer-events: none; animation: cc-pulse 1s ease-in-out infinite; }
@keyframes cc-pulse { 50% { opacity: .25; } }
.cc-faces { display: flex; flex-direction: row-reverse; }
.cc-face { width: 22px; height: 22px; margin-left: -7px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  font: 700 10px var(--font-body); color: #fff; background: #444; border: 2px solid var(--cc-fade, var(--bg-surface)); box-sizing: content-box; }
.cc-face:first-child { margin-left: 0; }
.cc-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* AI summary overlay (shown when the existing handler reveals it) */
.feed-grid .post-card .ai-summary-wrap { display: none !important; }
.feed-grid .post-card .ai-summary-wrap[style*="display: block"] { display: block !important; position: absolute; inset: 0 0 42px 0; z-index: 3;
  margin: 0 !important; padding: 14px !important; overflow: auto; font-size: 13px; line-height: 1.55;
  background: color-mix(in srgb, var(--cc-fade, var(--bg-elevated)) 55%, #000); color: var(--text-primary); }
.feed-grid .post-card .ai-summary-wrap .ai-summary-result { color: inherit; }
.feed-grid .post-card.cc-skipfirst .post-content > :first-child { display: none; }
.feed-grid .post-card .cc-title--auto { -webkit-line-clamp: 4; }
/* layouts */
.feed-grid .post-card[data-cc-layout="title"] .cc-title { font-size: 19px; -webkit-line-clamp: 3; }
.feed-grid .post-card[data-cc-layout="code"] .post-content { -webkit-line-clamp: 2; }
.feed-grid .post-card[data-cc-layout="code"] .post-code-file { max-height: 150px; }
.feed-grid .post-card[data-cc-layout="minimal"] .post-content, .feed-grid .post-card[data-cc-layout="minimal"] .post-code-file { display: none !important; }
.feed-grid .post-card[data-cc-layout="minimal"] .cc-title { font-size: 24px; -webkit-line-clamp: 5; }
@media (max-width: 520px) { #feed.feed-grid { grid-template-columns: 1fr; padding: 10px; } }

/* picker */
.cc-overlay { position: fixed; inset: 0; z-index: 20000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0,0,0,.72); }
.cc-panel { width: min(520px, 100%); max-height: 92vh; max-height: 92dvh; overflow: auto; padding: 18px; border-radius: 16px;
  background: var(--bg-base); border: 1px solid var(--border-mid); color: var(--text-primary); }
.cc-phead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; font-size: 16px; }
.cc-x { width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--text-secondary); cursor: pointer; }
.cc-x:hover { background: var(--bg-float); }
.cc-prevgrid { display: block; width: 270px; max-width: 100%; margin: 0 auto 14px; padding: 0; }
.cc-prevgrid .post-card { height: 190px; }
.cc-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.cc-sw { width: 66px; height: 40px; border-radius: 10px; border: 1px solid var(--border-mid); cursor: pointer; display: flex; align-items: flex-end; padding: 0 6px 4px; }
.cc-sw span { font-size: 10.5px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.cc-sw:hover { border-color: var(--cyan); }
.cc-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.cc-grid2 label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-muted); }
.cc-grid2 input[type="color"] { width: 100%; height: 34px; padding: 2px; border-radius: 8px; border: 1px solid var(--border-mid); background: transparent; cursor: pointer; }
.cc-grid2 input[type="text"], .cc-grid2 select { height: 34px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--border-mid); background: var(--bg-elevated); color: var(--text-primary); font-size: 13px; }
.cc-inl { display: flex; gap: 6px; align-items: center; } .cc-inl input[type="color"] { flex: 1; }
.cc-chk { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 13px; color: var(--text-secondary); }
.cc-note { margin-top: 6px; font-size: 11.5px; color: var(--text-muted); }
.cc-btns { display: flex; gap: 10px; margin-top: 16px; }
.cc-btn { flex: 1; min-height: 40px; border-radius: 999px; border: 1px solid var(--border-mid); background: transparent; color: var(--text-primary); font-weight: 700; cursor: pointer; }
.cc-btn--p { background: var(--cyan); border-color: transparent; color: var(--on-flare); }
