@import url("fonts.css");
:root {
  --paper: #eee3c9;
  --paper-deep: #e4d2ac;
  --ink: #352a1e;
  --muted: #776448;
  --blue: #274b70;
  --red: #873a2d;
  --gold: #a8813c;
  --gold-bright: #d5b466;
  --line: #af8c4b66;
  --stage: #f7efd958;
  --label: #f1e5cdeb;
  --serif: "IM Fell English", Georgia, serif;
  --gothic: "UnifrakturMaguntia", Georgia, serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #151b26;
  --paper-deep: #202936;
  --ink: #e9dec3;
  --muted: #ae9e7c;
  --blue: #b9c5d4;
  --red: #d8b275;
  --gold: #b29355;
  --gold-bright: #e6c778;
  --line: #a184495c;
  --stage: #202b394d;
  --label: #202b37f0;
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  padding: 42px 44px 38px;
  min-height: 100svh;
  position: relative;
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.6' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.065'/%3E%3C/svg%3E");
  color: var(--ink);
  font: 15px/1.6 var(--serif);
  transition:
    background-color 0.25s,
    color 0.25s;
}
.folio-frame {
  position: absolute;
  inset: 7px;
  z-index: 10;
  pointer-events: none;
  border: 29px solid transparent;
  border-image: url("assets/illumination.webp") 215 round;
  filter: drop-shadow(0 1px 2px #67471e66);
}
[data-theme="dark"] .folio-frame {
  filter: brightness(0.72) saturate(0.95) drop-shadow(0 0 8px #cda95b20);
}
.volume {
  max-width: 1700px;
  margin: auto;
  border: 1px solid var(--line);
  box-shadow:
    0 0 0 4px var(--paper),
    0 0 0 5px var(--line);
}
button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  background: none;
  border: 0;
}
button:hover {
  color: var(--red);
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 4px;
}
a {
  color: inherit;
  text-decoration: none;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 19px 25px 21px;
  border-bottom: 3px double var(--gold);
  background: linear-gradient(110deg, transparent, #b9914620, transparent);
}
.brand {
  font: 45px/1.1 var(--gothic);
  letter-spacing: -0.4px;
  background: linear-gradient(
    115deg,
    #68431c 0%,
    #a97f36 32%,
    #795022 58%,
    #aa853d 83%,
    #634018 100%
  );
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1px 0 #f8ebc3);
}
[data-theme="dark"] .brand {
  background-image: linear-gradient(
    115deg,
    #a27b36,
    #f5dfa0 34%,
    #b38a42 58%,
    #ead395 79%,
    #a27b36
  );
  filter: drop-shadow(0 1px 0 #05080c) drop-shadow(0 0 12px #c8a75a15);
}
.header-actions {
  display: flex;
  gap: 13px;
  align-items: center;
}
.header-actions button {
  font-size: 13px;
  border: 1px solid var(--line);
  padding: 8px 13px;
  color: var(--muted);
  min-height: 40px;
}
.header-actions button:hover {
  color: var(--ink);
  border-color: var(--gold);
}
main {
  display: grid;
  grid-template-columns: 190px minmax(360px, 1fr) 295px;
  min-height: calc(100svh - 183px);
}
.collection {
  border-right: 1px solid var(--line);
  padding: 26px 15px;
}
#weapons {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.weapon {
  position: relative;
  text-align: left;
  font-size: 16px;
  line-height: 1.4;
  padding: 12px 10px;
  width: 100%;
  border-bottom: 1px solid var(--line);
  transition:
    background-color 0.2s,
    color 0.2s;
}
.weapon.active {
  color: var(--red);
  background: linear-gradient(90deg, #b08b4522, transparent);
}
.weapon.active:before {
  content: "";
  position: absolute;
  width: 2px;
  left: -6px;
  top: 9px;
  bottom: 9px;
  background: var(--gold);
}
.workbench {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0 23px 25px;
}
.specimen-heading {
  padding: 23px 2px 14px;
}
h1 {
  font: 47px/1.05 var(--gothic);
  font-weight: 400;
  margin: 0;
  overflow-wrap: anywhere;
}
.stage-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
}
.stage-toolbar button {
  min-height: 44px;
  border: 1px solid var(--line);
  font-size: 13px;
  padding: 10px 13px;
}
.stage-toolbar .primary {
  flex: 1;
}
.primary {
  border: 1px solid #8a652b !important;
  background: linear-gradient(
    125deg,
    #a77b34 0%,
    #e2c27d 30%,
    #c69c51 53%,
    #e7ce93 78%,
    #af843c 100%
  ) !important;
  color: #291e0c !important;
  box-shadow:
    inset 0 0 0 2px #ecd59a7a,
    0 2px 4px #38280c25;
  text-shadow: 0 1px #fff0c26b;
  font-size: 15px !important;
  font-weight: 400;
  min-height: 46px;
}
.primary:hover {
  filter: brightness(1.08);
}
.primary[aria-pressed="true"] {
  background: linear-gradient(125deg, #765829, #b89151, #8f6c32) !important;
  color: #fff0cb !important;
  text-shadow: 0 1px #392400;
  box-shadow: inset 0 0 0 2px #b28e4e8c;
}
.focus-option {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1.35;
}
.focus-option input {
  accent-color: var(--gold);
  width: 16px;
  height: 16px;
  cursor: pointer;
  margin: 0;
}
.stage-toolbar .focus-option {
  flex-basis: 100%;
  justify-content: flex-end;
  margin-top: -3px;
}
#viewport {
  height: 390px;
  min-height: 300px;
  position: relative;
  flex: 1;
  border: 3px double var(--gold);
  background: radial-gradient(
    ellipse at 50% 44%,
    var(--stage),
    transparent 75%
  );
  box-shadow:
    inset 0 0 35px #a0813d0c,
    0 0 0 3px var(--paper),
    0 0 0 4px var(--line);
}
#viewport:before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid var(--line);
  pointer-events: none;
  z-index: 1;
}
[data-theme="dark"] #viewport {
  background: radial-gradient(ellipse at 50% 45%, #303a465e, #151d2780 78%);
  box-shadow:
    inset 0 0 60px #060a1040,
    0 0 0 3px var(--paper),
    0 0 0 4px var(--line);
}
#scene {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#scene:active {
  cursor: grabbing;
}
#leaders,
#labels {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}
#leaders line {
  stroke: var(--gold);
  stroke-width: 0.75;
  stroke-dasharray: 2 2;
}
.part-label {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 5px 9px;
  background: var(--label);
  border: 1px solid var(--gold);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: auto;
  box-shadow: 1px 2px 3px #00000016;
}
.part-label.active {
  color: var(--ink);
  border-color: var(--gold-bright);
  background: var(--paper-deep);
}
[data-theme="dark"] .part-label.active {
  color: #f6dda1;
  background: #423a2a;
  border-color: #d9b765;
}
#featureLabel {
  position: absolute;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 3;
  font-size: 12px;
  color: var(--red);
  padding: 4px 9px;
  background: var(--label);
  border-bottom: 1px solid var(--gold);
  white-space: nowrap;
}
#featureLabel:after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 1px;
  height: 15px;
  background: var(--gold);
}
.loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: var(--paper);
  color: var(--muted);
}
.loading[hidden] {
  display: none;
}
.loading p {
  font-size: 14px;
}
.spinner, [id^="compareStatus"][data-loading="true"]::before {
  content: "";
  display: block;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  background: var(--gold);
  mask: url("assets/loading-sword.svg") center/contain no-repeat;
  animation: spin 2s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
#retryModel {
  font-size: 14px;
  padding: 9px 23px;
  border: 1px solid var(--gold);
  color: var(--ink);
}
.view-controls {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 10px 0 8px;
}
.view-controls button {
  font-size: 11px;
  color: var(--muted);
  padding: 3px 6px;
  border-bottom: 1px solid transparent;
}
.view-controls button.active {
  border-bottom-color: var(--gold);
  color: var(--ink);
}
.assembly {
  margin-top: 4px;
  border-top: 3px double var(--gold);
  padding: 13px 3px 0;
}
.assembly-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}
.assembly-head output {
  font: 12px var(--serif);
  color: var(--red);
}
input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  width: 100%;
  height: 3px;
  margin: 20px 0;
  background: linear-gradient(
    90deg,
    var(--gold),
    var(--gold-bright),
    var(--gold)
  );
  cursor: pointer;
  accent-color: var(--gold);
}
input[type="range"]:disabled {
  opacity: 0.35;
  cursor: default;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 17px;
  height: 17px;
  border: 3px double #ecd39a;
  border-radius: 50%;
  background: #8c3b29;
  box-shadow: 0 0 0 1px #7f5a2a;
  cursor: grab;
}
input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 2px solid #ecd39a;
  border-radius: 50%;
  background: #8c3b29;
}
.assembly-actions {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  margin-top: 2px;
}
.assembly-actions button {
  flex: 1;
  padding: 11px 6px;
  font-size: 13px;
  color: var(--muted);
}
.assembly-actions button + button {
  border-left: 1px solid var(--line);
}
.assembly-actions button:last-child {
  color: var(--red);
}
.inspector {
  border-left: 1px solid var(--line);
  padding: 0 22px 24px;
  min-width: 0;
}
.inspector-tabs {
  display: flex;
  gap: 28px;
  height: 65px;
  margin-bottom: 19px;
  border-bottom: 1px solid var(--line);
}
.inspector-tabs button {
  font-size: 15px;
  color: var(--muted);
  padding: 0;
}
.inspector-tabs button.selected {
  color: var(--red);
  border-bottom: 2px solid var(--gold);
}
.study-modes {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 13px;
}
.study-modes button {
  flex: 1;
  text-align: left;
  font-size: 13px;
  color: var(--muted);
  padding: 5px 0 9px;
}
.study-modes button span {
  font-size: 10px;
  margin-left: 5px;
  color: var(--gold);
}
.study-modes button.selected {
  color: var(--ink);
  border-bottom: 1px solid var(--gold);
}
.study-modes button:disabled {
  cursor: default;
  opacity: 0.4;
}
#parts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 12px;
}
.part-row {
  text-align: left;
  min-height: 36px;
  padding: 7px 4px;
  font-size: 13px;
  line-height: 1.35;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.part-row.active {
  color: var(--red);
  border-color: var(--gold);
  background: linear-gradient(90deg, #b18e4a1c, transparent);
}
#partDetail {
  margin-top: 23px;
  padding-top: 18px;
  border-top: 3px double var(--gold);
}
#partDetail h2 {
  font: 34px/1.12 var(--gothic);
  color: var(--blue);
  margin: 0 0 16px;
  overflow-wrap: anywhere;
}
#partDescription {
  font-size: 15px;
  line-height: 1.8;
  margin: 0 0 20px;
  color: var(--ink);
}
.part-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  gap: 8px;
}
.part-navigation button {
  font-size: 12px;
  color: var(--red);
  padding: 5px 2px;
  min-height: 32px;
}
.part-navigation span {
  font-size: 11px;
  color: var(--muted);
}
#isolateMobile {
  display: none;
}
#historyPanel {
  font-size: 14px;
  line-height: 1.8;
}
#historyPanel h2 {
  font: 30px/1.15 var(--gothic);
  color: var(--blue);
  margin: 22px 0 18px;
}
#historyContext {
  margin: 0 0 20px;
}
.history-note {
  font-size: 12px;
  color: var(--muted);
  padding-top: 15px;
  border-top: 1px solid var(--line);
}
#sources {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 22px;
}
#sources a {
  font-size: 12px;
  line-height: 1.6;
  color: var(--blue);
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-underline-offset: 4px;
}
#customTuning {
  border-top: 1px solid var(--line);
  margin-top: 21px;
  padding-top: 14px;
  font-size: 12px;
  color: var(--muted);
}
#customTuning button {
  font-size: 12px;
  color: var(--red);
  padding: 8px 0;
}
@media (min-width: 1650px) {
  body {
    padding: 55px 58px 48px;
  }
  .folio-frame {
    border-width: 40px;
  }
  header {
    padding: 22px 32px;
  }
  .brand {
    font-size: 56px;
  }
  main {
    grid-template-columns: 220px minmax(500px, 1fr) 330px;
    min-height: calc(100svh - 216px);
  }
  .collection {
    padding: 30px 20px;
  }
  .weapon {
    font-size: 18px;
    padding: 13px 12px;
  }
  .workbench {
    padding: 0 30px 30px;
  }
  h1 {
    font-size: 55px;
  }
  .stage-toolbar .focus-option {
    flex-basis: auto;
    margin: 0;
  }
  .stage-toolbar .primary {
    flex: 1;
  }
  .stage-toolbar button {
    font-size: 14px;
  }
  .focus-option {
    font-size: 12px;
  }
  .inspector {
    padding: 0 28px 28px;
  }
  .part-row {
    font-size: 15px;
  }
  #partDescription {
    font-size: 16px;
  }
  .part-label {
    font-size: 12px;
  }
}
@media (max-width: 1200px) {
  body {
    padding: 34px 35px 31px;
  }
  .folio-frame {
    inset: 6px;
    border-width: 23px;
  }
  main {
    grid-template-columns: 160px minmax(330px, 1fr) 255px;
    min-height: calc(100svh - 166px);
  }
  header {
    padding: 16px 21px;
  }
  .brand {
    font-size: 40px;
  }
  .collection {
    padding: 24px 12px;
  }
  .weapon {
    font-size: 14px;
    padding: 12px 7px;
  }
  .workbench {
    padding: 0 19px 23px;
  }
  h1 {
    font-size: 42px;
  }
  .specimen-heading {
    padding-top: 24px;
  }
  .inspector {
    padding-left: 17px;
    padding-right: 17px;
  }
  .part-row {
    font-size: 12px;
  }
  .stage-toolbar button {
    padding: 9px 11px;
    font-size: 12px;
  }
  .stage-toolbar .primary {
    font-size: 14px !important;
  }
  #partDescription {
    font-size: 14px;
  }
  .part-label {
    font-size: 10px;
  }
}
@media (max-width: 980px) {
  body {
    padding: 29px 28px 26px;
  }
  .folio-frame {
    inset: 4px;
    border-width: 20px;
  }
  main {
    grid-template-columns: minmax(0, 1fr) 270px;
    min-height: 0;
  }
  .collection {
    grid-column: 1/-1;
    padding: 0 15px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  #weapons {
    flex-direction: row;
    overflow-x: auto;
    gap: 10px;
    padding: 11px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--gold) transparent;
  }
  .weapon {
    min-width: max-content;
    width: auto;
    padding: 8px 12px;
    border: 1px solid transparent;
    font-size: 14px;
  }
  .weapon.active {
    border-color: var(--gold);
  }
  .weapon.active:before {
    display: none;
  }
  .workbench {
    padding-bottom: 21px;
  }
  #viewport {
    height: 355px;
    flex: auto;
  }
  .inspector-tabs {
    height: 60px;
  }
  .stage-toolbar .focus-option {
    font-size: 11px;
  }
  #partDetail h2 {
    font-size: 31px;
  }
  .header-actions button {
    font-size: 12px;
  }
  .brand {
    font-size: 39px;
  }
}
@media (max-width: 660px) {
  body {
    padding: 23px 22px 21px;
  }
  .folio-frame {
    inset: 3px;
    border-width: 15px;
  }
  .volume {
    box-shadow:
      0 0 0 2px var(--paper),
      0 0 0 3px var(--line);
  }
  header {
    padding: 18px 13px 17px;
    gap: 10px;
    align-items: center;
  }
  .brand {
    font-size: 32px;
    max-width: 165px;
    line-height: 1.04;
  }
  .header-actions {
    gap: 6px;
    flex-direction: column;
  }
  .header-actions button {
    min-height: 31px;
    width: 83px;
    font-size: 10px;
    padding: 5px 6px;
  }
  main {
    display: flex;
    flex-direction: column;
  }
  .collection {
    padding: 0 11px;
  }
  #weapons {
    gap: 7px;
    padding: 10px 0;
  }
  .weapon {
    font-size: 13px;
    padding: 7px 10px;
  }
  .workbench {
    padding: 0 13px 20px;
  }
  .specimen-heading {
    padding: 24px 0 18px;
  }
  h1 {
    font-size: 40px;
  }
  .stage-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
    margin-bottom: 17px;
  }
  .stage-toolbar .primary {
    grid-column: 1/-1;
    min-height: 48px;
    font-size: 17px !important;
  }
  .stage-toolbar button {
    min-height: 40px;
    font-size: 12px;
  }
  .stage-toolbar .focus-option {
    font-size: 11px;
    margin: 0;
    justify-content: flex-start;
    line-height: 1.5;
    gap: 7px;
  }
  .focus-option input {
    width: 17px;
    height: 17px;
  }
  #viewport {
    height: 315px;
    min-height: 315px;
    border-width: 3px;
  }
  .part-label {
    font-size: 10px;
    padding: 5px 7px;
  }
  .view-controls {
    padding: 10px 0 7px;
    gap: 16px;
  }
  .view-controls button {
    font-size: 11px;
  }
  .assembly {
    margin-top: 0;
    padding-top: 12px;
  }
  .assembly-head {
    font-size: 13px;
  }
  .assembly-actions button {
    font-size: 12px;
    padding: 11px 4px;
  }
  input[type="range"] {
    margin: 22px 0;
    height: 4px;
  }
  input[type="range"]::-webkit-slider-thumb {
    width: 21px;
    height: 21px;
  }
  .inspector {
    border-left: 0;
    border-top: 3px double var(--gold);
    padding: 0 16px 24px;
  }
  .inspector-tabs {
    height: 56px;
    margin-bottom: 16px;
    gap: 35px;
  }
  .inspector-tabs button {
    font-size: 16px;
  }
  .study-modes button {
    font-size: 14px;
    padding-bottom: 11px;
  }
  .part-row {
    font-size: 15px;
    min-height: 40px;
    padding: 8px 4px;
  }
  #partDetail {
    padding-top: 21px;
    margin-top: 25px;
  }
  #partDetail h2 {
    font-size: 36px;
    margin-bottom: 14px;
  }
  #partDescription {
    font-size: 15px;
    margin-top: 17px;
  }
  #isolateMobile {
    display: block;
    width: 100%;
    padding: 11px;
    margin-bottom: 17px;
    min-height: 46px;
  }
  .part-navigation button {
    font-size: 14px;
  }
  .part-navigation span {
    font-size: 12px;
  }
  #historyPanel {
    font-size: 15px;
  }
  #historyPanel h2 {
    font-size: 33px;
  }
  #sources a {
    font-size: 13px;
  }
  .history-note {
    font-size: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  body {
    transition: none;
  }
  .spinner, [id^="compareStatus"][data-loading="true"]::before {
    animation: none;
  }
  * {
    scroll-behavior: auto !important;
  }
}

