.icofcv-history {
  --icofcv-blue: #0083a8;
  --icofcv-teal: #00a6a6;
  --icofcv-ink: #1f2a3d;
  --icofcv-surface: #f5fafb;
  color: var(--icofcv-ink);
  font-family: Montserrat, Arial, sans-serif;
  overflow-x: hidden;
}

.icofcv-history__title,
.timeline-period__title,
.timeline-card__title,
.timeline-drawer__title,
.timeline-drawer__reference-section h3 {
  color: var(--icofcv-ink);
  letter-spacing: 0;
}

.icofcv-history__status:empty {
  display: none;
}

.icofcv-history__status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 1rem;
  background: var(--icofcv-surface);
  border-left: 4px solid var(--icofcv-blue);
}

.icofcv-history__status p {
  margin: 0;
}

.timeline-period {
  margin-top: 2.25rem;
}

.timeline-period__title {
  margin: 0 0 1rem;
  font-size: 1.35rem;
}

.timeline-period__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: 1.25rem;
}

.timeline-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid #d4e2e6;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgb(31 42 61 / 8%);
}

.timeline-media {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #dcecef;
}

.timeline-media iframe,
.timeline-media img {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
}

.timeline-card__body {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
}

.timeline-card__title,
.timeline-card__excerpt {
  overflow-wrap: anywhere;
}

.timeline-card__title {
  margin: 0;
  font-size: 1.1rem;
}

.timeline-card__excerpt {
  margin: 0;
  line-height: 1.55;
}

.timeline-card__more,
.icofcv-history__status button,
.timeline-drawer__close {
  width: fit-content;
  min-height: 2.5rem;
  padding: 0.55rem 0.85rem;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--icofcv-blue);
  border: 1px solid var(--icofcv-blue);
  border-radius: 6px;
}

.timeline-card__more {
  margin-top: auto;
}

.timeline-card__more:hover,
.icofcv-history__status button:hover,
.timeline-drawer__close:hover {
  background: var(--icofcv-teal);
  border-color: var(--icofcv-teal);
}

.timeline-card__more:focus-visible,
.icofcv-history__status button:focus-visible,
.timeline-drawer__close:focus-visible {
  outline: 3px solid var(--icofcv-teal);
  outline-offset: 2px;
}

.icofcv-timeline-backdrop {
  position: fixed;
  z-index: 100000;
  inset: 0;
  background: rgb(31 42 61 / 45%);
}

.icofcv-timeline-backdrop[hidden],
.icofcv-timeline-drawer[hidden] {
  display: none !important;
}

.icofcv-timeline-drawer {
  position: fixed;
  z-index: 100001;
  top: 0;
  right: 0;
  box-sizing: border-box;
  width: clamp(360px, 30vw, 560px);
  max-width: 100%;
  height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--icofcv-ink);
  background: #fff;
  box-shadow: -6px 0 20px rgb(31 42 61 / 18%);
  isolation: isolate;
}

.timeline-drawer__header {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.25rem 1rem;
  background: #fff;
  border-bottom: 1px solid #d4e2e6;
}

.timeline-drawer__header > div {
  min-width: 0;
}

.timeline-drawer__period {
  margin: 0 0 0.25rem;
  color: var(--icofcv-teal);
  font-size: 0.9rem;
  font-weight: 700;
}

.timeline-drawer__title {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1.45rem;
}

.timeline-drawer__close {
  flex: 0 0 auto;
  color: var(--icofcv-blue);
  background: #fff;
}

.timeline-drawer__close:hover {
  color: #fff;
}

.timeline-drawer__content,
.timeline-drawer__reference-section,
.timeline-drawer__references {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  padding: 0 1.25rem 1.25rem;
  overflow-wrap: anywhere;
}

.timeline-drawer__references {
  padding: 0;
}

.timeline-drawer__content > *,
.timeline-drawer__references > * {
  box-sizing: border-box;
  max-width: 100%;
}

.icofcv-timeline-drawer img,
.icofcv-timeline-drawer video,
.icofcv-timeline-drawer iframe {
  display: block;
  max-width: 100%;
}

.timeline-drawer__content img,
.timeline-drawer__content video,
.timeline-drawer__references img,
.timeline-drawer__references video {
  height: auto;
}

.icofcv-timeline-drawer table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.icofcv-timeline-drawer th,
.icofcv-timeline-drawer td {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.icofcv-timeline-drawer pre,
.icofcv-timeline-drawer code {
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.timeline-drawer__content > :first-child,
.timeline-drawer__references > :first-child {
  margin-top: 0;
}

.timeline-drawer__content > :last-child,
.timeline-drawer__references > :last-child {
  margin-bottom: 0;
}

.timeline-drawer__reference-section {
  padding-top: 1.25rem;
  border-top: 1px solid #d4e2e6;
}

.timeline-drawer__reference-section h3 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

@media (max-width: 640px) {
  .icofcv-timeline-drawer {
    width: 100%;
  }
}
