/*
 * Minimal reset — Pico CSS-inspired baseline
 * Sensible defaults for semantic HTML so it looks good without classes.
 */

@font-face {
    font-family: 'IBM Plex Sans';
    src: url('/static/fonts/sans/ibm-plex-sans-400.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: 'IBM Plex Sans';
    src: url('/static/fonts/sans/ibm-plex-sans-700.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}

@font-face {
    font-family: 'Source Code Pro';
    src: url('/static/fonts/mono/source-code-pro-400.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}

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

:root {
    --font-sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'Source Code Pro', ui-monospace, Menlo, Consolas, monospace;

    --text: #1a1a2e;
    --text-muted: #555;
    --bg: #fff;
    --bg-subtle: #f7f7f9;
    --border: #e0e0e0;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-text: #fff;
    --danger: #dc2626;
    --success: #16a34a;

    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 2rem;
    --space-xl: 4rem;

    --radius: 4px;
    --max-width: 42rem;
    --line-height: 1.6;

    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --text: #e0e0e8;
        --text-muted: #b8b8c8;
        --bg: #16161a;
        --bg-subtle: #1e1e24;
        --border: #2e2e38;
        --accent: #60a5fa;
        --accent-hover: #93c5fd;
        --accent-text: #16161a;
    }
}

html {
    font-family: var(--font-sans);
    font-size: 100%;
    line-height: var(--line-height);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    touch-action: manipulation; /* disable double-tap zoom, kills 300ms tap delay */
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100vw;
    overflow-x: hidden;
}

body > main {
    flex: 1;
}

/* Typography */

h1, h2, h3, h4, h5, h6 {
    line-height: 1.25;
    font-weight: 700;
    margin-top: 1.5em;
    margin-bottom: 0.75em;
}

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

p, ul, ol, blockquote, pre, table, figure, details {
    margin-bottom: var(--space-md);
}

a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color 0.15s;
}

a:hover {
    color: var(--accent-hover);
}

small {
    font-size: 0.875rem;
    color: var(--text-muted);
}

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--bg-subtle);
    padding: 0.15em 0.35em;
    border-radius: var(--radius);
}

pre {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md);
    overflow-x: auto;
    font-size: 0.95rem;
    line-height: 1.5;
}

pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}

blockquote {
    border-left: 3px solid var(--accent);
    padding-left: var(--space-md);
    color: var(--text);
    font-style: italic;
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: var(--space-lg) 0;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Only round images in post/page content — not logos, icons, etc. */
.post-body img {
    border-radius: var(--radius);
}

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

li + li {
    margin-top: 0.25em;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.925rem;
}

th, td {
    text-align: left;
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border);
}

th {
    font-weight: 600;
    background: var(--bg-subtle);
}

/* Forms */

label {
    display: block;
    font-weight: 500;
    margin-bottom: var(--space-xs);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="search"],
textarea,
select {
    display: block;
    width: 100%;
    padding: 0.5em 0.75em;
    font: inherit;
    font-size: 1rem;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.15s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

textarea {
    min-height: 10em;
    resize: vertical;
}

button,
input[type="submit"] {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.5em 1.25em;
    font: inherit;
    font-weight: 500;
    color: var(--accent-text);
    background: var(--accent);
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
}

button:hover,
input[type="submit"]:hover {
    background: var(--accent-hover);
}

button.secondary {
    color: var(--text);
    background: var(--bg-subtle);
    border-color: var(--border);
}

button.secondary:hover {
    background: var(--border);
}

button.danger {
    color: #fff;
    background: var(--danger);
    border-color: transparent;
}

button.danger:hover {
    opacity: 0.9;
}

fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md);
}

details {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md);
}

summary {
    cursor: pointer;
    font-weight: 500;
}

/* Email obfuscation — decoy text hidden from users, visible to scrapers */
.email > span {
    display: none;
}

.email {
    font-family: var(--font-mono);
    font-size: 0.9em;
    white-space: nowrap;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
