:root {
  --ink: #1c2430;
  --paper: #eef1f0;
  --paper-raised: #f7f8f6;
  --rule: #d3d6cf;
  --amber: #c9821f;
  --amber-fill: #f2b25a;
  --green: #1f6f5c;
  --text-muted: #5b6470;
  --serif: 'Lora', Georgia, serif;
  --mono: 'IBM Plex Mono', monospace;
  --sans: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

.masthead {
  background: var(--ink);
  color: var(--paper);
  padding: 2.75rem 1.5rem 2.25rem;
}

.masthead-inner {
  max-width: 680px;
  margin: 0 auto;
}

.wordmark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 2.75rem);
  margin: 0;
  letter-spacing: -0.01em;
}

.tagline {
  margin: 0.4rem 0 0;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: #b9c2c9;
}

.feed {
  max-width: 680px;
  margin: 0 auto;
  padding: 0.5rem 1.5rem 4rem;
}

.loading {
  padding: 3rem 0;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.9rem;
}

.story {
  display: flex;
  gap: 1.1rem;
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--rule);
}

.story:first-child { padding-top: 1.75rem; }

.story-media {
  flex: 0 0 108px;
  width: 108px;
  height: 108px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--paper-raised);
}

.story-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.story-media:has(img[src=""]) { display: none; }

.story-body { flex: 1; min-width: 0; }

.story-meta {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.story-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.2rem;
  line-height: 1.3;
  margin: 0 0 0.45rem;
}

.story-title a {
  color: var(--ink);
  text-decoration: none;
}

.story-title a:hover { text-decoration: underline; }

.story-summary {
  font-size: 0.92rem;
  line-height: 1.5;
  color: #3c4450;
  margin: 0 0 0.9rem;
}

.story-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.35rem 0.6rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.action-btn:hover { border-color: var(--ink); color: var(--ink); }

.action-btn .icon { width: 15px; height: 15px; }

.like-btn.liked {
  border-color: var(--amber);
  color: var(--amber);
  background: color-mix(in srgb, var(--amber-fill) 25%, transparent);
}

.share-row { display: flex; gap: 0.35rem; margin-left: auto; }
.share-btn {
  padding: 0.4rem;
  width: 30px;
  height: 30px;
  justify-content: center;
}
.share-btn .icon { width: 15px; height: 15px; }

.comment-panel {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--rule);
}

.comment-list { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 0.9rem; }

.comment {
  font-size: 0.88rem;
  line-height: 1.5;
}

.comment-author {
  font-family: var(--mono);
  font-weight: 500;
  color: var(--green);
  margin-right: 0.4rem;
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.comment-name, .comment-body {
  font-family: var(--sans);
  font-size: 0.88rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper-raised);
  color: var(--ink);
}

.comment-body { resize: vertical; min-height: 60px; }

.comment-form button {
  align-self: flex-start;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 4px;
  padding: 0.5rem 1rem;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
}

.comment-form button:hover { background: var(--green); }

@media (max-width: 480px) {
  .story { flex-direction: column; }
  .story-media { width: 100%; height: 160px; }
}

/* ---- News tabs ---- */
.news-tabs {
  max-width: 680px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 0;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.news-tab {
  font-family: var(--mono);
  font-size: 0.8rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  color: var(--text-muted);
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.news-tab:hover { border-color: var(--amber); color: var(--ink); }
.news-tab.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
