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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  line-height: 1.7;
  color: #1a1a2e;
  background: #fafafa;
}

/* Top bar */

.topbar {
  background: #0f3460;
  padding: 0 1.5rem;
  height: 2.8rem;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-brand {
  color: #fff;
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.topbar-brand:hover {
  color: #e0e0f0;
}

main {
  max-width: 48rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* Typography */

h1, h2, h3, h4, h5, h6 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  line-height: 1.3;
  color: #16213e;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p {
  margin-bottom: 1em;
}

a {
  color: #0f3460;
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover {
  color: #e94560;
}

/* Code */

code {
  font-family: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: #e8e8ee;
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

pre {
  background: #1a1a2e;
  color: #e0e0e0;
  padding: 1.25em;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 1em;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.875em;
  color: inherit;
}

/* Lists */

ul, ol {
  margin-bottom: 1em;
  padding-left: 1.5em;
}

li {
  margin-bottom: 0.3em;
}

/* Blockquotes */

blockquote {
  border-left: 4px solid #0f3460;
  padding: 0.5em 1em;
  margin-bottom: 1em;
  color: #555;
  background: #f0f0f5;
  border-radius: 0 4px 4px 0;
}

/* Tables */

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1em;
}

th, td {
  border: 1px solid #ddd;
  padding: 0.6em 0.8em;
  text-align: left;
}

th {
  background: #f0f0f5;
  font-weight: 600;
}

/* Horizontal rule */

hr {
  border: none;
  border-top: 1px solid #ddd;
  margin: 2em 0;
}

/* Images */

img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* Index page */

.toolbar {
  display: flex;
  gap: 0.5em;
  align-items: center;
  margin-bottom: 1em;
}

.search-input {
  flex: 1;
  padding: 0.5em 0.75em;
  font-size: 0.95em;
  border: 1px solid #ddd;
  border-radius: 6px;
  outline: none;
  background: #fff;
  color: #1a1a2e;
}

.search-input:focus {
  border-color: #0f3460;
  box-shadow: 0 0 0 2px rgba(15, 52, 96, 0.1);
}

.search-input::placeholder {
  color: #aaa;
}

.tags-toggle {
  background: #e8e8ee;
  border: none;
  border-radius: 6px;
  padding: 0.5em 0.7em;
  font-size: 1.1em;
  cursor: pointer;
  transition: background 0.15s;
  line-height: 1;
}

.tags-toggle:hover {
  background: #d0d0dd;
}

.tags-toggle.active {
  background: #0f3460;
}

.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em;
  margin-bottom: 1.2em;
}

.tag-filter.hidden {
  display: none;
}

.group-section {
  margin-top: 0.5em;
}

.group-heading {
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 0.3em;
  margin-top: 1.8em;
  margin-bottom: 0.5em;
}

.group-heading:first-of-type {
  margin-top: 0.5em;
}

.tag-btn {
  background: #e8e8ee;
  border: none;
  border-radius: 999px;
  padding: 0.3em 0.8em;
  font-size: 0.85em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  color: #333;
}

.tag-btn:hover {
  background: #d0d0dd;
}

.tag-btn.active {
  background: #0f3460;
  color: #fff;
}

.entry-list {
  list-style: none;
  padding-left: 0;
}

.entry-list li {
  margin-bottom: 0.5em;
  font-size: 1.05em;
  display: flex;
  align-items: baseline;
  gap: 0.2em;
  flex-wrap: wrap;
}

.entry-list li a {
  text-decoration: none;
  font-weight: 500;
}

.entry-list li a:hover {
  text-decoration: underline;
}

.entry-date {
  font-size: 0.75em;
  color: #999;
  font-family: 'SF Mono', 'Fira Code', Menlo, monospace;
}

.tag-chips {
  display: inline-flex;
  gap: 0.2em;
  flex-wrap: wrap;
}

.tag-chip {
  display: inline-block;
  color: #bbb;
  font-size: 0.65em;
  padding: 0.1em 0.4em;
  border-radius: 999px;
}
