/* ─────────────────────────────────────────────
   DEPESZA — Daily Intelligence Brief
   Wire-service printout pinned to the corkboard.
   Clean paper, single accent, sharp hierarchy.
   ───────────────────────────────────────────── */

.item-depesza {
  cursor: default;
}

.item-depesza::before {
  left: 12%;
  transform: none;
}

.depesza-card {
  background: #fdfaf4;
  border: 1px solid rgba(28,22,8,0.09);
  box-shadow:
    var(--shadow-sm),
    inset 0 0 60px rgba(28,22,8,0.012);
  transition: box-shadow 0.22s;
  position: relative;
  overflow: hidden;
  font-family: 'Libre Baskerville', Georgia, serif;
  color: rgba(28,22,8,0.78);
}

.item-depesza:hover .depesza-card {
  box-shadow:
    var(--shadow-hover),
    inset 0 0 60px rgba(28,22,8,0.012);
}

/* ── Perforated top edge ── */
.depesza-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: repeating-linear-gradient(
    90deg,
    transparent 0px, transparent 3px,
    rgba(28,22,8,0.05) 3px, rgba(28,22,8,0.05) 4px,
    transparent 4px, transparent 7px
  );
  z-index: 3;
}

/* ── Hide the JS-injected margin rule ── */
.depesza-margin-rule { display: none; }

/* ── Ruled notebook lines — same treatment as the agenda card and other
   paper-cards on the corkboard. Subtle horizontal rules behind the content. ── */
.depesza-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent, transparent 23px,
    rgba(28,22,8,0.03) 23px, rgba(28,22,8,0.03) 24px
  );
  pointer-events: none;
  z-index: 0;
}

/* ─── HEADER — masthead strip ─── */
.depesza-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 1rem 0.45rem 1rem;
  background: rgba(28,22,8,0.025);
  border-bottom: 1px solid rgba(28,22,8,0.08);
  position: relative;
  z-index: 1;
}

.depesza-classification {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.55rem;
  font-weight: 500;
  color: rgba(150,65,35,0.75);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  display: inline-block;
}

.depesza-toggle {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.55rem;
  color: rgba(28,22,8,0.4) !important;
  background: none;
  background-color: transparent;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  letter-spacing: 0.06em;
  line-height: 1;
  transition: color 0.15s;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  outline: none;
  text-decoration: none;
}

.depesza-toggle:hover,
.depesza-toggle:focus,
.depesza-toggle:active { color: rgba(150,65,35,0.75) !important; text-decoration: none; }

/* "↻ new edition" pill — appears in the header when the freshness
   poller detects a newer edition than the one being rendered.
   Hidden by default (HTML `hidden` attribute), revealed by JS.
   Same monospace family as the toggle next to it, but in the coral
   accent so it pulls eyes — this is a call-to-action, not a passive
   control. Tucked between the classification label and the toggle
   so the layout stays balanced when it appears. */
.depesza-new-edition-btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.55rem;
  color: rgba(150,65,35,0.85);
  background: rgba(150,65,35,0.06);
  border: 1px solid rgba(150,65,35,0.2);
  border-radius: 1px;
  cursor: pointer;
  padding: 2px 6px;
  letter-spacing: 0.06em;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}
.depesza-new-edition-btn:hover {
  background: rgba(150,65,35,0.12);
  color: rgba(150,65,35,1);
}
.depesza-new-edition-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* ─── META ─── */
.depesza-meta {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 1rem 0.35rem 1rem;
  border-bottom: 1px dashed rgba(28,22,8,0.07);
  position: relative;
  z-index: 1;
  background: rgba(28,22,8,0.012);
}

