:root {
  color-scheme: light dark;

  --bg: #fafafa;
  --text: #1a1a1a;
  --text-muted: #444;
  --text-faint: #595959;
  --bg-code: #f0f0f0;
  --border: #ddd;
  --border-faint: #eee;
  --border-strong: #ccc;
  --link: #0057b7;
  --accent: #059669;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111;
    --text: #f0f0f0;
    --text-muted: #c0c0c0;
    --text-faint: #999;
    --bg-code: #1f1f1f;
    --border: #2a2a2a;
    --border-faint: #222;
    --border-strong: #333;
    --link: #6db4f5;
    --accent: #2ec293;
  }
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  max-width: 680px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

header {
  margin-bottom: 3rem;
}

header h1,
header nav {
  font-size: 1.25rem;
  line-height: 1;
}

header h1 a,
header nav a {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

header a .tld {
  display: inline-block;
  position: relative;
  color: transparent;
}

header a .tld::before {
  content: ".wtf";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  animation: tld-type 0.3s steps(1) 1;
}

header a:hover .tld::before {
  animation: tld-cycle 1.6s steps(1) infinite;
}

@keyframes tld-type {
  0%   { content: ""; }
  25%  { content: "."; }
  50%  { content: ".w"; }
  75%  { content: ".wt"; }
  100% { content: ".wtf"; }
}

@keyframes tld-cycle {
  0%   { content: ".wtf"; }
  25%  { content: ".huh"; }
  50%  { content: ".hmm"; }
  75%  { content: ".lol"; }
  100% { content: ".wtf"; }
}

main {
  min-height: 60vh;
}

/* Home - post list */
.post-preview {
  margin-bottom: 2.5rem;
}

.post-preview h2 {
  font-size: 1.35rem;
  margin-bottom: 0.25rem;
}

.post-preview h2 a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-preview time {
  display: block;
  font-size: 0.85rem;
  color: var(--text-faint);
  margin-bottom: 0.35rem;
}

.post-preview p {
  color: var(--text-muted);
}

/* Single post */
.post-header {
  margin-bottom: 2rem;
}

.post-header h1 {
  font-size: 2rem;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.post-header time {
  font-size: 0.9rem;
  color: var(--text-faint);
}

.post-content h2 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-size: 1.4rem;
}

.post-content h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  font-size: 1.15rem;
}

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

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

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 1.5rem 0;
}

.post-content blockquote {
  border-left: 3px solid var(--border-strong);
  padding-left: 1rem;
  color: var(--text-muted);
  margin: 1.25rem 0;
}

.post-content pre {
  background: var(--bg-code);
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 1.25rem 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

.post-content code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9em;
}

.post-content p code {
  background: var(--bg-code);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

.post-content ul,
.post-content ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.post-content li {
  margin-bottom: 0.35rem;
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.back {
  margin-top: 3rem;
}

.back a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-faint);
  font-size: 0.85rem;
  color: var(--text-faint);
}

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

@media (prefers-reduced-motion: reduce) {
  header a .tld::before,
  header a:hover .tld::before {
    animation: none;
    content: ".wtf";
  }
}
