/* ==========================================================================
   Chapter tour — the page is a sequence of full-screen chapters, not a scroll.
   Loaded after style.css, which supplies the palette, type and components.
   ========================================================================== */

:root {
  --topbar-h: 64px;
  --tourbar-h: 72px;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  display: grid;
  grid-template-rows: var(--topbar-h) minmax(0, 1fr) var(--tourbar-h);
}

/* ---------------------------------------------------------------- top bar */

.topbar {
  position: relative;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 24px);
  padding: 0 clamp(16px, 3vw, 34px);
  background: rgba(5, 9, 15, 0.96);
  border-bottom: 1px solid rgba(194, 162, 74, 0.22);
  backdrop-filter: blur(10px);
}

.topbar__brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--txt-on-dark);
}

.topbar__mark {
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: 0.14em;
}

.topbar__sub {
  font-family: var(--font-mono);
  font-size: 0.53rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--bronze);
}

.topbar__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  min-width: 0;
}

.topbar__num {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  color: var(--bronze);
}

.topbar__name {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--txt-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__menu {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  background: none;
  border: 1px solid rgba(194, 162, 74, 0.3);
  color: var(--txt-on-dark);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.topbar__menu:hover {
  border-color: var(--bronze);
  color: var(--bronze-bright);
}

.topbar__lines {
  display: grid;
  gap: 3px;
  width: 15px;
}

.topbar__lines i {
  display: block;
  height: 1px;
  background: currentColor;
}

.topbar__menu[aria-expanded="true"] .topbar__lines i:nth-child(1) {
  transform: translateY(4px) rotate(45deg);
}

.topbar__menu[aria-expanded="true"] .topbar__lines i:nth-child(2) {
  opacity: 0;
}

.topbar__menu[aria-expanded="true"] .topbar__lines i:nth-child(3) {
  transform: translateY(-4px) rotate(-45deg);
}

.topbar__lines i {
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}

.topbar__progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
}

.topbar__progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--bronze-dark), var(--bronze-bright));
  transition: width 0.5s var(--ease);
}

/* ------------------------------------------------------------------ stage */

.stage {
  position: relative;
  overflow: hidden;
}

.chapter {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(16px);
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease), visibility 0.45s;
  scrollbar-width: thin;
  scrollbar-color: var(--bronze-dark) transparent;
}

.chapter.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  z-index: 2;
}

.chapter.is-back {
  transform: translateY(-16px);
}

.chapter::-webkit-scrollbar {
  width: 8px;
}

.chapter::-webkit-scrollbar-thumb {
  background: rgba(142, 116, 48, 0.55);
  border-radius: 8px;
}

.chapter > .container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: clamp(20px, 3.4vh, 44px) clamp(20px, 4vw, 48px) clamp(26px, 4vh, 52px);
}

/* The old sections carried 120px of vertical padding; chapters are tighter. */
.chapter .section__title {
  font-size: clamp(1.9rem, 3.4vw, 2.9rem);
}

.chapter .section__lede {
  margin-top: 12px;
  font-size: clamp(0.95rem, 1.2vw, 1.05rem);
}

.chapter .section__head {
  margin-bottom: clamp(18px, 3vh, 34px);
}

.chapter .rule {
  margin-top: 18px;
}

/* ---------------------------------------------------------------- chapter 0 */

.chapter--cover {
  display: grid;
  place-items: stretch;
}

.cover {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr);
  align-items: center;
  gap: clamp(24px, 4vw, 64px);
  height: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: clamp(20px, 3vh, 40px) clamp(20px, 4vw, 56px);
  background:
    radial-gradient(ellipse at 74% 42%, rgba(194, 162, 74, 0.12), transparent 58%),
    linear-gradient(180deg, #081120 0%, #050a12 100%);
}

.cover__art {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  min-width: 0;
  order: 2;
}

