/* Home starts with the feed; the rail is reserved for account and section navigation. */
.site-header {
  justify-content: flex-start;
  gap: 24px;
  height: auto;
  min-height: 76px;
  flex-wrap: wrap;
  padding-block: 16px;
}

.main-nav {
  margin-left: 0;
  gap: 20px;
  flex-wrap: wrap;
}

.nav-divider {
  width: 1px;
  height: 26px;
  background: var(--muted);
  opacity: .6;
  align-self: center;
  flex-shrink: 0;
}

.main-nav a {
  white-space: nowrap;
}

@media (max-width: 800px) {
  .main-nav {
    order: 3;
    width: 100%;
    gap: 12px 17px;
  }
}

.header-actions {
  margin-left: auto;
  gap: 10px;
}

.header-signed-in-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-account-action {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 7px 10px;
  font: 10px 'DM Mono', monospace;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}

.header-account-action:hover {
  border-color: var(--coral);
  color: var(--coral);
}

.header-account-action:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}

.notification-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}

.notification-button:hover { border-color: var(--coral); color: var(--coral); }
.notification-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

#notificationBadge {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 10px;
  background: var(--coral);
  color: white;
  font: 9px/17px 'DM Mono', monospace;
  text-align: center;
}

#notificationBadge[hidden] { display: none; }

.header-signed-in-actions[hidden],
#headerAuthButton[hidden] {
  display: none;
}

.feed-layout {
  padding-top: 48px;
  min-height: 100vh;
  align-items: start;
}

.account-card {
  background: var(--cream);
}

.explore-card {
  background: #e8ded4;
}

.auth-inline span {
  color: var(--coral);
  font-size: 14px;
}

#signedInAccount h2 a,
.account-link {
  color: inherit;
  text-decoration: none;
}

.account-link,
.logout-button {
  display: inline-block;
  border: 0;
  background: none;
  padding: 0;
  color: var(--ink);
  font: 11px 'DM Mono', monospace;
  cursor: pointer;
  text-decoration: none;
}

.account-link span,
.logout-button span {
  color: var(--coral);
  font-size: 14px;
}

.logout-button {
  display: block;
  margin-top: 14px;
}

#signedInActions .account-link {
  margin-top: 14px;
}

.profile-page {
  padding: 56px 0 90px;
}

.profile-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 30px;
  align-items: end;
  border-bottom: 1px solid var(--line);
  padding-bottom: 35px;
}

.profile-header h1 {
  margin: 0;
  font: 500 clamp(48px, 7vw, 76px)/.92 'Newsreader', serif;
  letter-spacing: -.06em;
}

.profile-score {
  min-width: 155px;
  padding: 18px;
  background: #dfe3d2;
}

.profile-score b,
.profile-score span {
  display: block;
}

.profile-score b {
  font: 500 38px/1 'Newsreader', serif;
}

.profile-score span,
.profile-score small {
  color: var(--muted);
  font: 10px 'DM Mono', monospace;
}

.profile-actions {
  margin-top: 22px;
}

.profile-message-button {
  border: 1px solid var(--line);
  background: var(--surface-raised);
  color: var(--ink);
  padding: 11px 13px;
  font: 10px 'DM Mono', monospace;
  cursor: pointer;
}

.profile-message-button span { color: var(--coral); }

.profile-activity {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 38px;
  padding-top: 48px;
}

.profile-section h2 {
  margin: 0 0 17px;
  font: 500 29px/1 'Newsreader', serif;
}

.profile-post,
.profile-comment,
.profile-upvote {
  border-top: 1px solid var(--line);
  padding: 18px 0;
}

.profile-post:last-child,
.profile-comment:last-child,
.profile-upvote:last-child { border-bottom: 1px solid var(--line); }

.profile-post h3,
.profile-comment h3 {
  margin: 5px 0;
  font: 500 22px/1.1 'Newsreader', serif;
}

.profile-post h3 a,
.profile-comment h3 a { color: var(--ink); text-decoration: none; }
.profile-post h3 a:hover,
.profile-comment h3 a:hover { color: var(--coral); }

.profile-meta {
  color: var(--muted);
  font: 10px 'DM Mono', monospace;
}

