:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #eef7f5;
  --ink: #17202a;
  --muted: #687385;
  --line: #dde3ea;
  --teal: #0f766e;
  --teal-strong: #0a5c55;
  --coral: #d84c5f;
  --gold: #c48a16;
  --sky: #246fb9;
  --shadow: 0 18px 50px rgba(31, 41, 55, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(246, 247, 249, 0)),
    var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 320px;
  gap: 20px;
  max-width: 1480px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
}

.left-rail,
.right-rail {
  position: sticky;
  top: 18px;
  height: calc(100vh - 36px);
  overflow: auto;
}

.left-rail {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 74px;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: min(190px, 100%);
  height: auto;
  border-radius: 8px;
}

.mobile-logo {
  display: block;
  width: 132px;
  height: auto;
}

.brand small {
  display: block;
  margin-left: 8px;
  color: var(--muted);
  font-weight: 720;
}

.nav-stack {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

.nav-item .dot,
.flair-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--teal);
  flex: 0 0 auto;
}

.nav-item span:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.nav-count {
  color: var(--muted);
  font-size: 0.82rem;
}

.campus-card,
.side-panel,
.compose-card,
.welcome-band,
.feed-tools,
.post-card,
.empty-state,
.error-state {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.campus-card {
  margin-top: auto;
  padding: 14px;
}

.campus-card img {
  display: block;
  width: 100%;
  border-radius: 8px;
  background: var(--surface-soft);
}

.campus-card div {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.campus-card span,
.side-panel li,
.profile-meta,
.post-meta,
.empty-state p,
.error-state p,
.form-message,
.detail-body,
.compose-copy {
  color: var(--muted);
  line-height: 1.55;
}

.main-area {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 16px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
}

.menu-button,
.mobile-brand,
.mobile-filter-panel {
  display: none;
}

.search-field {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.search-field span {
  color: var(--muted);
  font-size: 1.2rem;
}

.search-field input,
.stacked-form input,
.compose-form input,
.compose-form textarea,
.compose-form select,
select {
  width: 100%;
  border: 0;
  color: var(--ink);
  background: transparent;
  outline: none;
}

.topbar-actions,
.tool-row,
.post-actions,
.modal-actions,
.auth-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.ghost-button,
.text-button,
.vote-button,
.close-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 750;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.primary-button {
  padding: 0 16px;
  color: #ffffff;
  background: var(--teal);
}

.primary-button:hover {
  background: var(--teal-strong);
  transform: translateY(-1px);
}

.primary-button:disabled,
.ghost-button:disabled,
.vote-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
}

.ghost-button {
  padding: 0 14px;
  color: var(--ink);
  background: #ffffff;
  border-color: var(--line);
}

.ghost-button:hover,
.vote-button:hover {
  border-color: #aeb8c5;
}

.text-button {
  min-height: 34px;
  padding: 0;
  color: var(--teal);
  background: transparent;
}

.welcome-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: clamp(18px, 3vw, 28px);
  overflow: hidden;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.7rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.18rem;
  letter-spacing: 0;
}

.welcome-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(86px, 1fr));
  gap: 10px;
}