.frame {
  position: relative;
  margin: 0;
  padding: clamp(8px, 1vw, 14px);
  background: linear-gradient(150deg, #7d6222 0%, #c9ab5e 22%, #8a6d28 48%, #d8bd74 74%, #6f5620 100%);
  box-shadow:
    0 30px 70px -30px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(255, 240, 200, 0.25);
}

.frame::after {
  content: "";
  position: absolute;
  inset: clamp(8px, 1vw, 14px);
  box-shadow: inset 0 0 42px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.frame img {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100dvh - var(--topbar-h) - var(--tourbar-h) - 130px);
  object-fit: contain;
}

.cover__cap {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  line-height: 1.7;
  letter-spacing: 0.08em;
  color: rgba(163, 180, 200, 0.75);
  max-width: 70ch;
}

.cover__cap cite {
  font-style: italic;
  color: rgba(230, 236, 244, 0.9);
}

.cover__text {
  order: 1;
  min-width: 0;
}

.cover__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--bronze);
  margin-bottom: clamp(10px, 1.6vh, 18px);
}

.cover__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.9rem, 6.4vw, 5.4rem);
  line-height: 0.96;
  letter-spacing: -0.01em;
  color: var(--ivory);
}

.cover__title em {
  font-style: italic;
  color: var(--bronze-bright);
}

.cover__sub {
  margin-top: 12px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.05rem, 1.9vw, 1.5rem);
  color: rgba(230, 236, 244, 0.82);
}

.cover__intro {
  margin-top: clamp(14px, 2.2vh, 24px);
  max-width: 52ch;
  font-size: clamp(0.92rem, 1.1vw, 1rem);
  line-height: 1.72;
  color: var(--txt-dim);
}

/* phones get a one-sentence stand-in for the long introduction */
.cover__intro--short {
  display: none;
  max-width: none;
}

.cover__facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: clamp(18px, 3vh, 30px) 0 0;
  padding: 16px 0;
  border-top: 1px solid rgba(194, 162, 74, 0.24);
  border-bottom: 1px solid rgba(194, 162, 74, 0.24);
}

.cover__facts dt {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bronze);
  margin-bottom: 6px;
}

.cover__facts dd {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 1.3vw, 1.12rem);
  color: var(--ivory);
}

.cover__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: clamp(18px, 3vh, 30px);
}

/* ---------------------------------------------------------------- tour bar */

.tourbar {
  position: relative;
  z-index: 40;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 0 clamp(16px, 3vw, 34px);
  background: rgba(5, 9, 15, 0.96);
  border-top: 1px solid rgba(194, 162, 74, 0.22);
}

.tourbar__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: none;
  border: 1px solid rgba(194, 162, 74, 0.28);
  color: var(--txt-dim);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.tourbar__btn:hover:not(:disabled) {
  color: var(--ink);
  background: var(--bronze);
  border-color: var(--bronze);
}

.tourbar__btn:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

.tourbar__btn--next {
  justify-self: end;
}

.tourbar__dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.dot {
  position: relative;
  width: 30px;
  height: 30px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(163, 180, 200, 0.28);
  transition: background 0.3s var(--ease), transform 0.3s var(--ease);
}

.dot:hover::before {
  background: var(--bronze-bright);
  transform: scale(1.35);
}

.dot.is-active::before {
  background: var(--bronze);
  transform: scale(1.6);
}

.dot:focus-visible {
  outline: 1px solid var(--bronze);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------- menu */

.menu {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 48px);
  background: rgba(3, 6, 11, 0.94);
  backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s var(--ease), visibility 0.35s;
}

.menu.is-open {
  opacity: 1;
  visibility: visible;
}

.menu__inner {
  width: min(1080px, 100%);
  max-height: 100%;
  overflow-y: auto;
  border: 1px solid rgba(194, 162, 74, 0.28);
  background: linear-gradient(180deg, rgba(12, 22, 38, 0.96), rgba(6, 12, 20, 0.96));
  padding: clamp(20px, 3vw, 36px);
}

.menu__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.menu__label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--bronze);
}

