/* bulletins.css — the Bulletins page (teacher/page-bulletins.js).
   Colours are the app's tokens, so dark mode follows. Every class starts
   with bulletin-: an ad blocker hides names like post-… and feed-…
   (tests/adblock-names.test.js). */

/* A closed menu, composer, list or file input is never drawn: this beats any
   display rule below, as the hidden attribute alone does not. */
.bulletin-page [hidden] {
  display: none !important;
}

.bulletin-page {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 22px 16px 40px;
}
/* Polished Nov 18 (Colin: "boring and hard to follow"): a card per bulletin
   with its kind in colour at the left, the words large, and what came of it
   (who has seen it, Got It, the linked work) on its own line under a rule. */
.bulletin-col {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Header ── */
.bulletin-top {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  column-gap: 12px;
  row-gap: 2px;
}
/* View as Student, at the header's right end. */
.bulletin-view-as {
  margin-left: auto;
  align-self: center;
}
.bulletin-title {
  font-size: 26px;
  letter-spacing: -0.01em;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}
.bulletin-sub {
  font-size: var(--text-base);
  color: var(--text-2);
}
.bulletin-sub a,
.bulletin-note-link {
  color: var(--link);
  text-decoration: none;
}
.bulletin-sub a:hover,
.bulletin-note-link:hover {
  text-decoration: underline;
}

#bulletin-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Cards ── */
.bulletin-card {
  background: var(--surface);
  border: 1px solid var(--divider-medium);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* ── Composer ── */
/* The closed bar: a grey field to write in, then the two ways to start with
   something to share. Same look as the Assignments bar. */
.bulletin-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
}
.bulletin-bar .tb-action-btn {
  flex-shrink: 0;
}
.bulletin-bar-open {
  flex: 1;
  min-width: 0;
  height: 36px;
  display: block;
  text-align: left;
  background: var(--seg-track);
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  font: inherit;
  font-size: var(--text-md);
  color: var(--text-2);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background-color 0.15s;
}
.bulletin-bar-open:hover {
  background: rgba(118, 118, 128, 0.18);
}
/* The picture on a link card in a bulletin. */
.bulletin-linkcard-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
}
.bulletin-linkcard-icon svg {
  width: 20px;
  height: 20px;
}

