/* A photographic opening and a chronological reading column on the woven page. */
.history-guide {
  --history-ink: #203931;
  --history-green: #1e6059;
  --history-quiet: #53665c;
  --history-rule: #c6c9ba;
  color: var(--history-ink);
}

.history-cover {
  width: min(1560px, calc(100% - 36px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  background-color: #193c39;
  background-image: linear-gradient(110deg, #193b38f7, #123534e8), url('/assets/pattern-relief.svg');
  background-size: auto, 255px;
  color: #fffaf0;
}

.history-cover-copy {
  align-self: center;
  max-width: 775px;
  padding: clamp(42px, 5.7vw, 96px) clamp(26px, 5vw, 85px);
}

.history-cover-copy h1 {
  margin: 0;
  max-width: 9.5ch;
  font: 400 clamp(58px, 7.4vw, 117px)/.99 var(--serif);
  letter-spacing: -.057em;
  text-wrap: balance;
  color: #faf4e7;
}

.history-cover-copy p {
  max-width: 37ch;
  margin: 25px 0 28px;
  font-size: clamp(15px, 1.15vw, 18px);
  line-height: 1.8;
  color: #e2e9de;
}

.history-cover-copy .button {
  gap: 26px;
  color: #173c37;
}

.history-cover-plate {
  position: relative;
  min-height: 470px;
  isolation: isolate;
  overflow: hidden;
}

.history-cover-photo {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 52%;
}

.history-cover-plate::after {
  position: absolute;
  inset: 0;
  content: '';
  background: linear-gradient(0deg, #151c19a6, transparent 23%);
  pointer-events: none;
}

.history-cover-plate figcaption {
  position: absolute;
  z-index: 1;
  bottom: 19px;
  left: clamp(18px, 2vw, 32px);
  right: 18px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: #fffaf0;
}

.history-cover-plate figcaption .icon,
.history-site h3 .icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.history-reading {
  width: min(1290px, calc(100% - 90px));
  margin: clamp(38px, 5vw, 82px) auto clamp(55px, 7vw, 100px);
  display: grid;
  grid-template-columns: minmax(180px, .37fr) minmax(0, 1fr);
  gap: clamp(38px, 5.8vw, 92px);
  align-items: start;
}

.history-contents,
.history-chapter {
  scroll-margin-top: 12px; /* The shared html rule provides room for the pinned site header. */
}

.history-contents {
  position: sticky;
  top: calc(var(--header-height, 84px) + 22px);
  border-top: 2px solid var(--history-ink);
}

.history-contents h2 {
  margin: 18px 0 12px;
  font: 400 25px/1.2 var(--serif);
  letter-spacing: -.035em;
}

.history-contents ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-contents li {
  border-bottom: 1px solid var(--history-rule);
}

.history-contents a {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-height: 60px;
  padding: 9px 2px;
  font-size: 14px;
  line-height: 1.35;
}

.history-contents small {
  font-size: 11px;
  line-height: 1.45;
  color: var(--history-quiet);
}

.history-contents a:hover > span,
.history-contents a:focus-visible > span,
.history-source a:hover,
.history-archive a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.history-timeline { min-width: 0; }

.history-chapter {
  padding: 0 0 clamp(32px, 4vw, 62px);
  border-top: 1px solid var(--history-rule);
}

.history-period {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 23px 0 15px;
  color: var(--history-green);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.history-period::before {
  content: '';
  width: 7px;
  height: 7px;
  transform: rotate(45deg);
  border: 1px solid var(--history-green);
  background: var(--history-green);
}

.history-chapter:target .history-period::before {
  outline: 1px solid var(--history-green);
  outline-offset: 3px;
}

.history-chapter h2 {
  max-width: 24ch;
  margin: 0;
  font: 400 clamp(36px, 3.55vw, 59px)/1.1 var(--serif);
  letter-spacing: -.047em;
  text-wrap: balance;
}

.history-narrative {
  max-width: 66ch;
  margin: 18px 0 22px;
  font-size: clamp(15px, 1.12vw, 18px);
  line-height: 1.82;
  color: #36483d;
}

.history-chapter-photo {
  margin: 0 0 22px;
  overflow: hidden;
}

.history-chapter-photo img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 350px;
  aspect-ratio: 2.5;
  object-fit: cover;
  object-position: 50% 48%;
}

.history-chapter-photo img[src$="/alghero.webp"] {
  object-position: 50% 62%;
}

.history-site {
  padding: 19px clamp(16px, 2vw, 28px) 12px;
  border-inline-start: 3px solid #749a86;
  background: #eaf0e6d9;
}

.history-site h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 7px;
  font: 400 clamp(23px, 2vw, 31px)/1.2 var(--serif);
  letter-spacing: -.03em;
  color: #214d43;
}

.history-site p {
  max-width: 68ch;
  font-size: 14px;
  line-height: 1.72;
  color: #354a3f;
}

.history-visit-link,
.history-back {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  font-size: 13px;
  font-weight: 600;
  color: var(--history-green);
}

.history-visit-link:hover,
.history-back:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.history-visit-link .icon,
.history-back .icon {
  width: 17px;
  height: 17px;
}

.history-source {
  margin-top: 9px;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 9px;
  font-size: 12px;
}

.history-source > span { color: var(--history-quiet); }

.history-source a,
.history-archive a {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-height: 44px;
  color: var(--history-green);
  text-decoration: underline;
  text-decoration-color: #acc0b1;
  text-underline-offset: 3px;
}

.history-source .icon,
.history-archive .icon {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
}

.history-archive {
  margin: 0 0 clamp(35px, 4vw, 64px);
  padding: clamp(20px, 3vw, 40px);
  background: #243936;
  color: #f7f3e9;
}

.history-archive img {
  display: block;
  width: 100%;
  height: auto;
}

.history-archive figcaption {
  margin-top: 20px;
}

.history-archive-date {
  color: #d7dfce;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.history-archive p {
  max-width: 45ch;
  margin: 9px 0 5px;
  font: 400 clamp(21px, 2.2vw, 30px)/1.36 var(--serif);
  letter-spacing: -.02em;
}

.history-archive a {
  color: #e3eadd;
  text-decoration-color: #82988b;
  font-size: 12px;
}

.history-back { border-top: 1px solid var(--history-rule); }
.history-back .icon { transform: rotate(180deg); }

@media (min-width: 761px) and (max-height: 700px) {
  .history-contents { position: static; }
}

@media (max-width: 900px) {
  .history-cover { width: calc(100% - 24px); }
  .history-cover-copy { padding: 45px 28px; }
  .history-cover-copy h1 { font-size: clamp(56px, 8vw, 72px); }
  .history-cover-plate { min-height: 410px; }
  .history-reading { width: calc(100% - 56px); gap: 30px; }
}

@media (max-width: 760px) {
  .history-cover {
    width: calc(100% - 16px);
    grid-template-columns: 1fr;
  }

  .history-cover-copy {
    width: 100%;
    padding: 39px 24px 33px;
  }

  .history-cover-copy h1 {
    max-width: 12ch;
    font-size: clamp(52px, 10vw, 70px);
    line-height: 1.02;
  }

  .history-cover-copy p { margin: 17px 0 20px; line-height: 1.68; }
  .history-cover-copy .button { min-height: 46px; }
  .history-cover-plate { min-height: 0; aspect-ratio: 2.35; }
  .history-cover-plate figcaption { font-size: 10px; left: 16px; bottom: 12px; }

  .history-reading {
    width: calc(100% - 40px);
    margin-top: 34px;
    grid-template-columns: 1fr;
    gap: 35px;
  }

  .history-contents { position: static; }
  .history-contents h2 { margin: 12px 0 7px; }
  .history-contents ol {
    display: grid;
    grid-template-columns: minmax(0,1fr) minmax(0,1fr);
    column-gap: 20px;
  }

  .history-contents a { min-height: 67px; }
  .history-contents small { font-size: 11px; }
  .history-chapter { padding-bottom: 24px; }
  .history-period { margin-top: 19px; font-size: 11px; }
  .history-chapter-photo img { aspect-ratio: 1.65; }
  .history-source { font-size: 11px; }
  .history-archive { padding: 16px; }
}

@media print {
  .history-guide { color: #172b20; }
  .history-cover { width: 100%; background: white; color: #172b20; }
  .history-cover-copy { padding: 16px 20px 16px 0; }
  .history-cover-copy h1, .history-cover-copy p { color: #172b20; }
  .history-cover-plate { min-height: 180px; }
  .history-cover-copy .button, .history-contents, .history-back { display: none; }
  .history-reading { display: block; width: 100%; margin: 20px 0; }
  .history-chapter h2 { break-after: avoid; }
  .history-archive, .history-site { break-inside: avoid; }
}

.history-picker { display: none; }
.history-contents a[aria-current="location"] {
  padding-inline-start: 11px;
  box-shadow: inset 3px 0 #327269;
  background: #e8eee4;
}
@media screen and (max-width: 760px) {
  .history-contents.history-index-ready {
    position: sticky;
    top: var(--header-height, 72px);
    z-index: 4;
    padding: 8px 0;
    border-block: 1px solid var(--history-rule);
    background: var(--ivory);
  }
  .history-index-ready h2 {
    margin: 0 0 3px;
    font: 500 11px/1.4 var(--sans);
    letter-spacing: .04em;
  }
  .history-index-ready ol { display: none; }
  .history-picker {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 4px 6px;
    border: 1px solid var(--history-rule);
    background: #fffdf7;
    color: var(--history-ink);
    font: 400 16px var(--sans);
  }
  .history-reading:has(.history-index-ready) .history-chapter { scroll-margin-top: 72px; }
}
@media screen and (max-height: 500px) {
  .history-contents.history-index-ready { position: static; }
  .history-reading:has(.history-index-ready) .history-chapter { scroll-margin-top: 12px; }
}