.menu__close {
  background: none;
  border: 1px solid rgba(194, 162, 74, 0.3);
  color: var(--txt-dim);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.menu__close:hover {
  color: var(--ink);
  background: var(--bronze);
}

.menu__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.menu__item {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(194, 162, 74, 0.16);
  color: var(--txt-on-dark);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}

.menu__item:hover,
.menu__item:focus-visible {
  border-color: var(--bronze);
  background: rgba(194, 162, 74, 0.08);
}

.menu__thumb {
  width: 54px;
  height: 54px;
  object-fit: cover;
  filter: saturate(0.85);
}

.menu__num {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.18em;
  color: var(--bronze);
}

.menu__title {
  display: block;
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin-top: 2px;
}

.menu__sub {
  display: block;
  font-size: 0.72rem;
  color: var(--txt-dim);
  margin-top: 2px;
}

.menu__hint {
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.12em;
  color: rgba(163, 180, 200, 0.6);
}

/* --------------------------------------------------- widget: chapter tabs */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(205, 188, 151, 0.5);
}

.tab {
  padding: 9px 16px;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--txt-on-light-mid);
  cursor: pointer;
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease);
}

.tab:hover {
  color: var(--ink);
}

.tab.is-active {
  color: var(--bronze-dark);
  border-bottom-color: var(--bronze-dark);
}

.pane {
  display: none;
}

.pane.is-active {
  display: block;
  animation: fadeUp 0.4s var(--ease) both;
}

/* sub-navigation inside the ship chapter */
.tabs--sub {
  margin-bottom: clamp(14px, 2.4vh, 26px);
  border-bottom: 1px solid rgba(205, 188, 151, 0.55);
}

.tabs--sub .tab {
  padding: 11px 18px;
  font-size: 0.63rem;
  letter-spacing: 0.18em;
}

.tabs--sub .tab.is-active {
  color: var(--ink);
  border-bottom-color: var(--bronze-dark);
}

.ship-pane {
  min-height: 0;
}

/* the chapter has to fit a screen, so the figures and the table are compacted */
.ship-pane .stats {
  margin: 0 0 clamp(12px, 2vh, 20px);
}

.ship-pane .lede-grid {
  display: flex;
  flex-direction: column-reverse;
  align-items: stretch;
  margin: 0;
}

.ship-pane .lede-grid__body {
  columns: 1;
  max-width: 1100px;
}

.ship-pane .lede-grid__body p {
  margin-top: 0;
}

.ship-pane .lede-grid__body p + p {
  margin-top: 1.05em;
  text-indent: 0;
}

.ship-pane .lede-grid__aside {
  position: static;
  float: none;
  margin: 0 0 clamp(14px, 2.4vh, 24px);
  padding: 0 0 14px;
  border-left: 0;
  border-bottom: 1px solid var(--parch-line);
  max-width: none;
}

.ship-pane .pullquote {
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  line-height: 1.45;
}

/* six compact figures across the top of the specification panel */
.ship-pane .stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 clamp(12px, 2vh, 20px);
  background: none;
  border: 0;
}

.ship-pane .stat {
  padding: 12px 13px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--parch-line);
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
}

.ship-pane .stat:hover {
  background: rgba(255, 255, 255, 0.85);
  border-color: var(--bronze-dark);
}

.ship-pane .stat__no,
.ship-pane .stat__note {
  display: none;
}

.ship-pane .stat__value {
  font-size: clamp(1.05rem, 1.5vw, 1.32rem);
  line-height: 1.15;
}

.ship-pane .stat__value small {
  display: block;
  margin-top: 2px;
  font-size: 0.58rem;
}

.ship-pane .stat__label {
  margin-top: 8px;
  font-size: 0.53rem;
  letter-spacing: 0.14em;
  line-height: 1.5;
}

.ship-pane .notes {
  margin-top: 0;
}

.ship-pane .gloss {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 clamp(16px, 2.4vw, 30px);
  margin-top: 0;
  border-top: 1px solid var(--parch-line);
}

.ship-pane .gloss__head {
  grid-column: 1 / -1;
}

.ship-pane .gloss__item {
  break-inside: avoid;
}

@media (max-width: 900px) {
  .ship-pane .gloss {
    grid-template-columns: minmax(0, 1fr);
  }
}

