/* finkredit — direction 1a (modern fintech). White surfaces, green accent,
   Reddit-style cards with a left vote column. Responsive: the sidebar drops and
   cards compact on narrow screens (the "1b" mobile density). */

:root {
  --bg: #f0eee9;
  --surface: #ffffff;
  --vote-bg: #f7f6f3;
  --ink: #101613;
  --ink-2: #3a443f;
  --muted: #8a938e;
  --text: #5a645f;
  --border: #e8e6e1;
  --green: #149359;
  --green-dark: #0e6b41;
  --green-soft: #e7f4ee;
  --link: #137a4e;
  --link-hover: #0d5c3a;
  --chip-bg: #f1f0ec;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius: 12px;
  --wrap: 1180px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Golos Text", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }
h1, h2, h3, h4 { line-height: 1.3; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

/* --- header ----------------------------------------------------------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.site-header .wrap { display: flex; align-items: center; gap: 22px; height: 60px; }
.brand { font-weight: 800; font-size: 21px; color: var(--ink); }
.brand span { color: var(--green); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.btn { background: var(--green); color: #fff; border: none; border-radius: 8px; padding: 9px 16px; font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; }
.btn:hover { background: var(--green-dark); color: #fff; }
.btn-ghost { background: var(--chip-bg); color: var(--ink-2); }
.btn-ghost:hover { background: var(--border); color: var(--ink); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--green), var(--green-dark)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.avatar-sm { width: 30px; height: 30px; border-radius: 50%; background: #e4e9f0; color: #42505c; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; }

/* --- two-column layouts (feed + detail) ------------------------------- */
.layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; padding: 16px 0 44px; align-items: start; }
.col-main { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.sidebar { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 76px; }
.side-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.side-card h4 { font-size: 14px; color: var(--ink); margin-bottom: 8px; }
.side-card .muted { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.side-card.partner { background: #f2faf6; border-color: #cfe8dc; }
.side-list { display: flex; flex-direction: column; }
.side-list a { padding: 9px 0; font-size: 13px; color: var(--ink-2); border-top: 1px solid var(--chip-bg); }
.side-list a:first-child { border-top: none; }
.side-list a:hover { color: var(--green); }

.breadcrumb { font-size: 13px; color: var(--muted); margin: 12px 0 2px; }
.breadcrumb a { color: var(--link); }

.sort-row { display: flex; gap: 16px; font-weight: 500; color: var(--muted); font-size: 13px; padding: 0 4px; }
.sort-row .active { color: var(--green); font-weight: 600; }
#feed { display: flex; flex-direction: column; gap: 12px; }

/* --- vote column (shared) --------------------------------------------- */
.votes { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 10px; background: var(--vote-bg); }
.vote-btn { background: none; border: none; cursor: pointer; font-family: inherit; font-size: 15px; line-height: 1; color: var(--muted); padding: 2px; }
.vote-btn:hover { color: var(--green); }
.vote-btn.on-up { color: var(--green); }
.vote-btn.on-down { color: #c0392b; }
.score { font-family: var(--mono); font-weight: 600; font-size: 13.5px; color: var(--ink); }

/* --- post card (feed + detail) ---------------------------------------- */
.post-card { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.post-main { flex: 1; min-width: 0; padding: 16px 20px; }
.post-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.post-meta .author { font-weight: 600; color: var(--ink-2); }
.badge { border-radius: 5px; padding: 2px 8px; font-weight: 600; font-size: 11.5px; background: var(--green-soft); color: var(--green-dark); }
.post-title { font-size: 16.5px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.post-title a { color: var(--ink); }
.post-title a:hover { color: var(--green); }
.post-excerpt { font-size: 13.5px; color: var(--text); margin-bottom: 12px; }
.post-actions { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.post-actions a { color: var(--muted); }
.tickers a { font-family: var(--mono); font-size: 12px; color: var(--green-dark); }

/* detail post: bigger title + full body + divider above actions */
.post-card.detail .post-main { padding: 20px 24px; }
.post-card.detail .post-title { font-size: 22px; margin-bottom: 10px; }
.post-card.detail .post-body { color: var(--text); font-size: 14.5px; }
.post-card.detail .post-body p { margin-bottom: 12px; }
.post-card.detail .post-body p:last-child { margin-bottom: 0; }
.post-card.detail .post-actions { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }

/* --- forms ------------------------------------------------------------ */
form p { margin-bottom: 10px; }
textarea, input[type="text"], input[type="url"], input[type="password"], input[type="email"], select {
  width: 100%; max-width: 640px; font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
}
textarea { min-height: 80px; resize: vertical; }
button[type="submit"] { background: var(--green); color: #fff; border: none; border-radius: 8px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; }
button[type="submit"]:hover { background: var(--green-dark); }
.comment-form { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin: 16px 0 4px; }
.comment-form textarea { flex: 1; max-width: none; min-height: 44px; }

/* --- comments --------------------------------------------------------- */
.comments-head { display: flex; align-items: baseline; justify-content: space-between; margin: 20px 0 8px; }
.comments-head h2 { font-size: 16px; }
.comments-head .sort { font-size: 13px; color: var(--muted); }
.comments-head .sort b { color: var(--green); }

/* One white card per top-level thread; the whole reply subtree lives inside it. */
.thread { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 18px 14px; margin-top: 12px; }
.c { padding-top: 12px; }
.c-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); list-style: none; cursor: pointer; }
.c-head::-webkit-details-marker { display: none; }
.c-author { font-weight: 700; color: var(--ink); }
.tag-author { background: var(--green-soft); color: var(--green-dark); border-radius: 4px; padding: 1px 6px; font-size: 10.5px; font-weight: 700; }
.c-karma { font-family: var(--mono); font-size: 11px; }
.c-hidden { font-style: italic; }
.c-body { font-size: 13.5px; color: var(--ink); margin: 8px 0; }
.c-body .deleted { color: var(--muted); font-style: italic; }
.c-actions { display: flex; align-items: center; gap: 14px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.c-actions .vote-btn { font-size: 13px; padding: 0; }
.c-actions .score { font-family: var(--mono); color: var(--ink); }
details.reply { margin-top: 6px; }
details.reply > summary { list-style: none; cursor: pointer; color: var(--muted); font-weight: 500; font-size: 12.5px; }
details.reply > summary::-webkit-details-marker { display: none; }
details.reply form { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 6px; }
details.reply textarea { max-width: none; }
/* A collapsed (downvoted) comment shows only its summary — <details> hides the rest
   natively, and because .replies now sits inside, its whole subtree folds away too. */

/* Nested replies indent inside the same card with a continuous rail. */
.replies { border-left: 2px solid var(--border); margin-left: 7px; padding-left: 16px; }
.replies:empty { border-left: none; margin: 0; padding: 0; }
.more-replies { display: inline-block; font-size: 12.5px; font-weight: 600; margin: 8px 0 2px; }

.messages { list-style: none; background: #fff4e5; border: 1px solid #f0d9b5; border-radius: 8px; padding: 10px 14px; margin: 14px 0; }

/* --- mobile ----------------------------------------------------------- */
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .post-main { padding: 12px 14px; }
  .post-title { font-size: 15px; }
  .post-excerpt { display: none; }
  .votes { padding: 12px 8px; }
  .thread { padding: 2px 12px 12px; }
  .replies { margin-left: 4px; padding-left: 10px; }
}
