/* ---- Writing an announcement (Nov 6, Bryan picked "A. Write it like the post") ----
   The box looks like the finished post: the same title and lines. On a computer a dark bar sits over
   the line you tap and a + waits beside an empty line; on a phone it opens full screen with the tools
   on top of the keyboard. Polls live here too, for posts and for any Discussions thread. */

/* Links in posts read as links (they used to look like plain words). */
.news-body .ann-text a,
.news-body > p > a,
.ann-image figcaption a,
.ann-spotlight-note a {
  color: var(--purple);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.pc {
  position: relative;
}
@media (min-width: 761px) {
  /* Room on the left for the + beside an empty line. */
  .news-post.is-writing {
    padding-left: 64px;
  }
}
.pc-title {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  /* The post's own title, so writing it looks like reading it. */
  font-family: 'Bricolage Grotesque', 'DM Sans', sans-serif;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.025em;
  resize: none;
  overflow: hidden;
}
.pc-title:focus,
.pc-doc:focus {
  outline: none;
}
.pc-title::placeholder {
  color: var(--muted);
  opacity: 1;
}
.pc-doc {
  min-height: 160px;
  caret-color: var(--purple);
  overflow-wrap: anywhere;
}
.pc-doc.is-empty > p:first-child::before {
  content: 'Write your post…';
  float: left;
  height: 0;
  color: var(--muted);
  pointer-events: none;
}

/* Pieces in the post (picture, poll, button, divider, spotlight), each with its own ✕. */
.pc-island {
  position: relative;
}
.pc-x,
.poll-card-x,
.poll-edit-x {
  display: inline-grid;
  place-items: center;
  flex: none;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.pc-x:hover,
.pc-x:focus-visible,
.poll-card-x:hover,
.poll-edit-x:hover {
  background: var(--soft);
  color: var(--ink);
}
.pc-x[data-armed='1'] {
  margin-left: auto;
  color: var(--ann-red);
}
.pc-divider {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pc-divider .ann-divider {
  flex: 1;
  margin: 14px 0;
}
.pc-picture > .pc-x {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  border: 1px solid var(--line);
  background: var(--paper);
}
.pc-picture img:not([src]) {
  width: 100%;
  min-height: 140px;
  background: var(--soft);
}
.pc-caption {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}
.pc-caption:focus {
  outline: none;
  color: var(--ink);
}
.pc-card,
.poll-card {
  display: grid;
  gap: 8px;
  padding: 10px 14px 14px;
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  background: var(--paper);
}
.pc-card-head,
.poll-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.pc-card input,
.pc-card textarea,
.poll-edit input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.4;
}
.pc-card textarea {
  display: block;
  resize: none;
  overflow: hidden;
}
.pc-card input:focus,
.pc-card textarea:focus,
.poll-edit input:focus {
  outline: none;
  border-color: var(--purple);
}
.pc-card input.pc-poll-q {
  padding: 2px 0 8px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  font-size: 16px;
  font-weight: 700;
}
.pc-card input.pc-poll-q:focus {
  border-bottom-color: var(--purple);
}
.pc-card input.pc-button-label {
  font-weight: 600;
}
.pc-picked {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
}
.pc-spot-results {
  display: grid;
  gap: 4px;
}
.pc-spot-results:empty {
  display: none;
}
.pc-spot-results button {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
}
.pc-spot-results button:hover {
  border-color: var(--purple);
}
.pc-spot-results small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
.pc-poll-said {
  margin: 0;
  font-weight: 700;
}
.pc-poll-said-opts {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.pc-poll-said-opts li {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-size: 15px;
}

/* A poll's options while it's being written (the composer and the New thread box). */
.poll-edit {
  display: grid;
  gap: 6px;
}
.poll-edit-opt {
  display: flex;
  align-items: center;
  gap: 4px;
}
.poll-edit-opt input {
  flex: 1;
}
.poll-edit-add {
  padding: 9px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font-size: 15px;
  text-align: left;
}
.poll-edit-add:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.poll-edit-len {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}
.poll-edit-len select {
  width: auto;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

/* On a computer: the dark bar over the line you tapped, and the + in the margin beside an empty line. */
.pc-bar {
  position: absolute;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--on-ink);
}
.pc-bar[hidden],
.pc-plus[hidden],
.pc-pop[hidden] {
  display: none;
}
.pc-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.pc-tool:hover,
.pc-tool[aria-pressed='true'],
.pc-tool[aria-expanded='true'] {
  background: color-mix(in srgb, var(--on-ink) 22%, transparent);
}
.pc-tool:disabled {
  opacity: 0.35;
}
.pc-tool svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pc-sep {
  width: 1px;
  height: 18px;
  margin: 0 2px;
  background: color-mix(in srgb, var(--on-ink) 35%, transparent);
}
.pc-link-in {
  width: min(300px, 52vw);
  height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 5px;
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
}
.pc-link-in:focus {
  outline: 2px solid var(--purple);
  outline-offset: 0;
}
.pc-plus {
  position: absolute;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  font-size: 19px;
  font-weight: 500;
  line-height: 1;
}
.pc-plus:hover {
  border-color: var(--purple);
  color: var(--purple);
}
.pc-plus[aria-expanded='true'] {
  transform: rotate(45deg);
}
.pc-pop {
  position: absolute;
  z-index: 6;
}
.pc-adds {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pc-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.pc-add:hover {
  border-color: var(--ink);
}
.pc-add[aria-disabled='true'] {
  opacity: 0.45;
}
.pc-menu {
  display: grid;
  min-width: 210px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.08);
}
.pc-menu-row {
  display: grid;
}
.pc-menu-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--ink);
  font-size: 15px;
  text-align: left;
}
.pc-menu-item:hover {
  background: var(--soft);
}
.pc-menu-item[aria-checked='true'] {
  color: var(--purple);
  font-weight: 700;
}
.pc-menu-item.is-h2 {
  font-size: 20px;
  font-weight: 700;
}
.pc-menu-item.is-h3 {
  font-size: 17px;
  font-weight: 700;
}
.pc-menu-item.is-quote {
  border-left: 3px solid var(--purple);
  border-radius: 0 6px 6px 0;
}
.pc-menu-item.is-bullets::before {
  content: '•\00a0\00a0';
}
.pc-menu-item.is-numbers::before {
  content: '1.\00a0\00a0';
}
.pc-menu-lab {
  margin: 8px 10px 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}
.pc-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.pc-foot .publish-consent {
  font-size: 14px;
}
.pc-gap {
  flex: 1;
}
.pc-topic {
  width: auto;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
}
.pc-mail {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* On a phone: full screen, Cancel and Post at the top, the tools on top of the keyboard. */
@media (max-width: 760px) {
  .pc.is-full {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--paper);
  }
  html:has(#announcements-view:not([hidden]) .pc.is-full) body {
    overflow: hidden;
  }
  html:has(#announcements-view:not([hidden]) .pc.is-full) :is(.phone-tabs, .player, .feedback-tab) {
    visibility: hidden;
  }
  .pc-top {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
    border-bottom: 1px solid var(--line);
    background: var(--paper);
  }
  .pc-top b {
    font-size: 15px;
  }
  .pc-top:has([data-pc-cancel][data-armed]) b {
    display: none;
  }
  .pc-top .text-button {
    color: var(--ink);
    font-size: 14px;
  }
  .pc-top .button.small {
    min-height: 36px;
    padding: 8px 16px;
    font-size: 13px;
  }
  .pc.is-full .pc-page {
    flex: 1 0 auto;
    padding: 16px max(16px, env(safe-area-inset-right)) calc(76px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }
  .pc.is-full .pc-title {
    font-size: 23px;
  }
  .pc.is-full .pc-doc {
    min-height: 36vh;
  }
  .pc.is-full .pc-foot {
    gap: 8px 16px;
  }
  .pc.is-full .pc-bar {
    position: fixed;
    left: 0;
    right: 0;
    display: flex;
    gap: 2px;
    padding: 6px max(10px, env(safe-area-inset-right)) 6px max(10px, env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    border-radius: 0;
    background: var(--paper);
    color: var(--ink);
  }
  .pc.is-full .pc-bar:not(.has-keyboard) {
    padding-bottom: max(6px, env(safe-area-inset-bottom));
  }
  .pc.is-full .pc-tool {
    min-width: 42px;
    height: 40px;
    border-radius: 8px;
    font-size: 16px;
  }
  .pc.is-full .pc-tool:hover,
  .pc.is-full .pc-tool[aria-pressed='true'],
  .pc.is-full .pc-tool[aria-expanded='true'] {
    background: var(--soft);
    color: var(--purple);
  }
  .pc.is-full .pc-add-tool {
    border: 1.5px solid var(--ink);
    font-size: 20px;
    font-weight: 500;
  }
  .pc.is-full .pc-link-in {
    flex: 1;
    width: auto;
    height: 40px;
    background: var(--bg);
    font-size: 16px;
  }
  .pc.is-full .pc-pop {
    position: fixed;
    left: 0;
    right: 0;
    padding: 10px max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    background: var(--paper);
  }
  /* The styles as a row of chips (and the heading fonts as a second row), each the same size. */
  .pc.is-full .pc-menu {
    gap: 8px;
    min-width: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }
  .pc.is-full .pc-menu-row {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .pc.is-full .pc-menu-item {
    flex: none;
    width: auto;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 15px;
    white-space: nowrap;
  }
  .pc.is-full .pc-menu-item.is-h2,
  .pc.is-full .pc-menu-item.is-h3 {
    font-size: 15px;
  }
  .pc.is-full .pc-menu-item.is-quote {
    border-left: 3px solid var(--purple);
  }
  .pc.is-full .pc-menu-item[aria-checked='true'] {
    border-color: var(--purple);
    background: var(--soft);
  }
  .pc.is-full .pc-menu-lab {
    flex: none;
    margin: 0 2px 0 0;
  }
  .pc.is-full .pc-adds {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .pc.is-full .pc-add {
    height: 40px;
  }
}

/* ---- Polls (Nov 6): in announcements and in any Discussions thread ----
   Tap an option to vote; once the counts show, a bar fills behind each option. */
.poll {
  display: grid;
  gap: 8px;
}
.poll-q {
  margin: 0;
  font-weight: 700;
  line-height: 1.4;
}
.poll-opts {
  display: grid;
  gap: 8px;
}
.poll-opt {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  overflow: hidden;
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
}
button.poll-opt:hover {
  border-color: var(--purple);
}
.poll-opt.has-count {
  border-color: var(--line);
}
.poll-opt.has-count::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  z-index: -1;
  width: var(--poll-fill, 0%);
  background: var(--soft);
}
.poll-opt.is-mine {
  border-color: var(--purple);
}
.poll-text {
  overflow-wrap: anywhere;
}
.poll-tick {
  color: var(--purple);
}
.poll-pct {
  flex: none;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.poll-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.poll-end.text-button {
  min-height: 32px;
  padding: 4px 0;
  font-size: 13px;
}
.poll-end[data-armed='1'] {
  color: var(--ann-red);
}
.thread-poll {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--purple);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
/* The New thread box: a poll under the words, and the admin's pin under the kinds. */
.cb-tool[aria-pressed='true'] {
  background: var(--soft);
  color: var(--ink);
}
.cb-poll {
  margin-top: 2px;
}
.cb-pin {
  font-size: 13px;
}
