/* The cabins (cabin.js): a painted room over the whole view, its pieces as layers. Every size that comes from a
   room's data is set by the script through the CSSOM (no style attribute); what moves each frame moves by transform
   and opacity only. Colours of a cabin: --cb-ground, --cb-rule, --cb-gilt (cabin_layout.js `theme`). */

.cabin {
  --cb-ground: rgb(15, 18, 31);
  --cb-rule: rgb(217, 176, 92);
  --cb-gilt: rgb(217, 176, 92);
  --cb-display: "Didot", "Bodoni 72", "Big Caslon", "Hoefler Text", "Iowan Old Style", "Noto Serif", Georgia, serif;
  --cb-serif: "Baskerville", "Hoefler Text", "Iowan Old Style", "Noto Serif", Palatino, Georgia, serif;
  --cb-sans: system-ui, -apple-system, "Roboto", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  position: absolute;
  inset: 0;
  overflow: hidden;
  contain: layout style;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  color: rgb(247, 237, 214);
  font-family: var(--cb-sans);
  outline: none;
}
.cabin[data-fixed="true"] { position: fixed; z-index: 2147483000; }
.cabin [hidden] { display: none !important; }
.cabin :focus-visible { outline: 2px solid var(--cb-gilt); outline-offset: 2px; }
.cabin:focus-visible { outline: 2px solid var(--cb-gilt); outline-offset: -5px; }
.cabin[data-hover]:not([data-hover=""]) { cursor: pointer; }