.profile-comment p { margin: 7px 0 0; color: var(--muted); white-space: pre-wrap; }
.profile-upvote h3 { margin: 5px 0; font: 500 19px/1.1 'Newsreader', serif; }
.profile-upvote h3 a { color: var(--ink); text-decoration: none; }
.profile-upvote h3 a:hover { color: var(--coral); }
.profile-upvote p { margin: 7px 0 0; color: var(--muted); font-size: 13px; white-space: pre-wrap; }

@media (max-width: 800px) {
  .header-account-action { padding: 6px 8px; font-size: 9px; }
  .profile-header,
  .profile-activity { grid-template-columns: 1fr; gap: 28px; }
  .profile-score { width: fit-content; }
}

.sidebar-links {
  display: flex;
  flex-direction: column;
  margin-top: 24px;
}

.sidebar-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(41, 40, 36, 0.16);
  padding: 15px 0;
  color: var(--ink);
  font: 11px 'DM Mono', monospace;
  text-decoration: none;
}

.sidebar-links a:last-child {
  border-bottom: 1px solid rgba(41, 40, 36, 0.16);
}

.sidebar-links a:hover {
  color: var(--coral);
}

.sidebar-links b {
  color: var(--coral);
  font-size: 16px;
  font-weight: 400;
}

.messages-page {
  padding: 56px 0 90px;
}

.notifications-page { padding: 56px 0 90px; }

.notification-list {
  margin-top: 36px;
  border-top: 1px solid var(--line);
}

.notification-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 13px;
  padding: 18px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}

.notification-item:hover { background: var(--cream); }
.notification-item.unread { background: color-mix(in srgb, var(--coral) 14%, transparent); }
.notification-item b { font-weight: 600; }
.notification-item time { display: block; margin-top: 4px; color: var(--muted); font: 10px 'DM Mono', monospace; }
.notification-dot { width: 7px; height: 7px; margin-top: 7px; border-radius: 50%; background: transparent; }
.notification-item.unread .notification-dot { background: var(--coral); }

.messages-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 590px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.conversation-panel {
  padding: 20px;
  border-right: 1px solid var(--line);
  background: var(--cream);
}

.conversation-panel form label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font: 10px 'DM Mono', monospace;
  text-transform: uppercase;
}

.conversation-panel form div {
  display: flex;
}

.conversation-panel input,
.message-form textarea {
  min-width: 0;
  flex: 1;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 10px;
  color: var(--ink);
  font: 13px 'DM Sans', sans-serif;
}

.conversation-panel form button,
.message-form button {
  border: 1px solid var(--line);
  background: var(--surface-raised);
  color: var(--ink);
  padding: 10px 13px;
  font: 10px 'DM Mono', monospace;
  cursor: pointer;
}

.conversation-list {
  display: flex;
  flex-direction: column;
  margin-top: 20px;
}

.conversation-item {
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  padding: 13px 4px;
  text-align: left;
  cursor: pointer;
}

.conversation-item.active {
  color: var(--coral);
}

.conversation-item b,
.conversation-item span {
  display: block;
}

.conversation-item b {
  font-size: 12px;
}

.conversation-item span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-panel {
  display: grid;
  grid-template-rows:auto minmax(0, 1fr) auto;
  min-width: 0;
}

.chat-panel h2 {
  margin: 0;
  border-bottom: 1px solid var(--line);
  padding: 18px 22px;
  font: 500 24px 'Newsreader', serif;
}

.chat-panel h2 a { color: inherit; text-decoration: none; }
.chat-panel h2 a:hover { color: var(--coral); }

.message-history {
  overflow-y: auto;
  padding: 22px;
}

.message {
  width: min(75%, 520px);
  margin: 0 0 14px;
  padding: 12px;
  background: var(--cream);
}

.message.mine {
  margin-left: auto;
  background: #dfe3d2;
}

.message b,
.message time {
  font: 9px 'DM Mono', monospace;
  color: var(--muted);
}

.message p {
  margin: 4px 0;
  white-space: pre-wrap;
}

.message-form {
  display: flex;
  border-top: 1px solid var(--line);
  padding: 16px;
}

.message-form textarea {
  resize: vertical;
}

@media (max-width: 800px) {
  .feed-layout {
    padding-top: 35px;
  }

  .messages-layout {
    grid-template-columns: 1fr;
  }

  .conversation-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}
