/* SydSI News and the admin portal. A typed ledger on white paper: monospace,
   black ink, and Annomate's blue kept for votes, the main button and focus. */

body.news {
  --ink: #0b0b0b;
  --soft: #6f6f6f;
  --faint: #b9b9b9;
  --rule: #e6e6e6;
  --paper: #ffffff;
  --line-strong: #d9d9d8;
  --accent: #3a6cf4;
  --accent-strong: #2c5be0;
  --btn: #ffffff;
  --btn-shadow: 0 1px 1px rgb(0 0 0 / 0.04), inset 0 -1px 0 rgb(0 0 0 / 0.03);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease: cubic-bezier(0.2, 0, 0, 1);

  font:
    14px / 1.55 ui-monospace,
    SFMono-Regular,
    Menlo,
    Consolas,
    monospace;
  color: var(--ink);
  background: var(--paper);
  max-width: none;
  padding: 0;
}

@media (prefers-color-scheme: dark) {
  body.news {
    --ink: #f2f2f2;
    --soft: #9a9a9a;
    --faint: #555555;
    --rule: #262626;
    --paper: #0a0a0a;
    --line-strong: #333333;
    --accent: #5b86ff;
    --accent-strong: #4a76f2;
    --btn: #1c1c1c;
    --btn-shadow: 0 1px 1px rgb(0 0 0 / 0.3), inset 0 1px 0 rgb(255 255 255 / 0.04);
  }
}

.news a {
  color: inherit;
  text-decoration: none;
}
.news a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.news :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.news main {
  padding: 0.5rem 2rem 5rem;
}
.news h1 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 1rem 0 0.25rem;
}
.news h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 2.5rem 0 0.75rem;
}

.lede {
  color: var(--soft);
  margin: 0 0 2.25rem;
  max-width: 60ch;
}
.lede::before {
  content: "> ";
  color: var(--faint);
}

/* Stories: numbered, with the vote key and count in a column on the left. */

.news .stories {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: story;
}
.news .story {
  display: grid;
  grid-template-columns: 3ch 4ch 1fr;
  align-items: start;
  margin: 0;
  padding: 0.6rem 0;
  counter-increment: story;
}
.news .story::before {
  content: counter(story) ".";
  color: var(--faint);
  text-align: right;
  padding-right: 1ch;
  transition: color 150ms ease;
}
.news .story:hover::before {
  color: var(--ink);
}
.news .votes {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.8rem;
  color: var(--soft);
  font-variant-numeric: tabular-nums;
}
.news .title {
  font-weight: 700;
}
.news .domain {
  color: var(--soft);
}

.news .byline {
  color: var(--soft);
  font-size: 0.86rem;
  margin-top: 0.1rem;
}
.news .byline a {
  color: var(--soft);
}
.news .byline a:hover {
  color: var(--ink);
}

/* Tags read as [policy]. The brackets open up on hover. */
.news .tag {
  white-space: nowrap;
  border: 0;
  padding: 0;
  font-size: inherit;
  color: var(--soft);
  opacity: 1;
}
.news .tag::before,
.news .tag::after {
  display: inline-block;
  color: var(--faint);
  transition: transform 150ms ease;
}
.news .tag::before {
  content: "[";
}
.news .tag::after {
  content: "]";
}
.news .tag:hover {
  color: var(--ink);
  text-decoration: none;
}
.news .tag:hover::before {
  transform: translateX(-3px);
}
.news .tag:hover::after {
  transform: translateX(3px);
}

/* Votes: a small key that turns blue once pressed. */

.news .vote {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--btn);
  box-shadow: var(--btn-shadow);
  font:
    9px / 1 ui-monospace,
    SFMono-Regular,
    Menlo,
    Consolas,
    monospace;
  color: var(--soft);
  opacity: 1;
  cursor: pointer;
  vertical-align: 1px;
  transition:
    transform 140ms var(--spring),
    color 120ms var(--ease),
    background 120ms var(--ease);
}
.news button.vote:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--btn) 94%, var(--ink));
}
.news button.vote:active {
  transform: scale(0.88);
}
.news .vote.voted {
  border-color: var(--accent-strong);
  background: linear-gradient(to bottom, color-mix(in srgb, var(--accent) 92%, white), var(--accent));
  box-shadow:
    0 1px 2px rgb(30 60 160 / 0.25),
    inset 0 1px 0 rgb(255 255 255 / 0.22);
  color: #fff;
}
.news button.vote.voted:hover {
  color: #fff;
  background: linear-gradient(to bottom, var(--accent), var(--accent-strong));
}
.news span.vote {
  cursor: default;
  box-shadow: none;
}

/* Discussion */

.news .post-body {
  margin: 0.5rem 0 1.5rem 5ch;
  max-width: 64ch;
}
.news .post-actions {
  margin: 0 0 1rem 5ch;
  color: var(--soft);
}

