:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Arial, sans-serif;
  --max-width: 900px;
  --color-text: #000;
  --color-light: #999;
  --color-bg: #fff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  padding: 3rem 1.5rem;
}

@media (min-width: 900px) {
  body {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 6rem;
    max-width: 1300px;
    margin: 0 auto;
    padding: 5rem 4rem 5rem 4rem;
  }
}

/* Header - sidebar on desktop */
header {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-bottom: 4rem;
}

@media (min-width: 900px) {
  header {
    position: sticky;
    top: 5rem;
    align-self: start;
    margin-bottom: 0;
  }
}

.header-title {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

header h1 {
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.4;
}

header h1 a {
  color: inherit;
  text-decoration: none;
}

.tagline {
  font-size: 1rem;
  color: var(--color-light);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.4;
}

.header-right {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.header-right a {
  font-size: 0.875rem;
  color: var(--color-light);
  text-decoration: none;
  font-weight: 300;
}

.header-right a:hover {
  color: var(--color-text);
}

#search {
  width: 100%;
  padding: 0.5rem 0.625rem;
  font-size: 0.875rem;
  font-family: inherit;
  font-weight: 300;
  border: 1px solid #ddd;
  border-radius: 0;
  background: var(--color-bg);
}

#search:focus {
  outline: none;
  border-color: var(--color-text);
}

#search::placeholder {
  color: var(--color-light);
}

.no-results {
  font-size: 0.875rem;
  font-weight: 300;
  color: var(--color-light);
}

/* Posts */
main {
  display: flex;
  flex-direction: column;
  gap: 5rem;
  max-width: 680px;
}

@media (min-width: 900px) {
  main {
    max-width: 650px;
    padding-right: 6rem;
  }
}

/* Date groups */
.date-group {
  display: block;
}

@media (min-width: 900px) {
  .date-group {
    display: grid;
    grid-template-columns: 1fr 0;
    position: relative;
  }
}

.date-marker {
  display: none;
}

@media (min-width: 900px) {
  .date-marker {
    display: block;
    position: sticky;
    top: 5rem;
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    margin-left: calc(100% + 2rem);
    padding-top: 2.5rem;
    font-size: 0.75rem;
    color: var(--color-light);
    font-weight: 300;
    letter-spacing: 0.05em;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
  }
}

.date-posts {
  display: flex;
  flex-direction: column;
  gap: 3rem;
  grid-column: 1;
}

.post {
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Meta footer - tags and permalink */
.post .meta {
  margin-top: 2rem;
  font-size: 0.75rem;
  color: var(--color-light);
  font-weight: 300;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: center;
}

.post .meta time {
  display: inline;
}

@media (min-width: 900px) {
  .post .meta time {
    display: none; /* Date shown in date-marker on desktop */
  }
}

.post .meta .permalink {
  color: var(--color-light);
  text-decoration: none;
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 300;
}

.post .meta .permalink:hover {
  color: var(--color-text);
}

.post .meta .tag {
  color: var(--color-light);
  text-decoration: none;
  font-size: 0.75rem;
}

.post .meta .tag:hover {
  color: var(--color-text);
}

.post .meta .tag::before {
  content: "#";
}


/* Source - the main subject */
.post .source {
  margin-bottom: 1rem;
}

.post .source-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.post .source-link {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 1.125rem;
  line-height: 1.35;
  letter-spacing: -0.015em;
  flex: 1;
}

.post .source-link:hover {
  text-decoration: underline;
}

.post .source-permalink {
  font-size: 0.8125rem;
  color: var(--color-light);
  text-decoration: none;
  flex-shrink: 0;
  font-weight: 300;
}

.post .source-permalink:hover {
  color: var(--color-text);
}

.post .source-meta {
  font-size: 0.8125rem;
  color: var(--color-light);
  font-weight: 300;
  margin-top: 0.375rem;
}

/* Title (for posts without source) */
.post h2 {
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: 1rem;
  letter-spacing: -0.015em;
}

/* Content */
.post .content {
  color: var(--color-text);
  font-size: 1rem;
  line-height: 1.65;
  font-weight: 300;
}

.post .content p {
  margin-bottom: 1.25rem;
}

.post .content p:last-child {
  margin-bottom: 0;
}

.post .content a {
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-color: #ccc;
  text-underline-offset: 2px;
}

.post .content a:hover {
  text-decoration-color: var(--color-text);
}

.post .content strong {
  font-weight: 500;
}

.post .content em {
  font-style: italic;
}

.post .content code {
  font-family: "SF Mono", Monaco, Consolas, monospace;
  font-size: 0.875rem;
  background: #f5f5f5;
  padding: 0.125rem 0.375rem;
  border-radius: 2px;
}

.post .content blockquote {
  margin: 1.5rem 0;
  padding-left: 1.5rem;
  border-left: 2px solid #ddd;
  color: var(--color-light);
  font-size: 1rem;
  font-style: italic;
  font-weight: 300;
}

.post .content blockquote p {
  margin-bottom: 1rem;
}

/* Embeds */
.post .embed {
  margin: 0 0 1.5rem 0;
}

.post .embed iframe {
  display: block;
  border-radius: 0;
  border: 1px solid #ddd;
}

/* Footer */
footer:not(.meta) {
  margin-top: 3rem;
  padding-top: 2.5rem;
  border-top: 1px solid #eee;
  font-size: 0.75rem;
  color: var(--color-light);
  font-weight: 300;
}

@media (min-width: 900px) {
  footer:not(.meta) {
    grid-column: 2;
  }
}
