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

/* ── Layout ── */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    max-width: 960px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    color: #222;
}

/* ── Navigation ── */
nav {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 1.5rem;
}
nav a { color: #5D3A9B; text-decoration: none; }
nav .spacer { flex: 1; }

/* ── Flash messages ── */
.messages li {
    list-style: none;
    background: #f5f0ff;
    border: 1px solid #d4b8f0;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    margin: 0.25rem 0;
}

/* ── Buttons ── */
.btn {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    border: 1px solid #5D3A9B;
    color: #5D3A9B;
    text-decoration: none;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
}
.btn-primary { background: #5D3A9B; color: #fff; }
.btn-primary:hover { background: #4a2e7d; border-color: #4a2e7d; color: #fff; }
.btn:not(.btn-primary):hover { background: #f5f0ff; }

/* ── Tool catalog grid ── */
.tool-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.tool-card {
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
}

/* ── Screen-reader utility ── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* ── Form inputs ── */
textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="url"] {
    width: 100%;
    box-sizing: border-box;
    padding: 0.55rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    color: #1e293b;
    background: #fff;
    transition: border-color 0.15s;
}
textarea:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="url"]:focus {
    outline: none;
    border-color: #5D3A9B;
    box-shadow: 0 0 0 3px rgba(93, 58, 155, 0.15);
}
textarea { resize: vertical; }
label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3rem;
    font-size: 0.95rem;
    color: #1e293b;
}

/* ── Form validation feedback ── */
.field-error {
    color: #dc2626;
    font-size: 0.875rem;
    margin-top: 0.3rem;
    margin-bottom: 0;
}
.non-field-errors {
    color: #dc2626;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    padding: 0.6rem 0.85rem;
    border-left: 3px solid #dc2626;
    background: #fef2f2;
    border-radius: 0 4px 4px 0;
}

/* ── Skip navigation link ── */
.skip-link {
    position: absolute;
    left: -999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
.skip-link:focus {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    display: inline-block;
    margin-bottom: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: #5D3A9B;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    z-index: 1000;
}

/* ── Page footer ── */
.page-footer {
    margin-top: 3rem;
    padding: 1.25rem 0;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    color: #64748b;
    font-size: 0.85rem;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    body { margin: 1rem auto; padding: 0 1rem; }
}
