/* Cover */
.cover-stage {
  height: 100%;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  background: var(--qin-dark);
}

.cover-strip {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid rgba(255, 249, 239, .12);
}

.cover-strip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center var(--cover-focus, 62%);
  filter: sepia(.18) saturate(.68) brightness(.62);
  transform: scale(1.05);
  animation: cover-breathe 9s var(--ease) infinite alternate;
  animation-delay: calc(var(--i) * -1.1s);
}

.cover-strip:nth-child(1) img { --cover-focus: 28%; }
.cover-strip:nth-child(2) img { --cover-focus: 67%; }
.cover-strip:nth-child(3) img { --cover-focus: 58%; }
.cover-strip:nth-child(4) img { --cover-focus: 63%; }
.cover-strip:nth-child(5) img { --cover-focus: 65%; }
.cover-strip:nth-child(6) img { --cover-focus: 59%; }

.cover-stage::after {
  position: absolute;
  z-index: 4;
  inset: 0;
  content: "";
  background:
    linear-gradient(180deg, rgba(45, 12, 10, .2), rgba(35, 13, 11, .48)),
    linear-gradient(90deg, transparent 48%, rgba(255, 249, 239, .05) 50%, transparent 52%);
}

.cover-line {
  position: absolute;
  z-index: 6;
  left: 9%;
  right: 9%;
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold) 22%, var(--gold) 78%, transparent);
  transform-origin: left;
  animation: line-draw 1.4s .25s var(--ease) both;
}

.scene-copy.is-cover {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: center;
}

.scene-copy.is-cover .scene-title {
  font-size: clamp(58px, 6.4vw, 92px);
}

/* Modern standards */
.modern-stage {
  height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgba(238, 229, 213, .17), transparent 40%),
    var(--qin-dark);
}

.modern-orbit {
  position: relative;
  width: min(70%, 520px);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 249, 239, .2);
  border-radius: 50%;
}

.modern-orbit::before,
.modern-orbit::after {
  position: absolute;
  inset: 19%;
  content: "";
  border: 1px solid rgba(255, 249, 239, .13);
  border-radius: 50%;
}

.modern-orbit::after {
  inset: 39%;
  background: var(--gold);
  box-shadow: 0 0 50px rgba(180, 138, 67, .3);
}

.modern-chip {
  position: absolute;
  left: 50%;
  top: 50%;
  min-width: 72px;
  padding: 9px 11px;
  border: 1px solid rgba(255, 249, 239, .26);
  border-radius: 99px;
  color: var(--white);
  background: rgba(24, 20, 17, .48);
  font: 700 11px/1 var(--sans);
  text-align: center;
  transform:
    rotate(calc(var(--i) * 72deg))
    translateY(calc(-1 * min(24vw, 188px)))
    rotate(calc(var(--i) * -72deg));
}

/* Annotation */
.annotation-marker {
  position: absolute;
  z-index: 7;
  left: 29%;
  top: 6%;
  width: 43%;
  height: 70%;
  border: 2px solid rgba(143, 32, 28, .88);
  border-radius: 46% 52% 44% 50%;
  opacity: 0;
  pointer-events: none;
  transform: scale(.82);
  transition: opacity .35s ease, transform .35s var(--ease);
}

.artifact-stage.is-annotated .annotation-marker {
  opacity: 1;
  transform: none;
}

.artifact-stage.is-annotated .artifact-img {
  filter: contrast(1.04) brightness(.93);
}

/* Pair compare */
.pair-stage {
  position: absolute;
  z-index: 8;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 0fr;
  align-items: center;
  gap: 0;
  padding: 7%;
  pointer-events: none;
  transition: grid-template-columns .6s var(--ease), gap .6s var(--ease);
}

.pair-stage .ding-copy {
  position: relative;
  height: 82%;
  opacity: 0;
}

.pair-stage .gui-outline {
  position: relative;
  width: 0;
  height: min(60%, 330px);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  overflow: visible;
  opacity: 0;
  transition: width .6s var(--ease), opacity .4s ease;
}

.gui-vessel {
  position: relative;
  width: min(100%, 240px);
  height: 100%;
  min-height: 118px;
  margin: 0 auto;
}

.gui-body {
  position: absolute;
  z-index: 2;
  left: 15%;
  right: 15%;
  top: 22%;
  height: 48%;
  border: 3px solid rgba(255, 249, 239, .78);
  border-top-width: 8px;
  border-radius: 16% 16% 42% 42%;
  box-shadow:
    inset 0 -18px 0 rgba(83, 106, 94, .26),
    0 20px 40px rgba(24, 20, 17, .22);
}

