.ug-history,
.ug-purpose {
  scroll-margin-block-start: 24px;
}

.ug-history-layout {
  display: grid;
  gap: clamp(26px, 3.8vw, 56px);
}

.ug-history-intro {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  align-items: baseline;
  gap: 18px clamp(24px, 5vw, 84px);
}

body.ug-internal main .ug-history-intro h2 {
  margin: 0 !important;
}

.ug-history-intro p {
  max-width: 54ch;
  margin: 0;
}

.ug-timeline-shell {
  min-width: 0;
}

.ug-timeline {
  --timeline-visible: 4;
  --timeline-icon-size: clamp(3.5rem, 5.5vw, 4.75rem);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc(100% / var(--timeline-visible));
  align-items: start;
  margin: 0;
  padding: 4px 0 12px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: #cbbfa5 #f6f2e9;
  list-style: none;
}

.ug-timeline:focus-visible {
  outline: 3px solid var(--ochre, #8a5000);
  outline-offset: 3px;
}

.ug-timeline-shell:has(.ug-timeline-controls:not([hidden])) .ug-timeline {
  scrollbar-width: none;
}

.ug-timeline > li {
  --tone: #8c5b0b;
  position: relative;
  display: grid;
  justify-items: center;
  align-content: start;
  min-width: 0;
  padding-inline: clamp(12px, 1.5vw, 24px);
  scroll-snap-align: start;
  text-align: center;
}

.ug-timeline > li:nth-child(2) { --tone: #a14e2b; }
.ug-timeline > li:nth-child(3) { --tone: #27766e; }
.ug-timeline > li:nth-child(4) { --tone: #426c91; }
.ug-timeline > li:nth-child(5) { --tone: #6a5c92; }
.ug-timeline > li:nth-child(6) { --tone: #91466b; }
.ug-timeline > li:nth-child(7) { --tone: #356a57; }
.ug-timeline > li:nth-child(8) { --tone: #70583c; }

.ug-timeline > li::before,
.ug-timeline > li::after {
  content: '';
  position: absolute;
  top: calc(var(--timeline-icon-size) / 2);
  width: 50%;
  border-top: 2px solid var(--tone);
  opacity: .4;
  pointer-events: none;
}

.ug-timeline > li::before { left: 0; }
.ug-timeline > li::after { right: 0; }
.ug-timeline > li:first-child::before,
.ug-timeline > li:last-child::after { content: none; }

.ug-timeline > li:has(+ .ug-timeline-future)::after,
.ug-timeline > .ug-timeline-future::before {
  border-top-style: dashed;
}

.ug-timeline-icon {
  z-index: 1;
  display: grid;
  place-items: center;
  width: var(--timeline-icon-size);
  height: var(--timeline-icon-size);
  border: 4px solid currentColor;
  border-radius: 50%;
  color: var(--tone);
  background: #fffefa;
  background: color-mix(in srgb, var(--tone) 7%, #fffefa);
  box-shadow: inset 0 0 0 4px #fffefa;
}

.ug-timeline-icon svg {
  display: block;
  width: 45%;
  height: 45%;
}

.ug-timeline > li > time {
  margin-block: 16px 8px;
  color: var(--tone);
  font-size: clamp(1.75rem, 2.35vw, 2.35rem);
  font-weight: 760;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.045em;
  line-height: 1.1;
}

.ug-timeline > li > div {
  max-width: 34ch;
}

body.ug-internal main .ug-timeline h3 {
  margin: 0 0 8px !important;
  font-size: clamp(1.125rem, 1.45vw, 1.35rem) !important;
  text-wrap: balance;
}

.ug-timeline p {
  margin: 0;
  text-wrap: pretty;
}

.ug-timeline-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-block-start: 14px;
}

.ug-timeline-controls[hidden],
.ug-timeline-controls [hidden] {
  display: none;
}

.ug-timeline-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #d6cbb8;
  border-radius: 999px;
  color: var(--ink, #242019);
  background: #fffefa;
  font: 650 .875rem/1.25 var(--body, sans-serif);
}

.ug-timeline-controls svg {
  display: block;
  width: 18px;
  height: 18px;
}

.ug-timeline-controls .ug-timeline-play {
  padding-inline: 16px;
}

.ug-timeline-controls button:disabled,
.ug-timeline-controls button[aria-disabled="true"] {
  color: #8a8175;
  border-color: #e5dfd4;
  cursor: default;
}

@media (hover: hover) {
  .ug-timeline-controls button:enabled:not([aria-disabled="true"]):hover {
    border-color: #b39557;
    background: #fff3cf;
  }
}

.ug-timeline-count {
  min-width: 4ch;
  color: var(--muted, #625b50);
  font-size: .875rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

@media (max-width: 1159px) {
  .ug-timeline { --timeline-visible: 3; }
}

@media (max-width: 899px) {
  .ug-timeline { --timeline-visible: 2; }
}

@media (max-width: 700px) {
  .ug-history-intro {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
}

@media (max-width: 700px), (max-width: 1024px) and (max-height: 600px) and (pointer: coarse) {
  .ug-timeline {
    --timeline-visible: 2;
    --timeline-icon-size: 2.75rem;
  }

  .ug-timeline > li {
    padding-inline: clamp(6px, 1.6vw, 12px);
  }

  /* Each snap point starts a pair of years, including after a swipe. */
  .ug-timeline > li:nth-child(even) {
    scroll-snap-align: none;
  }

  .ug-timeline-icon {
    border-width: 3px;
  }

  .ug-timeline > li > time {
    font-size: 1.5rem;
    margin-block: 10px 6px;
  }

  body.ug-internal main .ug-timeline h3 {
    font-size: 1rem !important;
    line-height: 1.25 !important;
  }

  body.ug-internal main .ug-history .ug-timeline p {
    font-size: 1rem;
    line-height: 1.45;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ug-timeline { scroll-behavior: auto; }
}

.ug-purpose {
  background: var(--paper, #fcf9f2);
}

.ug-purpose-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(14px, 1.8vw, 24px);
}

.ug-purpose-cards > article {
  --accent: #a87927;
  min-width: 0;
  padding: clamp(20px, 2.2vw, 32px);
  border: 1px solid #e8dcbb;
  border-radius: 20px;
  background: #fbf3dd;
  box-shadow: 0 8px 24px -19px #50422f56;
}

.ug-purpose-cards > #visao {
  --accent: #4e8471;
  border-color: #d2e3da;
  background: #eaf3ed;
}

.ug-purpose-cards > #valores {
  --accent: #807098;
  border-color: #e0d9e8;
  background: #f3eff7;
}

.ug-purpose-cards > article::before {
  content: '';
  display: block;
  width: 2.5rem;
  height: 3px;
  margin-bottom: clamp(16px, 1.5vw, 23px);
  border-radius: 3px;
  background: var(--accent);
}

body.ug-internal main .ug-purpose-cards h2 {
  margin: 0 0 .45em !important;
  font-size: clamp(1.75rem, 2.5vw, 2.25rem) !important;
}

body.ug-internal main .ug-purpose-cards p {
  margin: 0;
  color: #49463d !important;
  font-size: clamp(1rem, 1.15vw, 1.125rem);
  line-height: 1.6;
}

.ug-purpose-cards strong {
  color: var(--ink, #242019);
  font-weight: 700;
}

@media (max-width: 860px) {
  .ug-purpose-cards {
    grid-template-columns: minmax(0, 1fr);
    max-width: 68ch;
    margin-inline: auto;
  }
}