.ship-pane .stat {
  padding: 16px 18px;
}

.ship-pane .stat__value {
  font-size: clamp(1.35rem, 2vw, 1.7rem);
}

.ship-pane .stat__note {
  font-size: 0.76rem;
  line-height: 1.55;
}

.ship-pane .spec {
  margin-top: 0;
  border-top: 1px solid var(--parch-line);
}

.ship-pane #ship-reference .notes {
  margin-top: 0;
}

/* ship chapter: the specification list scrolls inside its pane */
.spec.is-scroll {
  max-height: min(46vh, 430px);
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--parch-line) transparent;
}

.spec.is-scroll::-webkit-scrollbar {
  width: 7px;
}

.spec.is-scroll::-webkit-scrollbar-thumb {
  background: var(--parch-line);
  border-radius: 8px;
}

/* -------------------------------------------------- widget: rail + detail */

.rail-layout {
  display: grid;
  grid-template-columns: minmax(0, 210px) minmax(0, 1fr);
  gap: clamp(16px, 2.4vw, 36px);
  align-items: start;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-left: 1px solid rgba(194, 162, 74, 0.3);
  max-height: min(66vh, 620px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.rail__btn {
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: baseline;
  gap: 10px;
  padding: 10px 12px;
  background: none;
  border: 0;
  border-left: 2px solid transparent;
  margin-left: -1px;
  text-align: left;
  cursor: pointer;
  color: inherit;
  opacity: 0.62;
  transition: opacity 0.25s var(--ease), border-color 0.25s var(--ease), background 0.25s var(--ease);
}

.rail__btn:hover {
  opacity: 1;
  background: rgba(194, 162, 74, 0.06);
}

.rail__btn.is-active {
  opacity: 1;
  border-left-color: var(--bronze);
  background: rgba(194, 162, 74, 0.1);
}

.rail__year {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--bronze);
}

.rail__label {
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.25;
}

.chapter--navy .rail,
.chapter--deep .rail {
  border-left-color: rgba(194, 162, 74, 0.35);
}

/* features become a single detail panel */
.features.is-detail .feature {
  display: none;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(18px, 3vw, 40px);
  align-items: center;
  animation: fadeUp 0.45s var(--ease) both;
}

.features.is-detail .feature.is-active {
  display: grid;
}

.features.is-detail .feature__media img {
  width: 100%;
  height: auto;
  max-height: min(52vh, 460px);
  object-fit: cover;
}

.features.is-detail .feature__body h3 {
  font-size: clamp(1.3rem, 2vw, 1.75rem);
}

.features.is-detail .feature__body p {
  margin-top: 12px;
  font-size: clamp(0.88rem, 1.05vw, 0.97rem);
  line-height: 1.75;
  max-width: 56ch;
}

/* timeline becomes rail + a single card */
.timeline.is-railed .tl-item {
  display: none;
  animation: fadeUp 0.45s var(--ease) both;
}

.timeline.is-railed .tl-item.is-active {
  display: block;
}

.timeline.is-railed .tl-item__year,
.timeline.is-railed .tl-item__dot {
  display: none;
}

.timeline.is-railed .tl-item__card {
  border: 1px solid var(--parch-line);
  background: rgba(255, 255, 255, 0.4);
}

.timeline.is-railed .tl-item__media img {
  max-height: min(46vh, 400px);
  width: 100%;
  object-fit: cover;
}

/* trafalgar becomes a stepped account */
.traf__grid.is-stepped .traf__cell {
  display: none;
  animation: fadeUp 0.45s var(--ease) both;
}

.traf__grid.is-stepped .traf__cell.is-active {
  display: block;
}

.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0 18px;
}

.step {
  min-width: 38px;
  height: 34px;
  padding: 0 10px;
  background: none;
  border: 1px solid rgba(194, 162, 74, 0.28);
  color: var(--txt-dim);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.25s var(--ease);
}

.step:hover {
  color: var(--ivory);
  border-color: var(--bronze);
}

.step.is-active {
  background: var(--bronze);
  border-color: var(--bronze);
  color: var(--ink);
}

