/* Small Swope — the whole design. Hand-written CSS on Propshaft: no Tailwind,
   no build step, no watcher. Dark mode follows the reader's system setting.
   Syntax-highlighting colours live in syntax.css (generated — see lib/tasks). */

:root {
  --bg:          #fdfdfc;
  --bg-subtle:   #f4f3f0;
  --text:        #1a1a18;
  --text-muted:  #6b6a65;
  --rule:        #e2e0da;
  --accent:      #1c5d99;
  --accent-soft: #e8f0f7;

  --sans:  ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Charter, "Iowan Old Style", "Source Serif Pro", Georgia, Cambria, "Times New Roman", serif;
  --mono:  ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --measure: 40rem;   /* ~68 characters — the comfortable reading width */
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #16161a;
    --bg-subtle:   #1e1e23;
    --text:        #e6e5e0;
    --text-muted:  #97968f;
    --rule:        #2e2e35;
    --accent:      #7fb2e0;
    --accent-soft: #1d2a36;
  }
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

/* --- masthead ------------------------------------------------------------ */

.masthead {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: baseline;
  justify-content: space-between;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 0;
}

.masthead--admin { max-width: 60rem; }

.masthead__name {
  font-weight: 650;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}
.masthead__name:hover { color: var(--accent); }

.masthead__nav { display: flex; gap: 1.25rem; align-items: baseline; font-size: 0.9rem; }
.masthead__nav a { color: var(--text-muted); text-decoration: none; }
.masthead__nav a:hover { color: var(--accent); text-decoration: underline; }

/* --- page shell ---------------------------------------------------------- */

.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}
.page--wide { max-width: 60rem; }

h1 { font-size: 1.9rem; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 1.5rem; }

.intro { margin-bottom: 3.5rem; }
/* The masthead is the site's name; this heading says what the site is FOR. */
.intro h1 { font-size: 1.3rem; font-weight: 450; line-height: 1.45; color: var(--text-muted); margin: 0; }

.empty { color: var(--text-muted); }

.flash {
  padding: 0.65rem 0.9rem;
  margin: 0 0 2rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 3px 3px 0;
  font-size: 0.92rem;
}
.flash--alert { border-left-color: #c0392b; background: rgba(192, 57, 43, 0.09); }

/* --- post summaries (home, tag pages) ------------------------------------ */

.summaries { display: flex; flex-direction: column; gap: 2.75rem; }

.summary__title { font-size: 1.2rem; line-height: 1.3; margin: 0 0 0.35rem; letter-spacing: -0.01em; }
.summary__title a { color: var(--text); text-decoration: none; }
.summary__title a:hover { color: var(--accent); text-decoration: underline; }

.summary__meta,
.post__meta {
  font-size: 0.83rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: baseline;
}

.summary__excerpt { margin: 0; color: var(--text-muted); }

.dot { opacity: 0.5; }

.tag {
  font-size: 0.78rem;
  text-decoration: none;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
}
.tag:hover { text-decoration: underline; }

.more { margin-top: 3.5rem; font-size: 0.92rem; }

/* --- archive ------------------------------------------------------------- */

.year { margin-bottom: 2.5rem; }
.year__heading {
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
  margin: 0 0 1rem;
}
.year__list { list-style: none; margin: 0; padding: 0; }
.year__list li {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  padding: 0.35rem 0;
}
.year__list time {
  flex: 0 0 4.5rem;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}
.year__list a { color: var(--text); text-decoration: none; }
.year__list a:hover { color: var(--accent); text-decoration: underline; }

/* --- a single post ------------------------------------------------------- */

.post__header { margin-bottom: 2.5rem; }
.post__title { font-size: 2.1rem; line-height: 1.15; letter-spacing: -0.025em; margin: 0 0 0.6rem; }

.preview-banner {
  padding: 0.65rem 0.9rem;
  margin: 0 0 2rem;
  background: var(--bg-subtle);
  border: 1px dashed var(--rule);
  border-radius: 4px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.post__tags { margin-top: 3rem; }
.post__nav { max-width: var(--measure); margin: 3rem auto 0; font-size: 0.9rem; }

/* --- prose: the rendered Markdown --------------------------------------- */

.prose { font-family: var(--serif); font-size: 1.115rem; line-height: 1.72; }

.prose > * + * { margin-top: 1.4em; }

.prose h2, .prose h3, .prose h4 {
  font-family: var(--sans);
  letter-spacing: -0.015em;
  line-height: 1.25;
  margin-top: 2.6em;
  margin-bottom: -0.4em;   /* the * + * rule adds the rest back */
}
.prose h2 { font-size: 1.4rem; }
.prose h3 { font-size: 1.15rem; }
.prose h4 { font-size: 1rem; }

.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.4em; }

.prose blockquote {
  margin-left: 0;
  margin-right: 0;
  padding-left: 1.2em;
  border-left: 3px solid var(--rule);
  color: var(--text-muted);
  font-style: italic;
}

.prose img { max-width: 100%; height: auto; border-radius: 4px; }

.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 3em 0; }

