:root {
  color-scheme: light;
  --bg: #f7f6f1;
  --text: #121212;
  --muted: #64635e;
  --line: #d8d4c8;
  --link: #183fb0;
  --mark: #efe9d8;
  --ascii: #334047;
  --ascii-glow: rgba(24, 63, 176, 0.1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1115;
  --text: #e7e2d6;
  --muted: #9b978f;
  --line: #34363a;
  --link: #8ea8ff;
  --mark: #1d2026;
  --ascii: #8debc3;
  --ascii-glow: rgba(71, 201, 179, 0.2);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  max-width: 760px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 42px 22px 28px;
  color: var(--text);
  background: var(--bg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 15px;
  line-height: 1.58;
}

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

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

button {
  font: inherit;
}

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 88px;
}

.brand {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.brand::before {
  color: var(--muted);
  content: "~/";
  font-weight: 400;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.nav a {
  color: var(--muted);
}

.nav a[aria-current="true"],
.nav a:hover,
.theme-toggle:hover {
  color: var(--text);
}

.theme-toggle {
  border: 0;
  padding: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.shell {
  outline: none;
}

.intro {
  margin-bottom: 58px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 16px;
  font-size: 1.85rem;
  line-height: 1.18;
}

h2 {
  font-size: 1rem;
  line-height: 1.4;
}

.intro-copy {
  max-width: 62ch;
  margin-bottom: 28px;
  color: var(--text);
}

.ascii-scene {
  width: 100%;
  height: 290px;
  margin: 0;
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  color: var(--ascii);
  font: 11px/1.05 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  letter-spacing: 0;
  text-shadow: 0 0 12px var(--ascii-glow);
  white-space: pre;
  user-select: none;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.search {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.search span,
.status,
.post-meta,
.tags,
.site-footer {
  color: var(--muted);
  font-size: 0.86rem;
}

.search input {
  width: min(260px, 52vw);
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 3px 0;
  color: var(--text);
  background: transparent;
  outline: none;
}

.search input:focus {
  border-color: var(--text);
}

.status {
  white-space: nowrap;
}

.post-list {
  display: grid;
  gap: 0;
}

.post-card {
  border-bottom: 1px solid var(--line);
}

.post-card:first-child {
  border-top: 1px solid var(--line);
}

.post-card a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 12rem;
  gap: 6px 24px;
  padding: 16px 0;
  color: var(--text);
  text-decoration: none;
}

.post-card a:hover h2 {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.post-card h2 {
  grid-column: 1;
  margin-bottom: 0;
  font-weight: 700;
}

.post-card p {
  grid-column: 1;
  margin-bottom: 0;
  color: var(--muted);
}

.post-meta {
  grid-column: 2;
  grid-row: 1 / span 2;
  text-align: right;
}

.post-meta span {
  display: block;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  gap: 8px;
}

.tags span::before {
  content: "#";
}

.article,
.not-found {
  max-width: 66ch;
}

.article .post-meta {
  display: flex;
  gap: 12px;
  margin: 28px 0 10px;
  text-align: left;
}

.article .post-meta span {
  display: inline;
}

.article h1,
.not-found h1 {
  margin-bottom: 20px;
  font-size: 2rem;
}

.article .tags {
  margin-bottom: 36px;
}

.about-layout {
  display: grid;
  max-width: none;
  grid-template-columns: minmax(0, 1fr) 210px;
  align-items: start;
  gap: 44px;
}

.about-sprite {
  display: block;
  width: 210px;
  aspect-ratio: 3 / 4;
  grid-column: 2;
  grid-row: 1;
  margin: 0;
  background-image: url("me_spritesheet_web.png");
  background-position: 0 0;
  background-repeat: no-repeat;
  background-size: 400% 100%;
  animation:
    portrait-blink 5.5s steps(1, end) -4.3s infinite,
    portrait-breathe 3.2s ease-in-out infinite;
  image-rendering: pixelated;
}

@keyframes portrait-blink {
  0%,
  90%,
  100% {
    background-position: 0 0;
  }

  92% {
    background-position: 33.333% 0;
  }

  94% {
    background-position: 66.667% 0;
  }

  96% {
    background-position: 100% 0;
  }
}

@keyframes portrait-breathe {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(1px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .about-sprite {
    animation: none;
  }
}

.article-body {
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  font-size: 1.12rem;
  line-height: 1.72;
}

.article-body p {
  margin-bottom: 22px;
}

.article-body ul {
  margin: 0 0 22px;
  padding-left: 23px;
}

.article-body li {
  margin-bottom: 8px;
}

code {
  border: 1px solid var(--line);
  padding: 1px 4px;
  background: var(--mark);
  font-family: inherit;
  font-size: 0.92em;
}

.text-link {
  display: inline-block;
  margin-bottom: 22px;
}

.empty {
  margin: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
  color: var(--muted);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 92px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

@media (max-width: 640px) {
  body {
    padding-top: 28px;
  }

  .site-header {
    display: block;
    margin-bottom: 58px;
  }

  .nav {
    justify-content: flex-start;
    margin-top: 8px;
  }

  .toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .search,
  .search input {
    width: 100%;
  }

  .post-card a {
    display: block;
  }

  .post-meta {
    margin: 5px 0 8px;
    text-align: left;
  }

  .about-layout {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .about-sprite {
    width: 168px;
    grid-column: 1;
    grid-row: 1;
  }

  .about-copy {
    grid-row: 2;
  }

  .site-footer {
    display: block;
  }

  .site-footer span {
    display: block;
  }
}