/* Comments are drawn as a tree, with ├── and └── for each reply. */
.news .comments {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 0;
}
.news .comments .comments {
  margin-left: 1ch;
}
.news .comments li {
  position: relative;
  margin: 0;
  padding: 0.75rem 0 0.25rem;
}
.news .comments .comments li {
  padding-left: 4ch;
}
.news .comments .comments li::before {
  content: "├──";
  position: absolute;
  left: 0;
  top: 0.75rem;
  color: var(--faint);
}
.news .comments .comments li:last-child::before {
  content: "└──";
}
/* The trunk carries on past every reply but the last. */
.news .comments .comments li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 0.5ch;
  top: 2rem;
  bottom: -0.75rem;
  border-left: 1px solid var(--faint);
}
.news .comments p {
  margin: 0.25rem 0;
  max-width: 64ch;
}
.news .comment-meta {
  color: var(--soft);
  font-size: 0.86rem;
}
.news .comment-meta a {
  color: var(--soft);
}
.news details summary {
  display: inline-block;
  cursor: pointer;
  color: var(--soft);
  font-size: 0.86rem;
  list-style: none;
}
.news details summary::-webkit-details-marker {
  display: none;
}
.news details summary::before {
  content: "↳ ";
}
.news details summary:hover {
  color: var(--ink);
}

/* Forms */

.news form {
  max-width: 64ch;
}
.news form.inline {
  display: inline;
}
.news label {
  color: var(--soft);
}
.news input[type="text"],
.news input[type="url"],
.news textarea {
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0.55rem 0.9ch;
  transition:
    border-color 120ms var(--ease),
    box-shadow 120ms var(--ease);
}
.news input:focus,
.news textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.news fieldset legend {
  color: var(--soft);
}
.news .check {
  color: var(--ink);
}
/* The main button, as in Annomate. */
.news button[type="submit"]:not(.link):not(.vote) {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 1.5ch;
  font: inherit;
  font-weight: 600;
  border: 1px solid var(--accent-strong);
  border-radius: 6px;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--accent) 92%, white), var(--accent));
  box-shadow:
    0 1px 2px rgb(30 60 160 / 0.25),
    inset 0 1px 0 rgb(255 255 255 / 0.22);
  color: #fff;
  cursor: pointer;
  transition:
    transform 140ms var(--spring),
    background 120ms var(--ease);
}
.news button[type="submit"]:not(.link):not(.vote):hover {
  background: linear-gradient(to bottom, var(--accent), var(--accent-strong));
}
.news button[type="submit"]:not(.link):not(.vote):active {
  transform: scale(0.97);
}
.news .link {
  color: var(--soft);
  text-decoration: none;
}
.news .link:hover {
  color: var(--ink);
}
.news .notice {
  color: var(--ink);
  font-weight: 700;
}
.news .notice::before {
  content: "! ";
}

/* Tables */

.news table {
  font-size: 0.86rem;
}
.news th {
  color: var(--soft);
  font-weight: 400;
  border-bottom: 1px solid var(--ink);
}
.news td {
  border-bottom: 1px solid var(--rule);
}
.news code {
  font-size: inherit;
  word-break: break-all;
}

/* Tag choices on the submit form, each with an (i) that shows what the tag is for. */

.tag-choice {
  display: inline-flex;
  align-items: center;
  gap: 0.5ch;
}
.info {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: none;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  color: var(--soft);
  cursor: help;
}
.info:hover,
.info:focus-visible {
  color: var(--ink);
  border-color: var(--ink);
}
.info::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: -0.5ch;
  width: max-content;
  max-width: 30ch;
  padding: 0.35rem 0.6rem;
  border-radius: 4px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  z-index: 10;
}
.info:hover::after,
.info:focus::after {
  opacity: 1;
}

/* Notifications, newest first, with the ones you hadn't seen marked. */

.notices {
  list-style: none;
  margin: 0;
  padding: 0;
}
.notice-row {
  padding: 0.45rem 0 0.45rem 1.5ch;
  border-left: 2px solid transparent;
}
.notice-row.unread {
  border-left-color: var(--accent);
  font-weight: 700;
}
.notices .meta {
  color: var(--faint);
  font-weight: 400;
}
/* A link that reads as a button, quieter than the blue submit ones. */
.news a.outline {
  display: inline-block;
  padding: 0.2rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}
.news a.outline:hover {
  border-color: var(--ink);
  text-decoration: none;
}
.news .form-actions {
  display: flex;
  align-items: center;
  gap: 2ch;
}
.news .follow {
  margin: 0.75rem 0 1.5rem;
}

/* Suggestions for an @username, at the cursor. */

