/* Inkboard — an actual whiteboard: light room, white board, marker tray.
   authored by a facilitator whose cloud whiteboard died mid-workshop. */

:root {
  --room: #eef0ec;
  --board: #ffffff;
  --ink: #1e1f1c;
  --fade: #6f746b;
  --blue: #2b6de0;
  --red: #e23d3d;
  --green: #1f9d55;
  --line: rgba(30, 31, 28, 0.16);
  --line-hard: rgba(30, 31, 28, 0.4);
  --tray: #dfe2db;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { background: var(--room); }

body {
  background: var(--room);
  color: var(--ink);
  font-family: "Rubik", -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

h1, h2, h3 { font-family: "Rubik", sans-serif; letter-spacing: -0.02em; line-height: 1.1; }

a { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--red); }

/* ---------- topbar ---------- */
.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 12px 18px 8px;
  border-bottom: 2px solid var(--line-hard);
  background: var(--room);
}
.wordmark { font-weight: 700; font-size: 1.3rem; color: var(--ink); text-decoration: none; }
.wordmark em { font-style: normal; color: var(--blue); }
.topbar .links { display: flex; flex-wrap: wrap; gap: 2px 16px; font-size: 0.86rem; }
.topbar .links a { color: var(--fade); text-decoration: none; }
.topbar .links a.here { color: var(--ink); border-bottom: 3px solid var(--blue); }
.topbar .links a:hover { color: var(--blue); }

/* ---------- the board app ---------- */
.boardwrap { max-width: 1100px; margin: 10px auto 0; padding: 0 14px; }

.appshell {
  border: 2px solid var(--line-hard);
  border-radius: 10px;
  background: var(--board);
  overflow: hidden;
  position: relative;
}
canvas#board {
  display: block;
  width: 100%;
  height: 62vh;
  min-height: 380px;
  touch-action: none;        /* one-finger draw shouldn't scroll/zoom the page */
  background: var(--board);
}
@media (max-height: 700px) and (max-width: 500px) {
  canvas#board { height: 52vh; min-height: 300px; }
}
body.presenting .appshell {
  position: fixed; inset: 0; z-index: 60; border: 0; border-radius: 0;
}
body.presenting canvas#board { height: 100vh; min-height: 0; }
body.presenting .topbar, body.presenting .boardbar, body.presenting .deskcol, body.presenting footer { display: none; }
body.presenting .tray { position: fixed; bottom: 10px; left: 50%; transform: translateX(-50%); z-index: 61; opacity: 0.25; transition: opacity .2s; }
body.presenting .tray:hover { opacity: 1; }

/* focus mode — fullscreen WORK, tray stays (tablets, ipads) */
body.focused .appshell {
  position: fixed; inset: 0; z-index: 60; border: 0; border-radius: 0;
  display: flex; flex-direction: column;
}
body.focused .canvaspane { flex: 1; min-height: 0; }
body.focused canvas#board { height: 100%; min-height: 0; }

/* the canvas + its corner fullscreen affordance */
.canvaspane { position: relative; }
.fsbtn {
  position: absolute; bottom: 12px; right: 12px; z-index: 15;
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1.5px solid var(--line); color: var(--fade);
  background: rgba(255, 255, 255, 0.72); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  box-shadow: 0 1px 5px rgba(30, 31, 28, 0.12); cursor: pointer; opacity: 0.5;
  transition: opacity .15s, background .15s, color .15s;
}
.fsbtn:hover { opacity: 1; background: #fff; color: var(--ink); }
.fsbtn:active { transform: translateY(1px); }
body.presenting .fsbtn { display: none; }

/* the always-visible clear-board button */
.tbtn.danger-btn { color: var(--red); border-color: var(--red); }
.tbtn.danger-btn:hover { background: var(--red); color: #fff; }
body.focused .topbar, body.focused .boardbar, body.focused .deskcol, body.focused footer { display: none; }

/* marker tray */
.tray {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px 10px;
  background: var(--tray);
  border-top: 2px solid var(--line-hard);
}
.tbtn {
  appearance: none;
  font-family: "Rubik", sans-serif;
  font-weight: 500;
  font-size: 0.8rem;
  color: var(--ink);
  background: var(--board);
  border: 1.5px solid var(--line-hard);
  border-radius: 7px;
  padding: 7px 10px;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--line);
}
.tbtn:active { transform: translateY(2px); box-shadow: none; }
.tbtn[aria-pressed="true"] { background: var(--ink); color: var(--board); border-color: var(--ink); }
.tbtn:disabled { opacity: 0.4; }

.swatch {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--line-hard);
  cursor: pointer;
  padding: 0;
  box-shadow: 0 2px 0 var(--line);
}
.swatch[aria-pressed="true"] { outline: 3px solid var(--ink); outline-offset: 1px; }

