*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  color: #1a1814;
  background:
    radial-gradient(720px 280px at 50% -10%, rgba(255, 252, 247, 0.85), transparent 70%),
    #e7e0d4;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.4;
}

.skip {
  position: absolute;
  left: 8px;
  top: -40px;
  z-index: 3;
  padding: 6px 8px;
  background: #1a1814;
  color: #fffdf8;
}

.skip:focus {
  top: 8px;
}

.wrap {
  width: min(980px, calc(100% - 20px));
  height: calc(100% - 28px - env(safe-area-inset-bottom, 0px));
  height: calc(100dvh - 28px - env(safe-area-inset-bottom, 0px));
  margin: 0 auto;
  padding: 8px 0 12px;
  overflow: auto;
}

.back {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: #1e3a5f;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}

.back:hover {
  text-decoration: underline;
}

.masthead {
  padding: 0 0 2px;
}

.kicker {
  margin: 0;
  color: #7c2d12;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 1px 0 4px;
  font-family: Georgia, "Iowan Old Style", Palatino, "Palatino Linotype", serif;
  font-size: clamp(1.35rem, 4.2vw, 1.7rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.dek {
  max-width: 40rem;
  margin: 0;
  color: #3f3a34;
  font-size: 0.78rem;
  line-height: 1.35;
}

.count {
  min-height: 1em;
  margin: 3px 0 0;
  color: #5c564e;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.timeline {
  position: relative;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 8px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(#c4a574, #8a5a32);
}

.timeline.is-message::before {
  display: none;
}

.year-mark {
  position: relative;
  z-index: 1;
  margin: 2px 0 4px;
}

.year-mark h2 {
  display: inline-block;
  margin: 0 0 0 24px;
  color: #3f3428;
  font-family: Georgia, Palatino, serif;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1;
}

.event {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  margin: 0 0 8px;
}

.marker {
  position: relative;
  z-index: 1;
}

.dot {
  display: block;
  width: 10px;
  height: 10px;
  margin-top: 12px;
  margin-left: 4px;
  border: 2px solid #8a5a32;
  border-radius: 50%;
  background: #fffdf8;
}

.card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(80, 55, 25, 0.1);
  border-radius: 10px;
  background: #fffdf8;
  box-shadow: 0 4px 12px rgba(70, 48, 22, 0.06);
}

.card figure {
  margin: 0;
  background: #1b2433;
}

.figure-tip,
.card figure img {
  display: block;
  width: 100%;
  height: 56px;
  object-fit: cover;
  object-position: center top;
}

.figure-tip {
  position: relative;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.zoom-label {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(26, 24, 20, 0.72);
  color: #fffdf8;
  font-size: 0.62rem;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.figure-tip img {
  height: 56px;
}

.card-body {
  padding: 6px 8px 7px;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.date-tip,
.card time {
  color: #7c2d12;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
}

.date-tip {
  border: 0;
  border-bottom: 1px dotted #a16207;
  padding: 2px 0;
  background: transparent;
  cursor: help;
  font-family: inherit;
}

.card h3 {
  margin: 1px 0 2px;
  font-family: Georgia, Palatino, serif;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.2;
}

.card p {
  margin: 0 0 5px;
  color: #2c2823;
  font-size: 0.72rem;
  line-height: 1.32;
}

.sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sources a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid #e4d8c6;
  border-radius: 999px;
  background: #f3ece1;
  color: #1e3a5f;
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
}

.sources a[data-tip] {
  cursor: help;
}

.sources a:hover {
  background: #e7dccb;
}

.info-tip {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #5c564e;
  cursor: help;
}

.info-tip svg {
  width: 15px;
  height: 15px;
}

.info-tip:hover,
.date-tip:hover,
.figure-tip:hover,
.info-tip[aria-expanded="true"],
.date-tip[aria-expanded="true"],
.figure-tip[aria-expanded="true"] {
  color: #1a1814;
}

.tip-pop {
  position: fixed;
  z-index: 30;
  max-width: min(260px, calc(100vw - 16px));
  padding: 6px 8px;
  border-radius: 8px;
  background: #1a1814;
  color: #fffdf8;
  font-size: 0.72rem;
  line-height: 1.35;
  box-shadow: 0 8px 18px rgba(26, 24, 20, 0.28);
  pointer-events: none;
}

.tip-pop[hidden] {
  display: none;
}

.viewer {
  width: min(920px, calc(100vw - 16px));
  max-height: calc(100vh - 16px);
  margin: auto;
  padding: 10px;
  border: 0;
  border-radius: 12px;
  background: #161410;
  color: #fffdf8;
}

.viewer::backdrop {
  background: rgba(20, 16, 12, 0.78);
}

.viewer-close {
  display: block;
  min-height: 32px;
  margin: 0 0 8px auto;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: #f3ece1;
  color: #1a1814;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

.viewer img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(72vh, 760px);
  object-fit: contain;
  object-position: center top;
  border-radius: 6px;
  background: #fff;
}

.viewer-cap {
  margin: 8px 0 0;
  font-size: 0.72rem;
  line-height: 1.35;
}

.viewer-cap[hidden] {
  display: none;
}

.status {
  margin: 8px 0 0;
  color: #3f3a34;
  font-size: 0.82rem;
}

.status.error {
  color: #7c2d12;
}

.foot {
  margin: 6px 0 0;
  color: #5c564e;
  font-size: 0.72rem;
}

.foot a {
  color: #1e3a5f;
}

.example-site {
  position: fixed;
  z-index: 20;
  left: max(8px, env(safe-area-inset-left, 0px));
  bottom: max(6px, env(safe-area-inset-bottom, 0px));
  max-width: calc(100vw - 16px);
  padding: 2px 0;
  white-space: nowrap;
  color: #5c564e;
  font-size: 0.66rem;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
}

.example-site:hover {
  color: #1e3a5f;
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
.skip:focus-visible {
  outline: 2px solid #1e3a5f;
  outline-offset: 2px;
}

@media (min-width: 880px) {
  .wrap {
    padding-top: 14px;
  }

  .timeline::before {
    left: 50%;
    transform: translateX(-1px);
  }

  .year-mark {
    margin: 4px 0 6px;
    text-align: center;
  }

  .year-mark h2 {
    margin: 0;
    padding: 0 8px;
    background: #e7e0d4;
  }

  .event {
    grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr);
    gap: 14px;
    margin-bottom: 10px;
  }

  .marker {
    grid-column: 2;
    grid-row: 1;
  }

  .card {
    grid-row: 1;
  }

  .event[data-side="left"] .card {
    grid-column: 1;
  }

  .event[data-side="right"] .card {
    grid-column: 3;
  }

  .dot {
    margin-top: 14px;
    margin-left: 4px;
  }

  .figure-tip,
  .figure-tip img,
  .card figure img {
    height: 64px;
  }
}

@media (max-width: 360px) {
  .wrap {
    width: calc(100% - 12px);
  }
}

@media print {
  html,
  body {
    height: auto;
    overflow: visible;
    background: #fff;
  }

  .wrap {
    height: auto;
    overflow: visible;
  }

  .back,
  .foot,
  .skip,
  .example-site,
  .tip-pop {
    display: none;
  }

  .card {
    break-inside: avoid;
    box-shadow: none;
  }
}