.bulletin-compose {
  display: grid;
  grid-template-rows: 1fr;
}
.bulletin-set {
  min-height: 0;
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bulletin-set:disabled {
  opacity: 0.7;
}
/* The feed slides down under the box as it opens. */
.bulletin-compose-opening {
  animation: bulletin-open 200ms var(--motion-ease, ease-out);
}
.bulletin-compose-opening .bulletin-set {
  overflow: hidden;
}
@keyframes bulletin-open {
  from {
    grid-template-rows: 0fr;
  }
  to {
    grid-template-rows: 1fr;
  }
}
/* A new bulletin glides in from just above its place: it moves, it does not fade. */
.bulletin-glide {
  animation: bulletin-glide 200ms var(--motion-ease, ease-out);
}
@keyframes bulletin-glide {
  from {
    transform: translateY(-14px);
  }
  to {
    transform: translateY(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .bulletin-compose-opening,
  .bulletin-glide {
    animation: none;
  }
}

.bulletin-kinds {
  display: flex;
  width: 100%;
}
.bulletin-kinds .seg-btn {
  flex: 1;
}
.bulletin-vh {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.bulletin-field {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: var(--text-md);
  color: var(--text);
  background: var(--seg-track);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 12px;
  height: 36px;
  transition: background-color 0.15s;
}
/* The ring is the app's own blue one (styles.css, input:focus). */
.bulletin-field:focus {
  background: var(--surface);
}
.bulletin-field::placeholder {
  color: var(--text-2);
}
textarea.bulletin-field {
  resize: vertical;
  height: auto;
  min-height: 84px;
  padding: 8px 12px;
  line-height: 1.45;
}
.bulletin-count {
  align-self: flex-end;
  margin-top: -8px;
  font-size: var(--text-xs);
  color: var(--text-3);
}
.bulletin-count.is-over {
  color: var(--danger);
  font-weight: 600;
}
.bulletin-pair {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.bulletin-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 180px;
  font-size: var(--text-sm);
  color: var(--text-2);
  font-weight: 500;
}
.bulletin-hint {
  font-size: var(--text-sm);
  color: var(--text-2);
}
.bulletin-problem {
  font-size: var(--text-sm);
  color: var(--danger);
}
.bulletin-chips {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bulletin-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 8px 6px 10px;
  min-height: 40px;
  font-size: var(--text-base);
  color: var(--text);
}
.bulletin-chip-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bulletin-chip-pages {
  color: var(--text-2);
  font-size: var(--text-sm);
  white-space: nowrap;
}
.bulletin-text-btn {
  background: none;
  border: 0;
  padding: 4px 6px;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--link);
  cursor: pointer;
  border-radius: var(--radius-xs);
}
.bulletin-text-btn:hover {
  text-decoration: underline;
}
.bulletin-text-btn.is-danger {
  color: var(--danger);
}
/* Let Students React: the words at the left, the three answers students
   see beside them when it is on, the switch at the right. */
.bulletin-react-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  min-height: 34px;
  padding: 0 2px;
}
.bulletin-react-label {
  font-size: var(--text-md);
  font-weight: 500;
  color: var(--text);
}
.bulletin-react-chip {
  height: 24px;
  border-radius: 8px;
  padding: 0 10px;
  background: var(--seg-track);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.bulletin-sw {
  margin-left: auto;
  width: 38px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 11px;
  background: rgba(118, 118, 128, 0.32);
  position: relative;
  flex: none;
  cursor: pointer;
  transition: background-color 0.15s;
}
.bulletin-sw[aria-checked='true'] {
  background: var(--active-fill);
}
.bulletin-sw-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s;
}
.bulletin-sw[aria-checked='true'] .bulletin-sw-knob {
  transform: translateX(16px);
}
.bulletin-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.bulletin-actions-end {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}
.bulletin-page .tb-action-btn.bulletin-post-btn {
  width: 80px;
  padding: 0;
  justify-content: center;
}
.bulletin-page .tb-action-btn:disabled {
  opacity: 0.45;
  cursor: default;
  filter: none;
  box-shadow: none;
}

/* A bulletin that was not posted, offered back. */
.bulletin-returned-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 10px 14px;
  font-size: var(--text-base);
  color: var(--text);
}
.bulletin-returned-line:empty,
#bulletin-returned:empty {
  display: none;
}
#bulletin-returned {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Feed ── */
/* Day and Pinned headings: a label with a rule running to the right. */
.bulletin-day {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-2);
  margin-top: 10px;
}
/* Pinned, with a pin, as class streams mark it. */
.bulletin-day.is-pinned::before {
  content: '';
  width: 14px;
  height: 14px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M16 3l5 5-3 1-4 4 1 5-2 2-4-4-5 5-1-1 5-5-4-4 2-2 5 1 4-4z'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M16 3l5 5-3 1-4 4 1 5-2 2-4-4-5 5-1-1 5-5-4-4 2-2 5 1 4-4z'/%3E%3C/svg%3E")
    center / contain no-repeat;
}
.bulletin-day::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--divider-medium);
}
.bulletin-post {
  padding: 16px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow var(--duration-micro, 0.15s) ease;
}
.bulletin-post:hover {
  box-shadow: var(--shadow-md, 0 2px 10px rgba(0, 0, 0, 0.08));
}
.bulletin-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-sm);
  color: var(--text-2);
}
.bulletin-kind-label {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--seg-track);
  color: var(--text-2);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
