@font-face {
    font-family: 'Ubuntu';
    src: url('../fonts/ubuntu-latin-400.woff2') format('woff2');
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: 'Ubuntu';
    src: url('../fonts/ubuntu-latin-500.woff2') format('woff2');
    font-style: normal;
    font-weight: 500;
    font-display: swap;
}

@font-face {
    font-family: 'Ubuntu';
    src: url('../fonts/ubuntu-latin-700.woff2') format('woff2');
    font-style: normal;
    font-weight: 700;
    font-display: swap;
}

@font-face {
    font-family: 'JetBrains Mono';
    src: url('../fonts/jetbrains-mono-latin-400.woff2') format('woff2');
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

:root {
    color-scheme: light;
    --input-border: #bfc5cb;
    --quiet-title: #4b5563;
    --boat: #7b838b;
    --row-border: #e5e7e9;
    --active: #e9eef4;
    --bg-primary: #fafafa;
    --bg-secondary: #f1f2f3;
    --bg-input: #ffffff;
    --text-primary: #262b32;
    --text-secondary: #515b68;
    --text-muted: #68717d;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --border: #dfe2e5;
    --link-color: #174bb5;
}

.dark {
    color-scheme: dark;
    --input-border: #565d67;
    --quiet-title: #eaedf2;
    --boat: #929ca9;
    --row-border: #373c43;
    --active: #303e54;
    --bg-primary: #202124;
    --bg-secondary: #34383f;
    --bg-input: #292b2f;
    --text-primary: #eaedf2;
    --text-secondary: #b4bdc9;
    --text-muted: #a4acb8;
    --border: #3d4148;
    --link-color: #79adff;
}

* {
    box-sizing: border-box;
}

html {
    font-family: 'Ubuntu', system-ui, sans-serif;
}

body {
    font-size: 14px;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color 0.15s ease, color 0.15s ease;
    line-height: 1.5;
}

.font-mono {
    font-family: 'JetBrains Mono', monospace;
}

.font-ubuntu {
    font-family: 'Ubuntu', sans-serif;
}

code, pre {
    font-family: 'JetBrains Mono', monospace;
}

.ascii-art {
    display: block;
    width: max-content;
    max-width: 100%;
    margin: 34px auto 0;
    text-align: left;
    white-space: pre;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.18;
    color: var(--boat);
    user-select: none;
    overflow: hidden;
}

/* The field and submit button share one compact search box. */
.search-form { margin-bottom: 17px; }
.search-box {
    display: flex;
    align-items: center;
    gap: 11px;
    height: 44px;
    padding: 4px 5px 4px 13px;
    border: 1px solid var(--input-border);
    border-radius: 6px;
    background: var(--bg-input);
}
.search-box:focus-within {
    border-color: var(--link-color);
    outline: 2px solid color-mix(in srgb, var(--link-color) 15%, transparent);
    outline-offset: 0;
}
.search-box svg { width: 17px; height: 17px; flex-shrink: 0; color: var(--text-muted); }
.search-input {
    flex: 1;
    min-width: 0;
    height: 32px;
    padding: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 16px;
    line-height: 22px;
}
.search-input::placeholder { color: var(--text-muted); opacity: 1; }
.search-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--bg-secondary);
    color: var(--link-color);
    font-size: 13px;
    font-weight: 500;
    line-height: 18px;
    cursor: pointer;
}
.search-submit:hover { border-color: var(--input-border); }
.home { max-width: 672px; margin: 0 auto; padding-top: 16px; text-align: center; }
.landing-title {
    font-size: 22px;
    font-weight: 400;
    line-height: 1.4;
    letter-spacing: normal;
    text-wrap: balance;
    margin: 0 0 20px;
}
.browse-links { display: flex; align-items: center; justify-content: center; gap: 15px; font-size: 14px; }
.browse-links .dot { color: var(--input-border); }
.index-count { font-size: 11px; }
.index-count-number { font-family: 'JetBrains Mono', monospace; font-weight: 400; font-variant-numeric: tabular-nums; }
.results .search-form { margin-bottom: 16px; }
.results-info { color: var(--text-muted); font-size: 12px; line-height: 18px; margin-bottom: 3px; }
.result { padding: 12px 0 13px; border-bottom: 1px solid var(--row-border); }
.result h2 { font-size: 18px; font-weight: 500; line-height: 24px; margin: 0 0 4px; }
.result-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; line-height: 1.5; color: var(--text-muted); margin-bottom: 3px; }
.result-meta time { white-space: nowrap; }
.result-source { color: var(--link-color); }
.result-source:hover { text-decoration: underline; text-underline-offset: 3px; }

.result-title, .result-snippet, .result-meta {
    overflow-wrap: anywhere;
}

.result-snippet strong {
    color: inherit;
    font-weight: 500;
}


.result-snippet {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

a:focus-visible, button:focus-visible {
    outline: 2px solid var(--link-color);
    outline-offset: 3px;
}

/* Result link styling */
.result-title {
    color: var(--quiet-title);
    transition: color 0.1s ease;
}

.result-title:hover, .result-title:focus-visible {
    color: var(--link-color);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Code blocks */
.code-block {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
}

/* Theme toggle */
.theme-toggle {
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.1s ease;
}

.theme-toggle:hover {
    color: var(--text-primary);
}

/* Nav links */
.nav-link {
    color: var(--text-muted);
    transition: color 0.1s ease;
}

.nav-link:hover {
    color: var(--text-primary);
}

/* Content link */
.content-link {
    color: var(--link-color);
    transition: color 0.1s ease;
}

.content-link:hover {
    text-decoration: underline;
}

/* Quicklinks */
.quicklink {
    color: #bf616a;
    transition: opacity 0.1s ease;
}

.quicklink:hover {
    opacity: 0.8;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Pagination */
.pagination {
    flex-wrap: wrap;
    row-gap: 6px;
}

.page-btn {
    background-color: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    transition: all 0.1s ease;
}

.page-btn:hover:not(.page-btn-disabled):not(.page-btn-active) {
    background-color: var(--bg-input);
    color: var(--text-primary);
}

.page-btn-active {
    background-color: var(--active);
    border-color: var(--border);
    color: var(--text-primary);
}

.page-btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Scrollbar styling for dark mode */
.dark ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.dark ::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

.dark ::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

@media (max-width: 650px) {
    .home { padding-top: 12px; }
    .landing-title { font-size: 20px; }
    .ascii-art { font-size: 12px; margin-top: 31px; }
    .search-box { gap: 9px; padding-left: 11px; }
    .search-submit { padding-left: 10px; padding-right: 10px; }
}
@media (max-width: 360px) {
    .landing-title { font-size: 19px; }
    .ascii-art { font-size: 11px; }
    .search-box { gap: 7px; }
    .search-submit { padding-left: 8px; padding-right: 8px; }
    .pagination { gap: 2px; }
    .pagination .page-btn { padding-left: 8px; padding-right: 8px; }
}
