/* The room: the canvas, and the overlay drawn on top of it (the "HUD"). */

:root {
  --hud-ink: #efe9dc;
  --hud-soft: #c9c4d2;
  --hud-muted: #a29fae;
  --hud-ground: #0b0a0f;
  --hud-panel: rgba(14, 13, 19, 0.74);
  --hud-line: rgba(255, 255, 255, 0.14);
  --hud-accent: #6fe08c;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
}

html.room, html.room body { height: 100%; margin: 0; background: var(--hud-ground); overflow: hidden; overscroll-behavior: none; }
html.room #root { position: fixed; inset: 0; }
html.room #plain { display: none; }

#gl { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }

.hud { position: fixed; z-index: 10; color: var(--hud-ink); pointer-events: none; }
.hud > * { pointer-events: auto; }

/* top: the name, the menu */
.hud.top { top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; gap: 16px; }
.hud.top .name {
  display: inline-flex; align-items: center; white-space: nowrap;
  background: none; border: 0; padding: 4px 0; cursor: pointer; filter: drop-shadow(0 1px 10px rgba(0,0,0,.6));
}
/* the wordmark: a transparent cutout, so it sits on the room */
.hud.top .name img { display: block; height: 30px; width: auto; }
.hud.top .name:hover img { opacity: .85; }
.hud.top .menu { display: flex; gap: 4px; }
.hud.top .menu a {
  font-family: var(--display); font-weight: 500; font-size: 22px; letter-spacing: 0.14em; text-decoration: none;
  color: rgba(239, 233, 220, 0.82); padding: 4px 12px 3px; border-radius: 3px; text-shadow: 0 1px 12px rgba(0,0,0,.6);
}
.hud.top .menu a:hover { color: #fff; }
.hud.top .menu a[aria-current="page"] { color: #1b1814; background: var(--hud-ink); text-shadow: none; }

/* the card */
.hud.panel {
  top: 70px; right: 22px; bottom: 86px; width: min(460px, calc(100vw - 44px));
  display: flex; flex-direction: column;
  background: var(--hud-panel); border: 1px solid var(--hud-line); border-radius: 6px;
  backdrop-filter: blur(16px) saturate(1.1); -webkit-backdrop-filter: blur(16px) saturate(1.1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  pointer-events: auto; overflow: hidden;
  animation: card-in .32s cubic-bezier(.2,.7,.2,1);
}
.hud.panel[hidden] { display: none; }
@keyframes card-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.hud.panel header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--hud-line); }
.hud.panel .ch { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; color: var(--hud-accent); }
.hud.panel h2 { font-family: var(--serif); font-weight: 700; font-size: 28px; line-height: 1.1; margin: 2px 0 0; letter-spacing: -0.01em; }
.hud.panel .close {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.1em; color: var(--hud-ink);
  background: rgba(255,255,255,.08); border: 1px solid var(--hud-line); border-radius: 999px; padding: 7px 12px 6px; cursor: pointer;
}
.hud.panel .close:hover { background: var(--hud-ink); color: #1b1814; }
.hud.panel .body { padding: 6px 18px 18px; overflow: auto; overscroll-behavior: contain; flex: 1;
  /* the plain pages' rows, in the dark */
  --ink: var(--hud-ink); --soft: var(--hud-soft); --muted: var(--hud-muted); --rule: var(--hud-line); --rule-strong: rgba(255,255,255,.3);
  --accent: var(--hud-accent); --accent-ink: #0f1a12; --sheet: rgba(255,255,255,.05); --paper: var(--hud-ground);
}
.hud.panel .body .rows .t { font-size: 17px; }
.hud.panel .body .rows p { font-size: 13.5px; }
.hud.panel .body .log ol a .r { font-size: 16px; }
.hud.panel .body .figs .v { font-size: 22px; }
.hud.panel .body .figs .l { font-size: 13.5px; }
.hud.panel .body p.intro { font-family: var(--serif); font-size: 16.5px; line-height: 1.5; margin: 12px 0 0; color: var(--hud-ink); }
.hud.panel .body .k-label a, .hud.panel .body .more { color: var(--hud-ink); font-family: var(--mono); font-size: 12px; }
.hud.panel .body .k-label a:hover, .hud.panel .body .more:hover { color: var(--hud-accent); }
.hud.panel .body .signup { background: rgba(255,255,255,.05); border-color: var(--hud-line); margin-top: 18px; }
.hud.panel .body .signup input { background: rgba(0,0,0,.3); color: var(--hud-ink); border-color: var(--hud-line); }
.hud.panel .body .btn, .hud.panel .body .k-label a.btn { background: var(--hud-ink); color: #1b1814; border-color: var(--hud-ink); display: inline-block; white-space: normal; line-height: 1.4; }
.hud.panel .body .btn:hover, .hud.panel .body .k-label a.btn:hover { background: var(--hud-accent); border-color: var(--hud-accent); color: #0f1a12; }
.hud.panel .body .photo { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 4px; margin-top: 14px; }

/* bottom: the hint, the pills */
.hud.ctl { left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; padding: 0 22px 18px; }
.hud.ctl .hint { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.02em; color: var(--hud-soft); text-shadow: 0 1px 10px rgba(0,0,0,.7); pointer-events: none; }
.hud.ctl .btns { display: flex; gap: 8px; }
.hud.ctl .pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-decoration: none; color: var(--hud-ink);
  background: rgba(14, 13, 19, 0.7); border: 1px solid var(--hud-line); border-radius: 999px; padding: 8px 14px 7px; cursor: pointer;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.hud.ctl .pill:hover { background: var(--hud-ink); color: #1b1814; }
.hud.ctl .pill[hidden] { display: none; }
.hud.ctl .pill svg { width: 15px; height: 15px; }

/* the tooltip by the cursor */
#tip {
  position: fixed; z-index: 11; pointer-events: none; max-width: 260px;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.02em; color: var(--hud-ink);
  background: rgba(14, 13, 19, 0.85); border: 1px solid var(--hud-line); border-radius: 3px; padding: 6px 9px 5px;
  transform: translate(14px, 18px);
}
#tip[hidden] { display: none; }

/* loading */
#loader { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: var(--hud-ground); transition: opacity .6s ease; }
#loader.off { opacity: 0; pointer-events: none; }
#loader .bar { width: 180px; height: 4px; background: rgba(255,255,255,.12); border-radius: 2px; overflow: hidden; }
#loader .bar span { display: block; height: 100%; width: 40%; background: var(--hud-accent); animation: load 1.1s ease-in-out infinite; }
@keyframes load { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }
#loader .t { font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; color: var(--hud-muted); margin-top: 14px; }

/* the error, if the renderer can't be made */
#err { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 24px; color: var(--hud-ink); font-family: var(--mono); font-size: 13px; text-align: center; background: var(--hud-ground); }
#err[hidden] { display: none; }

/* phones: the card is a sheet from the bottom, the menu is smaller */
@media (max-width: 720px) {
  .hud.top { padding: 12px 14px; }
  .hud.top .name img { height: 22px; }
  .hud.top .menu { gap: 0; }
  .hud.top .menu a { font-size: 16px; padding: 4px 6px 3px; letter-spacing: 0.08em; }
  .hud.panel { top: auto; left: 10px; right: 10px; bottom: 10px; width: auto; max-height: 62vh; }
  .hud.ctl { padding: 0 14px 12px; align-items: stretch; }
  .hud.ctl .hint { display: none; }
  .hud.ctl .btns { justify-content: flex-end; }
  body[data-panel] .hud.ctl { display: none; }
}

/* the music corner's arrow sits at the left edge, the bookshelf's beside it */
#go-music { position: fixed; left: 22px; bottom: 18px; }
#go-books { position: fixed; left: 206px; bottom: 18px; }
@media (max-width: 720px) { #go-music { left: 14px; bottom: 12px; } #go-books { left: 14px; bottom: 54px; } }

/* the contact form on the card (and the plain page) */
form.contact { display: grid; gap: 12px; margin-top: 14px; }
form.contact label { display: grid; gap: 5px; }
form.contact label span { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--hud-muted, var(--muted)); }
form.contact input, form.contact textarea { font: inherit; font-size: 15px; padding: 10px 12px; border: 1px solid var(--hud-line, var(--rule-strong)); border-radius: 4px; background: rgba(0,0,0,.3); color: var(--hud-ink, var(--ink)); width: 100%; }
form.contact textarea { resize: vertical; min-height: 120px; font-family: var(--serif); line-height: 1.45; }
form.contact input:focus, form.contact textarea:focus { outline: 2px solid var(--hud-accent, var(--accent)); outline-offset: 1px; }
form.contact .row { display: flex; align-items: center; gap: 12px; }
form.contact .msg { font-family: var(--mono); font-size: 12px; color: var(--hud-soft, var(--soft)); }
form.contact .msg.err { color: #ff9a8a; }
form.contact .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* the baseball's photo: by the cursor on hover, pinned in the middle on click */
#photo { position: fixed; z-index: 12; pointer-events: none; width: 190px; transform: translate(16px, -50%) rotate(-3deg); background: #fbf9f4; padding: 8px 8px 10px; box-shadow: 0 16px 40px rgba(0,0,0,.5); }
#photo[hidden] { display: none; }
#photo img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
#photo span { display: block; font-family: "Caveat", cursive; font-size: 17px; color: #1b1814; margin-top: 6px; line-height: 1.2; }
#photo.pinned { left: 50% !important; top: 50% !important; width: min(380px, 80vw); transform: translate(-50%, -50%) rotate(-2deg); pointer-events: auto; }
#photo.pinned span { font-size: 24px; }

/* bedtime? and book a meeting? */
#bedtime, #meet { position: fixed; inset: 0; z-index: 15; display: grid; place-items: center; padding: 20px; background: rgba(20, 4, 6, 0.45); }
#meet { background: rgba(6, 5, 12, 0.5); }
#bedtime[hidden], #meet[hidden] { display: none; }
#bedtime .card, #meet .card { max-width: 380px; background: rgba(14, 13, 19, 0.9); border: 1px solid var(--hud-line); border-radius: 6px; padding: 22px 24px; color: var(--hud-ink); box-shadow: 0 24px 60px rgba(0,0,0,.6); animation: card-in .3s ease; }
#bedtime h2, #meet h2 { font-family: var(--serif); font-size: 26px; margin: 0 0 8px; }
#bedtime p, #meet p { font-family: var(--sans); font-size: 14.5px; color: var(--hud-soft); margin: 0 0 16px; }
#bedtime .row, #meet .row { display: flex; gap: 8px; }
#bedtime .pill, #meet .pill { display: inline-flex; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; color: var(--hud-ink); background: rgba(255,255,255,.08); border: 1px solid var(--hud-line); border-radius: 999px; padding: 9px 14px 8px; cursor: pointer; }
#bedtime .pill:hover, #meet .pill:hover, #bed-yes, #meet-yes { background: var(--hud-ink); color: #1b1814; }
#bed-yes:hover, #meet-yes:hover { background: var(--hud-accent); }

/* after hours the overlay reddens a little too */
body[data-night] .hud.top .menu a[aria-current="page"], body[data-night] .hud.ctl .pill:hover { background: #ffb3a7; }
