body {
  max-width: 800px;
  padding: 0 8px;
  margin: 0 auto;
  font-family: system-ui, sans-serif;
  word-wrap: break-word;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  color: var(--primary);
}

body.light {
  --bg: #f0f0f0;
  --primary: black;
  --secondary: rgb(144, 144, 144);
  --tertiary: #d4d4d4;
  --btn-text: #666;
  --red: rgb(180, 0, 0);
  --green: rgb(0, 128, 0);
  --blue: rgb(0, 0, 180);
  --cyan: rgb(0, 128, 128);
  --yellow: rgb(180, 160, 0);
  --magenta: rgb(160, 0, 160);
  --orange: rgb(180, 100, 0);
}

body.dark {
  color-scheme: dark;
  --bg: #0a0a0a;
  --primary: rgb(144, 144, 144);
  --secondary: rgb(88, 88, 88);
  --tertiary: rgb(44, 44, 44);
  --btn-text: #999;
  --red: red;
  --green: green;
  --blue: rgb(80, 80, 255);
  --cyan: cyan;
  --yellow: yellow;
  --magenta: magenta;
  --orange: orange;
}

.secondary { color: var(--secondary); }
hr { border-color: var(--secondary); }
::placeholder { color: var(--secondary); }

main { flex: 1; }

a, button {
  all: unset;
  color: inherit;
  cursor: pointer;
  transition: color 0.15s;
}

button, .btn {
  padding: 2px 8px;
  background-color: var(--tertiary);
  color: var(--btn-text);
  border-radius: 4px;
  font-size: 0.85rem;
  text-decoration: none;
  align-self: flex-start;
}

button:hover, .btn:hover {
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

p { margin: 0; }
h1, h2, h3, h4, h5, h6 { font-weight: normal; }
h3 {
  font-size: 0.85rem;
  color: var(--secondary);
  margin: 8px 0 16px 0;
}
h4 { margin: 0; }

.inline-form {
  display: inline;
  margin: 0;
  padding: 0;
}

input:not([type="file"]):not([type="checkbox"]),
textarea {
  background-color: var(--tertiary);
  color: inherit;
  border: none;
  border-radius: 4px;
  padding: 6px 8px;
  box-sizing: border-box;
  outline: none;
  transition: box-shadow 0.15s;
}

input:not([type="file"]):not([type="checkbox"]):focus,
textarea:focus {
  box-shadow: 0 0 0 1px var(--secondary);
}

/* header */
header {
  display: flex;
  align-items: center;
}

header h1 {
  margin: 0;
  margin-right: 30px;
}

header h1 a:hover {
  text-decoration: none;
}

header nav {
  display: flex;
}

header nav a {
  text-decoration: none;
  margin-right: 40px;
}

/* footer */
footer {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 10px;
}

footer nav {
  display: flex;
}

footer nav a,
footer nav button {
  text-decoration: none;
  margin: 0 10px;
}

footer nav button {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
  color: var(--primary);
}

footer nav button:hover {
  text-decoration: none;
}

footer p {
  padding-top: 4px;
}

/* auth pages */
.auth-page {
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 70vh;
}

.auth-page h3 {
  font-size: 1rem;
  color: var(--primary);
}

.auth-page p {
  margin-bottom: 8px;
}

.auth-page > div {
  width: 250px;
  max-width: 100%;
}

.auth-page form {
  width: 100%;
}

.auth-page form div + div {
  padding-top: 8px;
}

.auth-page input:not([type="checkbox"]) {
  width: 100%;
  box-sizing: border-box;
}


.auth-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.auth-link {
  color: var(--secondary);
}

.auth-page #error {
  min-height: 1.5em;
}

.auth-page .error {
  color: var(--red);
  word-break: break-word;
  margin: 0;
}

.w-full { width: 100%; }
.bold { font-weight: bold; }
.error { color: var(--red); }
.success { color: var(--green); }
.danger { color: var(--red); }

