/* =========================================================
   Modern tool-page layer
   ---------------------------------------------------------
   Loaded LAST on every tool page (all *-tool-page shells and
   the health calculators) so it can refine the per-category
   shells without rewriting them:

   - Inter / Space Grotesk, matching the homepage and header
   - solid headings (no rainbow gradient text)
   - flat, single-hue buttons (no neon glow, no two-tone gradient)
   - flatter panels (no heavy blur / glow shadows)
   - calmer inputs

   Each category keeps its own accent colour; only the "2020 neon"
   treatment is removed. Works in dark and light mode because it
   only references the shell tokens.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── 1. Token remap (shared type + flat accents) ────────── */
html body[class*="-tool-page"],
html body.img-studio {
    /* typography */
    --cd-font: "Inter", system-ui, sans-serif;
    --cd-display: "Space Grotesk", "Inter", system-ui, sans-serif;
    --tx-font: "Inter", system-ui, sans-serif;
    --tx-display: "Space Grotesk", "Inter", system-ui, sans-serif;
    --ms-font: "Inter", system-ui, sans-serif;
    --ms-display: "Space Grotesk", "Inter", system-ui, sans-serif;
    --au-font: "Inter", system-ui, sans-serif;
    --au-display: "Space Grotesk", "Inter", system-ui, sans-serif;
    --cr-font: "Inter", system-ui, sans-serif;
    --cr-display: "Space Grotesk", "Inter", system-ui, sans-serif;
    --vid-font: "Inter", system-ui, sans-serif;
    --vid-display: "Space Grotesk", "Inter", system-ui, sans-serif;
    --img-font: "Inter", system-ui, sans-serif;
    --img-display: "Space Grotesk", "Inter", system-ui, sans-serif;
    --health-font: "Inter", system-ui, sans-serif;
    --health-display: "Space Grotesk", "Inter", system-ui, sans-serif;

    /* flat accents: collapse the second gradient stop onto the first */
    --cd-indigo: var(--cd-sky);
    --cd-indigo-deep: var(--cd-sky-deep);
    --tx-teal: var(--tx-emerald);
    --ms-cyan: var(--ms-blue);
    --ms-sky: var(--ms-blue);
    --au-orange: var(--au-amber);
    --cr-fuchsia: var(--cr-rose);
    --cr-pink: var(--cr-rose);
    --vid-accent-2: var(--vid-accent);

    /* no coloured glow, just a quiet elevation */
    --cd-glow: rgba(0, 0, 0, 0.22);
    --tx-glow: rgba(0, 0, 0, 0.22);
    --au-glow: rgba(0, 0, 0, 0.22);
    --cr-glow: rgba(0, 0, 0, 0.22);
    --vid-glow: rgba(0, 0, 0, 0.22);
    --img-glow: rgba(0, 0, 0, 0.22);
    --health-primary-glow: rgba(0, 0, 0, 0.22);
    --cd-shadow: 0 1px 2px rgba(0, 0, 0, 0.28), 0 10px 28px rgba(0, 0, 0, 0.16);
    --au-shadow: var(--cd-shadow);
    --cr-shadow: var(--cd-shadow);
    --vid-shadow: var(--cd-shadow);
    --health-shadow: var(--cd-shadow);
}

[data-theme="light"] body[class*="-tool-page"],
[data-theme="light"] body.img-studio {
    --cd-shadow: 0 1px 2px rgba(24, 24, 27, 0.06), 0 10px 28px rgba(24, 24, 27, 0.07);
    --au-shadow: var(--cd-shadow);
    --cr-shadow: var(--cd-shadow);
    --vid-shadow: var(--cd-shadow);
    --health-shadow: var(--cd-shadow);
    --cd-glow: rgba(24, 24, 27, 0.08);
    --tx-glow: rgba(24, 24, 27, 0.08);
    --au-glow: rgba(24, 24, 27, 0.08);
    --cr-glow: rgba(24, 24, 27, 0.08);
    --vid-glow: rgba(24, 24, 27, 0.08);
}

