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

@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/fonts/geist-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('/fonts/space-grotesk-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #000000;
  --fg: #f5f5f4;
  --muted: #f5f5f4;
  --dim: #e7e5e4;
  --faint: #131110;
  --accent: #dc2626;
  --link: #ef4444;
  --placeholder: #504b46;
  --border: rgba(255,255,255,0.05);
}

[hidden] { display: none !important; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  font-size: clamp(1.25rem, calc(1.1719rem + 0.5vw), 2.031rem);
}

body {
  font-family: 'Geist', system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  min-height: 100dvh;
  padding: 2rem 1.25rem 1.25rem;
  font-size: 0.875rem;
  line-height: 1.6;
}

@media (min-width: 768px) {
  body { padding: 3rem 1.5rem 1.5rem; }
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 999;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0 0 0.375rem 0.375rem;
  text-decoration: none;
  transition: top 0.15s;
}

.skip-link:focus { top: 0; }

html { scrollbar-color: #3e3a36 var(--bg); }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #3e3a36; border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--dim); }
::-webkit-scrollbar-corner { background: var(--bg); }

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

:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--accent); color: #fff; }

.wrap { max-width: 600px; width: 100%; margin: 0 auto; }

@media (min-width: 768px) {
  .wrap { max-width: 675px; }
}

.top { margin-bottom: 1.25rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.logo-line {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: clamp(1.375rem, 2.4vw, 1.875rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--fg);
  white-space: nowrap;
  overflow-x: clip;
  margin-bottom: 0.75rem;
  user-select: none;
}

.logo-line .path { color: var(--accent); }

.sub {
  margin-top: 0.375rem;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.6;
}

.links {
  margin-top: 0.875rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: 'Geist', system-ui, sans-serif;
  color: var(--muted);
  text-decoration: none;
  min-height: 2rem;
  transition: border-color 0.25s cubic-bezier(0.16, 1, 0.3, 1), color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.pill:hover { border-color: var(--accent); color: var(--fg); }
.pill svg { width: 15px; height: 15px; flex-shrink: 0; }

.submit {
  background: transparent;
  cursor: pointer;
  align-self: flex-start;
}

.sec-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  margin-top: 2rem;
}

.sec-head h2 {
  font-family: 'Space Grotesk', monospace;
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--accent);
  white-space: nowrap;
}

.sec-head .path { color: var(--dim); }

@keyframes blink {
  50% { opacity: 0; }
}

@media (min-width: 768px) {
  .sec-head h2 { font-size: 0.5625rem; }
}

.sec-head .note {
  color: var(--dim);
  font-size: 0.625rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
}