.tray .sep { width: 1.5px; height: 24px; background: var(--line-hard); margin: 0 4px; }
.tray select, .tray input[type="range"] { accent-color: var(--blue); }
.tray select {
  font-family: "Rubik", sans-serif;
  font-size: 0.8rem;
  border: 1.5px solid var(--line-hard);
  border-radius: 7px;
  padding: 6px;
  background: var(--board);
  color: var(--ink);
  max-width: 130px;
}

/* status bar over the canvas */
.boardbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px;
  font-size: 0.8rem;
  color: var(--fade);
}
.boardbar b { color: var(--ink); }
.boardbar .zoom { font-variant-numeric: tabular-nums; }

/* floating text editor */
.floatedit {
  position: absolute;
  border: 2px dashed var(--blue);
  background: rgba(255, 255, 255, 0.95);
  font-family: "Rubik", sans-serif;
  color: var(--ink);
  padding: 4px 6px;
  resize: none;
  overflow: hidden;
  min-width: 60px;
  z-index: 20;
}
.floatedit:focus { outline: none; }
.floatedit.notestyle { background: #fff9b1; border-color: #d8c94a; }

/* ---------- desk (prose) ---------- */
.deskcol { max-width: 760px; margin: 0 auto; padding: 0 18px; }

.opening { padding: 22px 0 4px; }
.opening h1 { font-size: 1.9rem; font-weight: 700; }
@media (min-width: 560px) { .opening h1 { font-size: 2.4rem; } }
.opening .why { margin-top: 8px; font-size: 0.97rem; color: var(--fade); }
.opening .why b { color: var(--ink); }

.sticker {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 500;
  border: 2px solid var(--line-hard);
  background: var(--board);
  padding: 3px 10px;
  border-radius: 6px;
  transform: rotate(-1.4deg);
  box-shadow: 2px 2px 0 var(--line-hard);
  margin: 0 6px 4px 0;
  white-space: nowrap;
}
.sticker.tilt { transform: rotate(1.1deg); }
.sticker.blue { background: var(--blue); border-color: var(--blue); color: #fff; }

.makernote {
  border: 2px solid var(--line-hard);
  border-radius: 10px;
  background: var(--board);
  box-shadow: 4px 4px 0 var(--line-hard);
  padding: 16px 18px;
  margin: 26px 0;
  transform: rotate(0.35deg);
}
.makernote .sig { font-size: 0.8rem; color: var(--fade); margin-top: 8px; }

section { margin-top: 42px; }
section > h2 { font-size: 1.35rem; font-weight: 700; margin-bottom: 12px; }
section > h2 .u { border-bottom: 4px solid var(--blue); padding-bottom: 1px; }
section p { margin-bottom: 12px; }
.fade { color: var(--fade); }
section ul, section ol { margin: 0 0 12px 22px; }
section li { margin-bottom: 7px; }

.loglist { font-size: 0.86rem; list-style: none; margin-left: 0 !important; }
.loglist li { padding: 6px 0; border-bottom: 1.5px dashed var(--line); margin: 0 !important; }
.loglist .v { color: var(--blue); font-weight: 700; margin-right: 10px; }

details { border: 2px solid var(--line); border-radius: 8px; background: var(--board); padding: 10px 14px; margin-bottom: 8px; }
details summary { cursor: pointer; font-weight: 600; }
details p { margin-top: 8px; color: var(--fade); font-size: 0.93rem; }

.elsewhere { font-size: 0.95rem; }
.elsewhere li { margin-bottom: 10px; }
.elsewhere .what { color: var(--fade); }

kbd {
  font-size: 0.75rem;
  border: 1.5px solid var(--line-hard);
  border-radius: 5px;
  padding: 1px 7px;
  background: var(--board);
  box-shadow: 0 2px 0 var(--line);
}

[hidden] { display: none !important; }

/* ---------- blog ---------- */
.postlist a {
  display: block;
  border: 2px solid var(--line-hard);
  border-radius: 10px;
  background: var(--board);
  padding: 14px 16px;
  margin-bottom: 10px;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 3px 3px 0 var(--line-hard);
}
.postlist a:hover { box-shadow: 1px 1px 0 var(--line-hard); transform: translate(2px, 2px); }
.postlist b { font-size: 1.08rem; display: block; margin-bottom: 4px; }
.postlist span { color: var(--fade); font-size: 0.88rem; }
.postlist time { display: block; font-size: 0.72rem; color: var(--fade); margin-top: 8px; }

article.post { padding-top: 26px; }
article.post h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 6px; }
article.post .meta { color: var(--fade); font-size: 0.76rem; margin-bottom: 20px; }
article.post h2 { font-size: 1.22rem; font-weight: 700; margin: 26px 0 10px; }
article.post p { margin-bottom: 13px; }
article.post figure { margin: 22px 0; border: 2px solid var(--line-hard); border-radius: 10px; overflow: hidden; box-shadow: 4px 4px 0 var(--line-hard); }
article.post figure svg { display: block; width: 100%; height: auto; }
article.post figcaption { font-size: 0.76rem; color: var(--fade); padding: 8px 12px; border-top: 1.5px dashed var(--line); background: var(--board); }
article.post ul, article.post ol { margin: 0 0 13px 22px; }
article.post li { margin-bottom: 6px; }

/* ---------- footer ---------- */
footer {
  margin-top: 56px;
  border-top: 2px solid var(--line-hard);
  padding: 18px 18px 34px;
  font-size: 0.82rem;
  color: var(--fade);
}
footer .cols { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 10px; }
footer a { color: var(--fade); text-decoration: none; }
footer a:hover { color: var(--blue); }

.plain { padding-top: 30px; }
.plain h1 { font-size: 1.7rem; font-weight: 700; margin-bottom: 14px; }
.plain h2 { font-size: 1.12rem; margin: 22px 0 8px; font-weight: 700; }
.plain p { margin-bottom: 12px; color: var(--fade); }
.plain p b { color: var(--ink); }

/* ---------- mobile toolbar: secondary controls collapse behind "more" ---------- */
#moretools { display: none; }
.tray-extra { display: contents; }   /* desktop: children flow inline exactly as before */

#shortcuts.minibtn, .minibtn {
  font-family: "Rubik", sans-serif; font-size: 0.72rem; color: var(--blue);
  background: none; border: 1px solid var(--line); border-radius: 6px;
  padding: 2px 7px; cursor: pointer; margin-left: 2px;
}
.minibtn:hover { background: var(--board); }