.gui-foot {
  position: absolute;
  z-index: 2;
  left: 36%;
  right: 36%;
  top: 69%;
  height: 18%;
  border: 3px solid rgba(255, 249, 239, .78);
  border-top: 0;
}

.gui-handles {
  position: absolute;
  z-index: 1;
  left: 2%;
  right: 2%;
  top: 31%;
  height: 30%;
}

.gui-handles::before,
.gui-handles::after {
  position: absolute;
  top: 0;
  width: 25%;
  height: 100%;
  border: 3px solid rgba(255, 249, 239, .78);
  border-radius: 50%;
  content: "";
}

.gui-handles::before {
  left: 0;
  border-right: 0;
}

.gui-handles::after {
  right: 0;
  border-left: 0;
}

.pair-stage .gui-label {
  display: grid;
  gap: 4px;
  justify-items: center;
  margin-top: 8px;
  min-width: min(100%, 168px);
  justify-self: center;
  padding: 7px 10px;
  border-left: 2px solid var(--gold);
  color: var(--white);
  background: rgba(24, 20, 17, .64);
  font-family: var(--sans);
  text-align: center;
}

.pair-stage .gui-label b {
  font-size: 17px;
  line-height: 1;
}

.pair-stage .gui-label small {
  display: grid;
  gap: 2px;
  max-width: 160px;
  color: rgba(255, 249, 239, .82);
  font-size: 9px;
  line-height: 1.35;
}

.pair-stage .gui-label small span {
  white-space: nowrap;
}

.artifact-stage.is-paired .artifact-img {
  transform: translateX(-18%) scale(.86);
}

.artifact-stage.is-paired .pair-stage {
  grid-template-columns: 1fr .72fr;
  gap: 4%;
}

.artifact-stage.is-paired .gui-outline {
  width: 100%;
  opacity: 1;
}

/* Material transition */
.material-stage {
  position: relative;
  height: 100%;
  overflow: hidden;
  background:
    linear-gradient(rgba(91, 63, 42, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91, 63, 42, .06) 1px, transparent 1px),
    radial-gradient(circle at 62% 48%, rgba(180, 138, 67, .17), transparent 34%),
    #d8cbb7;
  background-size: 32px 32px, 32px 32px, auto, auto;
}

.material-stage::after {
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(91, 63, 42, .22);
  content: "";
  pointer-events: none;
}

.material-source {
  position: absolute;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 27px;
  min-width: 258px;
  padding: 27px 36px;
  border: 3px solid rgba(55, 44, 34, .28);
  color: var(--ink);
  background: rgba(239, 230, 211, .9);
  box-shadow: 0 24px 66px rgba(55, 44, 34, .09);
  font: 700 36px/1 var(--sans);
  animation: material-enter .8s var(--ease) both;
}

.material-source i {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--source-color);
  box-shadow: inset 0 0 0 6px rgba(255, 255, 255, .25);
}

.material-source b {
  white-space: nowrap;
}

.material-source-gold {
  --source-color: #b48a43;
  left: 5%;
  top: 10%;
}

.material-source-turquoise {
  --source-color: #58766c;
  left: 5%;
  bottom: 8%;
  animation-delay: .12s;
}

.material-source-iron {
  --source-color: #67706b;
  left: 5%;
  right: auto;
  top: 42%;
  bottom: auto;
  animation-delay: .24s;
}

.material-assembly {
  position: absolute;
  z-index: 5;
  left: 60%;
  top: 47%;
  width: clamp(96px, 18vw, 176px);
  height: min(66%, 450px);
  transform: translate(-50%, -50%) rotate(13deg);
}

.material-pommel,
.material-grip,
.material-guard,
.material-blade,
.material-inlay {
  position: absolute;
  left: 50%;
  display: block;
  transform: translateX(-50%);
}

