/* wow cool fade in effect */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

:root {
  --bg: #232136;
  --text: #e0def4;
  --muted: #a3a0bd;
  --link: #9f94f5;
  --link-hover: #c4bbff;
  --accent: #c084fc;
  --hover: #2a2839;
  --line: rgba(255, 255, 255, 0.08);
}

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

html, body {
  margin: 0;
}

body {
  min-height: 100vh;
  min-height: 100dvh; /* fixes the mobile address bar jumping */
  padding: clamp(2rem, 10vh, 6rem) 1rem 2rem;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  color: var(--text);
  font-family: "Andika", sans-serif;
  font-weight: 400;
  animation: fadeIn 0.5s ease-in-out;
}

a { color: var(--link); }
a:hover { color: var(--link-hover); }
::selection { background: rgba(192, 132, 252, 0.35); }

/* the one column everything lives in */
.content {
  max-width: 40rem;
  width: 100%;
  margin: 0 auto;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

/* header (home + posts) */
.header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
}
.header > a { font-size: 0.875rem; }

.title {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.title h1 { margin: 0; font-size: 1.875rem; line-height: 1.2; }
.title h3 { margin: 0; font-size: 1rem; line-height: 1.5; font-weight: 400; color: var(--muted); }

.nav {
  display: flex;
  gap: 1.125rem;
  font-size: 0.875rem;
}

/* home list */
.posts { margin-top: 3.5rem; }
.posts-label {
  margin: 0;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.post-row,
.post-row:hover {
  color: var(--text);
  text-decoration: none;
}
.post-row {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 1rem;
  padding: 1.125rem 0.75rem;
  margin: 0 -0.75rem;
  border-radius: 8px;
  transition: background 0.15s;
}
.post-row:hover { background: var(--hover); }
.post-row:hover .post-title {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.post-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.post-date {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.post-title { font-size: 1.125rem; font-weight: 700; line-height: 1.35; }
.post-desc { margin-top: 0.25rem; font-size: 0.9rem; line-height: 1.55; color: var(--muted); }
.post-meta { margin-top: 0.5rem; font-size: 0.8125rem; color: var(--muted); }
.post-tags { color: var(--accent); }

/* post page */
.post { margin-top: 3.5rem; }
.post .post-meta { margin: 0; font-size: 0.875rem; }
.post h1 { margin: 0.75rem 0 0; font-size: 2.375rem; line-height: 1.2; }
.post-body { margin-top: 2.5rem; font-size: 1.0625rem; line-height: 1.75; }
.post-body > * { margin: 0 0 1.25rem; }
.post-body h2 { margin-top: 2.5rem; font-size: 1.5rem; line-height: 1.3; }
.post-body a { text-underline-offset: 3px; }
.post-body code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: rgba(255, 255, 255, 0.07);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
}
.post-body pre {
  overflow-x: auto;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
}
.post-body pre code { background: none; padding: 0; }

.post-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1.25rem;
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.pn { display: block; max-width: 17.5rem; text-decoration: none; }
.pn-next { margin-left: auto; text-align: right; }
.pn-label { display: block; font-size: 0.8125rem; color: var(--muted); }
.pn-title { display: block; margin-top: 0.25rem; font-size: 0.9375rem; line-height: 1.4; }
.pn:hover .pn-title { text-decoration: underline; text-underline-offset: 4px; }
.all-posts { margin-top: 1.75rem; text-align: center; font-size: 0.875rem; }

/* footer */
.footer {
  margin-top: auto;
  padding-top: 4rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

/* big screens: everything is in rem, so this scales the whole page up */
@media (min-width: 1600px) {
  html { font-size: 112.5%; }
}
@media (min-width: 2400px) {
  html { font-size: 125%; }
}

/* phone */
@media (max-width: 600px) {
  .post-row { grid-template-columns: 1fr; gap: 0.25rem; padding: 1rem 0.75rem; }
  .post h1 { font-size: 1.875rem; }
}