/* ============================================================
   ToolsSite — public design system
   Clean, light theme. One accent colour (#2563eb blue family).
   ============================================================ */

:root {
    --accent: #2563eb;
    --accent-dark: #1d4ed8;
    --accent-soft: #eff6ff;
    --bg: #f6f7f9;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --border-strong: #d1d5db;
    --error: #dc2626;
    --error-bg: #fef2f2;
    --success: #15803d;
    --success-bg: #f0fdf4;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-hover: 0 8px 20px rgba(16, 24, 40, .10);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); text-decoration: underline; }

img { max-width: 100%; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ---------- Header ---------- */

.site-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 28px;
    min-height: 64px;
    flex-wrap: wrap;
    padding-top: 6px;
    padding-bottom: 6px;
}

.logo {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -.02em;
    white-space: nowrap;
}
.logo:hover { color: var(--text); text-decoration: none; }
.logo span { color: var(--accent); }

.main-nav {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-left: auto;
}
.main-nav a {
    color: var(--text);
    font-size: 14.5px;
    font-weight: 500;
    padding: 7px 11px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}
.main-nav a:hover { background: var(--accent-soft); color: var(--accent-dark); text-decoration: none; }

/* ---------- Hero ---------- */

.hero {
    background: linear-gradient(180deg, #eaf1fe 0%, var(--bg) 100%);
    border-bottom: 1px solid var(--border);
    padding: 56px 0 48px;
    text-align: center;
}
.hero-title {
    font-size: 40px;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -.02em;
    margin: 0 0 12px;
}
.hero-title span { color: var(--accent); }
.hero-tag {
    font-size: 18px;
    color: var(--muted);
    max-width: 640px;
    margin: 0 auto 28px;
}

.search-form {
    display: flex;
    gap: 10px;
    max-width: 620px;
    margin: 0 auto;
}
.search-input {
    flex: 1;
    padding: 13px 18px;
    font-size: 16px;
    font-family: inherit;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: #fff;
    outline: none;
    min-width: 0;
}
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); }
.search-btn {
    padding: 13px 26px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
}
.search-btn:hover { background: var(--accent-dark); }

/* ---------- Sections & tool cards ---------- */

.section { padding: 40px 0 8px; }
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}
.section-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -.01em;
    margin: 0;
}
.section-link { font-size: 14.5px; font-weight: 600; white-space: nowrap; }

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(262px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.tool-card {
    display: flex;
    gap: 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    color: var(--text);
    transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}
.tool-card:hover {
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow-hover);
    border-color: var(--border-strong);
    transform: translateY(-2px);
}
.tool-card-icon {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 15px;
    text-align: center;
    overflow: hidden;
    padding: 4px;
}
.tool-card-body { min-width: 0; }
.tool-card-name {
    font-size: 16.5px;
    font-weight: 700;
    margin: 0 0 4px;
    line-height: 1.3;
}
.tool-card-summary {
    font-size: 14px;
    color: var(--muted);
    margin: 0 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tool-card-cat {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--accent);
}

.results-info { color: var(--muted); margin: 0 0 18px; }
.empty-state {
    background: var(--card);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 36px 24px;
    text-align: center;
    color: var(--muted);
    margin-bottom: 32px;
}

/* ---------- Breadcrumb / page heads ---------- */

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 14px;
    color: var(--muted);
    padding: 22px 0 4px;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--border-strong); }
.breadcrumb .current { color: var(--text); font-weight: 600; }

.page-head { padding: 6px 0 10px; }
.page-head h1 {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -.02em;
    margin: 8px 0 6px;
    line-height: 1.2;
}
.lead { font-size: 17.5px; color: var(--muted); margin: 0 0 20px; max-width: 760px; }

/* ---------- Article typography (DB HTML content) ---------- */

.article {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px 34px;
    margin: 26px 0 34px;
    font-size: 16.5px;
    line-height: 1.75;
    overflow-wrap: break-word;
}
.article > *:first-child { margin-top: 0; }
.article > *:last-child { margin-bottom: 0; }
.article h2 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -.01em;
    line-height: 1.3;
    margin: 30px 0 12px;
}
.article h3 {
    font-size: 19.5px;
    font-weight: 700;
    margin: 24px 0 10px;
    line-height: 1.35;
}
.article h4 { font-size: 17px; font-weight: 700; margin: 20px 0 8px; }
.article p { margin: 0 0 14px; }
.article ul, .article ol { margin: 0 0 14px; padding-left: 24px; }
.article li { margin-bottom: 6px; }
.article a { text-decoration: underline; }
.article strong { font-weight: 700; }
.article code {
    font-family: var(--font-mono);
    font-size: .88em;
    background: #f3f4f6;
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 1px 5px;
}
.article pre {
    font-family: var(--font-mono);
    font-size: 14px;
    background: #111827;
    color: #e5e7eb;
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    overflow-x: auto;
    margin: 0 0 16px;
}
.article pre code { background: none; border: none; padding: 0; color: inherit; }
.article table { border-collapse: collapse; width: 100%; margin: 0 0 16px; font-size: 15px; }
.article th, .article td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.article th { background: #f9fafb; font-weight: 700; }
.article blockquote {
    margin: 0 0 16px;
    padding: 4px 18px;
    border-left: 4px solid var(--accent);
    background: var(--accent-soft);
    color: var(--text);
}
.article img { border-radius: var(--radius-sm); }

/* ============================================================
   TOOL MODULE SHARED CLASSES (used by every tool partial/JS)
   ============================================================ */

.tool-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin: 6px 0 10px;
}

