/* Free tools (/tools, /tools/sql-formatter) - page-specific rules ONLY. Shared
   primitives (tokens, headings, buttons, eyebrows, cards, notices, form
   controls) come from tokens.css / site.css; do not re-declare them here.
   Per DESIGN.md: hairline borders, no new colors, mono for SQL only. */

/* ---------- Page head extras ---------- */
.tools-crumbs { font-family: "JetBrains Mono", monospace; font-size: .8rem; color: var(--muted); margin-bottom: 18px; }
.tools-crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; }
.tools-crumbs li + li::before { content: "/"; margin-right: 8px; color: var(--muted); }
.tools-crumbs [aria-current="page"] { color: var(--heading); }

/* ---------- Sections ---------- */
.tools-sec { padding: clamp(48px, 6vw, 72px) 0; border-top: 1px solid var(--line); }
.page-head + .tools-sec { border-top: none; }
.tools-sec h2 { font-size: clamp(1.7rem, 3.4vw, 2.3rem); margin: 0 0 12px; }
.tools-h3 { font-size: 1.2rem; margin: 28px 0 12px; }
.tools-intro { color: var(--muted); font-size: 1.06rem; max-width: 72ch; margin: 0 0 24px; }
.tools-intro.tools-after { margin: 22px 0 0; }
.tools-points { list-style: none; padding: 0; margin: 0; max-width: 80ch; }
.tools-points li { padding: 12px 0; border-bottom: 1px solid var(--line); line-height: 1.6; }
.tools-points li:last-child { border-bottom: none; }
.tools-points strong { color: var(--heading); }
.tools-sec code, .fmt code { font-family: "JetBrains Mono", monospace; font-size: .9em; }

/* ---------- The formatter ---------- */
.fmt-tool { padding: 32px 0 clamp(48px, 6vw, 72px); }
.fmt-options { display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: flex-end; margin-bottom: 18px; }
.fmt-opt { display: flex; flex-direction: column; gap: 6px; font-size: .86rem; font-weight: 600; color: var(--heading); }
.fmt-opt select { padding: 9px 12px; font-size: .95rem; min-width: 140px; }
.fmt-check { display: inline-flex; align-items: center; gap: 8px; font-size: .92rem; color: var(--ink); min-height: 44px; cursor: pointer; }
.fmt-check input { width: 18px; height: 18px; accent-color: var(--blue-bright); }

.fmt-panes { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.fmt-pane { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.fmt-pane-label { font-family: "JetBrains Mono", monospace; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.fmt-pane textarea {
    width: 100%;
    min-height: 380px;
    resize: vertical;
    font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
    font-size: .9rem;
    line-height: 1.55;
    tab-size: 4;
    /* SQL must read literally: no ">=" drawn as a ligature. */
    font-variant-ligatures: none;
    white-space: pre-wrap;
    overflow: auto;
}
/* The result keeps its line structure; long lines scroll instead of wrapping. */
.fmt-pane textarea[readonly] { background: var(--cream); white-space: pre; }

.fmt-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 18px; }
.fmt-status { font-size: .9rem; color: var(--muted); }
.fmt-status.is-error { color: var(--pink-strong); }
.fmt-unavailable { margin: 18px 0 0; }
.fmt-hint { font-size: .86rem; color: var(--muted); margin-top: 14px; }
.fmt-hint kbd {
    font-family: "JetBrains Mono", monospace; font-size: .8rem;
    padding: 1px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--card);
}

/* ---------- Before / after examples ---------- */
.fmt-example { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.fmt-example > div { min-width: 0; }
.fmt-example-label { display: block; font-family: "JetBrains Mono", monospace; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.fmt-code {
    margin: 0;
    padding: 16px 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
    font-size: .85rem;
    line-height: 1.55;
    color: var(--ink);
    font-variant-ligatures: none;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
}

/* ---------- FAQ ---------- */
.tools-faq { display: grid; gap: 18px; max-width: 80ch; }
.tools-faq .card h3 { font-size: 1.15rem; margin: 0 0 8px; }
.tools-faq .card p { color: var(--muted); margin: 0; }

/* ---------- Hub ---------- */
.tools-hub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px; }
.tools-hub-card {
    display: flex; flex-direction: column; gap: 10px;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 28px; color: var(--ink);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.tools-hub-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: transparent; text-decoration: none; }
.tools-hub-card h2 { font-size: 1.35rem; margin: 0; }
.tools-hub-card p { color: var(--muted); margin: 0; font-size: .98rem; }
.tools-hub-card .tools-more { margin-top: auto; color: var(--link); font-weight: 600; font-size: .92rem; }

/* ---------- CTA strip (same treatment as the Compare / Features CTA) ---------- */
.tools-cta {
    background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 60%, var(--blue) 130%);
    color: #cfe0ff; text-align: center; margin-top: 24px;
}
.tools-cta h2 { color: #fff; font-size: clamp(2rem, 4vw, 2.8rem); margin: 0 0 14px; }
.tools-cta p { color: #aebfe2; max-width: 560px; margin: 0 auto 28px; font-size: 1.08rem; }
.tools-cta .eyebrow { background: rgba(243, 118, 137, .18); color: var(--pink-soft); }
.tools-cta .tools-cta-actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.tools-cta .btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); }

@media (max-width: 820px) {
    .fmt-panes, .fmt-example { grid-template-columns: 1fr; }
    .fmt-pane textarea { min-height: 240px; }
    .fmt-opt { flex: 1 1 140px; }
    .fmt-opt select { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .tools-hub-card { transition: none; }
    .tools-hub-card:hover { transform: none; }
}