.depesza-meta-item {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.46rem;
  color: rgba(28,22,8,0.32);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* ─── HEADLINE ─── */
.depesza-headline {
  padding: 0.75rem 1rem 0.7rem 1rem;
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.4;
  color: rgba(28,22,8,0.84);
  border-bottom: 1px solid rgba(28,22,8,0.07);
  position: relative;
  z-index: 1;
}

.depesza-card.collapsed .depesza-headline {
  border-bottom: none;
  cursor: pointer;
}

/* ─── BODY — scrollable ─── */
.depesza-body {
  position: relative;
  z-index: 1;
  max-height: 400px;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.depesza-body::-webkit-scrollbar { display: none; }

.depesza-body::after {
  content: '';
  display: block;
  height: 1.2rem;
  background: linear-gradient(transparent, rgba(253,250,244,0.92));
  position: sticky;
  bottom: 0;
  pointer-events: none;
}

/* ─── SECTIONS ─── */
.depesza-section {
  padding: 0.6rem 1rem 0.6rem 1rem;
  border-bottom: 1px dashed rgba(28,22,8,0.08);
  position: relative;
  z-index: 1;
}

.depesza-section:last-child { border-bottom: none; }

.depesza-section--primary { padding-top: 0.85rem; padding-bottom: 0.85rem; }

/* Section labels — small mono dateline style, matches other corkboard cards */
.depesza-section-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.46rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(28,22,8,0.36);
  margin-bottom: 0.45rem;
}

/* The primary section per edition — slightly bigger, slightly darker, but
   still in the same family. No red, no decorative rule — quiet emphasis. */
.depesza-section-label--primary {
  font-size: 0.5rem;
  letter-spacing: 0.2em;
  color: rgba(28,22,8,0.55);
  margin-bottom: 0.5rem;
}

/* ─── AGENDA ITEMS ─── */
.depesza-agenda-item {
  display: flex;
  gap: 0.7rem;
  padding: 0.45rem 0;
  align-items: baseline;
}

.depesza-agenda-item + .depesza-agenda-item {
  border-top: 1px dotted rgba(28,22,8,0.06);
}

.depesza-time {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.55rem;
  color: rgba(28,22,8,0.5);
  width: 3.8rem;
  min-width: 3.8rem;
  flex-shrink: 0;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding-top: 0.15rem;
}

.depesza-agenda-body {
  flex: 1;
  min-width: 0;
}

/* Event title — the lead, what's happening */
.depesza-event {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 0.7rem;
  line-height: 1.45;
  color: rgba(28,22,8,0.85);
}

.depesza-event-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted rgba(28,22,8,0.22);
  transition: color 0.15s, border-color 0.15s;
}

.depesza-event-link:hover {
  color: rgba(150,65,35,0.85);
  border-bottom-color: rgba(150,65,35,0.45);
}

.depesza-event-location {
  color: rgba(28,22,8,0.55);
  font-style: italic;
}

/* Relevance — the why-it-matters. Sits under the event title, comfortable
   to read, but visibly secondary (slightly smaller, lighter colour, no decoration) */
.depesza-event-relevance {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 0.62rem;
  line-height: 1.5;
  color: rgba(28,22,8,0.55);
  margin-top: 0.25rem;
}

/* ─── NEWS ITEMS ─── */
.depesza-news-item { padding: 0.55rem 0; }

.depesza-news-item + .depesza-news-item {
  border-top: 1px dotted rgba(28,22,8,0.06);
}

/* News item header: headline full-width, source tucked below.
   Previously side-by-side, but long composite source labels
   ("TYGODNIK SOLIDARNOŚĆ (VIA GOOGLE NEWS) / WPOLSCE24")
   squeezed headlines into unreadably narrow columns. */
.depesza-news-top {
  margin-bottom: 0.2rem;
}

.depesza-news-headline {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.35;
  color: rgba(28,22,8,0.85);
  margin-bottom: 0.15rem;
}

.depesza-news-summary {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 0.62rem;
  line-height: 1.55;
  color: rgba(28,22,8,0.62);
}

.depesza-news-source {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.42rem;
  color: rgba(28,22,8,0.36);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: normal;
  display: block;
  margin-top: 0.1rem;
}

.depesza-news-source a {
  color: rgba(28,22,8,0.42);
  text-decoration: none;
  border-bottom: 1px dotted rgba(28,22,8,0.18);
}

.depesza-news-source a:hover {
  color: rgba(150,65,35,0.85);
  border-bottom-color: rgba(150,65,35,0.45);
}

/* ─── RADAR ─── */
.depesza-radar-item {
  display: flex;
  gap: 0.4rem;
  padding: 0.35rem 0;
  align-items: baseline;
  font-size: 0.62rem;
  line-height: 1.45;
  flex-wrap: wrap;
}

.depesza-radar-item + .depesza-radar-item {
  border-top: 1px dotted rgba(28,22,8,0.06);
}

.depesza-radar-name {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  color: rgba(28,22,8,0.85);
  font-size: 0.7rem;
}

