/* Hacker News reader — deployed-reference visual system.
   White surfaces, Inter, muted metadata, orange accent. No framework. */

@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --ink: #121418;
  --muted: #6a6f77;
  --border: #e4e6ea;
  --accent: #ff8c00;
  --accent-hover: #ea580c;
  --on-accent: #ffffff;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --comment-indent: 24px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--surface);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.92rem;
  line-height: 1.55;
  max-width: 900px;
  margin: 0;
  padding: 0 16px 0 174px;
}

/* Links: orange by default; contextual rules restore muted or primary ink. */
a {
  color: var(--accent);
  text-decoration: none;
}

a:visited {
  color: var(--muted);
}

a:hover,
a:focus-visible {
  color: var(--accent-hover);
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* Header: white, brand above uppercase tabs, hairline only. */
.nav {
  background: var(--surface);
  padding: 20px 0 0;
  margin-bottom: 16px;
}

.nav-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.brand {
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.brand:visited {
  color: var(--ink);
}

.brand:hover,
.brand:focus-visible {
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: block;
  width: 30px;
  height: 26px;
  flex: none;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 1px solid var(--border);
}

main {
  padding-bottom: 64px;
}

.tab {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 16px 10px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab:visited {
  color: var(--muted);
}

.tab:hover,
.tab:focus-visible,
.tab-active {
  color: var(--ink);
  text-decoration: none;
  border-bottom-color: var(--accent);
}

.tab-active:visited {
  color: var(--ink);
}

/* Collection pages flow straight from navigation into the story list. */
.note {
  color: var(--muted);
  font-size: 0.75rem;
  margin: 0 0 8px;
}

.page-heading {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}

/* Search lives on its own page, not in the header. */
.search-form {
  margin: 0 0 20px;
}

.search-form label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.search-controls {
  display: flex;
  gap: 8px;
  max-width: 460px;
}

.search-controls input {
  flex: 1;
  min-width: 0;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.search-controls button {
  font: inherit;
  font-weight: 600;
  color: var(--on-accent);
  background: var(--accent);
  border: 0;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  cursor: pointer;
}

.search-controls button:hover {
  background: var(--accent-hover);
}

/* Story rows. */
.stories {
  list-style: none;
  margin: 0;
  padding: 0;
}

.story {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.rank {
  color: var(--muted);
  font-size: 0.8rem;
  min-width: 26px;
  text-align: left;
  padding-top: 3px;
  font-variant-numeric: tabular-nums;
  flex: none;
}

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

.title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.title a,
.title a:visited {
  color: var(--ink);
}

.title a:hover,
.title a:focus-visible {
  color: var(--accent-hover);
}

.host {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 400;
}

.meta {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.meta a,
.meta a:visited {
  color: var(--muted);
}

.meta a:hover,
.meta a:focus-visible {
  color: var(--muted);
  text-decoration: underline;
}

/* Pager. */
.pager {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 32px;
  padding-top: 20px;
  font-size: 0.78rem;
}

.pager-button {
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: var(--radius-md);
  padding: 12px 20px;
}

.pager-button:visited {
  color: var(--on-accent);
}

.pager-button:hover,
.pager-button:focus-visible {
  color: var(--on-accent);
  background: var(--accent-hover);
  text-decoration: none;
}

.pager-status {
  color: var(--muted);
}

/* Item page. */
.item-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 20px;
  margin-bottom: 20px;
}

.item-title {
  color: var(--ink);
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
  overflow-wrap: anywhere;
}

.item-title a,
.item-title a:visited {
  color: var(--ink);
}

.item-title a:hover,
.item-title a:focus-visible {
  color: var(--accent-hover);
}

.item-meta {
  color: var(--muted);
  font-size: 0.78rem;
  margin: 0;
}

.item-meta a,
.item-meta a:visited {
  color: var(--muted);
}

.item-text {
  margin-top: 16px;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.item-text a {
  color: var(--accent);
}

/* Comments: nested white cards, not guide-line indents. */
.comments {
  list-style: none;
  margin: 0;
  padding: 0;
}

.comments .comments {
  margin: 12px 0 0 var(--comment-indent);
}

.comment {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin: 10px 0;
}

.comment:has(> .comments) {
  padding-bottom: 12px;
}

.comment .comment {
  margin: 10px 0 0;
}

.comment.depth-6 .comments {
  margin: 12px 0 0 0;
}

/* Deeper replies become a flat continuation so nested card geometry cannot
   accumulate horizontal indent after the six-level clamp. */
.comment.depth-6 .comment {
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  padding: 12px 0;
}

.comment.depth-6 > .comments,
.comment.depth-6 > .comments > li {
  display: contents;
}

.comment-meta {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  margin: 0;
}

.comment-meta a,
.comment-meta a:visited {
  color: var(--muted);
}

.comment-meta a:hover,
.comment-meta a:focus-visible {
  color: var(--muted);
  text-decoration: underline;
}

.comment-authorless {
  font-style: italic;
}

.comment-text {
  margin-top: 6px;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.comment-text p {
  margin: 10px 0 0;
}

.comment-text p:first-child {
  margin-top: 0;
}

/* Code blocks remain scrollable inside the fixed column. */
pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  overflow-x: auto;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

:not(pre) > code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 3px;
}

/* Truncation, empty, and error states follow the reference's quiet style. */
.truncation {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.empty,
.error-state {
  color: var(--muted);
  padding: 48px 0;
  text-align: left;
}

.error-state h1 {
  color: var(--ink);
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
}

.empty {
  margin: 20px 0 0;
}

@media (max-width: 768px) {
  body {
    max-width: none;
    padding: 0 16px;
  }
}