.metric {
  min-width: 88px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.metric strong {
  display: block;
  font-size: 1.25rem;
}

.metric span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.compose-card {
  padding: 16px;
}

.compose-signed-out {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.compose-signed-out h2,
.compose-form h2 {
  margin-bottom: 4px;
}

.compose-form {
  display: grid;
  gap: 12px;
}

.compose-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px;
  gap: 12px;
}

.field-shell {
  display: grid;
  gap: 7px;
}

.field-shell span,
.stacked-form span {
  color: #445064;
  font-size: 0.82rem;
  font-weight: 780;
}

.input-box,
.compose-form textarea,
.compose-form select,
.stacked-form input,
select {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.compose-form textarea {
  min-height: 110px;
  resize: vertical;
}

.compose-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.feed-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
}

.feed-list {
  display: grid;
  gap: 12px;
}

.post-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.post-card:hover {
  border-color: #b8c2cf;
  box-shadow: 0 20px 55px rgba(31, 41, 55, 0.1);
  transform: translateY(-1px);
}

.vote-stack {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 8px;
}

.vote-button {
  width: 42px;
  min-height: 42px;
  padding: 0;
  color: var(--teal);
  background: var(--surface-soft);
  border-color: #cde6e1;
  font-size: 1rem;
}

.vote-button.down {
  color: var(--coral);
  background: #fff1f3;
  border-color: #f6cbd2;
}

.vote-button.selected {
  color: #ffffff;
  background: var(--ink);
  border-color: var(--ink);
}

.vote-count {
  font-weight: 850;
}

.vote-note,
.vote-error {
  max-width: 72px;
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.3;
  text-align: center;
}

.vote-note {
  color: var(--muted);
}

.vote-error {
  color: #b42338;
}

.post-content {
  min-width: 0;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  font-size: 0.86rem;
}

.flair-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--ink);
  background: #f2f6f9;
  border: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 780;
}

.post-title {
  display: block;
  width: 100%;
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
  font-weight: 850;
  font-size: 1.18rem;
  line-height: 1.3;
}

.post-excerpt {
  margin: 0;
  color: #445064;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.post-actions {
  margin-top: 14px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--muted);
  background: #f8fafc;
  border: 1px solid var(--line);
  font-size: 0.8rem;
  font-weight: 720;
}

.chip-button {
  cursor: pointer;
}

.chip-button:hover {
  color: var(--ink);
  border-color: #aeb8c5;
}

.right-rail {
  display: grid;
  align-content: start;
  gap: 16px;
}

.side-panel {
  padding: 16px;
}

.panel-heading {
  margin-bottom: 14px;
}

.profile-card {
  display: grid;
  gap: 12px;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  color: #ffffff;
  background: var(--coral);
  font-weight: 900;
}

.trend-list {
  display: grid;
  gap: 10px;
}

.trend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.trend-item:last-child {
  border-bottom: 0;
}

.trend-item strong {
  display: flex;
  align-items: center;
  gap: 9px;
}

.trend-item span:last-child {
  color: var(--muted);
  font-size: 0.84rem;
}

.values-panel ul {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.values-panel li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.values-panel li span {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--ink);
  font-size: 0.78rem;
  font-weight: 850;
}

.empty-state,
.error-state {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 26px;
  text-align: center;
}

.empty-state h2,
.error-state h2 {
  margin-bottom: 8px;
}

.empty-state p,
.error-state p {
  max-width: 460px;
  margin-bottom: 16px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 18px;
}

.modal.open {
  display: grid;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 32, 42, 0.55);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.2);
}

.auth-panel {
  padding: 24px;
}

.close-button {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  min-height: 36px;
  padding: 0;
  color: var(--muted);
  background: #f8fafc;
  border-color: var(--line);
  font-size: 1.35rem;
}

.modal-copy {
  padding-right: 42px;
  margin-bottom: 18px;
}

.stacked-form {
  display: grid;
  gap: 12px;
}

.stacked-form label {
  display: grid;
  gap: 7px;
}

.form-message {
  min-height: 22px;
  margin: 0;
  font-size: 0.88rem;
}

.form-message.error {
  color: #b42338;
}

.form-message.success {
  color: var(--teal);
}

.auth-links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.auth-panel .text-button {
  margin-top: 12px;
}

.auth-links .text-button {
  margin-top: 0;
}

.forgot-page {
  display: grid;
  place-items: start center;
  min-height: calc(100vh - 96px);
  padding: clamp(18px, 4vw, 44px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(216, 76, 95, 0.06)),
    var(--surface);
  box-shadow: var(--shadow);
}

.forgot-page[hidden],
.settings-page[hidden] {
  display: none;
}

