/* The writing desk. One stylesheet, no framework; the site's own look is only
   used inside the preview iframe, which loads the site's real stylesheet. */
:root {
  --ink: #12211f;
  --ink-muted: #5a6b68;
  --ground: #fbf9f4;
  --surface: #f2efe8;
  --hairline: #ded8cc;
  --accent: #9a7b3f;
  --ok: #1f6f4a;
  --bad: #a1312a;
  --warn: #8a6410;
  --radius: 3px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: #0f4d43; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface); padding: .1em .35em;
  border-radius: 2px; overflow-wrap: anywhere; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .85rem 1.5rem; background: #0d1b19; color: #f4f1ea;
}
.topbar .brand { color: #f4f1ea; text-decoration: none; font-weight: 600; letter-spacing: .01em; }
.topbar .brand span { font-weight: 400; opacity: .7; }
.topbar nav { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.topbar nav a, .topbar .linkish { color: #f4f1ea; opacity: .85; text-decoration: none; }
.topbar nav a:hover { opacity: 1; text-decoration: underline; }
form.inline { display: inline; margin: 0; }

main { max-width: 64rem; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
body.wide main { max-width: 86rem; }
body.centred { display: grid; place-items: center; min-height: 100vh; }
body.centred main { padding: 1.5rem; }

h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 .35rem; }
h2 { font-size: 1.1rem; margin: 1.6rem 0 .5rem; }
.pagehead { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.muted { color: var(--ink-muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.footnote { max-width: 64rem; margin: 0 auto; padding: 1.5rem; color: var(--ink-muted); font-size: .8125rem; border-top: 1px solid var(--hairline); }

.card { background: #fff; border: 1px solid var(--hairline); border-radius: var(--radius); padding: 1.75rem; max-width: 30rem; width: 100%; }
.card.result { max-width: 46rem; }

label { display: block; font-weight: 600; margin-top: 1rem; font-size: .9375rem; }
label.checkline, label.sublabel { font-weight: 500; }
label.checkline { display: flex; gap: .5rem; align-items: baseline; }
abbr[title] { color: var(--bad); text-decoration: none; }
.hint { margin: .2rem 0 .4rem; font-size: .8125rem; color: var(--ink-muted); }
input[type=text], input[type=password], input[type=date], textarea, select {
  width: 100%; padding: .55rem .65rem; font: inherit; color: inherit;
  background: #fff; border: 1px solid var(--hairline); border-radius: var(--radius);
}
textarea { font-family: var(--mono); font-size: .9rem; line-height: 1.6; resize: vertical; }
#body { min-height: 28rem; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.field { margin-bottom: .25rem; }
.subfield { margin-left: .25rem; padding-left: .75rem; border-left: 2px solid var(--hairline); }
.counter { font-size: .75rem; color: var(--ink-muted); margin: .2rem 0 0; }
.counter.over { color: var(--warn); }

button { font: inherit; cursor: pointer; border-radius: var(--radius); }
button.primary, .button.primary { background: #0d1b19; color: #f4f1ea; border: 1px solid #0d1b19; padding: .55rem 1rem; text-decoration: none; display: inline-block; }
button.publish { background: var(--accent); color: #140d02; border: 1px solid #7d6332; padding: .55rem 1rem; font-weight: 600; }
button.secondary { background: #fff; border: 1px solid var(--hairline); padding: .55rem 1rem; }
button.linkish { background: none; border: 0; padding: 0; color: #0f4d43; text-decoration: underline; font-size: inherit; }
/* Not sticky. A sticky action bar inside this column overlays the fields behind
   it -- it was sitting on top of the Category select -- and hiding the field
   somebody is filling in to keep a button in view is the wrong trade on a form
   this short. */
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1.75rem;
  padding-top: 1rem; border-top: 1px solid var(--hairline); }

.error, .ok, .warn { padding: .7rem .9rem; border-radius: var(--radius); margin: 1rem 0; }
.error { background: #fdecea; border-left: 3px solid var(--bad); color: #5e1b16; }
.ok { background: #e8f5ee; border-left: 3px solid var(--ok); color: #10402b; }
.warn { background: #fdf3dd; border-left: 3px solid var(--warn); color: #4c3806; }
.error.small, .warn.small { padding: .35rem .5rem; margin: .3rem 0 .6rem; }
.problems { background: #fff; border: 1px solid var(--hairline); border-left: 3px solid var(--bad); padding: 1rem 1.25rem; margin-bottom: 1.5rem; }
.problems h2 { margin-top: .5rem; font-size: 1rem; }
.problems h2.error, .problems h2.warn { background: none; border: 0; padding: 0; }
.problems ul { margin: .4rem 0 .8rem; padding-left: 1.2rem; }
.problems li { margin: .3rem 0; }

/* The table is the one thing on these pages wide enough to push the page
   sideways on a phone. The wrapper takes the scrolling instead of the document,
   and the two columns a writer does not need on a small screen step aside -- the
   date and the category are both visible in the post's own editor. */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.posts { width: 100%; border-collapse: collapse; margin: 1rem 0; background: #fff; }
@media (max-width: 40rem) { .hide-narrow { display: none; } }
table.posts th, table.posts td { text-align: left; padding: .7rem .8rem; border-bottom: 1px solid var(--hairline); vertical-align: top; }
table.posts th { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); }
table.posts a.title { font-weight: 600; text-decoration: none; }
table.posts a.title:hover { text-decoration: underline; }
table.posts td p { margin: .25rem 0 0; }
table.posts td a + a { margin-left: .75rem; }
tr.is-draft { background: #fdf9ef; }
.badge { font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; padding: .15rem .45rem; border-radius: 2px; }
.badge.draft { background: #f3e3bd; color: #4c3806; }
.badge.live { background: #d9ecdf; color: #10402b; }
.empty { padding: 2rem; background: #fff; border: 1px dashed var(--hairline); text-align: center; }

.columns { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; }
@media (min-width: 60rem) { .columns { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } }
.col-side { background: #fff; border: 1px solid var(--hairline); border-radius: var(--radius); padding: 1rem 1.25rem 1.25rem; }

.tagpicker { display: flex; flex-wrap: wrap; gap: .4rem; margin: .3rem 0 .5rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; font-weight: 400; margin: 0;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: 999px; padding: .2rem .6rem; font-size: .8125rem; }
.chip:has(input:checked) { background: #0d1b19; color: #f4f1ea; border-color: #0d1b19; }
.coverpreview img { max-width: 100%; margin-top: .5rem; border: 1px solid var(--hairline); }

.uploads { margin-top: 2.5rem; background: #fff; border: 1px solid var(--hairline); padding: 1rem 1.25rem 1.5rem; }
.uploadform { display: grid; gap: .25rem; max-width: 30rem; }
.imagelist { font-size: .875rem; }
.imagelist code { margin-right: .5rem; }

#preview { width: 100%; height: 80vh; margin-top: 2rem; border: 1px solid var(--hairline); background: #fff; display: none; }
#preview.shown { display: block; }

.status { margin-top: 2.5rem; font-size: .875rem; color: var(--ink-muted); }
/* `max-content` in the first column plus a <dd> that cannot shrink was pushing
   the whole page sideways on a phone -- min-width: 0 lets the value column
   actually take the remaining space, and under 40rem the pairs stack. */
.status dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .25rem 1rem; }
.status dt { font-weight: 600; }
.status dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 40rem) {
  .status dl { grid-template-columns: minmax(0, 1fr); }
  .status dd { margin-bottom: .5rem; }
}

.buildstatus { margin: 1rem 0; padding: .75rem .9rem; background: var(--surface); border-radius: var(--radius); }
.buildstatus p { margin: 0; }
.spinner { display: inline-block; width: .7rem; height: .7rem; margin-right: .4rem; border: 2px solid var(--accent);
  border-top-color: transparent; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