/* the way in and the way out */
.cb-clip { position: absolute; inset: 0; overflow: hidden; background: #000; }
.cabin[data-state="loading"] .cb-clip { visibility: hidden; }
.cabin[data-entry="fade"] .cb-clip { animation: cb-fade 0.26s ease-out both; }
.cabin[data-state="leaving"] { opacity: 0; pointer-events: none; transition: opacity 0.32s ease-in; }
.cabin[data-away="true"] { opacity: 0; pointer-events: none; transition: opacity 0.3s ease-in; }
.cabin { transition: opacity 0.4s ease-out; }
@keyframes cb-fade { from { opacity: 0; } to { opacity: 1; } }

.cb-wait {
  position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%;
  border: 2px solid rgba(217, 176, 92, 0.9); box-shadow: 0 0 10px rgba(255, 204, 97, 0.5); opacity: 0;
}
.cb-wait[data-shown="true"] { opacity: 1; animation: cb-wait 1.1s ease-in-out infinite alternate; }
@keyframes cb-wait { from { transform: scale(0.8); opacity: 0.5; } to { transform: scale(1.1); opacity: 1; } }

.cb-rim { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; display: none; }
.cabin[data-entry="circle"] .cb-rim { display: block; }
.cb-rim path { stroke: rgb(255, 238, 205); stroke-width: 3; }

.cb-error {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(80%, 460px); margin: 0;
  font: 16px/1.4 var(--cb-serif); text-align: center;
}

/* the room */
.cb-backdrop {
  position: absolute; inset: -48px; background-size: cover; background-position: center; filter: blur(28px); opacity: 0.6;
}
.cb-slide { position: absolute; inset: 0; will-change: transform, opacity; }
.cb-slide[data-move="out"] { transition: transform 0.2s ease-in, opacity 0.2s ease-in; }
.cb-slide[data-move="jump"] { transition: none; }
.cb-slide[data-move="in"] { transition: transform 0.46s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease-out; }

.cb-roll {
  position: absolute; inset: 0; transform-origin: 50% 100%;
  animation: cb-roll var(--cb-roll-time, 4.5s) ease-in-out infinite alternate;
}
@keyframes cb-roll { from { transform: rotate(calc(var(--cb-roll, 0.35deg) * -1)); } to { transform: rotate(var(--cb-roll, 0.35deg)); } }
.cb-tilt { position: absolute; inset: 0; transform-origin: 50% 100%; will-change: transform; }
.cb-stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.cb-stage > *, .cb-lits > * { position: absolute; }
.cb-lits { pointer-events: none; }

.cb-window { left: 0; top: 0; width: 100%; height: 100%; overflow: hidden; }
.cb-window > * { position: absolute; }
.cb-drift { animation: cb-drift var(--cb-drift-time, 60s) linear infinite alternate; }
@keyframes cb-drift { to { transform: translateX(var(--cb-drift, -30px)); } }
.cb-heave { position: absolute; inset: 0; animation: cb-heave var(--cb-heave-time, 4.5s) ease-in-out infinite alternate; }
@keyframes cb-heave { from { transform: translateY(calc(var(--cb-heave, 16px) * -1)); } to { transform: translateY(var(--cb-heave, 16px)); } }
.cb-sea { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; }
.cb-flash { background: #fff; opacity: 0; animation: cb-flash var(--cb-flash-time, 9s) linear infinite; }
@keyframes cb-flash { 0%, 97% { opacity: 0; } 97.3% { opacity: 0.6; } 98.2% { opacity: 0.15; } 98.8% { opacity: 0.4; } 100% { opacity: 0; } }

.cb-room { left: 0; top: 0; width: 100%; height: 100%; }
.cb-cut { will-change: transform; }
.cb-room, .cb-cut, .cb-sea, .cb-lit, .cb-glow, .cb-tint, .cb-dark, .cb-dim, .cb-candle, .cb-floor, .cb-life { pointer-events: none; }
/* the room's running effects (cabin_life.js), drawn in the picture's own points over the hour's light */
.cb-life { display: block; }

/* the hour's light */
.cb-glow[data-blend="soft"], .cb-tint[data-blend="soft"] { mix-blend-mode: soft-light; }
.cb-glow[data-blend="add"], .cb-tint[data-blend="add"] { mix-blend-mode: screen; mix-blend-mode: plus-lighter; }
.cb-flicker { animation: cb-flicker 1.9s ease-in-out infinite; }
@keyframes cb-flicker { 0%, 100% { opacity: 1; } 13% { opacity: 0.93; } 27% { opacity: 1; } 41% { opacity: 0.9; } 58% { opacity: 0.98; } 72% { opacity: 0.92; } 86% { opacity: 0.99; } }
.cb-candle {
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; transform-origin: 50% 100%;
  background: linear-gradient(to bottom, rgb(255, 217, 128), rgb(255, 247, 219));
  box-shadow: 0 0 3px 1px rgba(255, 153, 51, 0.55);
  mix-blend-mode: screen; mix-blend-mode: plus-lighter;
  animation: cb-sway 2.1s ease-in-out infinite alternate;
}
@keyframes cb-sway { from { transform: rotate(-3.4deg); } to { transform: rotate(3.4deg); } }

/* a thing lit on its own outline */
.cb-dim { opacity: 0; transition: opacity 0.2s ease-out; }
.cb-dim.is-on { opacity: 1; }
.cb-lit {
  opacity: max(var(--cb-on, 0), var(--cb-charge, 0));
  transition: opacity 0.2s ease-in-out; will-change: opacity, transform;
}
.cb-lit.is-slow { transition-duration: 0.75s; }
.cb-lit.is-quick { transition-duration: 0.375s; }
.cb-lit.is-glint { --cb-on: 1; }
.cb-lit.is-on { --cb-on: 1; transition-duration: 0.2s; }
.cabin[data-charging="true"] .cb-lit { transition: none; }

.cb-thing { margin: 0; padding: 0; border: 0; border-radius: 6px; background: transparent; pointer-events: none; }

/* the names: engraved callouts against their things */
.cb-tags { position: absolute; inset: 0; pointer-events: none; }
.cb-tag { position: absolute; left: 0; top: 0; opacity: 0; visibility: hidden; transition: opacity 0.3s ease-out, visibility 0s linear 0.3s; }
.cb-tag.is-shown { opacity: 1; visibility: visible; transition: opacity 0.3s ease-out; }
.cb-tag-body {
  position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 14px 6px; white-space: nowrap; border-radius: 5px; border: 1.4px solid var(--cb-rule);
  background: var(--cb-ground);
  box-shadow: inset 0 0 0 2.6px var(--cb-ground), inset 0 0 0 3.2px rgba(217, 176, 92, 0.55), 0 2px 5px rgba(0, 0, 0, 0.6);
}
.cb-tag[data-side="below"] .cb-tag-body { top: 8px; }
.cb-tag[data-side="right"] .cb-tag-body { left: 8px; }
.cb-tag-name {
  display: flex; align-items: center; gap: 7px; font: 14px/1.15 var(--cb-display); letter-spacing: 1.6px;
  text-transform: uppercase; color: rgb(243, 228, 196); text-shadow: 0 1px 0 rgba(0, 0, 0, 0.75);
}
.cb-lozenge { display: block; flex: none; width: 4.5px; height: 4.5px; background: var(--cb-gilt); transform: rotate(45deg); }
.cb-tag-opens { font: italic 14px/1.2 var(--cb-serif); color: var(--cb-rule); }
.cb-tag-opens[data-none="true"] { opacity: 0.85; }
.cb-tag[data-opens="false"] .cb-tag-opens { display: none; }
.cb-tag-tip {
  position: absolute; width: 10px; height: 10px; background: var(--cb-ground); transform: rotate(45deg);
  border: 0 solid var(--cb-rule);
}
.cb-tag[data-side="above"] .cb-tag-tip { left: calc(var(--cb-tip, 50%) - 5px); top: calc(100% - 13.5px); border-right-width: 1.4px; border-bottom-width: 1.4px; }
.cb-tag[data-side="below"] .cb-tag-tip { left: calc(var(--cb-tip, 50%) - 5px); top: 3.5px; border-left-width: 1.4px; border-top-width: 1.4px; }
.cb-tag[data-side="right"] .cb-tag-tip { top: calc(var(--cb-tip, 50%) - 5px); left: 3.5px; border-left-width: 1.4px; border-bottom-width: 1.4px; }
.cb-tag[data-side="left"] .cb-tag-tip { top: calc(var(--cb-tip, 50%) - 5px); left: calc(100% - 13.5px); border-right-width: 1.4px; border-top-width: 1.4px; }
.cb-tag[data-side="over"] .cb-tag-tip { display: none; }
.cb-tag.is-nod .cb-tag-body { animation: cb-nod 0.36s ease-in-out; }
@keyframes cb-nod { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* the cabin's name: an escutcheon at the top of a wide view, inlaid in the floor of an upright one */
.cb-plate {
  position: absolute; left: 50%; box-sizing: border-box; pointer-events: none; color: rgb(250, 240, 214);
  transition: opacity 0.3s ease-out; text-align: center;
}
.cb-plate.is-hidden, .cabin[data-panel] .cb-plate, .cabin:not([data-state="room"]):not([data-state="entering"]) .cb-plate { opacity: 0; visibility: hidden; }
.cabin[data-sliding="true"] .cb-plate { opacity: 0.4; }
.cb-plate[data-kind="plate"] {
  top: calc(max(env(safe-area-inset-top), 0px) + 44px); width: max-content; max-width: min(460px, calc(100% - 260px));
  padding: 9px 16px; transform: translateX(-50%);
}
.cb-plate[data-kind="inlay"] {
  bottom: calc(max(env(safe-area-inset-bottom), 0px) + 4px); width: calc(100% - 36px); padding: 0 8px;
  transform-origin: 50% 100%; transform: translateX(-50%) perspective(640px) rotateX(34deg);
}
.cb-plate[data-kind="inlay"]::before {
  content: ""; position: absolute; inset: -34% -6%; z-index: -1;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.66), rgba(0, 0, 0, 0.4) 58%, rgba(0, 0, 0, 0));
}
.cb-plate-shape { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.6)); }
.cb-plate[data-kind="inlay"] .cb-plate-shape { display: none; }
.cb-plate-ground { fill: var(--cb-ground); stroke: var(--cb-rule); stroke-width: 1.8; }
.cb-plate-inner { fill: none; stroke: rgba(217, 176, 92, 0.6); stroke-width: 0.7; }
.cb-rivet { fill: var(--cb-gilt); }
.cb-plate-row { position: relative; display: flex; flex-direction: column; gap: 9px; }
.cb-plate-line { display: flex; align-items: center; justify-content: center; gap: 10px; }
.cb-plate-arrow {
  flex: none; width: 30px; height: 40px; margin: 0; padding: 0; border: 0; border-radius: 6px; background: none;
  color: var(--cb-rule); opacity: 0.85; cursor: pointer; pointer-events: auto;
}
.cb-plate-arrow:hover { opacity: 1; }
.cb-plate-arrow .cb-chevron { width: 11px; height: 18px; }
.cb-plate-badge { flex: none; width: 40px; height: 40px; object-fit: contain; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5)); }
.cb-plate-text { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.cb-plate-head {
  font: 19px/1.15 var(--cb-display); letter-spacing: 2.2px; text-transform: uppercase; text-wrap: balance;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}
.cb-plate-tail {
  font: 600 13px/1.2 var(--cb-sans); letter-spacing: 1.6px; text-transform: uppercase; color: rgb(237, 219, 173);
  text-wrap: balance; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}
.cb-plate[data-kind="inlay"] .cb-plate-head { font-size: 23px; letter-spacing: 3px; }
.cb-plate[data-kind="inlay"] .cb-plate-tail { font-size: 15px; letter-spacing: 2.2px; }
.cb-plate-rule { display: flex; align-items: center; gap: 5px; width: 120px; margin-top: 2px; }
.cb-plate-rule::before, .cb-plate-rule::after { content: ""; flex: 1; height: 0.8px; background: rgba(217, 176, 92, 0.7); }
.cb-plate[data-kind="inlay"] .cb-plate-rule { display: none; }
/* the room's floor names the cabin (decisions 196, 198): on an upright view no name is drawn over it; the chevrons
   stand at the two sides, the name stays for screen readers */
.cb-plate[data-kind="inlay"][data-floor="true"]::before, .cb-plate[data-kind="inlay"][data-floor="true"] .cb-fillet,
.cb-plate[data-kind="inlay"][data-floor="true"] .cb-plate-badge { display: none; }
.cb-plate[data-kind="inlay"][data-floor="true"] { transform: translateX(-50%); bottom: calc(max(env(safe-area-inset-bottom), 0px) + 18px); }
.cb-plate[data-kind="inlay"][data-floor="true"] .cb-plate-line { justify-content: space-between; }
.cb-plate[data-kind="inlay"][data-floor="true"] .cb-plate-text {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.cb-fillet { display: none; position: relative; height: 7px; }
.cb-plate[data-kind="inlay"] .cb-fillet { display: block; }
.cb-fillet::before {
  content: ""; position: absolute; left: 0; right: 0; top: 3px; height: 1.2px;
  background: linear-gradient(to right, rgba(217, 176, 92, 0), rgba(217, 176, 92, 0.85) 46%, rgba(217, 176, 92, 0) 46%, rgba(217, 176, 92, 0) 54%, rgba(217, 176, 92, 0.85) 54%, rgba(217, 176, 92, 0));
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}
.cb-fillet::after {
  content: ""; position: absolute; left: calc(50% - 3px); top: 0.5px; width: 6px; height: 6px; background: var(--cb-rule); transform: rotate(45deg);
}

/* the way back, and the look up and down a low wide view */
.cb-back {
  position: absolute; left: calc(max(env(safe-area-inset-left), 8px) + 8px); top: calc(max(env(safe-area-inset-top), 0px) + 8px);
  display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 8px 14px 8px 11px; border-radius: 999px;
  border: 1px solid rgb(115, 82, 31); color: rgb(51, 33, 13); font: 600 15px/1.2 var(--cb-sans); cursor: pointer;
  background: linear-gradient(to bottom, rgb(237, 209, 140), rgb(194, 153, 77) 55%, rgb(224, 191, 120));
  transition: opacity 0.3s ease-out;
}
.cb-back .cb-chevron { width: 8px; height: 14px; }
.cabin:not([data-state="room"]):not([data-state="failed"]) .cb-back { opacity: 0; pointer-events: none; }
.cb-look {
  position: absolute; left: calc(50% - 30px); width: 60px; height: 32px; margin: 0; padding: 0; border: 0; border-radius: 8px;
  background: none; color: var(--cb-gilt); opacity: 0.85; cursor: pointer; filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.8));
}
.cb-look .cb-chevron { width: 34px; height: 20px; }
.cb-look-up { top: calc(max(env(safe-area-inset-top), 0px) + 4px); }
.cb-look-down { bottom: calc(max(env(safe-area-inset-bottom), 0px) + 4px); }
.cb-look-down .cb-chevron { transform: rotate(180deg); }