@media (min-width: 981px) {
  #viewport {
    height: clamp(270px, 38svh, 440px);
    flex: 0 0 auto;
  }
}
@media (min-width: 981px) and (max-height: 800px) {
  body {
    padding-top: 31px;
    padding-bottom: 29px;
  }
  .folio-frame {
    border-top-width: 22px;
    border-bottom-width: 22px;
  }
  header {
    padding-top: 13px;
    padding-bottom: 14px;
  }
  .brand {
    font-size: 37px;
  }
  .specimen-heading {
    padding-top: 16px;
    padding-bottom: 13px;
  }
  h1 {
    font-size: 36px;
  }
  .workbench {
    padding-bottom: 16px;
  }
  #viewport {
    height: clamp(210px, calc(100svh - 430px), 300px);
    min-height: 210px;
  }
  .stage-toolbar {
    gap: 7px;
    margin-bottom: 11px;
  }
  .stage-toolbar button {
    min-height: 38px;
    padding-top: 7px;
    padding-bottom: 7px;
  }
  .stage-toolbar .primary {
    min-height: 40px;
  }
  .view-controls {
    padding-top: 7px;
    padding-bottom: 5px;
  }
  .assembly {
    padding-top: 10px;
  }
  main {
    min-height: calc(100svh - 135px);
  }
  .collection {
    padding-top: 20px;
  }
  .weapon {
    padding-top: 9px;
    padding-bottom: 9px;
  }
}

[data-theme="light"] #viewport {
  background: radial-gradient(ellipse at 50% 44%, #e0d3b6, #d1bd93);
}