.step--wide {
  padding: 0 14px;
}

.step__hint {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(163, 180, 200, 0.55);
  margin-top: 14px;
}

/* navy / deep chapter text defaults already come from style.css theme classes */

/* knowledge chapter: six cards should sit on two rows */
#knowledge .kcards {
  gap: clamp(12px, 1.6vw, 20px);
}

#knowledge .kcard {
  padding: clamp(16px, 1.8vw, 24px);
}

#knowledge .kcard__body {
  font-size: 0.87rem;
  line-height: 1.62;
}

#knowledge .kcard h3 {
  font-size: 1.02rem;
  margin-bottom: 10px;
}

#knowledge .kcard__toggle {
  margin-top: 12px;
  font-size: 0.56rem;
}

/* sources chapter: centre the footer block in the screen */
.chapter--sources > .container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100%;
}

@media (max-width: 760px) {
  .chapter--sources > .container {
    justify-content: flex-start;
  }
}

/* ==========================================================================
   Opening sequence — plays once when the exhibition is opened on the cover.
   The curtain lifts, the painting settles into its frame and the title block
   arrives line by line. Any key or tap skips straight to the final state.
   ========================================================================== */

.curtain {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #04070c;
  pointer-events: none;
  animation: curtainLift 1.15s var(--ease) 0.05s both;
}

html.is-intro .topbar {
  animation: introDown 0.8s var(--ease) 0.5s both;
}

html.is-intro .tourbar {
  animation: introUp 0.8s var(--ease) 0.7s both;
}

html.is-intro .cover__art {
  animation: introFrame 1.2s var(--ease) 0.15s both;
}

.cover__art .frame.is-ken {
  animation: kenBurns 22s ease-out 1.2s both;
}

html.is-intro .cover__eyebrow {
  animation: introRise 0.7s var(--ease) 0.62s both;
}

html.is-intro .cover__title {
  animation: introTitle 1.1s var(--ease) 0.74s both;
}

html.is-intro .cover__sub {
  animation: introRise 0.8s var(--ease) 1s both;
}

html.is-intro .cover__intro {
  animation: introRise 0.9s var(--ease) 1.16s both;
}

html.is-intro .cover__facts div:nth-child(1) { animation: introRise 0.7s var(--ease) 1.38s both; }
html.is-intro .cover__facts div:nth-child(2) { animation: introRise 0.7s var(--ease) 1.46s both; }
html.is-intro .cover__facts div:nth-child(3) { animation: introRise 0.7s var(--ease) 1.54s both; }
html.is-intro .cover__facts div:nth-child(4) { animation: introRise 0.7s var(--ease) 1.62s both; }

html.is-intro .cover__actions {
  animation: introRise 0.8s var(--ease) 1.74s both;
}

html.is-intro .cover__cap {
  animation: introRise 0.9s var(--ease) 1.62s both;
}

@keyframes curtainLift {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    visibility: hidden;
  }
}

@keyframes introDown {
  from {
    opacity: 0;
    transform: translateY(-14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes introUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes introFrame {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.965);
    filter: brightness(0.55);
  }
  to {
    opacity: 1;
    transform: none;
    filter: brightness(1);
  }
}

@keyframes kenBurns {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.025);
  }
}

@keyframes introTitle {
  from {
    opacity: 0;
    transform: translateY(26px);
    letter-spacing: 0.05em;
    filter: blur(7px);
  }
  to {
    opacity: 1;
    transform: none;
    letter-spacing: -0.01em;
    filter: blur(0);
  }
}

@keyframes introRise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* the slow push of the painting stays inside the column gutters */
.cover__art {
  overflow: visible;
}