/* the chest and the logbook */
.cb-panels { position: absolute; inset: 0; pointer-events: none; }
.cb-veil {
  position: absolute; inset: 0; display: grid; place-items: center; box-sizing: border-box; padding: 24px;
  background: rgba(0, 0, 0, 0.5); opacity: 0; transition: opacity 0.25s ease-out; pointer-events: auto;
}
.cb-veil.is-open { opacity: 1; }
.cb-paper {
  position: relative; box-sizing: border-box; display: flex; flex-direction: column; gap: 8px; width: min(440px, 100%);
  max-height: min(600px, 100%); padding: 18px 18px 14px 24px; border: 3px solid rgb(107, 69, 36); border-radius: 4px;
  background: rgb(242, 232, 209); color: rgb(43, 29, 18); box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
  font-family: var(--cb-serif); user-select: text; -webkit-user-select: text; touch-action: pan-y;
  transform: translateY(8px); transition: transform 0.25s ease-out;
}
.cb-veil.is-open .cb-paper { transform: none; }
.cb-veil[data-kind="chest"] .cb-paper { width: min(420px, 100%); padding-left: 18px; border: 2px solid rgb(140, 102, 46); border-radius: 6px; background: rgb(245, 237, 217); }
.cb-veil[data-kind="logbook"] .cb-paper::before { content: ""; position: absolute; left: 12px; top: 0; bottom: 0; width: 1px; background: rgba(191, 64, 51, 0.5); }
.cb-paper-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.cb-paper-title { margin: 0; font: 600 20px/1.2 var(--cb-serif); }
.cb-paper-note { margin: 2px 0 0; font: italic 14px/1.3 var(--cb-serif); opacity: 0.75; }
.cb-paper-empty { margin: 14px 0; font: 16px/1.4 var(--cb-serif); }
.cb-paper-close {
  flex: none; width: 34px; height: 34px; margin: 0; padding: 7px; border: 0; border-radius: 50%; cursor: pointer;
  background: rgb(43, 29, 18); color: rgb(245, 237, 217);
}
.cb-paper-close svg { display: block; width: 100%; height: 100%; }
.cb-paper :focus-visible { outline-color: rgb(128, 51, 31); }
.cb-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; overscroll-behavior: contain; }
.cb-row { border-bottom: 1px solid rgba(140, 166, 204, 0.4); }
.cb-row-line {
  display: flex; align-items: center; gap: 10px; box-sizing: border-box; width: 100%; min-height: 48px; margin: 0; padding: 6px 2px;
  border: 0; background: none; color: inherit; font: 16px/1.25 var(--cb-serif); text-align: left;
}
button.cb-row-line { cursor: pointer; }
button.cb-row-line::after { content: ""; flex: none; width: 7px; height: 7px; margin-left: auto; border: solid currentColor; border-width: 1.5px 1.5px 0 0; transform: rotate(45deg); opacity: 0.45; }
button.cb-row-line:hover { background: rgba(107, 69, 36, 0.08); }
.cb-medallion { flex: none; width: 34px; height: 34px; object-fit: contain; }
.cb-medallion.is-missing { visibility: hidden; }
.cb-seal { flex: none; width: 15px; height: 15px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, rgb(214, 163, 84), rgb(150, 98, 33)); }
.cb-row-text { display: flex; flex-direction: column; gap: 2px; }
.cb-row-name { font-weight: 500; }
.cb-row-date { font: 13px/1.2 var(--cb-sans); opacity: 0.6; }
.cb-leaf { position: relative; min-height: 196px; perspective: 900px; }
.cb-page { transform-origin: 0 50%; backface-visibility: hidden; transition: transform 0.36s ease-in-out, opacity 0.36s ease-in-out; }
.cb-page[data-turn="from-next"] { transform: rotateY(48deg); opacity: 0; }
.cb-page[data-turn="from-before"] { transform: rotateY(-62deg); opacity: 0; }
.cb-page[data-turn="to-before"] { position: absolute; inset: 0; transform: rotateY(-78deg); opacity: 0; }
.cb-page[data-turn="to-next"] { position: absolute; inset: 0; transform: rotateY(48deg); opacity: 0; }
.cb-page-title { margin: 2px 0 4px; font: 600 15px/1.25 var(--cb-serif); font-variant: small-caps; letter-spacing: 0.4px; color: rgb(128, 51, 31); }
.cb-paper-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cb-turn { width: 44px; height: 40px; margin: 0; padding: 0; border: 0; border-radius: 6px; background: none; color: inherit; cursor: pointer; }
.cb-turn .cb-chevron { width: 10px; height: 17px; }
.cb-turn:disabled { opacity: 0.25; cursor: default; }
.cb-page-count { font: italic 14px/1.2 var(--cb-serif); opacity: 0.75; }

/* a still room: Reduce Motion (the visitor's setting, or asked for a check), and a device that drew the entry slowly */
.cabin[data-motion="still"] *, .cabin[data-calm="true"] .cb-roll { animation: none !important; }
.cabin[data-motion="still"] .cb-page, .cabin[data-motion="still"] .cb-paper { transition-duration: 0.01s; }
@media (prefers-reduced-motion: reduce) {
  .cabin *, .cabin[data-entry="fade"] .cb-clip { animation: none !important; }
  .cabin .cb-page, .cabin .cb-paper { transition-duration: 0.01s; }
}