.mention-menu {
  position: absolute;
  z-index: 35;
  min-width: 24ch;
  max-width: 40ch;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.12);
}
.mention-option {
  display: flex;
  align-items: center;
  gap: 1ch;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.mention-option[aria-selected="true"] {
  background: var(--rule);
}
.mention-pic {
  width: 18px;
  height: 18px;
  flex: none;
}
.mention-handle {
  font-weight: 700;
}
.mention-name {
  color: var(--soft);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Members, newest first. */

.members {
  list-style: none;
  margin: 0;
  padding: 0;
}
.members .row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 1ch;
  min-height: 1.6rem;
  padding: 0.2rem 0;
}
.members .member {
  font-weight: 700;
}
.members .row .badge {
  font-size: inherit;
  margin: 0;
}
.members .meta {
  color: var(--faint);
  font-size: inherit;
  opacity: 1;
}

.news .subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 2.5ch;
  margin: 0 0 1.5rem;
}
.news .subnav a {
  color: var(--soft);
}
.news .subnav a:hover,
.news .subnav a[aria-current="page"] {
  color: var(--ink);
}
.news .subnav a[aria-current="page"] {
  font-weight: 700;
}

@media (max-width: 40rem) {
  .news main {
    padding: 0.5rem 1rem 4rem;
  }
  .news .story {
    grid-template-columns: 2.5ch 4ch 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .news * {
    transition: none !important;
  }
}

/* Profiles */

.avatar {
  border-radius: 6px;
  background: var(--rule);
  vertical-align: middle;
}
/* Members without GitHub have no picture, so they get a blank tile. */
span.avatar {
  display: inline-block;
  flex: none;
}
.members .member {
  display: inline-flex;
  align-items: center;
  gap: 1ch;
}
.members .real-name {
  color: var(--soft);
}
.news .badge {
  color: var(--soft);
  font-weight: 400;
  font-size: 0.86rem;
  margin-left: 1ch;
}
.news .badge::before {
  content: "(";
}
.news .badge::after {
  content: ")";
}
.profile {
  display: flex;
  gap: 2ch;
  align-items: center;
  margin: 1rem 0 1.5rem;
}
.profile .avatar {
  border-radius: 10px;
}
.profile h1 {
  margin: 0;
}
.profile .byline {
  margin: 0.15rem 0 0;
}
.profile-links {
  margin: 0.35rem 0 0;
}
.news .about {
  max-width: 64ch;
  margin-bottom: 1.5rem;
}

/* Images and videos in posts */

.news .embed {
  display: block;
  margin: 0.75rem 0;
  max-width: 64ch;
}
.news .embed img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}
.news .embed.video {
  aspect-ratio: 16 / 9;
}
.news .embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 6px;
  background: var(--rule);
}

/* Drawers, after Annomate's */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgb(0 0 0 / 0.08);
  animation: drawer-fade 160ms var(--ease);
}
.drawer {
  position: fixed;
  top: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 41;
  display: flex;
  flex-direction: column;
  width: min(560px, calc(100vw - 16px));
  border-radius: 12px;
  background: var(--paper);
  box-shadow:
    0 0 0 1px rgb(0 0 0 / 0.05),
    0 6px 16px rgb(0 0 0 / 0.08),
    0 20px 48px rgb(0 0 0 / 0.08);
  animation: drawer-slide 240ms var(--ease);
}
.drawer-head {
  display: flex;
  align-items: center;
  gap: 2ch;
  height: 52px;
  padding: 0 12px 0 20px;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}
.drawer-head h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drawer-open {
  color: var(--soft);
  font-size: 0.86rem;
  white-space: nowrap;
}
.drawer-open:hover {
  color: var(--ink);
}
.drawer-close {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--btn);
  box-shadow: var(--btn-shadow);
  color: var(--soft);
  font: inherit;
  cursor: pointer;
  transition: transform 140ms var(--spring);
}
.drawer-close:hover {
  color: var(--ink);
}
.drawer-close:active {
  transform: scale(0.92);
}
.drawer-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
}
.drawer-body .post-body,
.drawer-body .post-actions {
  margin-left: 7ch;
}
@keyframes drawer-fade {
  from {
    opacity: 0;
  }
}
@keyframes drawer-slide {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
}
@media (prefers-color-scheme: dark) {
  .scrim {
    background: rgb(0 0 0 / 0.4);
  }
  .drawer {
    box-shadow:
      0 0 0 1px rgb(255 255 255 / 0.06),
      0 20px 48px rgb(0 0 0 / 0.5);
  }
}
@media (prefers-reduced-motion: reduce) {
  .scrim,
  .drawer {
    animation: none;
  }
}

/* A member's picture next to their name in bylines and comments. */
.news .who {
  display: inline-flex;
  align-items: center;
  gap: 0.6ch;
  vertical-align: bottom;
}
.news .who .avatar {
  border-radius: 4px;
}

/* A comment that has just been posted, briefly marked. */
@keyframes just-added {
  from {
    background: color-mix(in srgb, var(--accent) 12%, transparent);
  }
}
.news .just-added {
  animation: just-added 1.6s var(--ease);
}
@media (prefers-reduced-motion: reduce) {
  .news .just-added {
    animation: none;
  }
}
