/* jamietalbot.com. One stylesheet, no web fonts, light and dark. */

:root {
  color-scheme: light dark;
  --ink: #1f1d1a;
  --muted: #6b665e;
  --paper: #fbfaf7;
  --rule: #e4e0d8;
  --accent: #9b3d1f;
  --tint: #f3efe7;
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --measure: 40rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8e4dc;
    --muted: #a39d92;
    --paper: #161513;
    --rule: #34312c;
    --accent: #e08a62;
    --tint: #211f1c;
  }
}

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

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

body {
  margin: 0;
  padding: 0 1rem;
  background: var(--paper);
  color: var(--ink);
  font: 1.125rem/1.65 var(--serif);
}

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

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

.masthead,
main,
.colophon {
  max-width: var(--measure);
  margin: 0 auto;
}

.masthead {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: baseline;
  justify-content: space-between;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
}

.masthead .name {
  color: var(--ink);
  font-weight: 650;
  font-size: 1.1rem;
  text-decoration: none;
}

.masthead nav {
  display: flex;
  gap: 1.25rem;
  font-size: 0.95rem;
}

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

.masthead nav a:hover {
  color: var(--accent);
}

main {
  padding: 2rem 0 3rem;
}

/* The home page is the name and nothing else. */

main.minimal {
  padding-top: 4rem;
}

h1,
h2,
h3,
h4 {
  font-family: var(--sans);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 2rem;
  margin: 0 0 0.5rem;
}

h2 {
  font-size: 1.35rem;
  margin: 2.5rem 0 0.75rem;
}

h3 {
  font-size: 1.1rem;
  margin: 2rem 0 0.5rem;
}

img {
  max-width: 100%;
  height: auto;
  border-radius: 2px;
}

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

hr {
  margin: 2.5rem auto;
  width: 30%;
  border: 0;
  border-top: 1px solid var(--rule);
}

code,
pre {
  font-family: var(--mono);
  font-size: 0.85em;
}

code {
  padding: 0.1em 0.3em;
  border-radius: 3px;
  background: var(--tint);
}

pre {
  overflow-x: auto;
  padding: 1rem;
  border-radius: 4px;
  background: var(--tint);
  line-height: 1.5;
  tab-size: 4;
}

pre code {
  padding: 0;
  background: none;
  font-size: 1em;
}

table {
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95em;
}

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

/* The date comes first: the writing is a time capsule. */

.dateline {
  margin: 0 0 0.25rem;
  color: var(--accent);
  font: 600 0.9rem/1.4 var(--sans);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.capsule {
  margin: 0.75rem 0 2rem;
  padding: 0.6rem 0.9rem;
  border-radius: 4px;
  background: var(--tint);
  color: var(--muted);
  font: 0.9rem/1.5 var(--sans);
}

.page .dateline {
  margin: 0 0 2rem;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

/* The writing index. */

.lede {
  color: var(--muted);
}

.years {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.9rem;
  font-family: var(--sans);
  font-size: 0.95rem;
}

.year h2 {
  position: sticky;
  top: 0;
  padding: 0.5rem 0;
  background: var(--paper);
}

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

.pieces li {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--rule);
}

.pieces time {
  padding-top: 0.15rem;
  color: var(--muted);
  font: 0.85rem/1.6 var(--sans);
  white-space: nowrap;
}

.pieces a {
  font-weight: 600;
  text-decoration: none;
}

.pieces p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Comments and neighbouring pieces. */

.comments {
  margin-top: 3rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--rule);
}

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

.comments li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 1rem;
}

.comments .meta {
  margin: 0;
  color: var(--muted);
  font: 0.85rem/1.5 var(--sans);
}

.comments .author {
  color: var(--ink);
  font-weight: 600;
}

.neighbours {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  font-family: var(--sans);
  font-size: 0.95rem;
}

.neighbours a {
  text-decoration: none;
}

.neighbours [rel="next"] {
  grid-column: 2;
  text-align: right;
}

.neighbours span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.colophon {
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font: 0.85rem/1.5 var(--sans);
}

@media (max-width: 30rem) {
  body {
    font-size: 1.0625rem;
  }

  h1 {
    font-size: 1.6rem;
  }

  .pieces li {
    grid-template-columns: 1fr;
    gap: 0;
  }
}
