/* Optional full-width news attached to the bottom of the viewport. */
.ahc-home-news {
  position: fixed;
  inset: auto 0 0;
  z-index: 1100;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 0 clamp(14px, 3vw, 40px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  border-bottom: 1px solid rgba(255, 235, 113, 0.3);
  background: #b51624;
  color: #ffeb71;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  overflow: hidden;
}

.ahc-home-news-label {
  padding-right: 18px;
  color: inherit;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ahc-home-news-viewport {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  overflow: hidden;
}

.ahc-home-news-track {
  display: flex;
  width: max-content;
  min-width: 200%;
  animation: ahc-home-news-scroll calc(var(--ahc-news-duration, 35s) / 1.32) linear infinite;
}

.ahc-home-news-group {
  display: flex;
  flex: 1 0 auto;
  align-items: center;
  justify-content: space-around;
  gap: clamp(20px, 2.4vw, 36px);
  min-width: 0;
  padding-inline: clamp(10px, 1.2vw, 18px);
  box-sizing: border-box;
  white-space: nowrap;
}

.ahc-home-news-group > span {
  flex: 0 0 auto;
}

.ahc-home-news-separator {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.ahc-home-news-pause {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.ahc-home-news-control {
  grid-column: 3;
  grid-row: 1;
  margin-left: 18px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 235, 113, 0.6);
  border-radius: 4px;
  color: inherit;
  font-size: 11px;
  cursor: pointer;
}

.ahc-home-news-pause:focus-visible + .ahc-home-news-control {
  outline: 2px solid #ffeb71;
  outline-offset: 2px;
}

.ahc-home-news-resume-label,
.ahc-home-news-pause:checked + .ahc-home-news-control .ahc-home-news-pause-label {
  display: none;
}

.ahc-home-news-pause:checked + .ahc-home-news-control .ahc-home-news-resume-label {
  display: inline;
}

.ahc-home-news:hover .ahc-home-news-track,
.ahc-home-news-pause:checked ~ .ahc-home-news-viewport .ahc-home-news-track {
  animation-play-state: paused;
}

#ahc-home-news-editor textarea {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  box-sizing: border-box;
  resize: vertical;
}

@keyframes ahc-home-news-scroll {
  to { transform: translateX(-50%); }
}

@media (max-width: 760px) {
  .ahc-home-news { min-height: 30px; font-size: 14px; }
  .ahc-home-news-label { padding-right: 10px; }
  .ahc-home-news-control { margin-left: 10px; padding: 2px 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .ahc-home-news-track { animation: none; width: auto; min-width: 0; }
  .ahc-home-news-group { min-width: 0; gap: 8px 24px; padding: 8px 0; justify-content: flex-start; flex-wrap: wrap; white-space: normal; }
  .ahc-home-news-group > span { flex: 0 1 auto; }
  .ahc-home-news-group > .ahc-home-news-separator { display: none; }
  .ahc-home-news-item::before { content: "•"; margin-right: 10px; }
  .ahc-home-news-group[aria-hidden="true"],
  .ahc-home-news-pause,
  .ahc-home-news-control { display: none; }
}

/* Keep the last page content and anchor targets above the visible news bar. */
body:has(.ahc-home-news)::after {
  content: "";
  display: block;
  flex: 0 0 auto;
  height: var(--ahc-home-news-height, 38px);
}

html:has(.ahc-home-news) {
  scroll-padding-bottom: var(--ahc-home-news-height, 38px);
}

@media (max-width: 760px) {
  body:has(.ahc-home-news)::after { height: var(--ahc-home-news-height, 30px); }
  html:has(.ahc-home-news) { scroll-padding-bottom: var(--ahc-home-news-height, 30px); }
}