@media (max-width: 640px) {
  .tray {
    flex-wrap: nowrap; overflow-x: auto; overflow-y: visible;
    -webkit-overflow-scrolling: touch; position: relative; scrollbar-width: none;
  }
  .tray::-webkit-scrollbar { display: none; }
  .tray > * { flex: 0 0 auto; }        /* keep buttons full-size; the row scrolls */
  #moretools { display: inline-flex; align-items: center; }
  .tray-extra {
    display: none;
    position: fixed; left: 8px; right: 8px; bottom: 72px;   /* bottom set precisely in JS on open */
    flex-wrap: wrap; gap: 6px; align-items: center;
    background: var(--tray); border: 2px solid var(--line-hard); border-radius: 12px;
    padding: 10px; box-shadow: 0 10px 26px rgba(30, 31, 28, 0.24); z-index: 72;
  }
  .tray-extra.open { display: flex; }
  .tray-extra .sep { display: none; }
}

/* ---------- keyboard shortcuts sheet ---------- */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 90; padding: 20px;
  background: rgba(30, 31, 28, 0.45);
  display: flex; align-items: center; justify-content: center;
}
.sheet-overlay[hidden] { display: none; }
.sheet {
  position: relative; background: var(--board); border: 2px solid var(--line-hard);
  border-radius: 14px; padding: 24px 26px; max-width: 640px; width: 100%;
  box-shadow: 0 20px 50px rgba(30, 31, 28, 0.3); max-height: 88vh; overflow: auto;
}
.sheet h3 { font-size: 1.2rem; margin-bottom: 16px; }
.sheet-x {
  position: absolute; top: 10px; right: 14px; background: none; border: 0;
  font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--fade);
}
.sheet-x:hover { color: var(--ink); }
.sheet .keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 20px; }
.sheet .keys > div > b {
  display: block; margin-bottom: 8px; color: var(--blue);
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
}
.sheet dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: baseline; }
.sheet dt {
  font-family: "Rubik", sans-serif; font-weight: 500; font-size: 0.74rem;
  background: var(--tray); border: 1px solid var(--line-hard); border-radius: 5px;
  padding: 2px 6px; white-space: nowrap; justify-self: start;
}
.sheet dd { font-size: 0.86rem; color: var(--fade); }

