@font-face {
  font-family: 'Reddit Sans';
  src: url('/fonts/reddit-sans-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Reddit Sans';
  src: url('/fonts/reddit-sans-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Reddit Sans';
  src: url('/fonts/reddit-sans-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Reddit Sans';
  src: url('/fonts/reddit-sans-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Reddit Sans';
  src: url('/fonts/reddit-sans-800.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --panel: #f6f8f9;
  --card: #ffffff;
  --text: #181c1f;
  --muted: #5c6c74;
  --line: #e5ebee;
  --hover: #f2f4f6;
  --accent: #ff6b35;
  --link: #115bca;
  --subm-name: #14205e;
  --up: #e76f2e;
  --down: #5b6abf;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

:root[data-theme='dark'] {
  --bg: #0b1416;
  --panel: #181c1f;
  --card: #181c1f;
  --text: #f2f4f5;
  --muted: #9aa3ab;
  --line: #2a3236;
  --hover: #1a2426;
  --link: #7fb3e8;
  --subm-name: #dbe4ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0b1416;
    --panel: #181c1f;
    --card: #181c1f;
    --text: #f2f4f5;
    --muted: #9aa3ab;
    --line: #2a3236;
    --hover: #1a2426;
    --link: #7fb3e8;
    --subm-name: #dbe4ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Reddit Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  text-decoration: underline;
}

button {
  font: inherit;
  color: inherit;
}

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

.small {
  font-size: 12px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 690px) minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  height: 56px;
  padding: 0 20px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
  justify-self: start;
}

.brand:hover {
  text-decoration: none;
}

.wordmark {
  font-size: 20px;
  letter-spacing: -0.02em;
}

.search {
  width: 100%;
  justify-self: center;
}

.search input {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  outline: none;
}

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

.search input:focus {
  border-color: var(--accent);
  background: var(--card);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
  font-size: 13px;
  white-space: nowrap;
}

.topnav a {
  color: var(--muted);
}

.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover {
  filter: brightness(0.95);
  text-decoration: none;
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

.iconbtn {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  color: var(--muted);
}

.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr) 312px;
  gap: 24px;
  max-width: 1800px;
  height: calc(100vh - 56px);
  margin: 0 auto;
  padding: 20px 20px 0;
  align-items: stretch;
  overflow: hidden;
}

.content {
  grid-column: 2 / 4;
  min-width: 0;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.content-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 312px;
  gap: 24px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

#main {
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#main::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.leftrail,
.rightrail {
  position: static;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  scrollbar-gutter: stable;
  padding-right: 6px;
}

.leftrail::-webkit-scrollbar,
.rightrail::-webkit-scrollbar {
  width: 6px;
}

.leftrail::-webkit-scrollbar-track,
.rightrail::-webkit-scrollbar-track {
  background: transparent;
}

.leftrail::-webkit-scrollbar-thumb,
.rightrail::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
}

.leftrail::-webkit-scrollbar-thumb:hover,
.rightrail::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

.leftrail h4 {
  margin: 0 0 6px;
  padding: 14px 10px 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav li {
  margin: 1px 0;
}

.nav a,
.navbtn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
}

.nav a:hover,
.navbtn:hover,
.nav a.active {
  background: var(--hover);
  text-decoration: none;
}

.nav a.active {
  font-weight: 600;
  color: var(--text);
}

.subm-link {
  font-size: 13px;
}

.recent {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.more {
  display: inline-block;
  margin: 4px 0 0 10px;
  font-size: 12px;
  color: var(--muted);
}

.card {
  background: var(--panel);
  border: 1px solid transparent;
  border-radius: 8px;
  box-shadow: none;
  padding: 12px 16px;
  margin-bottom: 12px;
}

.postcard {
  display: flex;
  gap: 8px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  padding: 8px 16px 8px 8px;
}

.postcard:last-child {
  border-bottom: 0;
}

.votes {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: none;
  width: 36px;
  padding-top: 2px;
}

.vote {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  padding: 3px;
  cursor: pointer;
  border-radius: 4px;
}

.vote:hover {
  background: var(--hover);
}

.vote.up:hover {
  color: var(--up);
}

.vote.down:hover {
  color: var(--down);
}

.score {
  font-size: 12px;
  font-weight: 700;
}

.postbody {
  min-width: 0;
  flex: 1;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.meta a {
  color: inherit;
  font-weight: 500;
}

.dot {
  color: var(--line);
}

.posttitle {
  margin: 5px 0 4px;
  font-size: 18px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.posttitle a {
  color: var(--text);
}

.posttitle a:hover {
  text-decoration: none;
  color: var(--link);
}

.preview {
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.postfull {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 6px 8px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.postfull .actions .votes {
  flex-direction: row;
  width: auto;
  gap: 4px;
}

.postfull .actions .vote {
  font-size: 13px;
}

.commentbox {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 4px 8px 0;
}

.chip {
  display: inline-block;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}

.chip:hover {
  background: var(--hover);
  text-decoration: none;
}

.postcard .chip,
.comment-actions .chip,
.postfull .chip {
  border-color: transparent;
  background: transparent;
  padding: 5px 9px;
}

.postcard .chip:hover,
.comment-actions .chip:hover,
.postfull .chip:hover {
  background: var(--hover);
}

.adcard {
  border-left: 0;
}

.adlabel {
  color: var(--accent);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.adbrand {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.adcta {
  border-color: var(--ad-accent, var(--accent));
  color: var(--ad-accent, var(--accent));
}

.aboutcard h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}

.stats div {
  border-top: 1px solid var(--line);
  padding-top: 6px;
}

.stats dt {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stats dd {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.banner {
  position: relative;
  height: 160px;
  border-radius: 12px;
  background: linear-gradient(120deg, var(--subm-accent, var(--accent)), color-mix(in srgb, var(--subm-accent, var(--accent)) 40%, #1a1a1b));
  background-size: cover;
  background-position: center;
}

.submhead {
  display: flex;
  align-items: center;
  gap: 20px;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0 8px 10px 16px;
  position: relative;
}

.submhead .submicon {
  width: 96px;
  height: 96px;
  margin-top: -24px;
  font-size: 44px;
  border: 4px solid var(--card);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.subminfo {
  min-width: 0;
  flex: 1;
}

.submicon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 26px;
  background: var(--card);
  border: 1px solid var(--line);
  flex: none;
}

.submhead h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--subm-name);
}

.submhead p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.submtools {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  font-size: 13px;
}

.toolbar a {
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--muted);
}

.toolbar a.active {
  background: var(--hover);
  color: var(--text);
  font-weight: 600;
}

.postfull h1 {
  margin: 4px 0 8px;
  font-size: 24px;
  line-height: 1.25;
}

.postfull .body {
  margin: 10px 0 14px;
  font-size: 15px;
  white-space: pre-wrap;
}

.comment {
  border-left: 2px solid var(--line);
  padding: 6px 0 6px 10px;
  margin: 6px 0;
}

.comment-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
}

.uname {
  font-weight: 600;
  color: var(--text);
}

.comment-body p {
  margin: 3px 0 4px;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.comment-actions .votes {
  flex-direction: row;
  width: auto;
  gap: 4px;
}

.comment-actions .vote {
  font-size: 12px;
}

.collapse {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  margin-left: auto;
}

.collapsed {
  display: none;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 56px 20px;
}

.empty .catmark {
  color: var(--accent);
  opacity: 0.5;
}

.pager {
  text-align: center;
  padding: 8px 0 24px;
}

.about-main {
  font-size: 20px;
  line-height: 1.45;
  margin: 8px 0 20px;
}

.about-small {
  font-size: 13px;
  color: var(--muted);
  margin: 6px 0;
}

.about-tiny {
  font-size: 11px;
  color: var(--muted);
  margin: 2px 0;
}

.about-fineprint {
  font-size: 10px;
  color: var(--muted);
  opacity: 0.55;
  margin: 16px 0 0;
  letter-spacing: 0.01em;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.5);
  padding: 20px;
}

.modal[hidden] {
  display: none;
}

.modal-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px 24px 20px;
  max-width: 430px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.modal-cat {
  font-size: 34px;
  margin-bottom: 8px;
}

.modal-card p {
  font-size: 16px;
  line-height: 1.45;
  margin: 0 0 18px;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  max-width: none;
  margin: 12px 0 0;
  padding: 24px 8px 40px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--line);
}

.explore-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.explore-cat {
  margin: 20px 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.submcard {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid transparent;
  border-radius: 8px;
}

.submcard .icon {
  font-size: 22px;
}

.submcard b {
  display: block;
  font-weight: 600;
}

.submcard span {
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 212px minmax(0, 1fr);
  }
  .content {
    grid-column: 2 / 3;
  }
  .content-cols {
    grid-template-columns: minmax(0, 1fr);
  }
  .rightrail {
    display: none;
  }
}

@media (max-width: 820px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    padding: 0 12px;
  }
  body {
    overflow: auto;
  }
  .shell {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    overflow: visible;
    padding: 12px;
  }
  .content {
    grid-column: 1 / -1;
    height: auto;
  }
  .content-cols {
    flex: none;
  }
  .leftrail {
    display: none;
  }
  #main {
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .topnav a {
    display: none;
  }
  .posttitle {
    font-size: 16px;
  }
  .banner {
    height: 120px;
  }
  .submhead {
    gap: 12px;
    padding-left: 12px;
  }
  .submhead .submicon {
    width: 72px;
    height: 72px;
    margin-top: -18px;
    font-size: 34px;
    border-width: 3px;
  }
  .submhead h1 {
    font-size: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
