:root {
  --bg_h: #fff;
  --bg: #fff;
  --bg_s: #f5f5f5;
  --bg1: #eee;
  --bg2: #ddd;
  --bg3: #ccc;
  --bg4: #aaa;
  --fg: #000;
  --fg1: #222;
  --fg2: #444;
  --fg3: #666;
  --fg4: #888;
  --blue: #111;
  --blue-dim: #333;
  --accent: #4a90e2;
}

.darkmode {
  --bg_h: #000;
  --bg: #000;
  --bg_s: #0a0a0a;
  --bg1: #111;
  --bg2: #222;
  --bg3: #333;
  --bg4: #555;
  --fg: #fff;
  --fg1: #ddd;
  --fg2: #bbb;
  --fg3: #999;
  --fg4: #777;
  --blue: #fff;
  --blue-dim: #ddd;
  --accent: #6aa9ee;
}

#wrapper {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
    "Songti SC", "Songti TC", STSong, SimSun, "Noto Serif CJK SC",
    "Source Han Serif SC", serif;
}

#header {
  position: relative;
  padding-top: 0.25rem;
}

#header > h1 {
  font-size: clamp(2.1rem, 4vw, 2.8rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

#header > h1 a {
  font-weight: 800;
}

#header .site-description {
  color: var(--fg2);
  font-size: 0.9rem;
  margin: -0.25rem 0 0.8rem;
  text-align: center;
}

#header > nav {
  justify-content: space-between;
  max-width: 52rem;
  margin-top: 0.55rem;
}

#header > nav > .nav-bar-item > a {
  font-size: 1.05rem;
}

.header-action {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--fg2);
  cursor: pointer;
  display: flex;
  justify-content: center;
  padding: 0.5rem;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.header-action:hover {
  border-color: var(--bg2);
  color: var(--accent);
}

.header-action svg {
  fill: currentColor;
}

.header-search {
  left: 0;
  position: absolute;
  top: 0;
  z-index: 2;
}

#header .dark-mode-toggle {
  position: absolute;
  right: 0;
  top: 0;
  z-index: 2;
}

#header .dark-mode-toggle svg {
  height: 1.2rem;
  width: 1.2rem;
}

#main.archive {
  margin-left: auto;
  margin-right: auto;
  max-width: 52rem;
  width: 100%;
}

#main > .post-group {
  margin-bottom: 1.1rem;
}

.post-group h3 {
  color: var(--fg2);
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

.post-group > ul {
  border-left: 1px solid var(--fg4);
  list-style: none;
  margin: 0 0 0 0.4rem;
  padding: 0 0 0 1.15rem;
}

.post-group li {
  border-radius: 4px;
  padding: 0.12rem 0.25rem;
  transition: background-color 0.2s ease;
}

.post-group li:hover {
  background: var(--bg_s);
}

.post-row {
  align-items: baseline;
  display: flex;
  gap: 0.8rem;
  justify-content: space-between;
  line-height: 1.7;
}

.post-link {
  color: var(--fg1);
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-meta {
  align-items: baseline;
  color: var(--fg4);
  display: flex;
  flex-shrink: 0;
  font-size: 0.78rem;
  gap: 0.7rem;
  white-space: nowrap;
}

.post-meta time {
  font-variant-numeric: tabular-nums;
  margin-left: 0;
  min-width: 0;
}

.post-tags {
  display: flex;
  gap: 0.4rem;
}

.post-tags a {
  color: var(--fg3);
}

.empty-state {
  color: var(--fg4);
  font-size: 0.9rem;
  margin: 1rem 0;
}

.pagination {
  align-items: center;
  border-top: 1px solid var(--bg2);
  display: flex;
  justify-content: space-between;
  margin: 2rem 0;
  padding-top: 1rem;
}

.search-modal {
  align-items: flex-start;
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 8vh 1rem 1rem;
  position: fixed;
  z-index: 100;
}

.search-modal[hidden] {
  display: none;
}

.search-modal-backdrop {
  background: rgb(0 0 0 / 48%);
  inset: 0;
  position: absolute;
}

.search-modal-panel {
  background: var(--bg);
  border: 1px solid var(--bg2);
  border-radius: 8px;
  box-shadow: 0 16px 50px rgb(0 0 0 / 24%);
  display: flex;
  flex-direction: column;
  max-height: 78vh;
  max-width: 44rem;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.search-modal-header {
  align-items: center;
  border-bottom: 1px solid var(--bg2);
  display: flex;
  gap: 0.5rem;
  padding: 0.8rem 1rem;
}

.search-modal-input,
#search-modal-input {
  background: transparent;
  border: 0;
  color: var(--fg);
  flex: 1;
  font: inherit;
  min-width: 0;
  outline: none;
}

.search-modal-close {
  background: var(--bg_s);
  border: 1px solid var(--bg2);
  border-radius: 4px;
  color: var(--fg3);
  cursor: pointer;
  padding: 0.2rem 0.5rem;
}

.search-status {
  color: var(--fg4);
  font-size: 0.82rem;
  margin: 0;
  padding: 0.45rem 1rem 0;
}

.search-results {
  list-style: none;
  margin: 0;
  overflow: auto;
  padding: 0.35rem 0.5rem;
}

.search-result {
  border-radius: 4px;
}

.search-result.is-active,
.search-result:hover {
  background: var(--bg_s);
}

.search-result-link {
  color: var(--fg1);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.65rem 0.75rem;
}

.search-result-meta,
.search-result-summary,
.search-empty {
  color: var(--fg4);
  font-size: 0.8rem;
}

.search-empty {
  padding: 1rem;
}

.search-modal-footer {
  border-top: 1px solid var(--bg2);
  color: var(--fg4);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.76rem;
  gap: 0.5rem 1rem;
  padding: 0.55rem 1rem;
}

.search-modal-footer kbd {
  background: var(--bg_s);
  border-radius: 3px;
  margin-right: 0.15rem;
  padding: 0.05rem 0.25rem;
}

.search-modal-open {
  overflow: hidden;
}

@media (max-width: 600px) {
  #header > nav {
    gap: 0.35rem 0.8rem;
  }

  #header > nav > .nav-bar-item > a {
    font-size: 0.95rem;
  }

  .post-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.1rem;
  }

  .post-link {
    white-space: normal;
  }

  .post-meta {
    gap: 0.5rem;
  }
}
