/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --color-bg: #fafafa;
    --color-text: #1a1a1a;
    --color-muted: #666;
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-success: #059669;
    --color-error: #dc2626;
    --color-border: #e5e7eb;
    --color-card: #fff;
    --radius: 6px;
    --max-width: 800px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    font-family: var(--font);
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1; padding: 2rem 0; }

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* === Typography === */
h1 { font-size: 2rem; margin-bottom: 1rem; }
h2 { font-size: 1.5rem; margin-bottom: 0.75rem; }
p { margin-bottom: 1rem; }
a { color: var(--color-primary); }
ul, ol { margin: 0 0 1rem 1.5rem; }

/* === Header === */
.site-header {
    background: var(--color-card);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 0;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--color-text);
}

.nav a {
    margin-left: 1.5rem;
    text-decoration: none;
    color: var(--color-muted);
    font-weight: 500;
    transition: color 0.2s;
}

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

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--color-text);
}

@media (max-width: 600px) {
    .nav-toggle { display: flex; }
    .nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--color-card);
        border-bottom: 1px solid var(--color-border);
        padding: 1rem 1.5rem;
        flex-direction: column;
    }
    .nav--open { display: flex; }
    .nav a { margin: 0.5rem 0; margin-left: 0; }
    .site-header { position: relative; }
}

/* === Footer === */
.site-footer {
    background: var(--color-card);
    border-top: 1px solid var(--color-border);
    padding: 1.5rem 0;
    text-align: center;
    color: var(--color-muted);
    font-size: 0.875rem;
}

/* === Card === */
.card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 2rem 0;
}

/* === Button === */
.btn {
    display: inline-block;
    background: var(--color-primary);
    color: #fff;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.btn:hover { background: var(--color-primary-dark); }

/* === Forms === */
.form { max-width: 500px; }

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: var(--font);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-group.has-error input,
.form-group.has-error textarea {
    border-color: var(--color-error);
}

.error {
    display: block;
    color: var(--color-error);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* === Alerts === */
.alert {
    padding: 0.8rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.alert--success {
    background: #ecfdf5;
    color: var(--color-success);
    border: 1px solid #a7f3d0;
}

/* === Error pages === */
.error-page { text-align: center; padding: 3rem 0; }
.error-page h1 { font-size: 4rem; color: var(--color-muted); }
.error-page p { margin-bottom: 1.5rem; color: var(--color-muted); }

/* === HTMX target === */
.htmx-target { margin-top: 1rem; }

.greeting-fragment {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    padding: 1rem;
}

/* === Debug === */
.debug-details { margin: 1.5rem 0; text-align: left; }
.debug-details pre {
    background: #f3f4f6;
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 0.8rem;
}