.material-pommel {
  top: 0;
  width: 38px;
  height: 30px;
  border: 2px solid #84632d;
  border-radius: 48% 48% 28% 28%;
  background: linear-gradient(135deg, #d2b16f, #96702f);
}

.material-grip {
  top: 26px;
  width: 17px;
  height: 64px;
  border: 1px solid #86652e;
  background: repeating-linear-gradient(0deg, #aa8240 0 7px, #d1ae68 7px 10px);
}

.material-guard {
  top: 85px;
  width: 72px;
  height: 12px;
  border: 1px solid #765829;
  border-radius: 50%;
  background: linear-gradient(90deg, #88662f, #d0ac63, #88662f);
}

.material-blade {
  top: 94px;
  width: 27px;
  height: calc(100% - 94px);
  clip-path: polygon(9% 0, 91% 0, 70% 90%, 50% 100%, 30% 90%);
  background: linear-gradient(90deg, #4e5552, #a9aeaa 47%, #5b625e);
  box-shadow: 6px 11px 18px rgba(40, 35, 31, .2);
}

.material-inlay {
  top: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5f8c80;
  box-shadow: -10px 7px 0 #5f8c80, 10px 7px 0 #5f8c80;
}

.material-conclusion {
  position: absolute;
  z-index: 6;
  right: 6%;
  top: 12%;
  margin: 0;
  color: var(--ink);
  text-align: right;
}

.material-conclusion b,
.material-conclusion span {
  display: block;
}

.material-conclusion b {
  color: var(--qin);
  font-size: clamp(21px, 3vw, 34px);
}

.material-conclusion span {
  margin-top: 5px;
  font: 11px/1.4 var(--sans);
}

/* Material hotspots */
.material-highlight {
  position: absolute;
  z-index: 7;
  left: var(--x, 50%);
  top: var(--y, 50%);
  width: var(--size, min(24vw, 180px));
  aspect-ratio: 1;
  border: 2px solid var(--highlight, var(--gold));
  border-radius: 50%;
  box-shadow: 0 0 0 999px rgba(24, 20, 17, .22);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.7);
  transition: opacity .35s ease, transform .45s var(--ease);
}

.artifact-stage.has-material-focus .material-highlight {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Path transition */
.path-stage {
  position: relative;
  height: 100%;
  display: grid;
  place-items: center;
  background:
    linear-gradient(rgba(105, 78, 51, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(105, 78, 51, .055) 1px, transparent 1px),
    radial-gradient(circle at 82% 50%, rgba(133, 30, 24, .13), transparent 34%),
    #d7c9b5;
  background-size: 36px 36px, 36px 36px, auto, auto;
}

.path-stage::after {
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(91, 63, 42, .22);
  content: "";
  pointer-events: none;
}

.rule-path {
  position: relative;
  z-index: 2;
  width: min(88%, 760px);
  display: grid;
  grid-template-columns: 1fr 38px 1fr 38px 1fr 38px 1fr;
  align-items: center;
  gap: 5px;
}

.rule-step {
  height: 126px;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 14px 8px;
  border: 1px solid rgba(74, 54, 39, .26);
  color: var(--ink);
  background: rgba(238, 228, 209, .82);
  text-align: center;
  box-shadow: 0 10px 26px rgba(55, 42, 32, .08);
}

.rule-index {
  margin-bottom: 10px;
  color: var(--gold-dark);
  font: 700 10px/1 var(--sans);
  letter-spacing: .15em;
}

.rule-step b {
  color: var(--qin);
  font-size: clamp(22px, 2.7vw, 34px);
}

.rule-step small {
  margin-top: 8px;
  color: #66594e;
  font: 10px/1.4 var(--sans);
}

.rule-link {
  position: relative;
  height: 32px;
}

.rule-link::after {
  position: absolute;
  left: 50%;
  top: 50%;
  color: var(--qin);
  content: "›";
  font: 400 28px/1 var(--serif);
  transform: translate(-50%, -54%);
}

.path-caption {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 12%;
  width: 100%;
  margin: 0;
  color: #65574c;
  font: 11px/1.4 var(--sans);
  letter-spacing: .08em;
  text-align: center;
  transform: translateX(-50%);
}

/* Seal observer */
.artifact-stage[data-seal-view="evidence"] .artifact-img {
  object-fit: contain;
  object-position: center;
  padding: clamp(18px, 3vw, 42px);
  background: #cabcaa;
}

.seal-word-overlay {
  position: absolute;
  z-index: 7;
  right: 6%;
  bottom: 9%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  width: 98px;
  padding: 10px;
  border: 1px solid rgba(255, 249, 239, .36);
  color: var(--white);
  background: rgba(85, 18, 15, .86);
  font-size: 21px;
  text-align: center;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .35s ease, transform .35s var(--ease);
}

.artifact-stage[data-seal-view="words"] .seal-word-overlay {
  opacity: 1;
  transform: none;
}

/* Measure */
.measure-stage {
  height: 100%;
  display: grid;
  align-content: center;
  justify-content: center;
  grid-template-columns: repeat(2, minmax(110px, 190px));
  gap: clamp(28px, 7vw, 76px);
  padding: 9%;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 249, 239, .18), transparent 37%),
    var(--qin-dark);
}

.measure-vessel {
  position: relative;
  align-self: end;
  overflow: hidden;
  border: 3px solid rgba(255, 249, 239, .72);
  border-top-width: 8px;
  border-radius: 10px 10px 28px 28px;
  background: rgba(255, 249, 239, .08);
}

.measure-vessel.a { height: min(38vh, 320px); }
.measure-vessel.b { height: min(27vh, 230px); }

.measure-grain {
  position: absolute;
  inset: auto 0 0;
  height: 0;
  background:
    radial-gradient(circle at 3px 3px, rgba(78, 43, 20, .42) 1.4px, transparent 1.8px) 0 0 / 9px 9px,
    linear-gradient(#d1a45d, #a97735);
  transition: height .55s var(--ease);
}

.measure-vessel span {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  top: 16px;
  color: var(--white);
  font: 800 12px/1 var(--sans);
  text-align: center;
}

.measure-difference {
  position: absolute;
  z-index: 8;
  left: 50%;
  bottom: 8%;
  width: min(78%, 520px);
  color: rgba(255, 249, 239, .86);
  font: 13px/1.65 var(--sans);
  text-align: center;
  transform: translateX(-50%);
}

/* Relation */
.relation-stage {
  height: 100%;
  display: grid;
  align-content: center;
  grid-template-columns: repeat(6, minmax(60px, 1fr));
  gap: 8px;
  padding: 8%;
  background: #2a211c;
}

.relation-item {
  position: relative;
  min-width: 0;
  height: min(62vh, 520px);
  overflow: hidden;
  border: 1px solid rgba(255, 249, 239, .12);
  cursor: pointer;
  opacity: .68;
  transition: opacity .3s ease, transform .35s var(--ease), border-color .3s ease;
}

.relation-item:hover,
.relation-item:focus-visible {
  z-index: 3;
  border-color: var(--gold);
  opacity: 1;
  transform: translateY(-8px);
}

.relation-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center var(--item-focus, 62%);
  filter: saturate(.76) brightness(.78);
}

.relation-item:nth-child(1) img { --item-focus: 28%; }

.relation-item span {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 30px 5px 10px;
  color: var(--white);
  background: linear-gradient(transparent, rgba(24, 20, 17, .88));
  font: 700 10px/1.35 var(--sans);
  text-align: center;
}

.relation-thread {
  position: absolute;
  z-index: 5;
  left: 8%;
  right: 8%;
  top: 50%;
  height: 1px;
  pointer-events: none;
  background: var(--qin);
}

/* Ending branches */
.ending-stage {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 2px;
  background: var(--black);
}

.ending-stage figure {
  position: relative;
  min-width: 0;
  min-height: 0;
  margin: 0;
  overflow: hidden;
}

.ending-stage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 63%;
  filter: sepia(.15) saturate(.6) brightness(.67);
  transition: filter .35s ease, transform .5s var(--ease);
}

.ending-stage figure:hover img {
  filter: saturate(.9) brightness(.82);
  transform: scale(1.025);
}

.ending-stage figcaption {
  position: absolute;
  z-index: 3;
  inset: auto 0 0;
  padding: 24px 8px 9px;
  color: rgba(255, 249, 239, .9);
  background: linear-gradient(transparent, rgba(24, 20, 17, .88));
  font: 700 10px/1.3 var(--sans);
  text-align: center;
}

@keyframes cover-breathe {
  from { transform: scale(1.04) translateY(-1%); }
  to { transform: scale(1.1) translateY(1%); }
}

@keyframes line-draw {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes material-enter {
  from {
    opacity: 0;
    filter: blur(4px);
  }
}

@media (max-width: 760px) {
  .cover-stage {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
  }

  .scene-copy.is-cover {
    min-height: auto;
  }

  .scene-copy.is-cover .scene-title {
    font-size: clamp(49px, 15vw, 66px);
  }

  .modern-orbit {
    width: min(74%, 260px);
  }

  .modern-chip {
    min-width: 58px;
    padding: 8px;
    transform:
      rotate(calc(var(--i) * 72deg))
      translateY(-112px)
      rotate(calc(var(--i) * -72deg));
  }

  .annotation-marker {
    left: 29%;
    top: 6%;
    width: 43%;
    height: 70%;
  }

  .pair-stage {
    padding: 5% 4%;
  }

  .artifact-stage.is-paired .artifact-img {
    transform: translateX(-21%) scale(.78);
  }

  .pair-stage .gui-outline {
    height: 68%;
  }

  .gui-vessel {
    min-height: 96px;
  }

  .pair-stage .gui-label b {
    font-size: 15px;
  }

  .pair-stage .gui-label small {
    max-width: 118px;
    font-size: 8px;
  }

  .material-stage::after,
  .path-stage::after {
    inset: 10px;
  }

  .material-source {
    min-width: 138px;
    gap: 10px;
    padding: 11px 15px;
    border-width: 2px;
    font-size: 23px;
  }

  .material-source i {
    width: 24px;
    height: 24px;
    box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .25);
  }

  .material-conclusion b {
    font-size: 20px;
  }

  .material-source-gold {
    left: 4%;
    top: 4%;
  }

  .material-source-turquoise {
    left: 4%;
    top: auto;
    bottom: 4%;
  }

  .material-source-iron {
    left: 4%;
    right: auto;
    top: 36%;
    bottom: auto;
  }

  .material-assembly {
    left: 78%;
    top: 54%;
    width: 74px;
    height: 70%;
  }

  .material-conclusion {
    right: 3%;
    top: 3%;
  }

  .material-conclusion span {
    max-width: 116px;
    font-size: 9px;
  }

  .rule-path {
    width: calc(100% - 34px);
    grid-template-columns: 1fr 12px 1fr 12px 1fr 12px 1fr;
    gap: 2px;
  }

  .rule-step {
    height: 112px;
    padding: 10px 3px;
  }

  .rule-index {
    margin-bottom: 7px;
    font-size: 8px;
  }

  .rule-step b {
    font-size: 19px;
  }

  .rule-step small {
    margin-top: 6px;
    font-size: 8px;
  }

  .path-caption {
    bottom: 9%;
    font-size: 10px;
  }

  .measure-stage {
    grid-template-columns: repeat(2, minmax(96px, 138px));
    gap: 25px;
    padding: 9% 6% 13%;
  }

  .measure-vessel.a { height: 190px; }
  .measure-vessel.b { height: 138px; }

  .measure-difference {
    bottom: 4%;
    font-size: 11px;
  }

  .relation-stage {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 5px;
    padding: 5%;
  }

  .relation-item {
    width: 100%;
    height: 100%;
  }

  .relation-item span {
    padding: 22px 4px 7px;
    font-size: 9px;
    text-align: center;
  }

  .relation-thread {
    display: none;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .pair-stage {
    padding: 5% 7%;
  }

  .pair-stage .gui-outline {
    height: 72%;
  }

  .gui-vessel {
    min-height: 112px;
  }

  .pair-stage .gui-label {
    margin-top: 4px;
  }

  .modern-orbit {
    width: min(64vh, 290px);
  }

  .modern-chip {
    min-width: 58px;
    padding: 7px 8px;
    font-size: 10px;
    transform:
      rotate(calc(var(--i) * 72deg))
      translateY(calc(-1 * min(24vh, 112px)))
      rotate(calc(var(--i) * -72deg));
  }

  .material-source {
    min-width: 108px;
    gap: 10px;
    padding: 10px 14px;
    border-width: 2px;
    font-size: 17px;
  }

  .material-source i {
    width: 16px;
    height: 16px;
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .25);
  }

  .material-source-gold {
    left: 5%;
    top: 8%;
  }

  .material-source-iron {
    left: 5%;
    top: 40%;
  }

  .material-source-turquoise {
    left: 5%;
    bottom: 8%;
  }

  .material-assembly {
    left: 68%;
    top: 53%;
    width: 76px;
    height: 76%;
  }

  .material-conclusion {
    right: 4%;
    top: 6%;
  }

  .material-conclusion b {
    font-size: 21px;
  }

  .material-conclusion span {
    display: none;
  }

  .relation-stage {
    gap: 5px;
    padding: 4%;
  }

  .relation-item {
    height: min(64vh, 320px);
  }
}
