/** General **/
:root {
  --bg: #ffffff;
  --text: #000000;
  --muted: #666666;
  --border: #dddddd;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f0f;
    --text: #eaeaea;
    --muted: #aaaaaa;
    --border: #333333;
  }
}

html {
  font-size: 16px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, sans-serif;
  max-width: 720px;
  margin: 40px auto;
  padding: 0 16px;
  line-height: 1.6;
}

header {
  margin-bottom: 40px;
}

nav a {
  margin-right: 12px;
  text-decoration: none;
  color: #000;
}

nav a:hover {
  text-decoration: underline;
}

article {
  margin-bottom: 32px;
}

h1,
h2,
h3 {
  line-height: 1.3;
}

.nav a,
.social a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 16px;
  text-decoration: none;
  color: #000;
}

.nav svg,
.social svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.social {
  margin-top: 24px;
}

a:hover {
  opacity: 0.7;
}

.nav a,
.social a,
.project-links a,
.back-nav a {
  padding: 4px 0;
}

/** Projects **/
.projects {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.project {
  border-left: 3px solid #000;
  padding-left: 16px;
}

.project header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.project-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: #000;
}

.project-links svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.project-tags {
  list-style: none;
  padding: 0;
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.project-tags li {
  font-size: 0.8rem;
  padding: 2px 8px;
  border: 1px solid #000;
}

/** Posts **/
.post-item {
  padding: 24px 0;
  border-bottom: 1px solid #ddd;
}

.post-item header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.post-item h2 {
  margin: 0;
}

.post-item a {
  text-decoration: none;
}

.post-item a:hover {
  text-decoration: underline;
}

.post-item time {
  font-size: 0.85rem;
  color: #666;
  white-space: nowrap;
}

.excerpt {
  margin: 8px 0 12px;
}

.post-tags {
  list-style: none;
  padding: 0;
  display: flex;
  gap: 8px;
}

.post-tags li {
  font-size: 0.75rem;
  border: 1px solid #000;
  padding: 2px 8px;
}

.post-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}

.post-filters button {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 10px;
  cursor: pointer;
  font-size: 0.85rem;
}

.post-filters button.active {
  background: var(--text);
  color: var(--bg);
}

.post-filters button:hover {
  opacity: 0.8;
}

h2,
h3 {
  position: relative;
}

.header-anchor {
  position: absolute;
  left: -1.4em;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  text-decoration: none;
  color: var(--muted);
  font-weight: normal;
}

h2:hover .header-anchor,
h3:hover .header-anchor {
  opacity: 1;
}

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

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

.post-content h2,
.post-content h3 {
  margin: 2.5rem 0 1rem;
}

.post-content h2:first-child,
.post-content h3:first-child {
  margin-top: 1.5rem;
}


/** Media queries **/
@media (max-width: 640px) {
  header h1 {
    margin-bottom: 12px;
  }

  .nav,
  .back-nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .post-item header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

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

/** Color mode **/
a {
  color: var(--text);
}

a:hover {
  opacity: 0.7;
}

.nav a,
.social a,
.project-links a,
.back-nav a {
  color: var(--text);
}

time,
small {
  color: var(--muted);
}

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

.project {
  border-left: 3px solid var(--text);
}

.post-tags li,
.project-tags li {
  border: 1px solid var(--text);
}

svg {
  fill: currentColor;
  stroke: currentColor;
}