/* ---------- contextual style panel (appears when an object is selected) ---------- */
.stylepanel {
  position: fixed; z-index: 70;
  display: flex; align-items: center; gap: 6px;
  background: var(--board); border: 1.5px solid var(--line-hard); border-radius: 11px;
  padding: 6px 8px; box-shadow: 0 6px 22px rgba(30, 31, 28, 0.18);
  font-family: "Rubik", sans-serif;
}
.stylepanel[hidden] { display: none; }
.stylepanel .grp { display: flex; align-items: center; gap: 4px; }
.stylepanel .grp[hidden] { display: none; }
.stylepanel .grp .lbl { font-size: 0.68rem; color: var(--fade); margin-right: 1px; }
.stylepanel .sw {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--line-hard); cursor: pointer; padding: 0;
}
.stylepanel .sw[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: 1px; }
.stylepanel .pbtn {
  appearance: none; font-family: "Rubik", sans-serif; font-size: 0.92rem; line-height: 1;
  background: var(--board); border: 1.5px solid var(--line-hard); border-radius: 7px;
  padding: 5px 8px; cursor: pointer; color: var(--ink);
}
.stylepanel .pbtn:active { transform: translateY(1px); }
.stylepanel .pbtn.danger { color: var(--red); }
.stylepanel input[type="range"] { width: 70px; accent-color: var(--blue); }
.stylepanel select {
  font-family: "Rubik", sans-serif; font-size: 0.76rem; color: var(--ink);
  border: 1.5px solid var(--line-hard); border-radius: 6px; padding: 3px 4px; background: var(--board);
}
.stylepanel .vsep { width: 1.5px; height: 22px; background: var(--line-hard); margin: 0 2px; }

/* ---------- right-click menu ---------- */
.ctxmenu {
  position: fixed; z-index: 80;
  background: var(--board); border: 1.5px solid var(--line-hard); border-radius: 9px;
  box-shadow: 0 10px 26px rgba(30, 31, 28, 0.22); padding: 4px; min-width: 176px;
  font-family: "Rubik", sans-serif;
}
.ctxmenu button {
  display: flex; justify-content: space-between; align-items: center; gap: 22px; width: 100%;
  text-align: left; background: none; border: 0; font-family: inherit; font-size: 0.85rem;
  color: var(--ink); padding: 7px 10px; border-radius: 6px; cursor: pointer;
}
.ctxmenu button:hover { background: var(--tray); }
.ctxmenu button.danger { color: var(--red); }
.ctxmenu button:disabled { opacity: 0.4; cursor: default; }
.ctxmenu button:disabled:hover { background: none; }
.ctxmenu .kbd { color: var(--fade); font-size: 0.74rem; }
.ctxmenu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }
