/* ════════════════════════════════════════════════════════════════════
   THE BOARD: the site menu, shared by every page.

   A parchment scroll that unrolls from the button, written like a BBS
   main menu: (I)NDEX, (N)OW, (F)IELD NOTES … The red letters are hotkeys
   while the scroll is open, and the prompt at the foot echoes them.

   This file is the look. The list of rooms lives in /board.js.
   Every class starts with tb- ("the board"), so nothing on a page can
   collide with it. Pages link this file before their own <style>, so a
   page can still override it. The Index hangs its board over the
   harbour with .tb--harbour; that position is in index.html.
   ════════════════════════════════════════════════════════════════════ */

.tb {
  --tb-amber: #c8923a;
  --tb-parch: #e8d4a0;
  --tb-ink: #2e1808;
  --tb-ink-soft: #6a4224;
  --tb-red: #922a12;
  --tb-burger: #8b5020;
  position: relative;
  z-index: 250;
  padding-top: 2.25px;               /* where the old button sat, so no header changes height */
  font-family: 'VT323', monospace;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.tb, .tb *, .tb *::before, .tb *::after { box-sizing: border-box; }

/* ── The button: THE BOARD ─────────────────────────────────────────── */
.tb-btn {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
  font: inherit;
  font-size: 15.5px;
  line-height: normal;
  color: var(--tb-amber);
  letter-spacing: 0.28em;
  padding: 5px 10px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(20,12,6,0.4);
  border: 1px solid rgba(140,90,40,0.3);
  border-radius: 2px;
  text-shadow: 0 0 12px rgba(200,140,50,0.35);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}
.tb--harbour .tb-btn {               /* over open sky it wants a little more backing */
  background: rgba(20,12,6,0.55);
  border-color: rgba(140,90,40,0.35);
  text-shadow: 0 0 12px rgba(200,140,50,0.45);
}
.tb-burger {
  flex: none;
  width: 14px;
  height: 9.5px;
  margin-right: 2px;
  background:
    linear-gradient(var(--tb-burger), var(--tb-burger)) 0 0 / 100% 1.5px no-repeat,
    linear-gradient(var(--tb-burger), var(--tb-burger)) 0 50% / 100% 1.5px no-repeat,
    linear-gradient(var(--tb-burger), var(--tb-burger)) 0 100% / 100% 1.5px no-repeat;
}
.tb-caret {
  flex: none;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #8b5020;
  margin-right: 5px;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), border-top-color 0.2s;
}
.tb.is-open .tb-btn {
  color: var(--tb-parch);
  border-color: rgba(200,140,80,0.6);
  background: rgba(40,24,10,0.7);
  --tb-burger: #c8923a;
}
.tb.is-open .tb-caret { transform: rotate(180deg); border-top-color: var(--tb-amber); }
@media (hover: hover) {
  .tb .tb-btn:hover {
    color: var(--tb-parch);
    border-color: rgba(200,140,80,0.6);
    background: rgba(40,24,10,0.7);
    --tb-burger: #c8923a;
  }
}
.tb-btn:focus-visible { outline: 1px dashed var(--tb-amber); outline-offset: 3px; }

/* ── The scroll ─────────────────────────────────────────────────────
   Closed, it's rolled up: two rods together, hidden. Open, it fades in,
   then the paper unrolls (grid rows 0fr → 1fr, so no heights in JS) and
   the foot rod drops with it, settles, and the ink ring draws itself. */
.tb-scroll {
  position: absolute;
  top: calc(100% + 8px);
  left: 29px;                        /* the left finial lines up with the button */
  width: max-content;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-100vw);     /* put away to the left, so a closed scroll never widens a phone's page */
  transition: opacity 0.12s ease 0.22s, visibility 0s linear 0.34s, transform 0s linear 0.34s;
}
.tb.is-open .tb-scroll {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: none;
  transition: opacity 0.12s ease, visibility 0s, transform 0s;
}
.tb-sheet {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.26s cubic-bezier(0.55, 0, 0.75, 0.2);
}
.tb.is-open .tb-sheet {
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.5s cubic-bezier(0.2, 0.75, 0.25, 1) 0.08s;
}

