/* Digest page styles — mobile-first, shared by /uge and /uge/{year}/{week} */

.digest-shell {
  max-width: 680px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  min-height: 100vh;
}

.digest-header {
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.back-link {
  display: inline-block;
  color: #7dd3fc;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.back-link::before {
  content: "← ";
}

.digest-header h1 {
  margin: 0 0 8px;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  color: #dbe7f0;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.digest-meta {
  margin: 0;
  color: #7dd3fc;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.digest-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.digest-narrative {
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 20px;
  padding: 28px;
}

.digest-narrative p {
  margin: 0;
  color: #dbe7f0;
  font-size: 1.15rem;
  line-height: 1.75;
}

.digest-narrative p a {
  color: #7dd3fc;
  text-decoration: underline;
  text-decoration-color: rgba(125, 211, 252, 0.4);
  text-underline-offset: 2px;
}

.digest-narrative p a:hover {
  text-decoration-color: currentColor;
}

.digest-breakdown,
.digest-notable {
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 20px;
  padding: 24px 28px;
}

.digest-breakdown h2,
.digest-notable h2 {
  margin: 0;
  font-size: 0.85rem;
  color: #7dd3fc;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}

.digest-notable h2 {
  margin-bottom: 16px;
}

/* Newsletter signup block — present on every archive page (published weeks are
   backfilled by scripts/backfill-archive-pages.py; future weeks carry it from
   src/digest/publisher.py). The Brevo form is hidden-until-proven: its message
   panels must stay hidden until its own script reveals them. */
.digest-signup {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.1), rgba(15, 23, 42, 0.72));
  border: 1px solid rgba(125, 211, 252, 0.28);
  border-radius: 20px;
  padding: 24px 28px;
}

.digest-signup .eyebrow {
  margin: 0 0 6px;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7dd3fc;
  font-weight: 700;
}

.digest-signup h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
  color: #dbe7f0;
}

.digest-signup-copy {
  margin: 0 0 16px;
  color: #9fb6ca;
  font-size: 0.95rem;
  line-height: 1.6;
}

.digest-signup .sib-form {
  margin-top: 4px;
}

.digest-signup .sib-form .input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(2, 6, 23, 0.6);
  color: #dbe7f0;
  font-size: 1rem;
}

.digest-signup .entry__label,
.digest-signup .entry__specification {
  display: block;
  margin-bottom: 6px;
  color: #9fb6ca;
  font-size: 0.85rem;
}

.digest-signup .sib-form-block__button {
  width: 100%;
  padding: 12px 16px;
  border: 0;
  border-radius: 10px;
  background: #38bdf8;
  color: #04121f;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}

.digest-signup .sib-form-block__button:hover {
  background: #7dd3fc;
}

:where(.sib-form-message-panel) {
  display: none;
}

#sib-container a {
  text-decoration: underline;
  color: #7dd3fc;
}

.stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.sort-toggle {
  display: inline-flex;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.sort-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
}

.sort-btn.active {
  background: #0b5ed7;
  color: #e7eff7;
}

.sort-btn:focus-visible {
  outline: 2px solid #7dd3fc;
  outline-offset: 2px;
}

.cat-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cat-list[hidden] {
  display: none;
}

.cat-item {
  border-radius: 12px;
  background: rgba(30, 64, 175, 0.14);
  overflow: hidden;
}

.cat-item summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  color: #cbd5e1;
  cursor: pointer;
  list-style: none;
}

.cat-item summary::-webkit-details-marker {
  display: none;
}

.cat-item summary::after {
  content: "+";
  color: #7dd3fc;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
  margin-left: 12px;
  transition: transform 0.15s ease;
}

.cat-item[open] summary::after {
  transform: rotate(45deg);
}

.cat-item summary:focus-visible {
  outline: 2px solid #7dd3fc;
  outline-offset: -2px;
}

.cat-item-list {
  list-style: none;
  margin: 0;
  padding: 0 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cat-item-list a,
.cat-item-list span {
  display: block;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.cat-item-list a {
  color: #93c5fd;
  text-decoration: none;
}

.cat-item-list a:hover {
  background: rgba(148, 163, 184, 0.1);
  color: #7dd3fc;
}

.cat-item-list span {
  color: #94a3b8;
}

.cat-label {
  flex: 1;
  font-size: 1rem;
}

.cat-count {
  flex: none;
  min-width: 2.4ch;
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-size: 1.3rem;
  font-weight: 700;
  color: #e2e8f0;
}

.notable-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.notable-list li {
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.notable-list li:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.notable-list a {
  color: #93c5fd;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.98rem;
}

.notable-list a:hover {
  color: #7dd3fc;
  text-decoration: underline;
}

.notable-list p {
  margin: 6px 0 0;
  color: #cbd5e1;
  font-size: 0.92rem;
  line-height: 1.55;
}

/* Loading state */
.digest-loading {
  color: #4a6a8c;
  text-align: center;
  padding: 48px 0;
  font-size: 1rem;
}

.digest-error {
  color: #f87171;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 16px;
  padding: 20px 24px;
  font-size: 0.95rem;
}

.digest-pager {
  display: flex;
  gap: 12px;
}

.pager-link {
  color: #93c5fd;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(30, 64, 175, 0.14);
}

.pager-link:hover {
  color: #7dd3fc;
  background: rgba(30, 64, 175, 0.22);
}

.pager-next {
  margin-left: auto;
}

.digest-footer {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  text-align: center;
}

.digest-footer p {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: #4a6a8c;
}

.digest-footer a {
  color: #7dd3fc;
  text-decoration: none;
  font-weight: 600;
}

@media (max-width: 480px) {
  .digest-shell {
    padding: 20px 16px 40px;
  }

  .digest-narrative {
    padding: 20px;
  }

  .digest-narrative p {
    font-size: 1.05rem;
  }

  .pager-link {
    font-size: 0.8rem;
    padding: 10px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cat-item summary::after {
    transition: none;
  }
}
