/* Tokens: swap these to change the look. Direction: The Almanac. */
:root {
  --paper: #EEEAE0;
  --paper-deep: #E6E1D4;
  --ink: #191816;
  --muted: #5C584F;
  --rule: rgba(25, 24, 22, 0.25);
  --accent: #C23B17;
  --good: #2E5B3F;
  --serif: 'Instrument Serif', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --measure: 760px;
  --gutter: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body { font: 14px/1.6 var(--mono); -webkit-font-smoothing: antialiased; min-height: 100vh; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
main { max-width: var(--measure); margin: 0 auto; padding: 0 var(--gutter) 120px; }

/* masthead */
.mast { padding: 22px 0 0; }
.mast-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.mast h1 { font: 400 clamp(46px, 11vw, 78px)/0.95 var(--serif); margin: 10px 0 12px; letter-spacing: -0.01em; }
.mast h1 em { font-style: italic; }
.double { border: 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); height: 4px; margin: 0; }

/* section nav */
nav.sections { display: flex; gap: 22px; padding: 12px 0 10px; border-bottom: 1px solid var(--rule); overflow-x: auto; }
nav.sections button { background: none; border: 0; padding: 4px 0; cursor: pointer; font-size: 13px; color: var(--muted); white-space: nowrap; border-bottom: 2px solid transparent; }
nav.sections button[aria-current="true"] { color: var(--ink); border-bottom-color: var(--accent); }
nav.sections .count { color: var(--accent); }

/* labels */
.label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.roman { margin: 28px 0 6px; display: flex; justify-content: space-between; align-items: baseline; }
.group { font: italic 400 26px/1.1 var(--serif); margin: 26px 0 4px; }

/* dot-leader rows */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: baseline; gap: 8px; padding: 9px 0; border-bottom: 1px dotted var(--rule); cursor: pointer; text-decoration: none; }
.row:hover .row-title { text-decoration: underline; text-underline-offset: 3px; }
.row-title { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-lead { flex: 1 1 24px; min-width: 24px; border-bottom: 1px dotted var(--muted); transform: translateY(-4px); opacity: .6; }
.row-val { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 8px; transform: translateY(-1px); }
.closed .row-title { color: var(--muted); }

/* thread */
.back { background: none; border: 0; padding: 18px 0 0; cursor: pointer; color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.title { font: 400 clamp(32px, 7vw, 46px)/1.05 var(--serif); margin: 12px 0 8px; }
.meta { color: var(--muted); font-size: 12px; display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 14px; }
.meta button { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; color: var(--muted); font-size: 12px; }
.brief { white-space: pre-wrap; border-left: 1px solid var(--rule); padding-left: 14px; margin: 0 0 10px; }

.msgs { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.msg { display: grid; grid-template-columns: 92px 1fr; gap: 14px; padding: 16px 0; border-bottom: 1px dotted var(--rule); }
.msg .who { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); line-height: 1.5; }
.msg .who b { display: block; color: var(--ink); font-weight: 500; }
.msg.john .who b { color: var(--accent); }
.msg .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .text a { text-underline-offset: 3px; }
.msg.new .who b::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 6px; transform: translateY(-1px); }
@media (max-width: 520px) { .msg { grid-template-columns: 1fr; gap: 4px; } .msg .who b { display: inline; margin-right: 8px; } }

/* forms */
.compose { margin-top: 22px; }
textarea, input[type=text], select { width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--ink); padding: 8px 0; outline: none; border-radius: 0; }
textarea { min-height: 84px; resize: vertical; line-height: 1.6; }
textarea:focus, input:focus, select:focus { border-bottom-color: var(--accent); }
.field { margin: 14px 0; }
.field .label { display: block; margin-bottom: 2px; }
.actions { display: flex; gap: 18px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.btn { background: var(--ink); color: var(--paper); border: 0; padding: 10px 18px; cursor: pointer; letter-spacing: .06em; text-transform: uppercase; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; color: var(--muted); font-size: 12px; }
.seg { display: flex; gap: 14px; flex-wrap: wrap; }
.seg button { background: none; border: 0; padding: 2px 0; cursor: pointer; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; border-bottom: 1px solid transparent; }
.seg button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--accent); }

/* big numbers and codes */
.lead-num { font: 400 clamp(90px, 26vw, 170px)/0.9 var(--serif); margin: 16px 0 0; }
.code { font: 400 clamp(38px, 10vw, 64px)/1 var(--serif); letter-spacing: .04em; margin: 10px 0 4px; user-select: all; }
.empty { color: var(--muted); font-style: italic; font-family: var(--serif); font-size: 22px; margin: 26px 0; }
.note { color: var(--muted); font-size: 12px; }
.err { color: var(--accent); font-size: 12px; min-height: 1em; }
.foot { margin-top: 48px; border-top: 1px solid var(--rule); padding-top: 10px; font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; }
.status-good { color: var(--good); }

/* files on a message */
.msg .files { list-style: none; margin: 8px 0 0; padding: 0; white-space: normal; }
.msg .files li { padding: 2px 0; }
.msg .files li::before { content: '↓ '; color: var(--accent); }
.msg .files .link { color: var(--ink); font-size: 14px; }
.msg .files .gone { color: var(--muted); }
.msg .files .gone::before { color: var(--muted); }
.msg .files .gone > span:first-child { text-decoration: line-through; }

/* edits */
.edits .edit { padding: 12px 0 2px; border-bottom: 1px dotted var(--rule); }
.edits .edit-text { white-space: pre-wrap; overflow-wrap: anywhere; cursor: pointer; }
.edits .closed .edit-text { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--rule); cursor: default; }
.edits .edit .note { margin-top: 4px; }
.edits .edit .meta { margin: 6px 0 8px; }
.edits .edit textarea { min-height: 64px; }