/* the rods: turned wood with brass finials */
.tb-rod {
  position: relative;
  z-index: 2;
  height: 15px;
  margin: 0 -12px;
  border-radius: 8px;
  background:
    linear-gradient(to right, rgba(20,8,0,0.45), rgba(20,8,0,0) 7px, rgba(20,8,0,0) calc(100% - 7px), rgba(20,8,0,0.45)),
    linear-gradient(to bottom, #2e1a0a 0%, #563414 18%, #7a4e24 34%, #9e6e3a 45%, #835628 57%, #563414 80%, #2e1a0a 100%);
  box-shadow: 0 3px 5px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,220,160,0.35);
}
.tb-rod::before,
.tb-rod::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 20px;
  height: 15px;
  margin-top: -7.5px;
  background-repeat: no-repeat;
  background-size: 15px 15px, 15px 15px, 4px 12px;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.55));
}
.tb-rod::before {
  left: -17px;
  background-image:
    radial-gradient(circle at 36% 32%, rgba(255,246,214,0.95) 0, rgba(255,246,214,0) 3.5px),
    radial-gradient(circle closest-side, #e6bf66 0%, #c4923a 46%, #87591a 80%, #4a2d0a 96%, rgba(74,45,10,0) 100%),
    linear-gradient(to bottom, #5a3a10 0%, #e9c878 38%, #b4862c 64%, #5a3a10 100%);
  background-position: 0 0, 0 0, 100% 50%;
}
.tb-rod::after {
  right: -17px;
  background-image:
    radial-gradient(circle at 36% 32%, rgba(255,246,214,0.95) 0, rgba(255,246,214,0) 3.5px),
    radial-gradient(circle closest-side, #e6bf66 0%, #c4923a 46%, #87591a 80%, #4a2d0a 96%, rgba(74,45,10,0) 100%),
    linear-gradient(to bottom, #5a3a10 0%, #e9c878 38%, #b4862c 64%, #5a3a10 100%);
  background-position: 100% 0, 100% 0, 0 50%;
}
.tb.is-open .tb-rod--foot { animation: tb-settle 0.34s ease-out 0.56s both; }
@keyframes tb-settle {
  0%, 100% { transform: translateY(0); }
  45% { transform: translateY(3px); }
}

/* the paper: the outer box clips (it's the part unrolled so far);
   the inner box carries the parchment, so the stain doesn't slide */
.tb-paper {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border-left: 1px solid rgba(90,56,24,0.75);
  border-right: 1px solid rgba(90,56,24,0.75);
  box-shadow: 0 14px 30px rgba(0,0,0,0.8), 0 4px 10px rgba(0,0,0,0.55);
}
.tb-paper::after {                    /* the paper darkens where it curls under each rod */
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(64,34,10,0.42), rgba(64,34,10,0) 15px),
    linear-gradient(to top, rgba(64,34,10,0.46), rgba(64,34,10,0) 17px);
}
.tb-paper-in {
  padding: 13px 26px 11px 20px;
  background-color: #d8bc80;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.026' numOctaves='3' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.52 0 0 0 0 0.31 0 0 0 0 0.09 1.1 0 0 0 -0.5'/%3E%3C/filter%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.4 0 0 0 0 0.24 0 0 0 0 0.07 0.9 0 0 0 -0.36'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23m)'/%3E%3Crect width='220' height='220' filter='url(%23g)'/%3E%3C/svg%3E"),
    radial-gradient(circle at calc(100% - 34px) calc(100% - 30px), rgba(118,64,22,0) 0 17px, rgba(118,64,22,0.2) 17.5px 19px, rgba(118,64,22,0.07) 20px, rgba(118,64,22,0) 22px),
    radial-gradient(circle at calc(100% - 40px) calc(100% - 37px), rgba(118,64,22,0) 0 17px, rgba(118,64,22,0.12) 17.5px 18.5px, rgba(118,64,22,0) 20px),
    radial-gradient(ellipse 70% 55% at 50% 0%, rgba(244,226,172,0.55), rgba(244,226,172,0)),
    linear-gradient(to right, rgba(120,66,18,0.26), rgba(120,66,18,0) 15%, rgba(120,66,18,0) 85%, rgba(120,66,18,0.26)),
    linear-gradient(to bottom, #dcc184 0%, #d2b273 50%, #c6a263 100%);
  box-shadow: inset 0 0 26px rgba(122,70,20,0.3);
}

/* ── The menu, written on it ────────────────────────────────────────── */
.tb-list { list-style: none; margin: 0; padding: 0; }
.tb-list li { margin: 0; padding: 0; }
.tb-link {
  position: relative;
  display: block;
  padding: 8px 12px 8px 8px;
  font-size: 20px;
  line-height: 22px;
  letter-spacing: 0.14em;
  color: var(--tb-ink);
  text-decoration: none;
  white-space: nowrap;
  border-radius: 2px;
  outline: none;
}
.tb-name { position: relative; display: inline-block; isolation: isolate; }
.tb-key { color: var(--tb-ink-soft); letter-spacing: 0.03em; }
.tb-key b { font-weight: normal; color: var(--tb-red); text-shadow: 0 0 1px rgba(146,42,18,0.35); }

/* hover: a quill stroke draws in under the name */
.tb-name::after {
  content: '';
  position: absolute;
  left: -1px;
  right: 0.2em;
  bottom: -3px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(to right, rgba(46,24,8,0.8), rgba(46,24,8,0.62) 72%, rgba(46,24,8,0));
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.26s cubic-bezier(0.3, 0.7, 0.3, 1);
}
@media (hover: hover) {
  .tb-link:hover .tb-name::after { transform: scaleX(1); }
}
.tb-link:focus-visible .tb-name::after { transform: scaleX(1); }
/* keyboard: the BBS lightbar, in ink */
.tb-link:focus-visible {
  background: rgba(70,36,10,0.13);
  outline: 1px dashed rgba(46,24,8,0.5);
  outline-offset: -1px;
}
.tb-link.is-picked { background: rgba(70,36,10,0.2); }

/* you are here: a quick ring in red ink, drawn as the scroll opens */
.tb-here {
  position: absolute;
  z-index: -1;
  overflow: visible;
  pointer-events: none;
}
.tb-here path {
  fill: none;
  stroke: var(--tb-red);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.8;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}
.tb.is-open .tb-here path {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.55s cubic-bezier(0.45, 0.1, 0.35, 1) 0.5s;
}

/* the prompt at the foot */
.tb-cmd {
  margin: 6px 0 0;
  padding: 9px 8px 3px;
  border-top: 1px dashed rgba(80,40,8,0.32);
  font-size: 17px;
  line-height: 20px;
  letter-spacing: 0.08em;
  color: var(--tb-ink-soft);
  white-space: nowrap;
}
.tb-echo { color: var(--tb-red); }
.tb-cursor {
  display: inline-block;
  width: 0.4em;
  height: 3px;
  margin-left: 1px;
  vertical-align: baseline;
  background: var(--tb-ink);
  animation: tb-blink 1.06s step-end infinite;
}
@keyframes tb-blink { 50% { opacity: 0; } }

/* ── Phones ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .tb { padding-top: 3.25px; }
  .tb-btn { font-size: 14.5px; padding: 4px 8px; min-height: 26px; }
  .tb--harbour { padding-top: 2.25px; }
  .tb--harbour .tb-btn { padding: 5px 10px; min-height: 28px; }
  .tb-link { letter-spacing: 0.1em; }
  /* the scroll, a size down on a phone: it was over half the screen. Smaller writing, less margin. */
  .tb-paper-in { padding: 10px 20px 9px 16px; }
  .tb-link { font-size: 18px; line-height: 20px; }
  .tb-cmd { margin-top: 4px; padding: 7px 8px 2px; font-size: 15.5px; line-height: 18px; }
}
@media (pointer: coarse) {
  .tb-link { padding-top: 11px; padding-bottom: 11px; }   /* 44px to tap */
}
@media (max-width: 600px) and (pointer: coarse) {
  .tb-link { padding-top: 10px; padding-bottom: 10px; }   /* 40px rows on a phone: still a thumb's worth */
}
/* phones on their side: two columns, no prompt, so it fits above the status bar */
@media (max-height: 500px) and (orientation: landscape) {
  .tb-list {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(var(--tb-rows, 3), auto);
    column-gap: 18px;
  }
  .tb-cmd { display: none; }
  .tb-paper-in { padding-top: 8px; padding-bottom: 8px; }
  .tb-link { padding-top: 7px; padding-bottom: 7px; }      /* 36px rows: short screens need the room */
  .tb--harbour.is-open { z-index: 150; }                   /* the Index: open, it may lie over the status bar */
}

/* ── Less motion: no unrolling, no blinking, no drawing ─────────────── */
@media (prefers-reduced-motion: reduce) {
  .tb-scroll, .tb.is-open .tb-scroll,
  .tb-sheet, .tb.is-open .tb-sheet,
  .tb-here path, .tb.is-open .tb-here path,
  .tb-caret, .tb-name::after { transition: none !important; }
  .tb-cursor, .tb.is-open .tb-rod--foot { animation: none !important; }
}
.tb-instant, .tb-instant * { transition: none !important; animation: none !important; }

/* ── Without JavaScript (or if /board.js fails to load) ────────────────
   board.js removes this list and builds the scroll. Until then, the
   plain list in the page opens on hover or focus. */
.tb-fallback { display: none; }
.tb:not(.tb-ready):hover .tb-fallback,
.tb:not(.tb-ready):focus-within .tb-fallback {
  display: block;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  margin: 0;
  padding: 10px 18px;
  list-style: none;
  background: #d4b77d;
  border: 1px solid #5a3818;
  border-radius: 3px;
  box-shadow: 0 14px 30px rgba(0,0,0,0.8);
}
.tb-fallback a {
  display: block;
  padding: 7px 2px;
  font-size: 19px;
  letter-spacing: 0.14em;
  color: var(--tb-ink);
  text-decoration: none;
  white-space: nowrap;
}

/* ════════════════════════════════════════════════════════════════════
   THE WORLD: the ways out of each room. (Not the board, but every page
   loads this file, so it lives here.) An exit is an SVG link in a scene,
   <a class="wx-exit">: the door, the window, the fire. Hover lights its
   outline and says where it goes; /board.js walks you through it.
   ════════════════════════════════════════════════════════════════════ */
.wx-exit { cursor: pointer; outline: none; }   /* not in the tab order (the board is), so no focus box on click */
.wx-exit .wx-glow { opacity: 0; transition: opacity 0.25s; }
.wx-exit.wx-going .wx-glow { opacity: 1; }
@media (hover: hover) { .wx-exit:hover .wx-glow { opacity: 1; } }
/* an exit that leaves by itself (NOW's dinghy) takes its ring along: none left on the sand */
.wx-exit[data-wx-delay].wx-going .wx-glow { opacity: 0; }
.wx-cap { opacity: 0; transition: opacity 0.25s; }
.wx-cap.wx-on { opacity: 1; }
.wx-lean { transition: scale 0.55s cubic-bezier(0.5, 0, 0.75, 0.4); scale: 1.22; }
.wx-veil {
  position: fixed; inset: 0; z-index: 10000;
  background: #050305; opacity: 0; pointer-events: none;
  transition: opacity 0.42s ease-in;
}
.wx-veil.wx-on { opacity: 1; }

/* the house's mark: one blanket line in every page's status bar
   (SYSOP · CAPTAIN H. BARTER · © MMXXVI DARK LORE BBS). Narrower windows
   keep the short form (© MMXXVI), so no bar grows a line. */
@media (max-width: 1100px) {
  .status-copy-name { display: none; }
}

/* ── THE COUNTER ─────────────────────────────────────────────────────────
   The caller line: /counter.js puts "YOU ARE CALLER #000412" at the head of
   the right-hand side of every room's status bar, once the count is in. */
.status-bar .caller { color: #e8b85a; letter-spacing: 0.18em; }
.status-bar .caller-no { color: #ffd27a; text-shadow: 0 0 6px rgba(255,180,90,0.55); }
.status-bar .caller-short .caller-you { display: none; }   /* where the whole line won't fit: CALLER #000412 */
/* ── end of THE COUNTER ── */
