/* 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).

   THE IDEA — two voices.

   This site is a notebook of detours, so the design gives the page two
   typographic voices and lets the contrast between them do the work:

     serif (Literata)   what a person wrote — titles, prose
     mono  (Plex Mono)  what the machine knows — dates, durations, tags, code
     sans  (system)     interface chrome — the admin's forms and buttons

   Every "nice" detail below is one of those three voices used consistently.
   Adding a fourth is how this starts looking like everything else. */

/* --- fonts --------------------------------------------------------------- */

/* Self-hosted: no third-party request, and the site renders identically on a
   Linux box with no Georgia as it does on a Mac. Both faces are SIL OFL 1.1 —
   see app/assets/fonts/LICENSE.txt. Propshaft fingerprints these url()s. */

@font-face {
  font-family: "Literata";
  src: url("/assets/literata-latin-f7659a86.woff2") format("woff2");
  font-weight: 400 700;      /* variable */
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("/assets/literata-latin-italic-14b52dde.woff2") format("woff2");
  font-weight: 400 700;      /* variable */
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("/assets/plex-mono-400-d803141a.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("/assets/plex-mono-600-b71798d4.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg:          #fcfbf7;   /* warm paper, a half-step off white */
  --bg-subtle:   #f3f1ea;
  --text:        #191813;
  --text-muted:  #6c6960;
  --rule:        #e4e0d5;
  --accent:      #0f6156;   /* pine ink */
  --accent-soft: #e2eeeb;
  --danger:      #a8342a;

  --serif: "Literata", Charter, "Iowan Old Style", Georgia, serif;
  --mono:  "Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans:  ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

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

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #17181a;
    --bg-subtle:   #1f2124;
    --text:        #e9e7df;
    --text-muted:  #97948a;
    --rule:        #2e3134;
    --accent:      #6cc0ae;   /* the same ink, thinned for a dark page */
    --accent-soft: #162926;
    --danger:      #e0736a;
  }
}

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

body {
  margin: 0;
  background:
    radial-gradient(circle at 50% 0, color-mix(in srgb, var(--accent) 4%, transparent), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  font-optical-sizing: auto;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

::selection { background: var(--accent-soft); color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* The machine voice. Anything the site knows rather than wrote goes through
   this: dates, durations, tags, labels, counts. */
.meta {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  color: var(--text-muted);
}

/* --- 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.7rem;
  position: relative;
  border-bottom: 1px solid var(--rule);
}

/* The tick: a short accent segment sitting on the rule, like the mark on a
   ledger's header. The one piece of pure ornament on the page. */
.masthead::after {
  content: "";
  position: absolute;
  left: 1.25rem;
  bottom: -1px;
  width: 2.25rem;
  height: 2px;
  background: var(--accent);
}

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

.masthead__name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -0.015em;
  color: var(--text);
  text-decoration: none;
}
.masthead__name:hover { color: var(--accent); }

.masthead__nav {
  display: flex;
  gap: 1.15rem;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}
.masthead__nav a { color: var(--text-muted); text-decoration: none; transition: color 120ms ease; }
.masthead__nav a:hover { color: var(--accent); }

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

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

h1 {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 1.75rem;
}

/* The masthead is the site's name; this heading says what the site is FOR, so
   it is set as prose rather than as a muted caption. */
.intro { margin-bottom: 3.25rem; }
.intro__eyebrow {
  margin: 0 0 0.85rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.intro__eyebrow::before {
  content: "";
  display: inline-block;
  width: 1.5rem;
  height: 1px;
  margin: 0 0.65rem 0.22rem 0;
  background: currentColor;
}
.intro h1 {
  font-size: clamp(1.55rem, 4vw, 2.05rem);
  font-weight: 400;
  line-height: 1.32;
  letter-spacing: -0.025em;
  color: var(--text);
  margin: 0;
  max-width: 34rem;
  text-wrap: balance;
}

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

.flash {
  padding: 0.65rem 0.9rem;
  margin: 0 0 2rem;
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  font-family: var(--sans);
  font-size: 0.92rem;
}
.flash--alert { border-left-color: var(--danger); background: rgba(168, 52, 42, 0.09); }

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

.index-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--text-muted);
  font-family: var(--mono);
  color: var(--text-muted);
}
.index-heading h2,
.index-heading span {
  margin: 0;
  font: inherit;
  font-size: 0.68rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.index-heading h2 { font-weight: 600; color: var(--text); }
.index-heading span { letter-spacing: 0.04em; }

/* A ruled index rather than a stack of cards: each entry is a row in the
   ledger, and the rule between them is the only separator needed. */
.summaries { display: flex; flex-direction: column; }

.summary {
  position: relative;
  padding: 1.8rem 2.25rem 1.9rem 0;
  border-bottom: 1px solid var(--rule);
}
.summary::after {
  content: "\2197";
  position: absolute;
  top: 1.85rem;
  right: 0.1rem;
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--rule);
  transition: color 120ms ease, transform 120ms ease;
}
.summary:focus-within::after,
.summary:hover::after {
  color: var(--accent);
  transform: translate(0.12rem, -0.12rem);
}

.summary__title {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: 0 0 0.5rem;
}
.summary__title a { color: var(--text); text-decoration: none; transition: color 120ms ease; }
.summary__title a:hover { color: var(--accent); }
.summary__title a::after { content: ""; position: absolute; inset: 0; }

.summary__meta,
.post__meta {
  font-family: var(--mono);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  margin: 0 0 0.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: baseline;
}

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

.dot { opacity: 0.45; }

/* Tags read as what they are — a hashtag in the machine voice. No pill. */
.tag {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 120ms ease;
}
.tag::before { content: "#"; opacity: 0.5; }
.tag:hover { color: var(--accent); }

.more {
  margin-top: 1.5rem;
  font-family: var(--mono);
  font-size: 0.78rem;
}
.more a { text-decoration: none; }
.more a:hover { text-decoration: underline; }

@media (max-width: 30rem) {
  .intro { margin-bottom: 2.5rem; }
  .summary { padding-right: 1.5rem; }
  .summary::after { display: none; }
}

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

.year { margin-bottom: 2.75rem; }
.year__heading {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
  margin: 0 0 0.25rem;
}
.year__list { list-style: none; margin: 0; padding: 0; }
.year__list li {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 1rem;
  align-items: baseline;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--rule);
}
.year__list time {
  font-family: var(--mono);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}