/* A reminder in the app's notice colours, as the Dashboard tile labels it. */
.bulletin-post.is-reminder .bulletin-kind-label {
  background: var(--notice-bg);
  color: var(--notice-text);
}
.bulletin-time {
  margin-left: auto;
  white-space: nowrap;
}
.bulletin-body {
  font-size: var(--text-md);
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.bulletin-linkcard {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.bulletin-linkcard:hover {
  background: var(--overlay-hover);
}
.bulletin-linkcard-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.bulletin-linkcard-host {
  font-size: var(--text-xs);
  color: var(--text-2);
}
.bulletin-file {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bulletin-file-name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
}
.bulletin-file-pages {
  font-weight: 400;
  color: var(--text-2);
  font-size: var(--text-sm);
  margin-left: 6px;
}
.bulletin-thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.bulletin-thumb-link {
  display: block;
  width: 84px;
  height: 108px;
  border-radius: var(--radius-xs);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.bulletin-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* A page still on its way (_loadPictures sets its source once the address is
   ready): the plain grey box, not the browser's broken-picture mark and alt
   text (Colin, Nov 16; the same rule as img[data-work-pic] in styles.css). */
.bulletin-thumb:not([src]) {
  content: url('data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7');
  background: #eceef2;
  color: transparent;
  font-size: 0;
}
.bulletin-thumb-more {
  align-self: center;
  font-size: var(--text-sm);
  color: var(--text-2);
}
.bulletin-foot {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px 14px;
  flex-wrap: wrap;
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--divider-medium);
  font-size: var(--text-sm);
  color: var(--text-2);
}
/* Who has seen it, with a bar of how many of the class. */
.bulletin-seen-btn {
  display: inline-grid;
  grid-template-columns: auto auto;
  justify-content: start;
  column-gap: 0.3em;
  row-gap: 5px;
  background: none;
  border: 0;
  padding: 2px 0;
  font: inherit;
  color: var(--link);
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}
.bulletin-seen-btn::after {
  content: '';
  grid-column: 1 / -1;
  width: 100%;
  min-width: 140px;
  height: 4px;
  border-radius: 2px;
  background:
    linear-gradient(var(--link), var(--link)) 0 0 / var(--seen, 0%) 100% no-repeat,
    var(--divider-medium);
}
.bulletin-seen-btn:hover {
  text-decoration: underline;
}
.bulletin-linked {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--seg-track, rgba(118, 118, 128, 0.12));
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bulletin-not-seen {
  font-weight: 600;
}
.bulletin-foot a {
  color: var(--link);
  text-decoration: none;
}
.bulletin-foot a:hover {
  text-decoration: underline;
}
.bulletin-more {
  position: relative;
  margin-left: auto;
}
.bulletin-more-btn {
  width: 32px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text-2);
  font-size: var(--text-lg);
  line-height: 1;
  cursor: pointer;
}
.bulletin-more-btn:hover {
  background: var(--overlay-hover);
  color: var(--text);
}
.bulletin-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  z-index: var(--z-fab);
  min-width: 140px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 4px;
  display: flex;
  flex-direction: column;
}
.bulletin-menu-item {
  text-align: left;
  background: none;
  border: 0;
  padding: 7px 10px;
  font: inherit;
  font-size: var(--text-base);
  color: var(--text);
  border-radius: var(--radius-xs);
  cursor: pointer;
}
.bulletin-menu-item:hover,
.bulletin-menu-item:focus-visible {
  background: var(--overlay-hover);
}
.bulletin-menu-item.is-danger {
  color: var(--danger);
}

/* ── Who has seen it ── */
.bulletin-seenlist {
  margin: 6px -18px -14px;
  padding: 16px 18px 18px;
  border-radius: 0 0 var(--radius) var(--radius);
  border-top: 1px solid var(--divider-medium);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.bulletin-seen-aside,
.bsl-aside {
  font-size: var(--text-sm);
  color: var(--text-2);
}
/* Who has seen it (teacher/bulletin-seen.js): the count large, a bar of the
   class, then the two groups side by side as name chips. */
.bsl-summary {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  column-gap: 10px;
  row-gap: 8px;
}
.bsl-big {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
}
.bsl-of {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0;
}
.bsl-sum-text {
  font-size: var(--text-base);
  color: var(--text-2);
}
.bsl-bar {
  grid-column: 1 / -1;
  height: 6px;
  border-radius: 3px;
  background:
    linear-gradient(var(--active), var(--active)) 0 0 / var(--seen, 0%) 100% no-repeat,
    var(--seg-track);
}
.bsl-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.bsl-group {
  padding: 12px 14px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--divider-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bsl-head {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text);
}
.bsl-count {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--seg-track);
  color: var(--text-2);
  font-size: var(--text-xs);
  text-align: center;
}
.bsl-sub {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-2);
}
.bsl-chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.bsl-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 3px;
  border-radius: 999px;
  background: var(--seg-track);
  font-size: var(--text-sm);
  color: var(--text);
  white-space: nowrap;
}
button.bsl-chip {
  border: 1px solid transparent;
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
}
button.bsl-chip:hover {
  border-color: var(--divider-medium);
}
/* Picked to remind: the app's selection blue. */
button.bsl-chip[aria-pressed='true'] {
  background: var(--active-fill);
  color: #fff;
}
button.bsl-chip[aria-pressed='true'] .bsl-av {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}
.bsl-av {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.bsl-again-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
}
.bsl-again {
  align-self: flex-start;
}
.bsl-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.bulletin-empty {
  text-align: center;
  color: var(--text-2);
  font-size: var(--text-md);
  padding: 28px 0;
}
.bulletin-unavailable {
  padding: 18px 16px;
  color: var(--text-2);
  font-size: var(--text-md);
}

@media (max-width: 700px) {
  .bulletin-page {
    padding: 14px 12px 32px;
  }
}

/* A bulletin arrived at from the Dashboard's tile: outlined for a few seconds, with room above it when scrolled to. */
.bulletin-post {
  scroll-margin-top: 16px;
}
.bulletin-arrived {
  outline: 2px solid var(--active);
  outline-offset: 2px;
}
