/* corkboard: a dim detective's office. Dark chrome so the board itself is the bright thing. */

@font-face { font-family: "Rock Salt"; src: url("/assets/fonts/rock_salt.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Caveat"; src: url("/assets/fonts/caveat.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Special Elite"; src: url("/assets/fonts/SpecialElite-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "IM Fell English"; src: url("/assets/fonts/imfell_roman.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "IM Fell English"; font-style: italic; src: url("/assets/fonts/imfell_italic.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Uncial Antiqua"; src: url("/assets/fonts/uncialantiqua.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Orbitron"; src: url("/assets/fonts/orbitron.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Share Tech Mono"; src: url("/assets/fonts/sharetechmono.ttf") format("truetype"); font-display: swap; }

:root {
  --bg: #16130f;
  --panel: #221d18;
  --panel-2: #2c251f;
  --line: #3d342b;
  --text: #ece4d8;
  --muted: #a89a88;
  --red: #c8202f;
  --red-2: #e0434f;
  --amber: #f2c14e;
  --radius: 8px;
  --type: "Special Elite", "Courier New", monospace;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--ui); }
a { color: var(--amber); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.red { color: var(--red-2); }
.spacer { flex: 1; }
[hidden] { display: none !important; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 0.4em;
  font: inherit; font-size: 0.9rem; color: var(--text); text-decoration: none;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.4em 0.85em; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-2); }
.btn.danger { color: #ff8a8a; border-color: #6b2a2a; }
.btn.link { background: none; border: none; padding: 0.2em 0.4em; color: var(--amber); }
.btn.big { font-size: 1.05rem; padding: 0.6em 1.2em; }
.btn:disabled { opacity: 0.6; cursor: default; }

input, select, textarea {
  font: inherit; color: var(--text); background: #120f0c; border: 1px solid var(--line);
  border-radius: 6px; padding: 0.45em 0.6em; width: 100%;
}
textarea { resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: auto; }
input[type="color"] { padding: 0; width: 2rem; height: 2rem; border-radius: 50%; overflow: hidden; }

/* ---------- Top bar ---------- */

.bar {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.5rem 1rem; background: var(--panel); border-bottom: 1px solid var(--line);
  min-height: 52px;
}
.brand {
  font-family: var(--type); font-size: 1.3rem; color: var(--text); text-decoration: none; letter-spacing: 0.02em;
  display: inline-flex; align-items: center; gap: 0.4em;
}
.brand::before { content: ""; width: 0.75em; height: 0.75em; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ff6b74, var(--red) 60%, #6d0d15); box-shadow: 0 1px 2px #000; }
.account { display: inline-flex; align-items: center; gap: 0.25rem; margin: 0; }
.who { color: var(--muted); font-size: 0.9rem; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Home ---------- */

.home { min-height: 100%; display: flex; flex-direction: column; }
.home-main { width: 100%; max-width: 860px; margin: 0 auto; padding: 2rem 1rem 3rem; flex: 1; }
.hero h1 { font-family: var(--type); font-weight: normal; font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1.1; margin: 1rem 0 0.75rem; }
.lede { font-size: 1.1rem; color: #d6ccbd; max-width: 60ch; }
.new-board { display: flex; gap: 0.5rem; margin: 1.5rem 0 0.5rem; max-width: 560px; }
.new-board input { flex: 1; }
.boards, .how { margin-top: 2.5rem; }
.boards h2, .how h2, .prose h2 { font-family: var(--type); font-weight: normal; font-size: 1.35rem; border-bottom: 1px dashed var(--line); padding-bottom: 0.3rem; }
.boards ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.4rem; }
.boards li { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; align-items: baseline; padding: 0.55rem 0.75rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.boards li a { font-weight: 600; color: var(--text); }
.how li { margin: 0.4rem 0; }
.prose h1 { font-family: var(--type); font-weight: normal; }
.foot { padding: 1rem; text-align: center; color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--line); }
@media (max-width: 560px) { .new-board { flex-direction: column; } }

/* ---------- Board page ---------- */

.board-page { display: grid; grid-template-rows: auto 1fr; height: 100dvh; overflow: hidden; }
.board-page .bar { flex-wrap: wrap; z-index: 5; }
.board-name {
  font-family: var(--type); font-size: 1.1rem; background: transparent; border: 1px solid transparent;
  width: auto; min-width: 6rem; max-width: 22rem; flex: 0 1 22rem; padding: 0.2em 0.4em;
}
.can-edit .board-name:hover, .board-name:focus { border-color: var(--line); background: #120f0c; }
.board-name[readonly] { cursor: default; }
.status { font-size: 0.85rem; color: var(--muted); }
.status.warn { color: var(--amber); }
.people { display: flex; margin-left: auto; }
.person {
  --c: #888; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--c); color: #fff; font-size: 0.75rem; font-weight: 700; border: 2px solid var(--panel);
  margin-left: -6px; text-shadow: 0 1px 1px rgba(0,0,0,0.5);
}
.person.viewing { opacity: 0.6; }
.person.more { background: var(--panel-2); color: var(--muted); }
.bar-actions { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }

.stage { position: relative; background: #0d0b09; outline: none; overflow: hidden; touch-action: none; }
.is-gone .stage, .is-gone .tools, .is-gone .zoom { display: none; }

.tools {
  position: fixed; left: 12px; top: 50%; transform: translateY(-50%); z-index: 4;
  display: flex; flex-direction: column; gap: 2px; padding: 6px;
  background: rgba(34, 29, 24, 0.94); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,0.5);
}
.tools hr { border: none; border-top: 1px solid var(--line); margin: 4px 2px; }
.tools button {
  display: flex; flex-direction: column; align-items: center; gap: 2px; width: 62px; padding: 6px 2px;
  background: none; border: 1px solid transparent; border-radius: 8px; color: var(--text); font: 0.7rem var(--ui); cursor: pointer;
}
.tools button:hover { background: var(--panel-2); }
.tools button.on { border-color: var(--amber); background: rgba(242, 193, 78, 0.12); }
.ico { width: 26px; height: 22px; display: block; background: center / contain no-repeat; }
.ico-sticky { background-image: url("/assets/classic/note_white.webp"); filter: sepia(1) saturate(4) hue-rotate(10deg) brightness(1.05); }
.ico-photo { background-image: url("/assets/classic/photoFrame.webp"); }
.ico-index { background-image: url("/assets/classic/note_index.webp"); }
.ico-handout { background-image: url("/assets/classic/newhandout.webp"); }
.ico-document { background-image: url("/assets/classic/doc_old.webp"); }
.ico-media { background-image: url("/assets/classic/cassette1.webp"); }
.ico-pin { background-image: url("/assets/classic/pins/redPin.webp"); }
.ico-yarn { background: none; position: relative; }
.ico-yarn::before { content: ""; position: absolute; inset: 2px 2px 6px; border-bottom: 3px solid var(--red-2); border-radius: 0 0 50% 50%; }

.zoom {
  position: fixed; right: 12px; bottom: 12px; z-index: 4; display: flex; flex-direction: column; gap: 2px;
  background: rgba(34, 29, 24, 0.94); border: 1px solid var(--line); border-radius: 10px; padding: 4px;
}
.zoom button { width: 36px; height: 36px; background: none; border: none; color: var(--text); font-size: 1.2rem; border-radius: 6px; cursor: pointer; }
.zoom button:hover { background: var(--panel-2); }

.hint, .toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 20;
  background: rgba(20, 17, 14, 0.95); border: 1px solid var(--line); border-radius: 999px;
  padding: 0.5em 1.1em; font-size: 0.9rem; box-shadow: 0 4px 16px rgba(0,0,0,0.5); max-width: calc(100vw - 32px);
}
.hint { top: 64px; border-color: var(--amber); }
.toast { bottom: 20px; }
.toast.error { border-color: var(--red-2); color: #ffb3b8; }

.menu {
  position: fixed; z-index: 30; min-width: 200px; max-width: 280px; padding: 4px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,0.6);
}
.menu > button {
  display: block; width: 100%; text-align: left; background: none; border: none; color: var(--text);
  font: inherit; font-size: 0.9rem; padding: 0.4em 0.7em; border-radius: 6px; cursor: pointer;
}
.menu > button:hover, .menu > button:focus { background: var(--panel-2); outline: none; }
.menu > button.danger { color: #ff8a8a; }
.menu hr { border: none; border-top: 1px solid var(--line); margin: 4px; }
.menu-group { padding: 0.3em 0.7em; }
.menu-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.25em; }
.menu-row { display: flex; flex-wrap: wrap; gap: 4px; }
.menu-chip {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 6px;
  font: 0.8rem var(--ui); padding: 0.2em 0.5em; cursor: pointer; min-width: 26px; min-height: 26px;
}
.menu-chip:hover { border-color: var(--amber); }
.menu-chip.swatch, .pin-chip { width: 26px; height: 26px; padding: 0; border-radius: 50%; }
.menu-chip.swatch { background: var(--c); }
.pin-chip { background: center / 80% no-repeat; }
.pin-red { background-image: url("/assets/classic/pins/redPin.webp"); }
.pin-blue { background-image: url("/assets/classic/pins/bluePin.webp"); }
.pin-yellow { background-image: url("/assets/classic/pins/yellowPin.webp"); }
.pin-green { background-image: url("/assets/classic/pins/greenPin.webp"); }
.pin-none { width: auto; border-radius: 6px; padding: 0 0.5em; }

/* ---------- Dialogs ---------- */

.dialog {
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px;
  padding: 1.25rem; width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); box-shadow: 0 16px 48px rgba(0,0,0,0.7);
}
.dialog::backdrop { background: rgba(0,0,0,0.55); }
.dialog h2 { font-family: var(--type); font-weight: normal; margin: 0 0 1rem; }
.dialog h3 { font-size: 1rem; margin: 1.25rem 0 0.25rem; }
.dialog label { display: block; margin: 0 0 0.8rem; font-size: 0.9rem; color: #d6ccbd; }
.dialog label > input, .dialog label > textarea, .dialog label > select { margin-top: 0.25rem; }
.dialog label.check { display: flex; gap: 0.5rem; align-items: center; }
.dialog .row { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 0.8rem; }
.dialog .row > label { flex: 1; margin: 0; min-width: 8rem; }
.dialog .narrow { width: 5rem; }
.dialog-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }
.field { margin-bottom: 0.8rem; }
.field-label { display: block; font-size: 0.9rem; color: #d6ccbd; margin-bottom: 0.3rem; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.swatch-option { margin: 0 !important; position: relative; cursor: pointer; }
.swatch-option input[type="radio"] { position: absolute; opacity: 0; }
.swatch { --c: #fff; display: block; width: 26px; height: 26px; border-radius: 50%; background: var(--c); border: 2px solid var(--line); }
.swatch.default { background: repeating-linear-gradient(45deg, #555 0 4px, #333 4px 8px); }
.swatch-option input:checked + .swatch, .swatch-option.custom input[type="radio"]:checked ~ input[type="color"] { outline: 2px solid var(--amber); outline-offset: 2px; }
.swatch-option input:focus-visible + .swatch { outline: 2px dashed var(--amber); }
.image-preview { display: block; max-width: 100%; max-height: 160px; margin-top: 0.5rem; border-radius: 6px; }
.callout { background: rgba(242, 193, 78, 0.08); border: 1px solid rgba(242, 193, 78, 0.35); border-radius: var(--radius); padding: 0.6rem 0.8rem; font-size: 0.9rem; }
.copy-row { display: flex; gap: 0.4rem; margin-top: 0.25rem; }
.copy-row input { flex: 1; }
.share-link { margin-bottom: 0.75rem; }
.share-link p { margin: 0.25rem 0 0; }
.editors { list-style: none; padding: 0; margin: 0.5rem 0; }
.editors li { display: flex; justify-content: space-between; align-items: center; padding: 0.3rem 0; border-bottom: 1px dashed var(--line); }
.player { width: min(860px, calc(100vw - 32px)); }
.embed { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 8px; background: #000; }
.embed.audio { aspect-ratio: auto; height: 166px; }
audio { width: 100%; }

.gone { position: fixed; inset: 52px 0 0; display: grid; place-content: center; text-align: center; padding: 1rem; }
.gone h1 { font-family: var(--type); font-weight: normal; }

/* ---------- Small screens ---------- */

@media (max-width: 700px) {
  .board-page .bar { gap: 0.4rem; padding: 0.4rem 0.6rem; }
  .board-name { flex: 1 1 8rem; }
  .people { order: 5; }
  .bar-actions { width: 100%; }
  .bar-actions #account { margin-left: auto; }
  .tools {
    top: auto; bottom: 10px; left: 10px; right: 60px; transform: none; flex-direction: row; overflow-x: auto;
  }
  .tools hr { border-top: none; border-left: 1px solid var(--line); margin: 2px 4px; }
  .tools button { width: 54px; flex: none; }
  .hint { top: auto; bottom: 90px; }
}

/* ---------- Rich text editor ---------- */

.rich { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.rich-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; background: var(--panel-2); border-bottom: 1px solid var(--line); align-items: center; }
.rich-btn {
  min-width: 30px; height: 30px; padding: 0 6px; border: 1px solid transparent; border-radius: 6px;
  background: none; color: var(--text); font: 0.95rem Georgia, serif; cursor: pointer;
}
.rich-btn:hover { border-color: var(--line); background: var(--panel); }
.rich-btn.on { border-color: var(--amber); background: rgba(242, 193, 78, 0.15); }
.rich-btn.rich-ink { min-width: 22px; width: 22px; height: 22px; padding: 0; border-radius: 50%; background: var(--c); border: 2px solid var(--line); margin: 0 2px; }
.rich-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.rich-editor {
  background: #f7f0dd; color: #111; padding: 0.6rem 0.8rem; max-height: 50dvh; overflow: auto;
  line-height: 1.35; outline: none; white-space: pre-wrap; word-break: break-word;
}
.rich-editor.dark { background: #0d1b26; }
.rich-editor:focus-visible { box-shadow: inset 0 0 0 2px var(--amber); }
.rich-editor h3 { font-size: 1.3em; margin: 0.2em 0; }
.rich-editor ul, .rich-editor ol { margin: 0.2em 0; padding-left: 1.6em; }
.rich-editor div, .rich-editor p { margin: 0; min-height: 1.2em; }
