/* one shared stylesheet: system font, lots of whitespace, one accent color */

:root {
  --accent: #d9480f;
  --accent-soft: #fff1ea;
  --text: #1c1c1e;
  --muted: #6b6b70;
  --line: #e7e7ea;
  --bg: #fafafa;
  --card: #ffffff;
  --error: #c62828;
  --radius: 12px;
}

* { box-sizing: border-box; }

/* reserve the scrollbar space so pages dont shift sideways when content gets long */
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

/* top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 52px;
}
.brand { font-weight: 700; color: var(--text); margin-right: auto; letter-spacing: -0.01em; }
.topbar-inner > * { white-space: nowrap; }
.brand:hover { text-decoration: none; }
.topbar-inner > a:not(.brand), .topbar-inner > .link-button { font-size: 15px; color: var(--muted); }
.topbar-inner > a:not(.brand):hover, .topbar-inner > .link-button:hover { color: var(--text); text-decoration: none; }

/* people search (top bar) */
.search { position: relative; flex: 0 1 220px; min-width: 120px; }
.search-input {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 14px;
  background: var(--bg);
}
/* the browser's blue clear "x" doesnt match the accent; escape / backspace clear instead */
.search-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: max(100%, 280px);
  max-height: min(420px, 60vh);
  overflow-y: auto;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  white-space: normal;
  z-index: 20;
}
.search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text);
}
.search-result:hover, .search-result.active { background: var(--accent-soft); text-decoration: none; }
.search-result .avatar { width: 32px; height: 32px; font-size: 14px; }
.search-names { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.search-names .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-names .handle { font-size: 13px; color: var(--muted); }
.search-empty { margin: 0; padding: 8px 10px; color: var(--muted); font-size: 14px; }

/* layout */

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 16px 64px;
}
h1 { font-size: 24px; margin: 0 0 24px; letter-spacing: -0.02em; }
.narrow { max-width: 400px; margin: 0 auto; }
.muted { color: var(--muted); }
.center { text-align: center; }
[hidden] { display: none !important; }

/* forms */

form { display: flex; flex-direction: column; gap: 16px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
input, textarea {
  font: inherit;
  color: var(--text);
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}
textarea { resize: vertical; min-height: 80px; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.hint { font-size: 13px; color: var(--muted); margin: -8px 0 0; }

button {
  font: inherit;
  cursor: pointer;
  border: 0;
  border-radius: 999px;
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
button:hover { filter: brightness(1.05); }
button:disabled { opacity: 0.6; cursor: default; }
button.secondary { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.link-button { background: none; border: 0; padding: 0; font-weight: 400; color: var(--accent); border-radius: 0; }
.link-button:hover { filter: none; text-decoration: underline; }

.error { color: var(--error); font-size: 14px; margin: 0; }
.error:empty, .bio:empty { display: none; }
.ok { color: #2e7d32; font-size: 14px; margin: 0; }
.below { margin-top: 24px; font-size: 15px; color: var(--muted); }

/* cards */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.toolbar { display: flex; justify-content: flex-end; margin-bottom: 16px; }
.new-post { margin-bottom: 24px; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; }

/* posts */

.posts { display: flex; flex-direction: column; gap: 16px; }
.post { display: flex; flex-direction: column; gap: 10px; }
.post-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.post-head .who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; min-width: 0; }
.post-head .name { font-weight: 600; color: var(--text); }
.post-head .handle, .post-head .time { color: var(--muted); font-size: 14px; }
.post-title { font-size: 18px; margin: 4px 0 0; line-height: 1.35; overflow-wrap: anywhere; }
.post-desc { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.post-link { font-size: 14px; overflow-wrap: anywhere; }
.tag {
  align-self: flex-start;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}
.post-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 4px;
}
.score { font-size: 14px; color: var(--muted); }
.score strong { color: var(--text); }

/* stars: hovering a star lights it and the ones before it */
.stars { display: inline-flex; }
.stars button {
  background: none;
  border-radius: 4px;
  padding: 2px 3px;
  font-size: 22px;
  line-height: 1;
  font-weight: 400;
  color: #d0d0d5;
}
.stars button.on { color: var(--accent); }
.stars:hover button { color: var(--accent); }
.stars button:hover ~ button { color: #d0d0d5; }
.stars button:focus-visible { outline: 2px solid var(--accent); }

/* avatars */

.avatar {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  text-transform: uppercase;
}
.avatar.big { width: 88px; height: 88px; font-size: 34px; }

/* profile */

.profile { display: flex; flex-direction: column; gap: 12px; margin-bottom: 40px; }
.profile-top { display: flex; align-items: center; gap: 16px; }
.profile-names { flex: 1; min-width: 0; }
.profile-names h1 { margin: 0; overflow-wrap: anywhere; }
.profile-names .handle { color: var(--muted); }
.bio { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.stats { display: flex; flex-wrap: wrap; gap: 4px 20px; color: var(--muted); font-size: 15px; }
.stats strong { color: var(--text); }
.section-title { font-size: 16px; margin: 0 0 16px; color: var(--muted); font-weight: 600; }

.load-more { display: block; margin: 24px auto 0; }
.empty { text-align: center; color: var(--muted); padding: 32px 0; margin: 0; }

@media (max-width: 480px) {
  main { padding-top: 24px; }
  /* phones: app name, then the links, then a full width search box; not sticky (too tall) */
  .topbar { position: static; }
  .topbar-inner { gap: 2px 16px; flex-wrap: wrap; padding: 10px 16px 12px; }
  .brand { flex-basis: 100%; }
  .topbar-inner > a:not(.brand), .topbar-inner > .link-button { font-size: 14px; }
  .search { order: 3; flex-basis: 100%; margin-top: 8px; }
  .search-results { width: 100%; }
  .card { padding: 16px; }
  .avatar.big { width: 64px; height: 64px; font-size: 26px; }
}
