/* Wakil BBS — a terminal window for talking with friends.
   Shares its foundation with Wakil Books: Tokyo Night after dark, Tokyo Day in the light. */

@font-face { font-family: "Newsreader"; font-weight: 400; font-style: normal; font-display: swap; src: url(fonts/newsreader-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Newsreader"; font-weight: 600; font-style: normal; font-display: swap; src: url(fonts/newsreader-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Newsreader"; font-weight: 400; font-style: italic; font-display: swap; src: url(fonts/newsreader-latin-400-italic.woff2) format("woff2"); }
@font-face { font-family: "Newsreader"; font-weight: 600; font-style: italic; font-display: swap; src: url(fonts/newsreader-latin-600-italic.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url(fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-display: swap; src: url(fonts/jetbrains-mono-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Amiri"; font-weight: 400; font-display: swap; src: url(fonts/amiri-arabic-400-normal.woff2) format("woff2"); }

:root {
  /* Tokyo Day */
  --bg: #d5d6db; --win: #e1e2e7; --bar: #d0d1d7; --field: #e9e9ed;
  --text: #3760bf; --strong: #343b58; --muted: #6172b0; --faint: #8990b3; --line: #c4c8da;
  --blue: #2e7de9; --purple: #9854f1; --green: #587539; --yellow: #8c6c3e;
  --red: #f52a65; --cyan: #007197; --orange: #b15c00;
  --shadow: 0 30px 70px -34px #3760bf55;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --serif: "Newsreader", Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16161e; --win: #1a1b26; --bar: #13131a; --field: #1f2335;
    --text: #c0caf5; --strong: #c0caf5; --muted: #7982a9; --faint: #4f5679; --line: #262a3d;
    --blue: #7aa2f7; --purple: #bb9af7; --green: #9ece6a; --yellow: #e0af68;
    --red: #f7768e; --cyan: #7dcfff; --orange: #ff9e64;
    --shadow: 0 30px 70px -30px #000c; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #16161e; --win: #1a1b26; --bar: #13131a; --field: #1f2335;
  --text: #c0caf5; --strong: #c0caf5; --muted: #7982a9; --faint: #4f5679; --line: #262a3d;
  --blue: #7aa2f7; --purple: #bb9af7; --green: #9ece6a; --yellow: #e0af68;
  --red: #f7768e; --cyan: #7dcfff; --orange: #ff9e64;
  --shadow: 0 30px 70px -30px #000c; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 14.5px/1.65 var(--mono); padding: 36px 20px; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
img { max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.inline { display: inline; margin: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.serif { font-family: var(--serif); }

/* ---------------------------------------------------------------- window */
.win { max-width: 1060px; margin: 0 auto; background: var(--win); border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.titlebar { display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: var(--bar); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.dots { display: flex; gap: 8px; width: 70px; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--red); }
.dots i:nth-child(2) { background: var(--yellow); }
.dots i:nth-child(3) { background: var(--green); }
.titlebar .title { flex: 1; text-align: center; color: var(--muted); }
.titlebar .title:hover { text-decoration: none; color: var(--text); }
.titlebar .tools { width: 70px; display: flex; justify-content: flex-end; }
.theme-btn { background: none; border: 0; padding: 2px; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.theme-btn:hover { color: var(--text); }
.theme-btn .moon { display: none; }
:root[data-theme="dark"] .theme-btn .sun { display: none; }
:root[data-theme="dark"] .theme-btn .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .sun { display: none; }
  :root:not([data-theme="light"]) .theme-btn .moon { display: block; }
}

.tabs { display: flex; gap: 2px; padding: 0 14px; background: var(--bar);
  border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 8px 14px; color: var(--muted); font-size: 12.5px; border-bottom: 2px solid transparent;
  white-space: nowrap; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--strong); border-color: var(--purple); background: var(--win); }
.tabs .add { margin-left: auto; color: var(--green); }

.body { padding: 26px 30px 34px; }

.foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; padding: 14px 30px;
  border-top: 1px solid var(--line); background: var(--bar); color: var(--muted); font-size: 12.5px; }
.foot a { color: var(--strong); }
.foot-credit { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.foot-sep { opacity: .5; }
.foot [lang="ar"] { font: 1.15rem "Amiri", serif; color: var(--yellow); }
.foot .right { margin-left: auto; }

/* ---------------------------------------------------------------- headers */
.h { display: flex; align-items: center; gap: 12px; margin: 38px 0 16px; font-size: 12.5px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: var(--strong); }
.h:first-child { margin-top: 0; }
.h::before { content: ""; flex: 0 0 8px; height: 8px; border-radius: 2px; background: var(--c, var(--green));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c, var(--green)) 22%, transparent); }
.h::after { content: ""; flex: 1; height: 1px; background: var(--line); order: 2; min-width: 16px; }
.h em, .h .meta { order: 3; font-style: normal; text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 400; }
.h a, .h .act { order: 4; text-transform: none; letter-spacing: 0; font-weight: 400; }
.c-green { --c: var(--green); } .c-blue { --c: var(--blue); } .c-purple { --c: var(--purple); }
.c-yellow { --c: var(--yellow); } .c-orange { --c: var(--orange); } .c-cyan { --c: var(--cyan); } .c-red { --c: var(--red); }

.page-title { font: 600 2rem/1.1 var(--serif); color: var(--strong); margin-bottom: 6px; letter-spacing: -.01em; }
.page-sub { color: var(--muted); margin-bottom: 26px; }
.empty { color: var(--faint); }
.empty a { color: var(--blue); }

/* ---------------------------------------------------------------- controls */
.btn { display: inline-flex; align-items: center; gap: 6px; font: 500 12.5px/1 var(--mono);
  padding: 9px 14px; border-radius: 4px; border: 1px solid var(--line); background: var(--field);
  color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn-go { background: var(--green); border-color: var(--green); color: var(--win); }
.btn-go:hover { border-color: var(--green); filter: brightness(1.08); }
.btn-small { padding: 6px 10px; font-size: 12px; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--blue); cursor: pointer; }
.linkish:hover { text-decoration: underline; }
.danger { color: var(--red); }
.icon-btn { width: 30px; height: 30px; display: inline-grid; place-items: center; background: var(--field);
  border: 1px solid var(--line); border-radius: 4px; color: var(--muted); cursor: pointer; font: 13px var(--mono); }
.icon-btn:hover:not(:disabled) { color: var(--text); border-color: var(--muted); }
.icon-btn:disabled { opacity: .3; cursor: default; }

input, select, textarea { font: 13.5px/1.5 var(--mono); color: var(--strong); background: var(--field);
  border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; width: 100%; min-width: 0; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--purple);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--purple) 20%, transparent); }
.btn:focus-visible, .icon-btn:focus-visible, a:focus-visible, .linkish:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }
textarea { resize: vertical; }
label, .label { display: block; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }
.hint { text-transform: none; letter-spacing: 0; color: var(--faint); }
.row { display: flex; gap: 8px; align-items: center; }
.check { display: flex; gap: 8px; align-items: center; text-transform: none; letter-spacing: 0; font-size: 13px; margin: 0; }
.check input { width: auto; }

.flash { margin: 0 0 18px; padding: 9px 14px; border-left: 2px solid var(--yellow);
  background: color-mix(in srgb, var(--yellow) 10%, transparent); color: var(--strong); }
.flash::before { content: "› "; color: var(--yellow); }


/* ---------------------------------------------------------------- shared bits from Books */
.pill { font-size: 11px; padding: 2px 7px; border-radius: 3px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; justify-self: start; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 3px 22px; margin: 16px 0; }
.facts dt { color: var(--faint); }
.facts dd { margin: 0; color: var(--strong); }
.login { max-width: 340px; margin: 30px auto 10px; display: flex; flex-direction: column; gap: 12px; }
.err { text-align: center; padding: 50px 0 40px; }
.err .code { font-size: 3rem; color: var(--purple); }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 400; color: var(--faint); font-size: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.table td { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.table .num { text-align: right; }
.ranked { list-style: none; margin: 0 0 14px; padding: 0; }
.ranked li { display: flex; gap: 12px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.ranked li .n { color: var(--faint); }
.ranked li .c { margin-left: auto; color: var(--muted); }

/* ---------------------------------------------------------------- bbs: chrome */
.tabs .add-form { margin-left: auto; }
.tabs .add { margin-left: auto; }
.tab-btn { background: none; border: 0; padding: 8px 14px; color: var(--muted); font: 12.5px var(--mono); cursor: pointer; }
.tab-btn:hover { color: var(--red); }
.crumbs { color: var(--muted); font-size: 12.5px; margin-bottom: 10px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.pager { display: flex; justify-content: space-between; margin-top: 16px; font-size: 12.5px; }
.pager a:only-child { margin-left: auto; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.cyan { color: var(--cyan); }
.ok { color: var(--green); }
.small { font-size: 11.5px; }
.kv-b { color: var(--cyan); font-weight: 400; }
.prompt-sym { color: var(--green); }
.row.wrap { flex-wrap: wrap; margin-bottom: 14px; }
.row .grow { flex: 1 1 220px; width: auto; }
.row select { width: auto; }

/* login banner */
.motd { margin: 0 0 28px; padding: 14px 18px; border: 1px dashed var(--line); border-radius: 4px;
  font: 13px/1.7 var(--mono); white-space: pre-wrap; color: var(--text);
  background: color-mix(in srgb, var(--green) 4%, transparent); }
.motd b { color: var(--green); font-weight: 500; letter-spacing: .25em; font-size: 15px; }

/* ---------------------------------------------------------------- bbs: board index */
.board-list, .thread-list { border-top: 1px solid var(--line); }
.bl-head, .bl-row { display: grid; grid-template-columns: minmax(0, 1fr) 70px 70px minmax(0, 280px); gap: 16px; align-items: center; }
.tl-head, .tl-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) 70px minmax(0, 190px); gap: 14px; align-items: center; }
.bl-head, .tl-head { padding: 6px 0; color: var(--faint); font-size: 12px; border-bottom: 1px solid var(--line); }
.bl-head span:nth-child(2), .bl-head span:nth-child(3), .tl-head span:nth-child(3) { text-align: right; }
.bl-row { padding: 12px 0; border-bottom: 1px dashed var(--line); }
.bl-main, .tl-main, .bl-last { display: flex; flex-direction: column; min-width: 0; }
.bl-name { color: var(--cyan); }
.bl-title { color: var(--strong); margin-left: 8px; }
.bl-desc { font-size: 12.5px; }
.bl-last a, .bl-last span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-last span { font-size: 12px; }

/* ---------------------------------------------------------------- bbs: thread list */
.tl-row { padding: 9px 0; border-bottom: 1px dashed var(--line); color: var(--text); }
.tl-row:hover { text-decoration: none; background: color-mix(in srgb, var(--purple) 5%, transparent); }
.tl-row .mark { color: var(--faint); text-align: center; }
.tl-row.unread .mark { color: var(--green); }
.tl-row .c-pin { color: var(--yellow); font-weight: 400; }
.tl-row .t { color: var(--strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-row.unread .t { font-weight: 500; }
.tl-row .a { color: var(--muted); font-size: 12px; }
.tl-row .lock { color: var(--red); }
.tl-last { color: var(--muted); font-size: 12.5px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill-pin { color: var(--yellow); border-color: color-mix(in srgb, var(--yellow) 45%, transparent); }
.pill-lock { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, transparent); }

/* ---------------------------------------------------------------- bbs: posts */
.mod-bar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: -10px 0 22px; font-size: 12.5px; }
.mod-bar .move select { width: auto; padding: 4px 8px; font-size: 12px; }
.posts { display: flex; flex-direction: column; gap: 18px; }
.post { border: 1px solid var(--line); border-radius: 4px; background: color-mix(in srgb, var(--field) 55%, transparent); scroll-margin-top: 20px; }
.post:target { border-color: var(--purple); box-shadow: 0 0 0 3px color-mix(in srgb, var(--purple) 15%, transparent); }
.post-head { display: flex; gap: 12px; align-items: baseline; padding: 8px 14px; border-bottom: 1px dashed var(--line); font-size: 13px; }
.post-head .who { color: var(--green); font-weight: 500; }
.post-head .who.admin { color: var(--purple); }
.post-no { margin-left: auto; }
.post-no:hover { color: var(--text); }
.post-time { font-size: 12px; }
.post-body { padding: 14px 16px 12px; font: 1.08rem/1.65 var(--serif); color: var(--strong); overflow-wrap: anywhere; }
.post-body > * + * { margin-top: .75em; }
.post-body p { margin: 0; }
.post-body h3, .post-body h4 { font: 600 1.15rem var(--serif); margin: 1em 0 .3em; }
.post-body ul, .post-body ol { margin: 0; padding-left: 1.4em; }
.post-body blockquote { margin: 0; padding: 2px 0 2px 14px; border-left: 2px solid var(--yellow); color: var(--muted); font-style: italic; }
.post-body code { font: .82em var(--mono); color: var(--cyan); background: var(--field); padding: 1px 5px; border-radius: 3px; }
.post-body pre { font: 13px/1.55 var(--mono); background: var(--bar); border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; overflow-x: auto; }
.post-body pre code { background: none; padding: 0; color: var(--text); font-size: inherit; }
.post-body hr { border: 0; border-top: 1px dashed var(--line); }
.post-foot { display: flex; flex-wrap: wrap; gap: 12px; align-items: baseline; padding: 6px 14px 9px; font-size: 12px; }
.post-acts { margin-left: auto; display: flex; gap: 14px; }

/* ---------------------------------------------------------------- bbs: forms */
.compose { display: flex; flex-direction: column; gap: 14px; max-width: 760px; }
.compose.narrow { max-width: 480px; }
.compose textarea { font: 1.02rem/1.6 var(--serif); }
#body { min-height: 9em; }

/* ---------------------------------------------------------------- bbs: admin */
.admin-table { margin-bottom: 8px; }
.admin-table td { vertical-align: middle; padding-right: 12px; }
.admin-table .pill { margin-left: 6px; }
.code-chip { font: 12.5px var(--mono); color: var(--cyan); background: var(--field); padding: 2px 7px; border-radius: 3px; margin-right: 6px; user-select: all; }
.board-edit { display: grid; grid-template-columns: 64px 110px minmax(0, 1fr) minmax(0, 1.4fr) auto auto; gap: 8px; align-items: center;
  padding: 6px 0; border-bottom: 1px dashed var(--line); }
.board-edit.new { grid-template-columns: 110px minmax(0, 1fr) minmax(0, 1.4fr) auto; border-bottom: 0; margin-top: 6px; }
.board-edit .slug { overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------- phones */
@media (max-width: 760px) {
  body { padding: 0; font-size: 13px; }
  .win { border-radius: 0; border: 0; min-height: 100vh; display: flex; flex-direction: column; }
  .body { padding: 18px 16px 26px; flex: 1; }
  .dots { width: auto; }
  .titlebar .tools { width: auto; }
  .titlebar .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabs { padding: 0 6px; }
  .tabs a, .tab-btn { padding: 8px 10px; }
  .foot { padding: 12px 16px; }
  .h { margin-top: 32px; }
  .motd { font-size: 12px; padding: 12px; }
  .bl-head, .tl-head { display: none; }
  .bl-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
  .bl-row .num { display: none; }
  .bl-last { grid-column: 1 / -1; }
  .tl-row { grid-template-columns: 14px minmax(0, 1fr) auto; gap: 2px 10px; }
  .tl-last { grid-column: 2 / -1; text-align: left; font-size: 12px; }
  .post-head, .post-foot { padding-left: 12px; padding-right: 12px; }
  .post-body { padding: 12px; font-size: 1.02rem; }
  .board-edit, .board-edit.new { grid-template-columns: 1fr 1fr; }
  .board-edit .pos { width: 100%; }
  .admin-table thead { display: none; }
  .admin-table tr { display: grid; grid-template-columns: 1fr auto; padding: 6px 0; border-bottom: 1px dashed var(--line); }
  .admin-table td { border: 0; padding: 2px 0; }
}