/* ── 2. Base type ───────────────────────────────────────── */
html body[class*="-tool-page"] {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* ── 3. Headings: solid, tight, no gradient text ────────── */
html body[class*="-tool-page"] h1 {
    font-family: "Space Grotesk", "Inter", system-ui, sans-serif;
    font-size: clamp(1.7rem, 3.4vw, 2.3rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
    background: none !important;
    -webkit-background-clip: border-box !important;
    background-clip: border-box !important;
    -webkit-text-fill-color: var(--primary-text-color) !important;
    color: var(--primary-text-color) !important;
}

html body[class*="-tool-page"] h2,
html body[class*="-tool-page"] h3 {
    font-family: "Space Grotesk", "Inter", system-ui, sans-serif;
    letter-spacing: -0.015em;
}

/* ── 4. Buttons: flat, no neon glow ─────────────────────── */
html body[class*="-tool-page"] button,
html body[class*="-tool-page"] .btn,
html body[class*="-tool-page"] .action-btn,
html body[class*="-tool-page"] .primary-btn,
html body[class*="-tool-page"] .secondary-btn,
html body[class*="-tool-page"] .file-upload-btn,
html body[class*="-tool-page"] label.file-upload-btn {
    font-family: "Inter", system-ui, sans-serif;
    box-shadow: none !important;
    text-shadow: none !important;
    letter-spacing: 0;
}

html body[class*="-tool-page"] button:not(:disabled):hover,
html body[class*="-tool-page"] .btn:hover,
html body[class*="-tool-page"] .action-btn:hover,
html body[class*="-tool-page"] .primary-btn:hover {
    transform: none !important;
    filter: brightness(1.08);
}

html body[class*="-tool-page"] button:active:not(:disabled) {
    transform: translateY(1px) !important;
}

html body[class*="-tool-page"] button:focus-visible,
html body[class*="-tool-page"] a:focus-visible,
html body[class*="-tool-page"] input:focus-visible,
html body[class*="-tool-page"] select:focus-visible,
html body[class*="-tool-page"] textarea:focus-visible {
    outline: 2px solid var(--accent-color, currentColor);
    outline-offset: 2px;
}

/* ── 5. Panels: no frosted glass ────────────────────────── */
html body[class*="-tool-page"] .panel,
html body[class*="-tool-page"] .input-section,
html body[class*="-tool-page"] .output-section,
html body[class*="-tool-page"] .results-section,
html body[class*="-tool-page"] .preview-section,
html body[class*="-tool-page"] .upload-section,
html body[class*="-tool-page"] .controls-section,
html body[class*="-tool-page"] .input-panel,
html body[class*="-tool-page"] .output-panel {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

/* ── 6. Fields: readable text in inputs, mono only for code ─ */
html body.cd-tool-page input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
html body.cd-tool-page select {
    font-family: "Inter", system-ui, sans-serif !important;
}

html body.cd-tool-page textarea,
html body.cd-tool-page pre {
    font-family: "JetBrains Mono", ui-monospace, Consolas, monospace !important;
}

html body[class*="-tool-page"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):focus,
html body[class*="-tool-page"] select:focus,
html body[class*="-tool-page"] textarea:focus {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-color, #888) 22%, transparent);
}

/* ── 7. Back-link pills: quieter ────────────────────────── */
html body[class*="-tool-page"] a[class$="-back"],
html body[class*="-tool-page"] a.cat-back {
    font-weight: 600;
    letter-spacing: 0;
}

/* ── 8. Respect reduced motion ──────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    html body[class*="-tool-page"] * {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* ── 9. Light mode: output blocks stay on light surfaces ── */
[data-theme="light"] html body.cd-tool-page pre,
html[data-theme="light"] body.cd-tool-page pre,
html[data-theme="light"] body.cd-tool-page #formatted-json,
html[data-theme="light"] body.cd-tool-page #beautified-code,
html[data-theme="light"] body.cd-tool-page #validation-results,
html[data-theme="light"] body.cd-tool-page .output-display,
html[data-theme="light"] body.cd-tool-page .diff-output {
    background: #f4f4f5 !important;
    color: #18181b !important;
    border-color: rgba(24, 24, 27, 0.12) !important;
}