.sec-head::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* --- Compose form --- */
.compose {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.search-label {
  display: inline-flex;
  align-items: center;
  font-family: 'Space Grotesk', monospace;
  font-size: 0.8125rem;
  color: var(--accent);
  white-space: nowrap;
}

.suggest-input {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  padding: 0.5rem 0.6rem;
  font-family: 'Space Grotesk', monospace;
  font-size: 0.8125rem;
  color: var(--fg);
  line-height: 1.6;
  resize: vertical;
  min-height: 5rem;
  outline: none;
  transition: border-color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.suggest-title {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  padding: 0.5rem 0.6rem;
  font-family: 'Space Grotesk', monospace;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fg);
  line-height: 1.4;
  outline: none;
  transition: border-color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.suggest-title::placeholder { color: var(--placeholder); }

.suggest-title:focus { border-color: var(--accent); }

.suggest-input::placeholder { color: var(--placeholder); }

.suggest-input:focus { border-color: var(--accent); }

.tos-line {
  font-size: 0.6875rem;
  font-family: 'Space Grotesk', monospace;
  color: var(--dim);
}

.tos-line a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  transition: color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.tos-line a:hover { color: var(--fg); }

.search-status {
  font-size: 0.75rem;
  font-family: 'Space Grotesk', monospace;
  color: var(--dim);
  min-height: 1.2rem;
}

.search-status.ok { color: #4ade80; }
.search-status.err { color: var(--accent); }

/* --- Notes tabs --- */
.tabs {
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  overflow: hidden;
  background: var(--faint);
}

.tab-strip {
  display: flex;
  gap: 0.25rem;
  padding: 0.4rem 0.5rem 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab {
  font-family: 'Space Grotesk', monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  color: var(--dim);
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 0.25rem 0.25rem 0 0;
  padding: 0.3rem 0.6rem;
  min-height: 1.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.tab:hover { color: var(--fg); }

.tab.on {
  color: var(--fg);
  background: var(--faint);
  border-color: var(--border);
  box-shadow: inset 0 1px 0 var(--accent);
}

.tab-panel {
  padding: 0.625rem 0.75rem;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--muted);
}

.tab-panel[hidden] { display: none; }

/* --- Terms page --- */
.terms {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.terms-item h2 {
  font-family: 'Space Grotesk', monospace;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.terms-item h2::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.terms-item p {
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--muted);
  margin-top: 0.35rem;
}

.terms-item p code {
  font-family: 'Space Grotesk', monospace;
  color: var(--fg);
}

/* --- Suggestion list --- */
.suggestion {
  display: block;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  transition: color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  animation: suggestIn 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.suggestion:last-child { border-bottom: none; }

@keyframes suggestIn {
  from { opacity: 0; transform: translateY(-0.25rem); }
  to { opacity: 1; transform: translateY(0); }
}

.suggestion-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.suggestion-body {
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.45;
  color: var(--fg);
  white-space: pre-wrap;
  word-break: break-word;
}

.suggestion-title {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--fg);
  word-break: break-word;
  margin: 0 0 0.2rem;
}

.suggestion:hover .suggestion-title { color: var(--accent); }

.suggestion-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  flex-shrink: 0;
}

.suggestion-date {
  font-size: 0.625rem;
  font-family: 'Space Grotesk', monospace;
  color: var(--dim);
  white-space: nowrap;
}

.suggestion-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.3rem;
}

.log-tag {
  font-size: 0.625rem;
  font-family: 'Space Grotesk', monospace;
  color: var(--dim);
  background: var(--faint);
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
  white-space: nowrap;
  transition: color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.suggestion:hover .log-tag { color: var(--accent); }

.replies {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.reply {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.75rem;
  padding-left: 0.375rem;
  border-left: 1px solid var(--border);
}

.reply-author {
  font-family: 'Space Grotesk', monospace;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.reply-body {
  color: var(--fg);
  flex: 1;
  white-space: pre-wrap;
  word-break: break-word;
}

.reply .suggestion-date {
  color: var(--dim);
  white-space: nowrap;
}

/* --- Voting --- */
.vote {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

.vote-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  transition: border-color 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.vote-btn svg { width: 14px; height: 14px; display: block; }

.vote-btn:hover { border-color: var(--dim); color: var(--fg); }

.vote.voted-up .vote-btn.up { border-color: #4ade80; color: #4ade80; }
.vote.voted-down .vote-btn.down { border-color: var(--accent); color: var(--accent); }

.vote.busy { pointer-events: none; }

@keyframes vote-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.vote-btn.pop { animation: vote-pop 0.22s ease-out; }

.vote-num {
  font-size: 0.625rem;
  font-family: 'Space Grotesk', monospace;
  min-width: 1.4ch;
  text-align: center;
  white-space: nowrap;
}

.vote-num.up { color: #4ade80; }
.vote-num.down { color: var(--accent); }

.vote-num.up:empty::before,
.vote-num.down:empty::before { content: '0'; }

.empty {
  padding: 1.25rem 0;
  font-size: 0.8125rem;
  font-family: 'Space Grotesk', monospace;
  color: var(--dim);
}

/* --- Footer --- */
.foot {
  margin-top: 2rem;
}

.foot-inner {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding-top: 0.625rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.625rem;
  font-family: 'Space Grotesk', monospace;
  color: var(--dim);
}

@media (min-width: 768px) {
  .foot-inner { max-width: 675px; }
}

.foot-right {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  animation: blink 1.4s step-end infinite;
}

/* --- Reveal animations --- */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  animation: revealIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-play-state: paused;
}

@keyframes revealIn {
  to { opacity: 1; transform: translateY(0); }
}

/* --- Accessibility & motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; animation: none; }
}

@media (prefers-contrast: more) {
  :root {
    --border: rgba(255,255,255,0.15);
    --dim: #b9b3ad;
  }
}

@media print {
  body { background: #fff; color: #000; padding: 0; }
  .skip-link, .suggest-title, .suggest-input, .submit, .foot-right { display: none; }
}