.prose code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--bg-subtle);
  padding: 0.12em 0.35em;
  border-radius: 3px;
}

/* Code blocks: full-bleed-ish panel, scrolls on its own so the page never does */
.prose pre {
  font-family: var(--mono);
  font-size: 0.86rem;
  line-height: 1.55;
  background: var(--bg-subtle);
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
}
.prose pre code { background: none; padding: 0; font-size: inherit; }

.prose table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 0.94rem; }
.prose th, .prose td { text-align: left; padding: 0.45rem 0.7rem; border-bottom: 1px solid var(--rule); }
.prose th { font-weight: 650; }

/* Wide things get their own scrollbar rather than pushing the page sideways */
.prose .table-wrap { overflow-x: auto; }

/* --- footer -------------------------------------------------------------- */

.colophon {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  border-top: 1px solid var(--rule);
  color: var(--text-muted);
  font-size: 0.85rem;
}
.colophon p { margin: 0.25rem 0; }

/* --- admin --------------------------------------------------------------- */

.admin-group { margin-bottom: 3rem; }
.admin-group h2 {
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.5rem;
  margin: 0 0 0.5rem;
}
.count { opacity: 0.6; margin-left: 0.35rem; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
.admin-table td { padding: 0.6rem 0.5rem 0.6rem 0; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
.admin-table__title a { color: var(--text); text-decoration: none; font-weight: 550; }
.admin-table__title a:hover { color: var(--accent); text-decoration: underline; }
.admin-table__title .slug { display: block; font-family: var(--mono); font-size: 0.78rem; color: var(--text-muted); }
.admin-table__date { white-space: nowrap; color: var(--text-muted); font-size: 0.85rem; }
.admin-table__actions { text-align: right; white-space: nowrap; }
.admin-table__actions a, .admin-table__actions form { display: inline-block; margin-left: 0.75rem; }

.status-line { margin-top: -1rem; color: var(--text-muted); font-size: 0.9rem; }

.admin-form { max-width: 46rem; }
.field { margin-bottom: 1.5rem; }
.field label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.3rem; }

input[type=text], input[type=email], input[type=password],
input[type=datetime-local], input[type=file], textarea {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.5rem 0.6rem;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

textarea { resize: vertical; }
textarea.monospace { font-family: var(--mono); font-size: 0.88rem; line-height: 1.6; }

.hint { font-size: 0.82rem; color: var(--text-muted); margin: 0.35rem 0 0; }
.hint code { font-family: var(--mono); font-size: 0.95em; }

.errors {
  border-left: 3px solid #c0392b;
  background: rgba(192, 57, 43, 0.09);
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  border-radius: 0 3px 3px 0;
  font-size: 0.92rem;
}
.errors p { margin: 0 0 0.4rem; font-weight: 600; }
.errors ul { margin: 0; padding-left: 1.2rem; }

.actions { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-top: 2rem; }

.button, input[type=submit] {
  font: inherit;
  font-size: 0.92rem;
  font-weight: 550;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 4px;
  padding: 0.55rem 1.1rem;
  cursor: pointer;
}
.button:hover, input[type=submit]:hover { filter: brightness(1.1); }

/* button_to renders a <form><button>; make those read as plain links */
.linkish, .linkish button {
  font: inherit;
  font-size: 0.9rem;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.danger, .danger button { color: #c0392b; }

/* --- sign-in ------------------------------------------------------------- */

.page form { max-width: 22rem; }
