/* The site's one stylesheet: clean and functional, a narrow column for
   reading, the sign-up first. System fonts only, so nothing loads from
   another origin; light and dark follow the reader's system. A first
   design, to be replaced when the design comes (README.md, "Open
   decisions"). */

:root {
  color-scheme: light dark;
  --bg: #fbfaf7;
  --surface: #f3f1ec;
  --ink: #1b1b1b;
  --muted: #5f5d58;
  --rule: #e4e0d8;
  --accent: #1b1b1b;
  --accent-ink: #fbfaf7;
  --focus: #2f5bd3;
  --danger: #a3261b;
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --measure: 42rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151515;
    --surface: #1e1e1d;
    --ink: #edebe6;
    --muted: #a3a09a;
    --rule: #2e2d2a;
    --accent: #edebe6;
    --accent-ink: #151515;
    --focus: #8fb0ff;
    --danger: #ff8a7a;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1.0625rem/1.6 var(--sans);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  width: 100%;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

img {
  max-width: 100%;
  height: auto;
}

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.5rem 0.75rem;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 4px;
  z-index: 1;
}

.skip:focus {
  top: 1rem;
}

/* Header */

.site-header {
  padding: 1.5rem 0;
}

.header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

.brand {
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.site-nav ul,
.site-footer ul,
.plain {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

.site-nav a {
  text-decoration: none;
  color: var(--muted);
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--ink);
}

.site-nav a[aria-current="page"] {
  text-decoration: underline;
}

/* Headings and leads */

.hero {
  padding: 3.5rem 0 3rem;
}

.hero-name,
.page-title {
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 1rem;
}

.hero-name {
  font-size: clamp(2.5rem, 7vw, 4rem);
}

.page-title {
  font-size: clamp(2rem, 5vw, 2.75rem);
}

.hero-lead,
.lead {
  font-size: 1.25rem;
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 1.75rem;
}

.page-head {
  padding: 2.5rem 0 1.5rem;
}

.section {
  padding: 2rem 0;
  border-top: 1px solid var(--rule);
}

.section-title {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1.25rem;
}

.empty,
.signup-closed {
  color: var(--muted);
}

.more,
.back,
.feed-link {
  margin: 1.5rem 0 0;
}

.feed-link {
  font-size: 0.9375rem;
  margin: 0;
}

/* The newsletter's form */

.signup {
  max-width: 32rem;
}

.signup-row {
  display: flex;
  gap: 0.5rem;
}

.signup input[type="email"] {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: 0.75rem 0.875rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--muted);
  border-radius: 6px;
}

button,
.button {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
}

button:hover,
.button:hover {
  opacity: 0.88;
}

.fine {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0.75rem 0 0;
}

/* A field no person sees: a bot fills it. */
.trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.box {
  margin: 3rem 0 0;
  padding: 1.75rem;
  background: var(--surface);
  border-radius: 10px;
}

.box h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  margin: 0 0 0.5rem;
}

.box > p:first-of-type {
  margin-top: 0;
}

/* Lists of posts and books */

.entries {
  list-style: none;
  margin: 0;
  padding: 0;
}

.entry {
  padding: 0 0 1.5rem;
}

.entry + .entry {
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}

.entry-title {
  font-family: var(--serif);
  font-size: 1.375rem;
  line-height: 1.3;
  margin: 0 0 0.375rem;
}

.entry-title a {
  text-decoration: none;
}

.entry-title a:hover {
  text-decoration: underline;
}

.entry-summary {
  margin: 0;
  color: var(--muted);
}

.entry-date {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0.375rem 0 0;
}

.books {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2rem;
}

.book-card {
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: 1.25rem;
  align-items: start;
}

.book-cover {
  width: 6rem;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.18);
}

.book-subtitle {
  color: var(--muted);
  margin: 0 0 0.5rem;
}

/* A book's page */

.book {
  display: grid;
  gap: 2rem;
  padding: 2.5rem 0 0;
}

@media (min-width: 40rem) {
  .book {
    grid-template-columns: 13rem 1fr;
  }
}

.book-cover-large {
  width: 13rem;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgb(0 0 0 / 0.2);
}

.buy {
  margin: 0 0 2rem;
}

.buy p:first-child {
  margin: 0;
}

.details {
  display: grid;
  gap: 0.5rem;
  margin: 2rem 0 0;
  font-size: 0.9375rem;
}

.details div {
  display: flex;
  gap: 0.75rem;
}

.details dt {
  color: var(--muted);
  min-width: 6rem;
}

.details dd {
  margin: 0;
}

/* A post and the legal pages */

.post-head {
  padding: 2.5rem 0 1.5rem;
}

.post-meta {
  font-size: 0.9375rem;
  color: var(--muted);
  margin: 0;
}

.preview-note {
  margin: 1.5rem 0 0;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-radius: 6px;
}

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

.prose h2,
.prose h3,
.prose h4 {
  font-family: var(--sans);
  line-height: 1.3;
  margin: 2.25em 0 0.5em;
}

.prose h2 {
  font-size: 1.375rem;
}

.prose h3 {
  font-size: 1.1875rem;
}

.prose h4 {
  font-size: 1rem;
}

.prose blockquote {
  margin: 1.5em 0;
  padding: 0 0 0 1.25em;
  border-left: 3px solid var(--rule);
  color: var(--muted);
}

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

.prose pre {
  font-size: 0.875rem;
  background: var(--surface);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
}

.prose pre code {
  background: none;
  padding: 0;
}

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

.prose img {
  display: block;
  margin: 1.5em auto;
  border-radius: 4px;
}

.prose table {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--sans);
  font-size: 0.9375rem;
}

.prose th,
.prose td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--rule);
}

.legal {
  font-family: var(--sans);
  font-size: 1.0625rem;
}

.legal h2 {
  font-size: 1.25rem;
}

.toc {
  margin: 0 0 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-radius: 8px;
  font-size: 0.9375rem;
}

.toc ol {
  margin: 0;
  padding-left: 1.25rem;
}

/* Footer */

.site-footer {
  margin-top: 5rem;
  padding: 2.5rem 0 2rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9375rem;
  color: var(--muted);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1.5rem;
}

.site-footer li + li {
  margin-top: 0.25rem;
}

.site-footer a {
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
}

.footer-fine {
  margin-top: 2rem;
  font-size: 0.8125rem;
}

.footer-fine p {
  margin: 0.25rem 0;
}

@media (max-width: 30rem) {
  .signup-row {
    flex-direction: column;
  }

  .hero {
    padding: 2rem 0 2.5rem;
  }
}
