:root {
  color-scheme: light;
  --fir: #5d3b22;
  --fir-dark: #392516;
  --brass: #b8860b;
  --brass-light: #e5c16b;
  --parchment: #f7f3e8;
  --paper: #fffdf5;
  --hunter: #2d4c3b;
  --ink: #283126;
  --muted-ink: #4b5146;
  --edge: #b9a98c;
  --shadow: 0 12px 36px rgb(28 21 13 / 22%);
  --focus: #133e7d;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 280px;
  background: radial-gradient(circle at 50% -10%, #60735b, #354837 55%, #26362c);
  color: var(--ink);
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 1.48;
}
[hidden] { display: none !important; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
button:focus-visible, a:focus-visible, input:focus-visible,
textarea:focus-visible, [role='button']:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
a { color: #19493d; text-underline-offset: .18em; }
.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: .55rem 1.1rem;
  position: sticky;
  top: 0;
  z-index: 20;
  padding: .75rem clamp(.75rem, 2vw, 2rem);
  border-bottom: 3px solid var(--brass);
  background: linear-gradient(145deg, var(--fir-dark), var(--fir));
  color: var(--parchment);
  box-shadow: 0 3px 13px #1d190fa6;
}
.brand {
  color: var(--parchment);
  text-decoration: none;
  font-weight: bold;
  font-size: 1.07rem;
  letter-spacing: .02em;
  white-space: nowrap;
}
.brand small {
  display: block;
  color: var(--brass-light);
  font-family: system-ui, sans-serif;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .21em;
}
.chrome {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .36rem;
}
.chrome button {
  min-height: 2.3rem;
  padding: .36rem .66rem;
  color: var(--paper);
  border: 1px solid #d7b36c;
  border-radius: .37rem;
  background: #4b3224;
  font-family: system-ui, sans-serif;
  font-weight: 650;
  font-size: .83rem;
}
.chrome button:hover, .chrome button[aria-pressed='true'] {
  background: var(--parchment);
  color: var(--fir-dark);
}
.chrome .tour-switch { border-color: #f0d68a; background: var(--hunter); }
.loading-message { color: var(--paper); text-align: center; padding: 2rem; }
.library-shell { max-width: 1400px; margin: 0 auto; padding: 1.15rem clamp(.65rem, 2vw, 1.5rem) 5.5rem; }
.room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  color: var(--paper);
  padding: 0 .3rem .5rem;
}
.room-header h1 { margin: 0; font-size: clamp(1.65rem, 3.6vw, 2.7rem); font-weight: 600; }
.room-description { margin: .15rem 0 .5rem; max-width: 65ch; color: #f5eddb; font-size: .98rem; }
.room-counter {
  align-self: start;
  color: var(--brass-light);
  border: 1px solid #c5aa75;
  border-radius: 999px;
  padding: .25rem .65rem;
  font-family: system-ui, sans-serif;
  white-space: nowrap;
  font-weight: 700;
  font-size: .78rem;
}
.plate-frame {
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
  padding: clamp(.35rem, 1.1vw, .9rem);
  border: 2px solid var(--brass);
  border-radius: .85rem;
  background: linear-gradient(150deg, #9f7546, #3d2416 45%, #876138);
  box-shadow: var(--shadow), inset 0 0 0 3px #c8a25e;
}
.plate-stage {
  position: relative;
  overflow: hidden;
  /* JS fitStage sets the pixel width; 75vh*ratio is the pre-JS desktop default. */
  width: min(100%, calc(75vh * 1600 / 893));
  max-width: 100%;
  margin-inline: auto;
  aspect-ratio: 1600 / 893;
  border: 0;
  background: #241b12;
  isolation: isolate;
}
.plate-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0;
  transition: opacity 350ms ease;
  pointer-events: none;
}
.plate-layer.is-visible { opacity: 1; }
.room-plate { width: 100%; height: 100%; object-fit: contain; display: block; }
.room-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.15rem;
  padding: 1rem 2rem;
  text-align: center;
  background:
    repeating-linear-gradient(0deg, transparent 0 27px, #7e67401b 28px 29px),
    radial-gradient(ellipse at center, #fff8e7 0%, #dacba9 100%);
  color: var(--fir-dark);
  font-size: clamp(.8rem, 1.5vw, 1.2rem);
}
.room-fallback strong { font-size: clamp(1.4rem, 4.5vw, 3.6rem); font-weight: 500; }
.fallback-ornament { font-size: clamp(2.7rem, 9vw, 6.5rem); color: var(--brass); line-height: 1; }
.hotspot-layer { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; overflow: visible; }
.room-hotspot, .compass-hotspot { cursor: pointer; }
.hotspot-area {
  fill: #ffdb6e;
  fill-opacity: .055;
  stroke: #ffefb4;
  stroke-opacity: .18;
  stroke-width: .28;
  vector-effect: non-scaling-stroke;
  transition: fill-opacity .14s ease, stroke-opacity .14s ease;
}
.hotspot-marker {
  fill: #cfac51;
  stroke: #2d2418;
  stroke-width: .6;
  vector-effect: non-scaling-stroke;
  opacity: .8;
}
.room-hotspot:hover .hotspot-area,
.room-hotspot:focus-visible .hotspot-area { fill-opacity: .25; stroke-opacity: 1; stroke-width: .7; }
.room-hotspot:hover .hotspot-marker,
.room-hotspot:focus-visible .hotspot-marker { fill: #fff6cc; opacity: 1; }
.compass-disc { fill: #392516e6; stroke: #eed387; stroke-width: .6; vector-effect: non-scaling-stroke; }
.compass-glyph {
  fill: #fff5cf;
  font-family: system-ui, sans-serif;
  font-size: 5.5px;
  font-weight: bold;
  pointer-events: none;
}
.compass-hotspot:hover .compass-disc, .compass-hotspot:focus-visible .compass-disc { fill: var(--hunter); }
.caption-panel {
  margin: .8rem 0 1.15rem;
  padding: 1rem clamp(1rem, 3vw, 1.7rem);
  border-left: 5px solid var(--brass);
  border-radius: .4rem;
  background: var(--parchment);
  box-shadow: 0 2px 10px #0e170e47;
}
.caption-label {
  margin: 0 0 .3rem;
  color: var(--hunter);
  font-family: system-ui, sans-serif;
  font-weight: 800;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .095em;
}
#caption-text { margin: 0; color: #2d241a; font-size: clamp(1rem, 1.5vw, 1.2rem); }
#caption-meta { margin: .5rem 0 0; color: #545246; font-family: system-ui, sans-serif; font-size: .72rem; overflow-wrap: anywhere; }
.action-columns { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(310px, 2fr); gap: 1rem; }
.action-card {
  padding: 1rem;
  border: 1px solid var(--edge);
  border-radius: .55rem;
  background: var(--parchment);
  box-shadow: 0 3px 11px #1c241f2e;
}
.action-card h2 { margin: 0 0 .35rem; font-size: 1.14rem; color: var(--fir-dark); }
.action-card p { margin-top: 0; font-size: .87rem; color: var(--muted-ink); }
.action-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 215px), 1fr)); padding: 0; margin: .3rem 0 0; gap: .4rem; list-style: none; }
.action-list button {
  width: 100%; min-height: 2.55rem;
  padding: .5rem .65rem;
  text-align: left;
  border: 1px solid #bea66f;
  border-radius: .35rem;
  background: #fffaec;
  color: #273e2d;
  font-family: system-ui, sans-serif;
  font-weight: 650;
  font-size: .82rem;
}
.action-list button:hover { border-color: var(--hunter); background: #e7f0df; }
.site-footer { margin: 2rem 0; color: #eee6d5; font-family: system-ui, sans-serif; font-size: .82rem; text-align: center; }
.site-footer a { color: #ffde87; }
.mobile-compass { display: none; }
.library-dialog {
  width: min(95vw, 790px);
  max-height: min(86vh, 950px);
  overflow-y: auto;
  padding: clamp(1rem, 2vw, 1.8rem);
  border: 3px solid var(--brass);
  border-radius: .65rem;
  color: var(--ink);
  background: var(--parchment);
  box-shadow: 0 25px 90px #08150acc;
}
.library-dialog::backdrop { background: rgb(12 21 16 / 78%); backdrop-filter: blur(3px); }
.dialog-header { display: flex; justify-content: flex-end; }
.dialog-header button {
  border: 1px solid var(--fir);
  border-radius: .25rem;
  padding: .25rem .6rem;
  background: #f6ebcc;
  color: #32261b;
  font-family: system-ui, sans-serif;
}
.library-dialog h2 { color: var(--fir-dark); margin: .3rem 0; font-size: clamp(1.35rem, 2.3vw, 2rem); }
.library-dialog h3 { color: var(--hunter); }
.eyebrow { margin: 0; color: var(--hunter); font: 700 .68rem system-ui, sans-serif; letter-spacing: .2em; }
.panel-lead { margin: .25rem 0 1rem; color: #455045; font-size: 1.02rem; }
.object-frame { overflow: hidden; width: 100%; min-height: 200px; border: 1px solid #a48b5c; background: #ede3ca; }
.object-frame img { display: block; width: 100%; height: auto; max-height: 390px; object-fit: contain; }
.object-fallback {
  display: grid; justify-items: center; align-content: center;
  gap: .4rem; min-height: 210px; padding: 1.5rem;
  text-align: center;
  color: #493a26;
  background: repeating-linear-gradient(36deg, #e9ddc6, #e9ddc6 18px, #e4d5b9 19px, #e4d5b9 21px);
}
.object-fallback-mark { font-size: 3rem; color: #8c6824; }
.object-description { font-weight: 650; }
.panel-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin: .9rem 0; }
.brass-button, .secondary-button {
  min-height: 2.45rem; padding: .58rem .85rem;
  border: 1px solid #725117; border-radius: .35rem;
  background: var(--hunter); color: #fff9e8;
  font-family: system-ui, sans-serif; font-size: .89rem; font-weight: 700;
}
.brass-button:hover { background: #1d382a; }
.secondary-button { background: #f5ead4; color: #3a2c1d; }
.secondary-button:hover { background: #e7d4af; }
.panel-note { color: #42483a; }
.fine-print { font-size: .8rem; color: #51564d; }
.request-note { padding: .65rem; border: 1px solid #627859; background: #e7ebde; color: #223a28; }
.privacy-warning {
  border-left: 4px solid var(--brass);
  padding: .75rem;
  background: #fff4d4;
  color: #463315;
}
.artifact-sheet {
  display: grid; min-height: 155px; place-items: center;
  border: 1px dashed #8f7851;
  margin: 1rem 0;
  color: #5c4a30;
  background: #e8dfcc;
  font: 750 .93rem system-ui, sans-serif;
  letter-spacing: .1em;
  text-align: center;
}
.discussion-box, .privacy-paper, .preview-sheet {
  margin: .95rem 0; padding: .9rem 1rem;
  border: 1px solid #c9b890;
  background: var(--paper);
}
.place-form label, .discussion-box label { display: grid; gap: .35rem; margin: .55rem 0; font-weight: 650; }
.place-form input, .discussion-box textarea {
  display: block; width: 100%; padding: .6rem;
  border: 1px solid #6b6b5a;
  border-radius: .25rem;
  background: white; color: var(--ink);
}
.choice-row { display: flex; gap: 1rem; flex-wrap: wrap; border: 1px solid #ad9770; padding: .7rem; margin: .95rem 0; }
.choice-row legend { padding: 0 .3rem; font-weight: 700; }
.radio-choice { cursor: pointer; display: inline-flex; align-items: center; gap: .25rem; }
.radio-choice input { width: 1.15rem; height: 1.15rem; accent-color: var(--hunter); }
.privacy-rule { font-weight: 700; }
.floorplan-layout { display: grid; grid-template-columns: 1fr; gap: .5rem; }
.floorplan-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(4, auto);
  gap: .42rem;
  padding: .8rem;
  border: 2px solid #887353;
  border-radius: .4rem;
  background: #e3d9bf;
}
.floorplan-room {
  min-height: 3.5rem;
  padding: .35rem .2rem;
  border: 2px solid #887341;
  border-radius: .27rem;
  background: var(--paper);
  color: var(--fir-dark);
  font: 700 .72rem system-ui, sans-serif;
}
.floorplan-room[aria-current='location'] { background: var(--hunter); color: white; }
.floorplan-room[data-room-id='01_entrance'] { grid-area: 4 / 3; }
.floorplan-room[data-room-id='02_reference_desk'] { grid-area: 3 / 3; }
.floorplan-room[data-room-id='03_stacks'] { grid-area: 2 / 2; }
.floorplan-room[data-room-id='04_reading_room'] { grid-area: 2 / 3; }
.floorplan-room[data-room-id='05_writing_room'] { grid-area: 2 / 4; }
.floorplan-room[data-room-id='06_map_case'] { grid-area: 1 / 3; }
.floorplan-room[data-room-id='07_light_table'] { grid-area: 1 / 4; }
.floorplan-room[data-room-id='08_pedee_office'] { grid-area: 3 / 4; }
.floorplan-room[data-room-id='09_starter_office'] { grid-area: 4 / 4; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
@media (max-width: 900px) {
  .action-columns { grid-template-columns: 1fr; }
  .chrome { width: 100%; }
  .chrome button { flex: 1 1 auto; }
}
@media (max-width: 639px) {
  .site-header { position: static; gap: .55rem; }
  .chrome button { padding: .33rem .4rem; font-size: .74rem; min-height: 2.5rem; }
  .room-header h1 { font-size: 1.65rem; }
  .plate-stage { aspect-ratio: 1600 / 893; }
  .room-fallback { gap: .4rem; padding: .5rem; }
  .room-fallback strong { font-size: 1.5rem; }
  .caption-panel { margin-top: .48rem; }
  .mobile-compass {
    display: flex; justify-content: center; gap: .3rem;
    position: fixed; z-index: 25;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: .5rem; right: .5rem;
    padding: .38rem; border: 2px solid var(--brass-light);
    border-radius: 999px;
    background: var(--fir-dark);
    box-shadow: 0 4px 19px #0009;
  }
  .mobile-compass button {
    flex: 1; min-width: 0; padding: .53rem .15rem;
    border: 1px solid #b89750; border-radius: 999px;
    background: var(--parchment); color: var(--fir-dark);
    font: 750 .67rem system-ui, sans-serif;
  }
  .floorplan-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .2rem; padding: .35rem; }
  .floorplan-room { font-size: .54rem; min-height: 3.3rem; overflow-wrap: anywhere; }
  .library-dialog { max-height: 80vh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0ms !important; animation-duration: 0ms !important; }
}

.floorplan-card-figure { margin: 0 0 .75rem; }
.floorplan-card-figure img { width: 100%; height: auto; border-radius: 8px; border: 1px solid #b8860b66; display: block; }
.object-frame { position: relative; margin: .75rem 0 1rem; }
.object-frame img { width: 100%; height: auto; border-radius: 8px; border: 1px solid #b8860b66; display: block; }
.object-fallback { display: grid; place-items: center; gap: .35rem; min-height: 12rem; padding: 1rem; background: #f7f3e8; border: 1px dashed #b8860b99; border-radius: 8px; color: #392516; text-align: center; }
.object-fallback-mark { font-size: 1.4rem; color: #b8860b; }
/* Mobile compass retains its fixed, inset viewport positioning. */
.mobile-compass .compass-bar-art { display: none; }
@media (max-width: 720px) {
  .mobile-compass .compass-bar-art { display: block; width: 100%; height: auto; opacity: .9; margin-bottom: .35rem; border-radius: 6px; }
}

/* Keep letterboxing outside the shared image/hotspot coordinate box. */
#sound-button { background: #f4cf73; color: #392516; border-width: 2px; }