.forgot-card {
  width: min(100%, 560px);
  padding: clamp(18px, 4vw, 28px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(31, 41, 55, 0.1);
}

.forgot-card h1 {
  margin-bottom: 10px;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  line-height: 1.08;
}

.forgot-copy {
  margin-bottom: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.forgot-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.home-view-hidden {
  display: none !important;
}

.settings-page {
  display: grid;
}

.settings-shell {
  display: grid;
  gap: 16px;
}

.settings-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(18px, 4vw, 28px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.settings-hero h1 {
  max-width: 680px;
  margin-bottom: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.settings-card {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.settings-card h2 {
  margin-bottom: 4px;
}

.settings-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.settings-card textarea {
  min-height: 104px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fbfcfe;
  resize: vertical;
  outline: none;
}

.danger-card {
  border-color: #f4b8c0;
  background: #fff8f9;
}

.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid #b42338;
  border-radius: 8px;
  color: #ffffff;
  background: #b42338;
  font-weight: 750;
}

.danger-button:hover {
  background: #8f1d2d;
}

.post-detail {
  width: min(100%, 760px);
  padding: 0;
}

.detail-inner {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 18px;
  padding: 22px;
}

.detail-body {
  white-space: pre-wrap;
  color: #334155;
}

.detail-footer {
  padding: 16px 22px 22px;
  border-top: 1px solid var(--line);
}

.comments-section {
  display: grid;
  gap: 14px;
}

.comments-heading,
.comment-actions,
.comment-login {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.comment-list {
  display: grid;
  gap: 10px;
}

.comment-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.comment-avatar {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: #ffffff;
  background: var(--sky);
  font-size: 0.9rem;
  font-weight: 850;
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.comment-meta strong {
  color: var(--ink);
}

.comment-item p,
.comment-login p,
.comment-state {
  margin: 0;
  color: #445064;
  line-height: 1.5;
}

.comment-form {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.comment-form textarea {
  min-height: 92px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fbfcfe;
  resize: vertical;
  outline: none;
}

.reply-empty {
  padding: 14px;
  border: 1px dashed #c7d0dc;
  border-radius: 8px;
  color: var(--muted);
  background: #f8fafc;
}

.color-admissions { background: #0f766e; }
.color-campus { background: #246fb9; }
.color-career { background: #d84c5f; }
.color-housing { background: #c48a16; }
.color-events { background: #6b7280; }
.color-general { background: #17202a; }

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .right-rail {
    display: none;
  }
}

@media (max-width: 860px) {
  .app-shell {
    display: block;
    padding: 10px;
  }

  .left-rail {
    display: none;
  }

  .main-area {
    gap: 12px;
  }

  .topbar {
    grid-template-columns: 42px minmax(108px, auto) minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
  }

  .menu-button {
    display: inline-grid;
    width: 42px;
    padding: 0;
    background: #ffffff;
    border-color: var(--line);
  }

  .menu-button span {
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: var(--ink);
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .topbar-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .search-field {
    min-height: 42px;
  }

  .mobile-filter-panel.open {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .welcome-band {
    grid-template-columns: 1fr;
  }

  .welcome-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .compose-signed-out,
  .feed-tools {
    align-items: flex-start;
    flex-direction: column;
  }

  .compose-grid {
    grid-template-columns: 1fr;
  }

  .settings-hero {
    flex-direction: column;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .mobile-brand {
    min-width: 0;
  }

  .search-field {
    grid-column: 1 / -1;
  }

  .mobile-filter-panel.open {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 2rem;
  }

  .welcome-metrics {
    grid-template-columns: 1fr;
  }

  .post-card,
  .detail-inner {
    grid-template-columns: 1fr;
  }

  .vote-stack {
    display: flex;
    justify-content: flex-start;
    align-items: center;
  }

  .post-title {
    font-size: 1.05rem;
  }
}
