@font-face { font-family: "IM Fell English"; src: url("assets/fonts/IMFellEnglish.ttf") format("truetype"); }
@font-face { font-family: "Archivo"; src: url("assets/fonts/Archivo-Regular.ttf") format("truetype"); font-weight: 400; }
@font-face { font-family: "Archivo"; src: url("assets/fonts/Archivo-Bold.ttf") format("truetype"); font-weight: 700; }

:root {
  --parchment: #f4ecd9;
  --parchment-deep: #ece1c9;
  --ink: #2b2118;
  --navy: #173753;
  --sepia: #5d4a26;
  --gold: #b98a1d;
  --red: #d92b20;
  --line: #d8c9a3;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "Archivo", system-ui, sans-serif;
  background: var(--parchment);
  color: var(--ink);
  display: flex; flex-direction: column;
}
a { color: var(--navy); }

header.top {
  display: flex; align-items: baseline; gap: 14px;
  padding: 10px 18px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--parchment);
  flex: 0 0 auto; flex-wrap: wrap;
}
.wordmark { font-size: 26px; line-height: 1; white-space: nowrap; text-decoration: none; }
.wordmark .yester { font-family: "IM Fell English", serif; color: var(--sepia); }
.wordmark .mapw { font-family: "Archivo", sans-serif; font-weight: 700; color: var(--navy); }
.roomname {
  font-family: "IM Fell English", serif; font-size: 19px; color: var(--sepia);
  border-left: 1px solid var(--line); padding-left: 14px;
}
.tagline { font-size: 13px; color: var(--sepia); font-style: italic; }
header.top .spacer { flex: 1 1 auto; }
.version { font-size: 12px; color: var(--sepia); font-variant-numeric: tabular-nums; }
.pinown {
  font: inherit; font-size: 13.5px; font-weight: 700;
  background: var(--navy); color: #fff; border: 0; border-radius: 6px;
  padding: 7px 13px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.pinown:hover { background: #0f2a42; }

main.room { flex: 1 1 auto; display: flex; min-height: 0; }

aside.shelf {
  width: 348px; flex: 0 0 348px; overflow-y: auto;
  border-right: 1px solid var(--line); background: var(--parchment);
  padding: 12px 12px 16px;
}
.newest {
  font-size: 13px; color: var(--sepia); margin: 2px 2px 10px;
}
.newest b { color: var(--ink); }
.era { margin: 4px 2px 12px; }
.era .era-head { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--sepia); margin-bottom: 2px; }
.era .era-head b { color: var(--ink); font-variant-numeric: tabular-nums; }
.era .era-note { font-size: 11.5px; color: var(--sepia); }
/* The two-head era control (Scott, 2026-11-29): FROM and TO
   ride one track; the span between the heads is filled. */
.dualrange { position: relative; height: 22px; margin: 2px 0 0; }
.dualrange::before { content: ''; position: absolute; left: 0; right: 0; top: 9px; height: 4px; border-radius: 2px; background: #d9c9a3; }
.dualrange .dr-fill { position: absolute; top: 9px; height: 4px; border-radius: 2px; background: var(--navy); }
.dualrange input[type="range"] { position: absolute; left: 0; top: 0; width: 100%; height: 22px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; pointer-events: none; }
.dualrange input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #f4ecd9; border: 2px solid var(--navy); pointer-events: auto; cursor: grab; }
.dualrange input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #f4ecd9; border: 2px solid var(--navy); pointer-events: auto; cursor: grab; }
.era-heads { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--sepia); margin: 1px 0 2px; }
.era-heads b { color: var(--ink); font-variant-numeric: tabular-nums; }
/* Tag chips + picker (Scott, 2026-11-29, Thingalog rules). */
.tags { margin: 2px 2px 10px; }
#tagchips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
#tagchips:empty { margin-bottom: 0; }
.fchip { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; padding: 3px 8px; border: 1px solid var(--navy); border-radius: 999px; background: #eef2f7; color: var(--ink); }
.fchip.mode-or { border-style: dashed; }
.fchip.mode-not { border-color: #a33; background: #f9ecec; }
.fconn { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; color: var(--sepia); align-self: center; }
.fchip-ctl { display: none; gap: 2px; }
.fchip:hover .fchip-ctl { display: inline-flex; }
.fchip-ctl button { font: inherit; font-size: 10.5px; font-weight: 700; border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 1px 5px; cursor: pointer; color: var(--sepia); }
.fchip-ctl button:hover { color: var(--ink); }
.fclear { font: inherit; font-size: 12px; font-weight: 700; border: none; background: none; color: var(--sepia); cursor: pointer; padding: 3px 4px; text-decoration: underline; align-self: center; }
.fclear:hover { color: var(--ink); }
.tagtoggle { font: inherit; font-size: 12.5px; font-weight: 700; letter-spacing: 0.04em; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 4px 10px; cursor: pointer; color: var(--sepia); }
#tagpicker { margin-top: 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 4px 0; max-height: 260px; overflow-y: auto; }
.tagrow { display: flex; align-items: center; gap: 6px; padding-right: 8px; }
.tagrow .tagname { flex: 1; text-align: left; font: inherit; font-size: 13px; border: 0; background: none; padding: 4px 0; cursor: pointer; color: var(--ink); }
.tagrow .tagname:hover { text-decoration: underline; }
.tagrow-ctl { display: inline-flex; gap: 2px; opacity: 0; transition: opacity 0.15s; }
.tagrow:hover .tagrow-ctl { opacity: 1; }
.tagrow-ctl button { font: inherit; font-size: 10.5px; font-weight: 700; border: 1px solid var(--line); background: #f7efdb; border-radius: 6px; padding: 1px 5px; cursor: pointer; color: var(--sepia); }
.tags-note { font-size: 11.5px; color: var(--sepia); margin-top: 5px; }
.card {
  width: 100%;
  background: #fffdf6; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px; margin: 0 0 9px;
  transition: opacity .8s ease, filter .8s ease;
}
.card:hover { border-color: var(--gold); }
.card.ishidden { opacity: .55; filter: saturate(.35); }
.card.suppressed { opacity: .45; filter: grayscale(1); }
.cardmain { display: flex; gap: 10px; cursor: pointer; }
.cardmain img { width: 86px; height: 64px; object-fit: cover; border-radius: 4px; background: var(--parchment-deep); flex: 0 0 auto; }
.cardctl {
  display: flex; align-items: center; gap: 8px; margin-top: 7px;
  border-top: 1px dashed var(--line); padding-top: 7px;
}
.cardctl input[type="range"] { flex: 1 1 auto; accent-color: var(--navy); min-width: 0; }
.cardctl .pct { font-size: 12px; color: var(--sepia); font-variant-numeric: tabular-nums; width: 34px; }
.cardctl .hidelab { font-size: 12.5px; color: var(--sepia); display: flex; align-items: center; gap: 3px; cursor: pointer; white-space: nowrap; }
#hiddenrow { margin: 0 2px 9px; }
.hbtn {
  font: inherit; font-size: 12.5px; font-weight: 700; color: var(--navy);
  background: none; border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; cursor: pointer;
}
.hbtn:hover { border-color: var(--gold); }
.card .ct { font-weight: 700; font-size: 14.5px; color: var(--ink); line-height: 1.25; }
.card .cm { font-size: 12.5px; color: var(--sepia); margin-top: 2px; }
.card .cp { font-size: 12.5px; color: var(--gold); font-weight: 700; margin-top: 1px; }
.shelf .colophon { font-size: 12px; color: var(--sepia); margin: 14px 2px 0; line-height: 1.5; }
.empty-note { font-size: 14px; color: var(--sepia); padding: 10px 2px; line-height: 1.5; }

section.stage { flex: 1 1 auto; position: relative; min-width: 0; }
.optpill {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  background: #fffdf6; border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 14px; font-size: 12px; color: var(--sepia);
  box-shadow: 0 1px 5px rgba(60, 45, 20, .18); pointer-events: none; z-index: 5;
  white-space: nowrap;
}
.optpill b { color: var(--ink); font-weight: 700; }
#cmap, #smap { position: absolute; inset: 0; }
.toolbar {
  position: absolute; top: 10px; left: 10px; z-index: 5;
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.tbtn {
  font: inherit; font-size: 13px; font-weight: 700;
  background: rgba(255,253,246,.94); color: var(--navy);
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 11px; cursor: pointer;
}
.tbtn[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.opctl {
  display: flex; align-items: center; gap: 7px;
  background: rgba(255,253,246,.94); border: 1px solid var(--line); border-radius: 6px;
  padding: 5px 10px; font-size: 12.5px; color: var(--sepia);
}
.opctl input[type="range"] { width: 110px; accent-color: var(--navy); }
.cardpage { color: var(--navy); font-weight: 700; font-size: 12.5px; text-decoration: none; }
.cardpage:hover { text-decoration: underline; }
.pinsctl { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.pinsctl input { accent-color: var(--navy); margin: 0; }
/* ---------- sheet page ---------- */
.sheetmain { flex: 1 1 auto; display: flex; min-height: 0; }
section.sheetstage { flex: 1 1 auto; position: relative; min-width: 0; }
aside.rail {
  width: 360px; flex: 0 0 360px; overflow-y: auto;
  border-left: 1px solid var(--line); background: var(--parchment); padding: 16px 18px 20px;
}
.rail h1 { font-family: "IM Fell English", serif; font-weight: 400; font-size: 27px; line-height: 1.15; margin: 0 0 4px; color: var(--ink); }
.rail .sdate { font-size: 14px; color: var(--sepia); margin-bottom: 10px; }
.rail .spins { font-size: 14px; color: var(--gold); font-weight: 700; margin-bottom: 12px; }
.rail .snote { font-size: 14px; line-height: 1.55; margin: 0 0 10px; }
.rail .smallprint { font-size: 12px; color: var(--sepia); line-height: 1.5; margin-top: 14px; }
.rail .actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.rail textarea {
  width: 100%; min-height: 74px; font-size: 12px; font-family: ui-monospace, monospace;
  border: 1px solid var(--line); border-radius: 6px; padding: 7px; background: #fffdf6; color: var(--ink);
}
.backlink { font-size: 13.5px; font-weight: 700; text-decoration: none; }
.credit {
  position: absolute; right: 10px; bottom: 10px; z-index: 5;
  background: rgba(255,253,246,.92); border: 1px solid var(--line); border-radius: 6px;
  font-size: 12px; padding: 4px 9px; color: var(--sepia);
}
body.embed header.top, body.embed aside.rail { display: none; }
body.embed .sheetmain { flex: 1 1 auto; }

@media (max-width: 820px) {
  main.room { flex-direction: column; }
  aside.shelf { width: auto; flex: 0 0 auto; max-height: 44%; border-right: 0; border-bottom: 1px solid var(--line); }
  .sheetmain { flex-direction: column; }
  aside.rail { width: auto; flex: 0 0 auto; max-height: 46%; border-left: 0; border-top: 1px solid var(--line); order: 2; }
  section.sheetstage { order: 1; min-height: 300px; }
  .roomname { display: none; }
}

/* The hover pin: a brand-navy teardrop with a gold heart, and a
   halo that breathes outward — the "it's here" marker for sheets
   too small on screen to glow usefully. */
.hoverpin { position: relative; width: 26px; height: 37px; pointer-events: none; }
.hoverpin svg { position: relative; z-index: 2; display: block; filter: drop-shadow(0 1px 3px rgba(0,0,0,.5)); }
.hoverpin .hp-halo {
  position: absolute; z-index: 1; left: 50%; top: 12px; width: 30px; height: 30px;
  margin: -15px 0 0 -15px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,176,32,.85) 0%, rgba(255,176,32,0) 68%);
  animation: hp-pulse 1.2s ease-out infinite;
}
@keyframes hp-pulse {
  0% { transform: scale(.45); opacity: .95; }
  100% { transform: scale(2.1); opacity: 0; }
}

.peekbtn {
  display: block; width: 100%; margin: 0 0 12px; padding: 8px 10px;
  font: inherit; font-size: 13px; font-weight: 700; color: var(--navy);
  background: #fffdf6; border: 1.5px solid var(--navy); border-radius: 8px; cursor: pointer;
}
.peekbtn:hover { background: var(--parchment-deep); }
.peekbtn.held { background: var(--navy); color: var(--parchment); }

/* Folio (2026-11-29): the embed hangs the map and the headline
   on a foreign page; the room's furniture stays home. */
.embedbar {
  position: absolute; left: 10px; bottom: 10px; z-index: 6;
  background: #fffdf6; border: 1px solid var(--line); border-radius: 6px;
  padding: 4px 10px; font-size: 12px; color: var(--sepia);
  box-shadow: 0 1px 5px rgba(60, 45, 20, .18); pointer-events: none;
}
body.embed header.top, body.embed aside.shelf { display: none; }
body.embed .embedbar { display: block !important; }
body.embed .toolbar { display: none; }