.depesza-radar-role {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.46rem;
  color: rgba(28,22,8,0.38);
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.depesza-radar-status {
  color: rgba(28,22,8,0.6);
  font-size: 0.62rem;
}

/* ─── BRUSSELS WATCH ─── */
.depesza-brussels {
  font-size: 0.66rem;
  line-height: 1.6;
  color: rgba(28,22,8,0.7);
  padding: 0.4rem 0 0.4rem 0.7rem;
  border-left: 2px solid rgba(0,51,153,0.32);
  background: rgba(0,51,153,0.02);
}

/* ─── EDITOR'S NOTE ─── */
.depesza-editors-note {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 0.7rem;
  line-height: 1.6;
  color: rgba(28,22,8,0.62);
  padding: 0.2rem 0;
}

/* ─── DATA GAPS ─── */
.depesza-data-gap {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.46rem;
  line-height: 1.55;
  color: rgba(28,22,8,0.32);
  padding: 0.12rem 0;
  letter-spacing: 0.04em;
}

/* ─── READ FULL BRIEFING LINK ─── */
.depesza-read-full {
  padding: 0.6rem 1rem 0.5rem 1rem;
  text-align: right;
  position: relative;
  z-index: 1;
  border-top: 1px solid rgba(28,22,8,0.05);
  background: rgba(150,65,35,0.018);
}

.depesza-read-full-link {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.55rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(150,65,35,0.85);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.depesza-read-full-link:hover {
  color: rgba(150,65,35,1);
}

/* ─── POLICY PIPELINE TYPE TAG ─── */
.depesza-pipeline-type {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.46rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(150,65,35,0.65);
  background: rgba(150,65,35,0.07);
  padding: 0.12rem 0.4rem;
  border-radius: 1px;
  margin-left: 0.35rem;
  vertical-align: middle;
  font-weight: 500;
}

/* ─── FOOTER ─── */
.depesza-footer {
  padding: 0.4rem 1rem 0.4rem 1rem;
  border-top: 1px solid rgba(28,22,8,0.07);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 1;
  background: rgba(28,22,8,0.012);
}

.depesza-footer-text {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.42rem;
  color: rgba(28,22,8,0.28);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.depesza-refresh-btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.45rem;
  color: rgba(28,22,8,0.3);
  background: none;
  background-color: transparent;
  border: 1px solid rgba(28,22,8,0.08);
  padding: 0.12rem 0.35rem;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: all 0.15s;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.depesza-refresh-btn:hover {
  background: rgba(28,22,8,0.03);
  color: rgba(28,22,8,0.5);
  border-color: rgba(28,22,8,0.15);
}

.depesza-refresh-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ─── COLLAPSED STATE ─── */
/* Body is hidden when collapsed (its content is the briefing itself).
   The footer stays visible — but only its left slot. The right slot
   (passive metadata like "auto-generated · 14:32") is hidden because
   it's not actionable; the left slot holds the refresh button or
   "↻ new edition" pill, both of which the user might want to click
   without unfurling the card first. This matches the symmetry the
   user noticed: just like "Read full briefing →" lives on the right
   in the expanded body, "↻ refresh" lives on the left in the footer. */
.depesza-card.collapsed .depesza-body { display: none; }
.depesza-card.collapsed .depesza-footer-text { display: none; }
.depesza-card.collapsed .depesza-footer {
  /* Footer keeps its border but loses the heavy padding now that it's
     a single-action strip rather than a full status row. */
  padding-top: 0.3rem;
  padding-bottom: 0.3rem;
}

/* Two-slot footer — left holds the action button (refresh OR the
   new-edition pill, mutually exclusive), right holds metadata. */
.depesza-footer-left {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ─── LOADING ─── */
.depesza-loading {
  padding: 0.85rem 1rem 0.85rem 1rem;
  position: relative;
  z-index: 1;
}

.depesza-loading-pulse {
  display: block;
  height: 7px;
  background: linear-gradient(90deg, rgba(28,22,8,0.03) 25%, rgba(28,22,8,0.06) 50%, rgba(28,22,8,0.03) 75%);
  background-size: 200% 100%;
  animation: depesza-shimmer 1.5s infinite;
  margin: 0.3rem 0;
}

@keyframes depesza-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── ERROR / EMPTY ─── */
.depesza-error,
.depesza-empty {
  padding: 0.85rem 1rem 0.85rem 1rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.55rem;
  color: rgba(28,22,8,0.3);
  text-align: center;
  position: relative;
  z-index: 1;
}

.depesza-error-detail {
  font-size: 0.45rem;
  color: rgba(192,57,43,0.55);
  margin-top: 0.2rem;
}

.depesza-empty-generate { margin-top: 0.35rem; }

/* ─── RESPONSIVE ─── */
@media (max-width: 639px) {
  .depesza-agenda-item { flex-direction: column; gap: 0.08rem; }
  .depesza-radar-item { flex-wrap: wrap; }

  .depesza-header,
  .depesza-meta,
  .depesza-headline,
  .depesza-section,
  .depesza-read-full,
  .depesza-footer,
  .depesza-loading,
  .depesza-error,
  .depesza-empty {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }
}

/* ─── PREVENT HORIZONTAL OVERFLOW ─── */
.depesza-card { overflow-x: hidden; }
.depesza-event,
.depesza-event-link,
.depesza-news-summary,
.depesza-radar-status,
.depesza-brussels,
.depesza-editors-note,
.depesza-headline,
.depesza-event-relevance {
  word-break: break-word;
  overflow-wrap: break-word;
}
