:root {
  --bg: #fff7f1;
  --fg: #111;
  --muted: #666;
  --accent: #ff6600;
  /* HN orange; change as you like */
  --line: #e6e6df;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --radius: 3px;
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  /*, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;*/
  line-height: 1.5;
}

/* Layout */
main {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--space-4);
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--space-3);
}

nav ul {
  list-style: none;
  display: flex;
  gap: var(--space-3);
  padding: 0;
  margin: 0;
}

nav a {
  color: inherit;
  text-decoration: none;
}

nav a:hover {
  text-decoration: underline;
}

/* Right-side nav actions look consistent */
nav ul:last-child a,
nav ul:last-child button {
  display: inline-block;
  padding: calc(var(--space-2) - 1px) var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  text-decoration: none;
}

nav ul:last-child a:hover,
nav ul:last-child button:hover {
  background: rgba(0, 0, 0, 0.03);
  text-decoration: none;
}

/* Collapse to two rows on small screens (no JS) */
@media (max-width: 720px) {
  nav {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
  }

  nav ul {
    width: 100%;
  }

  nav ul:last-child {
    flex-wrap: wrap;
    gap: var(--space-2);
  }
}

/* Typography */
h1,
h2,
h3 {
  line-height: 1.2;
  margin: var(--space-3) 0 var(--space-2);
}

p {
  margin: var(--space-2) 0;
}

small {
  color: var(--muted);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: var(--space-4) 0;
}

/* Lists (feed) */
ul.feed {
  padding: 0;
  margin: var(--space-3) 0;
  list-style: none;
}

ul.feed>li {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--line);
}

/* Forms */
label {
  display: block;
  margin: var(--space-3) 0;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  padding: var(--space-2);
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  border-radius: var(--radius);
}

input:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button {
  display: inline-block;
  padding: calc(var(--space-2) - 1px) var(--space-3);
  border: 2px solid var(--accent);
  background: transparent;
  color: var(--accent);
  border-radius: var(--radius);
  cursor: pointer;
}

button:disabled,
button[disabled] {
  color: var(--muted);
  border: 2px solid var(--muted);
  cursor: not-allowed;
}

button:disabled:hover,
button[disabled][hover] {
  background: transparent;
}

button.secondary {
  background: transparent;
}

button:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

/* Make tiny icon-only buttons easy to click */
button[aria-label="Upvote"] {
  min-width: 0px;
  min-height: 0px;
  line-height: 1;
}

/* Icon button reset (for glyph-only controls like ▲) */
.icon-button {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 28px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.icon-button:hover {
  color: var(--accent);
  background: transparent;
}

.icon-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.icon-button.active {
  color: var(--accent);
}

/* Terminal-ish touches */
code,
pre {
  font-family: var(--mono);
}

pre {
  border: 1px solid var(--line);
  padding: var(--space-3);
  overflow: auto;
}

/* Brand in monospace for a subtle terminal vibe */
nav strong {
  font-family: var(--mono);
  letter-spacing: 0.2px;
}

/* Utilities */
.muted {
  color: var(--muted);
}

.inline {
  display: inline-block;
}

.right {
  float: right;
}

.break-word {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Auto dark mode using system preference */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b0a;
    --fg: #e9e9e6;
    --muted: #a0a0a0;
    --line: #222;
    --accent: #ff7a1a;
  }
}

/* Manual overrides via data-theme attribute */
:root[data-theme="dark"] {
  --bg: #0b0b0a;
  --fg: #e9e9e6;
  --muted: #a0a0a0;
  --line: #222;
  --accent: #ff7a1a;
}

:root[data-theme="light"] {
  --bg: #fff7f1;
  --fg: #111;
  --muted: #666;
  --line: #e6e6df;
  --accent: #ff6600;
}