.tool-drop {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius);
    background: #fbfcfe;
    padding: 34px 20px;
    text-align: center;
    color: var(--muted);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
    margin-bottom: 16px;
}
.tool-drop:hover,
.tool-drop.dragover,
.tool-drop.drag-over {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-dark);
}
.tool-drop p { margin: 0 0 4px; font-size: 16px; font-weight: 600; color: var(--text); pointer-events: none; }
.tool-drop small { font-size: 13.5px; pointer-events: none; }
.tool-drop input[type="file"] { display: none; }

.tool-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 16px;
}
.tool-row > * { flex: 0 1 auto; }
.tool-row .grow { flex: 1 1 180px; }

.tool-label {
    display: block;
    font-size: 13.5px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text);
}

.tool-input,
.tool-select,
.tool-textarea {
    width: 100%;
    font-family: inherit;
    font-size: 15.5px;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 10px 13px;
    outline: none;
}
.tool-input:focus,
.tool-select:focus,
.tool-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .16);
}
.tool-textarea {
    min-height: 150px;
    resize: vertical;
    line-height: 1.55;
}
textarea.tool-textarea.mono, input.tool-input.mono { font-family: var(--font-mono); font-size: 14px; }

.tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-size: 15.5px;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 11px 22px;
    cursor: pointer;
    transition: background .15s ease;
    text-decoration: none;
}
.tool-btn:hover { background: var(--accent-dark); color: #fff; text-decoration: none; }
.tool-btn.secondary {
    background: #fff;
    color: var(--text);
    border-color: var(--border-strong);
}
.tool-btn.secondary:hover { background: #f3f4f6; color: var(--text); }
.tool-btn:disabled,
.tool-btn.secondary:disabled {
    opacity: .55;
    cursor: not-allowed;
    pointer-events: none;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.tool-msg {
    font-size: 14.5px;
    color: var(--muted);
    margin: 10px 0;
    min-height: 0;
}
.tool-msg:empty { display: none; margin: 0; }
.tool-msg.error { color: var(--error); font-weight: 600; }
.tool-msg.success { color: var(--success); font-weight: 600; }

.tool-result {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fbfcfe;
    padding: 18px;
    margin-top: 16px;
    overflow-wrap: break-word;
}
.tool-result h3 { margin: 0 0 10px; font-size: 17px; }
.tool-result img { border-radius: var(--radius-sm); }
.tool-result pre {
    font-family: var(--font-mono);
    font-size: 13.5px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    overflow: auto;
    max-height: 420px;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0 0 12px;
}

.tool-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 14.5px;
    margin-bottom: 12px;
}
.tool-table th, .tool-table td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
    vertical-align: top;
}
.tool-table th { background: #f9fafb; font-weight: 700; }
.tool-table tr:nth-child(even) td { background: #fcfcfd; }

/* ---------- Alerts / generic buttons ---------- */

.alert {
    border-radius: var(--radius-sm);
    padding: 13px 16px;
    margin: 16px 0;
    font-size: 15px;
    border: 1px solid transparent;
}
.alert-success { background: var(--success-bg); color: var(--success); border-color: #bbf7d0; }
.alert-error { background: var(--error-bg); color: var(--error); border-color: #fecaca; }
.alert ul { margin: 0; padding-left: 20px; }

.btn {
    display: inline-block;
    font-weight: 600;
    font-size: 15px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    border: 1px solid var(--accent);
    color: #fff;
    cursor: pointer;
}
.btn:hover { background: var(--accent-dark); color: #fff; text-decoration: none; }

/* ---------- Footer ---------- */

.site-footer {
    background: #111827;
    color: #d1d5db;
    margin-top: 56px;
    padding: 42px 0 0;
}
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 32px;
    padding-bottom: 30px;
}
.footer-brand { font-size: 20px; font-weight: 800; color: #fff; margin-bottom: 8px; }
.footer-brand span { color: #60a5fa; }
.site-footer p { color: #9ca3af; font-size: 14.5px; margin: 0 0 10px; }
.footer-title {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li { margin-bottom: 8px; }
.footer-links a { color: #d1d5db; font-size: 14.5px; }
.footer-links a:hover { color: #fff; }
.footer-bottom {
    border-top: 1px solid #1f2937;
    padding: 16px 0 20px;
    font-size: 13.5px;
    color: #9ca3af;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

/* ---------- Responsive ---------- */

@media (max-width: 820px) {
    .hero { padding: 40px 0 34px; }
    .hero-title { font-size: 31px; }
    .hero-tag { font-size: 16px; }
    .page-head h1 { font-size: 26px; }
    .article { padding: 22px 18px; font-size: 16px; }
    .tool-box { padding: 18px 14px; }
    .footer-grid { grid-template-columns: 1fr; gap: 22px; }
    .search-form { flex-direction: column; }
    .search-btn { width: 100%; }
    .header-inner { gap: 10px; }
    .main-nav { margin-left: 0; }
}