@media (prefers-reduced-motion: reduce) {
  html.is-intro .topbar,
  html.is-intro .tourbar,
  html.is-intro .cover__art,
  .cover__art .frame.is-ken,
  html.is-intro .cover__eyebrow,
  html.is-intro .cover__title,
  html.is-intro .cover__sub,
  html.is-intro .cover__intro,
  html.is-intro .cover__facts div,
  html.is-intro .cover__actions,
  html.is-intro .cover__cap,
  .curtain {
    animation: none !important;
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* reveal on chapter entry */
.chapter .chapter-reveal {
  opacity: 0;
  transform: translateY(12px);
}

.chapter.is-active .chapter-reveal.is-in {
  animation: fadeUp 0.6s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 60ms);
}

@media (prefers-reduced-motion: reduce) {
  .chapter,
  .chapter .chapter-reveal,
  .features.is-detail .feature,
  .timeline.is-railed .tl-item,
  .traf__grid.is-stepped .traf__cell {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 1080px) {
  .cover {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    align-content: center;
  }

  .cover__art {
    order: 1;
  }

  .cover__text {
    order: 2;
  }

  .cover .frame img {
    max-height: min(38vh, 340px);
    margin: 0 auto;
  }

  .frame {
    display: flex;
    justify-content: center;
  }

  .cover__art .frame {
    width: fit-content;
    margin-inline: auto;
  }

  .cover__facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rail-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .rail {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    border-left: 0;
    border-bottom: 1px solid rgba(194, 162, 74, 0.3);
    max-height: none;
    padding-bottom: 4px;
  }

  .rail__btn {
    border-left: 0;
    border-bottom: 2px solid transparent;
    margin-left: 0;
    margin-bottom: -1px;
    white-space: nowrap;
    grid-template-columns: auto auto;
  }

  .rail__btn.is-active {
    border-bottom-color: var(--bronze);
  }

  .features.is-detail .feature {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  :root {
    --topbar-h: 58px;
    --tourbar-h: 64px;
  }

  .topbar__sub,
  .topbar__menu-label {
    display: none;
  }

  .topbar__meta {
    gap: 8px;
  }

  .tourbar {
    gap: 10px;
  }

  .tourbar__btn {
    padding: 9px 12px;
    letter-spacing: 0.14em;
  }

  .tourbar__btn span {
    display: none;
  }

  .dot {
    width: 24px;
    height: 24px;
  }

  .cover__title {
    font-size: clamp(2.4rem, 11vw, 3.2rem);
  }

  .cover__intro {
    font-size: 0.86rem;
    line-height: 1.62;
  }

  .cover .frame img {
    max-height: 24vh;
  }

  /* the frame spans the full text column on phones */
  .cover__art .frame {
    width: 100%;
    margin-inline: 0;
    padding: 6px;
  }

  .cover__art .frame::after {
    inset: 6px;
  }

  .cover__art .frame img {
    max-height: none;
    height: auto;
  }

  .cover {
    padding: 14px 18px;
  }

  /* keep the call to action above the fold on phones */
  .cover__facts {
    display: none;
  }

  .cover__intro {
    font-size: 0.75rem;
    line-height: 1.45;
  }

  .cover__intro:not(.cover__intro--short) {
    display: none;
  }

  .cover__intro--short {
    display: block;
    margin-top: 10px;
  }

  .cover__cap {
    font-size: 0.5rem;
    line-height: 1.55;
  }

  .cover__sub {
    font-size: 0.98rem;
    margin-top: 8px;
  }

  .cover__eyebrow {
    margin-bottom: 8px;
    font-size: 0.5rem;
    letter-spacing: 0.08em;
    white-space: nowrap;
  }

  .cover__intro {
    margin-top: 10px;
  }

  .cover__actions {
    margin-top: 14px;
    gap: 8px;
  }

  .cover__actions .btn {
    padding: 12px 18px;
    font-size: 0.62rem;
  }

  .chapter > .container {
    padding-left: 18px;
    padding-right: 18px;
  }

  .menu__list {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
}

/* short phones: the picture gives up a little width so the caption, the short
   introduction and both buttons still fit above the fold */
@media (max-width: 760px) and (max-height: 760px) {
  .cover__art .frame {
    width: 90%;
    margin-inline: auto;
  }
}

@media (max-width: 760px) and (max-height: 700px) {
  .cover__art .frame {
    width: 78%;
  }
}

@media (max-width: 760px) and (max-height: 660px) {
  .cover__art .frame {
    width: 72%;
  }
}
