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

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.7;
    color: #2c2c2c;
    background: #fafafa;
}

main {
    max-width: 70ch;
    margin: 3rem auto;
    padding: 0 1.5rem;
}

/* Typography */

h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: #1a1a1a;
}

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

p {
    margin: 0 0 1rem;
}

a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.broken-link {
    color: #9ca3af;
    text-decoration: none;
    border-bottom: 1px dashed #9ca3af;
    cursor: help;
}

/* Code */

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

pre {
    background: #f0f0f0;
    border-radius: 6px;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    line-height: 1.5;
}

pre code {
    background: none;
    padding: 0;
    font-size: 0.85em;
}

/* Tables */

table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
}

th, td {
    border: 1px solid #e5e5e5;
    padding: 0.5rem 0.75rem;
    text-align: left;
}

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

/* Lists */

ul, ol {
    padding-left: 1.5rem;
}

.entry-list {
    list-style: none;
    padding: 0;
    columns: 2;
    column-gap: 2rem;
}

.entry-list li {
    padding: 0.3rem 0;
    break-inside: avoid;
}

/* Header */

header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: #fafafa;
    border-bottom: 1px solid #eee;
}

/* Hamburger */

.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    z-index: 200;
}

.hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: #2c2c2c;
    border-radius: 1px;
    transition: transform 0.2s, opacity 0.2s;
}

#nav-toggle:checked ~ .hamburger span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

#nav-toggle:checked ~ .hamburger span:nth-child(2) {
    opacity: 0;
}

#nav-toggle:checked ~ .hamburger span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Nav panel */

#main-nav {
    position: fixed;
    top: 0;
    left: -260px;
    width: 260px;
    height: 100vh;
    background: #fff;
    border-right: 1px solid #eee;
    padding: 4rem 1.5rem 2rem;
    transition: left 0.2s ease;
    z-index: 150;
}

#nav-toggle:checked ~ #main-nav {
    left: 0;
}

#main-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#main-nav li {
    margin-bottom: 0.75rem;
}

#main-nav a {
    font-size: 1.1rem;
    color: #2c2c2c;
}

#main-nav a:hover {
    color: #2563eb;
}

.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 140;
}

#nav-toggle:checked ~ .nav-overlay {
    display: block;
}

/* Search */

.search-btn {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    color: #2c2c2c;
    border-radius: 4px;
}

.search-btn:hover {
    background: #f0f0f0;
}

#search-bar {
    max-width: 70ch;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid #eee;
}

#search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    outline: none;
    font-family: inherit;
}

#search-input:focus {
    border-color: #2563eb;
}

#search-results {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
}

#search-results li {
    padding: 0.4rem 0;
}

#search-results a {
    display: block;
}

#search-results .excerpt {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.15rem;
}

/* Responsive */

@media (max-width: 600px) {
    main {
        margin: 2rem auto;
        padding: 0 1rem;
    }

    .entry-list {
        columns: 1;
    }
}