.center-column {
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
}

/* message box (error pages) */
.message-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  aspect-ratio: 2;
}

.message-box.error p {
  color: var(--red);
}

/* feed + posts */
.post-card {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--tertiary);
}

.post-card:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.post-actions { margin-top: 8px; position: relative; }

.post-media { margin: 4px 0; position: relative; }
.post-media.landscape,
.post-carousel.landscape .post-carousel-slide { aspect-ratio: 4 / 3; }
.post-media.portrait,
.post-carousel.portrait .post-carousel-slide { aspect-ratio: 3 / 4; }

.post-media img,
.post-media video,
.post-media .video-player,
.post-carousel-slide img,
.post-carousel-slide video,
.post-carousel-slide .video-player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 4px;
}

.post-processing {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tertiary);
  color: var(--secondary);
  border-radius: 4px;
}

.post-carousel { margin: 4px 0; }

.post-carousel-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  border-radius: 4px;
}

html.js .post-carousel-track { scrollbar-width: none; }
html.js .post-carousel-track::-webkit-scrollbar { display: none; }

.post-carousel-slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  position: relative;
}

.post-carousel-nav.prev,
.post-carousel-nav.next {
  position: absolute;
  top: 0;
}
.post-carousel-nav.prev { left: 0; }
.post-carousel-nav.next { right: 0; }
.post-carousel-nav[hidden] { display: none; }

.video-player {
  position: relative;
  cursor: pointer;
}

.video-player::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 1.5rem 0 1.5rem 2.5rem;
  border-color: transparent transparent transparent var(--primary);
  pointer-events: none;
}

.video-player.playing::after {
  opacity: 0;
}

.post-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  /*margin-bottom: 4px;*/
}

.post-caption {
  margin-bottom: 4px;
  text-align: left;
}
.mention { color: var(--magenta); }
.chat-post-link { color: var(--magenta); display: block; margin-bottom: 4px; text-decoration: none; }
.chat-post-thumb { width: 80px; height: 80px; object-fit: cover; border-radius: 4px; }
.chat-msg-self .chat-post-thumb { margin-left: auto; }
.chat-msg-self .chat-post-link { text-align: right; }
.chat-post-caption { display: block; }
.chat-post-caption:hover { text-decoration: underline; }
.chat-post-label { display: block; font-size: 0.8rem; color: var(--secondary); }
.reposted-by { margin-bottom: 2px; }
.reposted-by a { color: var(--blue); }
.mention-suggest { color: var(--secondary); margin-bottom: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.mention-suggest div { cursor: pointer; }
.mention-suggest div:hover, .mention-suggest div.active { color: var(--magenta); }


.post-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--secondary);
}

.post-actions .like-button {
  display: flex;
  align-items: center;
}

/* inline "more" — native <details> disclosure, no JS required.
   the panel hangs centered directly under the "more" button so it clearly
   belongs to this post (anchored to the button, not the whole row). */
.post-more { position: relative; }
.post-more > summary {
  list-style: none;
  cursor: pointer;
}
.post-more > summary::-webkit-details-marker { display: none; }
.post-more[open] > summary { color: var(--primary); }
.post-more-content {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 4px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  white-space: nowrap;
  background-color: var(--bg);
  border: 1px solid var(--tertiary);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
/* de-emphasise the stat links so action buttons read as the primary content */
.post-more-content > a:not(.btn) {
  font-size: 0.85rem;
  color: var(--secondary);
}


/* user lists */
.user-list-item {
  border-radius: 4px;
  transition: background-color 0.15s;
}

.user-list-item:hover {
  background-color: var(--tertiary);
}

.user-list-item > a {
  display: block;
  padding: 8px;
  text-decoration: none;
}

.user-list-item > a:hover {
  text-decoration: underline;
}

/* responsive */
@media (max-width: 550px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  header nav {
    margin-bottom: 10px;
  }

  header nav a {
    margin-right: 20px;
  }
}