.year__list a { color: var(--text); text-decoration: none; transition: color 120ms ease; }
.year__list a:hover { color: var(--accent); }

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

.post__header { margin-bottom: 2.75rem; }
.post__title {
  font-family: var(--serif);
  font-size: 2.45rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.028em;
  margin: 0 0 0.7rem;
}

@media (max-width: 30rem) {
  .post__title { font-size: 1.95rem; }
  h1 { font-size: 1.7rem; }
}

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

.post__tags {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.post__nav {
  max-width: var(--measure);
  margin: 2.5rem auto 0;
  font-family: var(--mono);
  font-size: 0.78rem;
}
.post__nav a { text-decoration: none; }
.post__nav a:hover { text-decoration: underline; }

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

.prose { font-size: 1.09rem; line-height: 1.7; }
.prose p { text-wrap: pretty; }

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

.prose h2, .prose h3, .prose h4 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.25;
  margin-top: 2.5em;
  margin-bottom: -0.45em;   /* the * + * rule adds the rest back */
}
.prose h2 { font-size: 1.45rem; }
.prose h3 { font-size: 1.18rem; }
.prose h4 { font-size: 1rem; }

.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.35em; }
.prose li::marker { color: var(--text-muted); }

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

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

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

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

/* Code blocks scroll on their own so the page never does */
.prose pre {
  font-family: var(--mono);
  font-size: 0.83rem;
  line-height: 1.6;
  color: var(--text);          /* overrides the Rouge theme's cool grey base */
  background: var(--bg-subtle);
  border: 1px solid var(--rule);
  border-left: 2px solid var(--accent);
  border-radius: 0 4px 4px 0;
  padding: 0.9rem 1.1rem;
  overflow-x: auto;
}
.prose pre code { background: none; padding: 0; font-size: inherit; }

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}
.prose th, .prose td { text-align: left; padding: 0.45rem 0.7rem 0.45rem 0; border-bottom: 1px solid var(--rule); }
.prose th {
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom-color: var(--text-muted);
}

/* 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-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.01em;
}
.colophon p { margin: 0.3rem 0; }
.colophon a { color: var(--text-muted); text-decoration: none; }
.colophon a:hover { color: var(--accent); text-decoration: underline; }

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

/* The admin is a tool, not a publication: it speaks in the interface voice. */
.masthead--admin .masthead__name,
.admin-group,
.admin-table,
.admin-form,
.status-line { font-family: var(--sans); }

.admin-group { margin-bottom: 3rem; }
.admin-group h2 {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  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.72rem; color: var(--text-muted); }
.admin-table__date {
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}
.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: -1.25rem; color: var(--text-muted); font-size: 0.9rem; }

.admin-form { max-width: 46rem; }
.field { margin-bottom: 1.5rem; }
.field label {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

input[type=text], input[type=email], input[type=password],
input[type=datetime-local], input[type=file], textarea {
  width: 100%;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 3px;
  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.86rem; line-height: 1.65; }

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

.errors {
  border-left: 2px solid var(--danger);
  background: rgba(168, 52, 42, 0.09);
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  font-family: var(--sans);
  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-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 550;
  color: var(--bg);
  background: var(--accent);
  border: 0;
  border-radius: 3px;
  padding: 0.55rem 1.1rem;
  cursor: pointer;
  transition: filter 120ms ease;
}
.button:hover, input[type=submit]:hover { filter: brightness(1.12); }

/* button_to renders a <form><button>; make those read as plain links */
.linkish, .linkish button {
  font-family: var(--sans);
  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: var(--danger); }

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

/* Scoped to the auth forms by class. A bare `.page form` also caught the
   admin's post form and squeezed the Markdown textarea down to 22rem. */
.auth-form { max-width: 22rem; }
