/* Pinned paper bar, notification bell, and folded-paper dialog sheet. */
.announcement-bell {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: #42483d;
  background: transparent;
  border: 0;
  border-radius: 50%;
  transition: background-color 150ms ease, color 150ms ease;
}
.announcement-bell .icon { width: 20px; height: 20px; transform-origin: 50% 14%; }

.announcement-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 2px var(--canvas);
  opacity: 0;
  transition: opacity 150ms ease;
}
.announcement-bell[data-unread="true"] .announcement-dot { opacity: 1; }

:root { --pinned-height: max(38px, 2.4rem); }
#pinned-bar {
  position: relative;
  isolation: isolate;
  background: linear-gradient(100deg, #f7efdcf7, #fbf6e9f2), var(--paper) var(--paper-grain) repeat;
  border-top: 1px solid #dfdac9;
  color: #35466b;
}

#pinned-announcement {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  height: calc(var(--pinned-height) - 1px);
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: transparent;
  text-align: start;
  font-size: .855rem;
  font-weight: 560;
  line-height: 1.4;
}
.pin-glyph { width: 21px; height: 21px; color: #3554a6; }
#pinned-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pinned-arrow { width: 16px; height: 16px; margin-inline-end: 2px; color: #626b79; }
#pinned-announcement:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

body:has(#pinned-bar:not([hidden])) .desk {
  min-height: calc(100vh - var(--header-height) - var(--pinned-height) - 1px);
  min-height: calc(100dvh - var(--header-height) - var(--pinned-height) - 1px);
}

#announcement-dialog {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  border: 0;
  overflow: hidden;
  overscroll-behavior: contain;
  background: transparent;
  color: var(--ink);
}
#announcement-dialog[open] { display: grid; place-items: center; }
#announcement-dialog::backdrop { background: transparent; }
body:has(#announcement-dialog[open]) { overflow: hidden; }

.announcement-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: #25291f66;
}

.announcement-paper-shell {
  --note-inset: clamp(23px, 6vw, 36px);
  --note-edge: #c6bca2;
  --note-stock: linear-gradient(108deg, #fff9eae0, #fff9ede6 54%, #fbf1dcdf), var(--paper-grain) repeat #faf1df;
  position: relative;
  width: min(100%, 28.5rem);
  min-width: 0;
  min-height: 0;
  filter: drop-shadow(0 2px 1px #3d392429) drop-shadow(0 15px 22px #24251d38);
}

.announcement-paper {
  display: flex;
  flex-direction: column;
  max-height: min(42rem, calc(100dvh - max(24px, env(safe-area-inset-top)) - max(24px, env(safe-area-inset-bottom))));
  min-height: 0;
  font-family: var(--sans);
}

.announcement-meta, .announcement-content {
  position: relative;
  background: var(--note-stock);
  border-inline: 1px solid var(--note-edge);
}

.announcement-meta {
  z-index: 1;
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px calc(var(--note-inset) - 9px) 8px var(--note-inset);
  mask: linear-gradient(#000 0 0) bottom / 100% calc(100% - 4px) no-repeat,
    conic-gradient(from 135deg at 50% 0, #000 90deg, transparent 0) top left / 8px 5px repeat-x;
}
.announcement-meta::after {
  content: "";
  position: absolute;
  inset: auto var(--note-inset) 0;
  height: 1px;
  background: repeating-linear-gradient(90deg, #c2b699 0 3px, transparent 3px 7px);
}

#announcement-date {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #595343;
  font: 600 12px/1.4 var(--mono);
  letter-spacing: .075em;
  font-variant-numeric: tabular-nums;
}
#announcement-date::before {
  content: "";
  width: 13px;
  height: 4px;
  background: var(--orange);
  transform: skewX(-18deg);
}

.announcement-dismiss {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  color: #4a4b42;
  background: transparent;
  transition: background-color 150ms ease, color 150ms ease;
}
.announcement-dismiss .icon { width: 18px; height: 18px; }
.announcement-dismiss:focus-visible, .announcement-bell:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -3px;
}

.announcement-content {
  --dog-ear: 21px;
  --fold: linear-gradient(135deg, #c8d4ec 2%, #b6c7e6 25%, #9baecf 43%, #7e95bd 49.5%, transparent 50%);
  flex: 0 1 auto;
  min-height: 0;
  margin-top: -1px;
  overflow: auto;
  overscroll-behavior: contain;
  overflow-wrap: anywhere;
  scrollbar-width: thin;
  scrollbar-color: #c4b99d transparent;
  padding: 20px var(--note-inset) 30px;
  border-bottom: 1px solid var(--note-edge);
  border-radius: 0 0 0 3px;
  background: var(--fold) right -1px bottom -1px / var(--dog-ear) var(--dog-ear) no-repeat, var(--note-stock);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--dog-ear)), calc(100% - var(--dog-ear)) 100%, 0 100%);
  transform-origin: 50% 0;
}

.announcement-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.announcement-tab {
  padding: 4px 9px;
  border: 1px solid #cabfa3;
  border-radius: 5px;
  background: #fffaf080;
  color: #5b5546;
  font: 620 11.5px/1.3 var(--mono);
}
.announcement-tab[aria-pressed="true"] {
  border-color: #3654a8;
  background: #e9effd;
  color: var(--blue);
}

#announcement-title {
  color: #243c82;
  margin: 0 0 12px;
  font: 740 clamp(21px, 3.6vw, 26px)/1.35 var(--sans);
  letter-spacing: -.04em;
}
#announcement-body {
  color: #42453d;
  font: 400 14.5px/1.82 var(--sans);
}
#announcement-body p { margin: 0; white-space: pre-line; }
#announcement-body p + p { margin-top: .8em; }

#announcement-snooze {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  margin-block-start: 18px;
  padding: 6px 13px;
  color: #4f5245;
  border: 1px solid #c6bfab;
  border-radius: 6px;
  background: #fffaf080;
  font-size: 13px;
  font-weight: 580;
}

@media (max-width: 460px) {
  .announcement-bell { width: 36px; height: 36px; }
  .announcement-dot { top: 5px; right: 5px; }
  .announcement-content { padding-block: 18px 26px; }
  .announcement-meta { padding-block: 13px 6px; }
}

@media (hover: hover) and (pointer: fine) {
  .announcement-bell:hover { background: #eaecdf; color: #243b80; }
  .announcement-dismiss:hover { background: #ebe1c9; color: #282c24; }
  #pinned-announcement:hover,
  #pinned-announcement:hover .pinned-arrow { color: var(--blue); }
  #announcement-snooze:hover { background: #f2ebd9; color: #333a30; }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .announcement-bell .icon { transition: transform 180ms var(--ease-out); }
  .announcement-bell:hover .icon { transform: rotate(-12deg); }
  .pinned-arrow { transition: transform 180ms var(--ease-out); }
  #pinned-announcement:hover .pinned-arrow { transform: translateX(2px); }
}
