

/* ----- Theme ----- */
:root{
  --muted:#6b7280;          /* zinc-500 */
  --muted-2:#9ca3af;        /* zinc-400 */
  --border:#e5e7eb;         /* zinc-200 */
  --bg-soft:#f8fafc;        /* slate-50 */
  --ink:#0b0f19;
  --brand:#0f172a;          /* slate-900 */
  --up:#047857;             /* emerald-700 */
  --up-bg:#ecfdf5;          /* emerald-50 */
  --up-br:#a7f3d0;          /* emerald-200 */
  --down:#b91c1c;           /* red-700 */
  --down-bg:#fef2f2;        /* red-50 */
  --down-br:#fecaca;        /* red-200 */
}
@media (prefers-color-scheme: dark){
  body{background:#0b0f19; color:#e5e7eb}
  :root{
    --muted:#9ca3af;
    --muted-2:#6b7280;
    --border:#1f2937;
    --bg-soft:#0f172a;
    --brand:#e5e7eb;
  }
  .card{background:#0f172a}
  .reply-btn{background:#111827}
  .vote .circle{background:#111827; border-color:#1f2937; color:#9ca3af}
  .vote input:checked + .circle.up{background:rgba(16,185,129,.12); border-color:#065f46; color:#34d399}
  .vote input:checked + .circle.down{background:rgba(248,113,113,.12); border-color:#7f1d1d; color:#fca5a5}
}

/* ----- Layout ----- */

.page-title{
  font-weight:800;
  letter-spacing:-.02em;
  font-size:clamp(1.75rem, 1.2rem + 1.5vw, 2.5rem);
  color:var(--brand);
  margin:0 0 .25rem;
}
.page-sub{
  margin:0 0 2rem;
  color:var(--muted);
  font-size:.925rem;
}

/* ----- Comment ----- */
.comment{
  padding-block:2rem;
  border-top:1px solid var(--border);
}
.comment:first-of-type{border-top:0}
.comment-grid{
  display:grid;
  grid-template-columns:56px 1fr;
  gap:1rem;
}
@media (min-width: 640px){
  .comment-grid{grid-template-columns:72px 1fr; gap:1.25rem}
}

/* Avatar */
.avatar{
  width:56px; height:56px; border-radius:9999px; overflow:hidden; border:1px solid var(--border);
}
@media (min-width:640px){ .avatar{width:64px; height:64px} }
.avatar img{width:100%; height:100%; object-fit:cover}

/* Header row */
.head{
  display:flex; flex-direction:column; gap:.25rem;
}
.head-top{
  display:flex; flex-wrap:wrap; align-items:center; gap:.5rem; justify-content:space-between;
}
.author{font-weight:700; font-size:1.1rem; color:inherit}
.time{color:var(--muted); font-size:.94rem}
.meta-right{display:flex; align-items:center; gap:1.25rem; color:var(--muted)}
.meta-link{display:inline-flex; align-items:center; gap:.4rem; color:#ef4444}
.permalink{color:var(--muted)}
.meta-link:hover,.permalink:hover{color:#dc2626}
.permalink:hover{color:#374151}

@media (max-width: 639.98px){
  .meta-right{order:2; margin-top:.5rem}
}

/* Content */
.content{margin-top:1rem; font-size:1rem; color:inherit}

/* Actions row */
.actions{
  margin-top:1rem;
  display:flex; flex-wrap:wrap; align-items:center; gap:.75rem 1.25rem;
}
.reply-btn{
  border:1px solid transparent;
  background:#0b0f19;
  color:#fff;
  padding:.5rem 1rem;
  border-radius:.5rem;
  font-weight:700;
  letter-spacing:.02em;
  text-transform:uppercase;
  font-size:.9rem;
}
.reply-btn:hover{background:#111827}
.reply-btn:focus-visible{outline:3px solid #d1d5db; outline-offset:2px}

/* Votes (CSS-only, accessible) */
.votes{display:flex; align-items:center; gap:1rem}
.vote{display:inline-flex; align-items:center; gap:.5rem}
.vote input{
  position:absolute; inline-size:1px; block-size:1px; overflow:hidden;
  clip:rect(0 0 0 0); white-space:nowrap; clip-path:inset(50%); border:0; padding:0; margin:-1px;
}
.vote .circle{
  display:inline-flex; align-items:center; justify-content:center;
  width:38px; height:38px; border-radius:9999px;
  border:1px solid var(--border);
  background:#fff; color:#6b7280;
  box-shadow:0 1px 1px rgba(0,0,0,.04);
  user-select:none;
  transition:background-color .2s, border-color .2s, color .2s, transform .06s;
  font-size:18px; line-height:1;
}
.vote .circle:active{transform:scale(.98)}
.vote .count{
  min-width:2ch; text-align:left; font-weight:600; color:#374151;
  font-variant-numeric: tabular-nums;
}
/* Hover states */
.vote:hover .circle{background:#f8fafc}

/* Checked states (using sibling selectors) */
.vote input:checked + .circle.up{
  background:var(--up-bg); border-color:var(--up-br); color:var(--up);
}
.vote input:checked ~ .count.up{color:var(--up)}
.vote input:checked + .circle.down{
  background:var(--down-bg); border-color:var(--down-br); color:var(--down);
}
.vote input:checked ~ .count.down{color:var(--down)}

/* Focus ring for keyboard users */
.vote input:focus-visible + .circle{outline:3px solid #d1d5db; outline-offset:2px}

/* Helpers */
.divider{height:1px; background:var(--border); margin:1.5rem 0 0}