/* =========================================================================
   MXG Labs — professional dual-tone theme (single light theme).
   Indigo accent (#4f46e5) over a calm slate-neutral canvas.
   ========================================================================= */
:root {
    --bg: #f5f6f8;
    --panel: #ffffff;
    --surface-2: #f3f4f6;
    --surface-3: #e8eaef;

    --border: #e7e9ee;
    --border-strong: #d5d9e0;

    --text: #131722;
    --text-2: #3a414d;
    --muted: #697586;
    --faint: #98a2b3;

    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-soft: #eef2ff;

    --success: #16a34a;
    --danger: #dc2626;

    --hero-grad: linear-gradient(135deg, #312e81 0%, #4338ca 50%, #4f46e5 100%);

    --radius: 14px;
    --radius-lg: 18px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
    --shadow-md: 0 8px 24px rgba(16, 24, 40, 0.09);

    --gap: 16px;
    --maxw: 1080px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
h1, h2, h3 { letter-spacing: -0.018em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.icon { display: block; flex: none; }
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 1.5rem 1.25rem; flex: 1; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- Header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 20;
    background: color-mix(in srgb, var(--panel) 86%, transparent);
    backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 1px solid var(--border);
}
.site-header-inner {
    max-width: var(--maxw); margin: 0 auto;
    display: flex; align-items: center; gap: 1rem;
    padding: 0.7rem 1.25rem;
}
.brand { display: flex; align-items: center; gap: 0.55rem; font-weight: 700; font-size: 1.05rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
    display: grid; place-items: center; width: 30px; height: 30px;
    border-radius: 9px; background: var(--hero-grad); color: #fff;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.4);
}
.site-nav { margin-left: auto; display: flex; gap: 0.25rem; flex-wrap: wrap; }
.site-nav-link {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.45rem 0.7rem; border-radius: var(--radius-sm);
    color: var(--text-2); font-size: 0.84rem; font-weight: 500;
}
.site-nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.site-nav-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 0.82rem; }
.site-footer .container { padding-top: 1.1rem; padding-bottom: 1.1rem; flex: none; }

/* ---------- Buttons ---------- */
.btn {
    padding: 0.7rem 1rem;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: #fff; border: none; border-radius: var(--radius-sm);
    font: inherit; font-weight: 600; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
    box-shadow: 0 1px 2px rgba(79, 70, 229, 0.25);
    transition: filter 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}
.btn:hover { filter: brightness(1.05); box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3); text-decoration: none; color: #fff; }
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; }
.btn-secondary {
    padding: 0.5rem 0.8rem; background: var(--panel); color: var(--text);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font: inherit; font-weight: 600; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.alert {
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
    padding: 0.6rem 0.8rem; border-radius: var(--radius-sm); font-size: 0.88rem;
}

/* ---------- Hero / home ---------- */
.hero { padding: 1.5rem 0 0.5rem; }
.hero-eyebrow {
    display: inline-block; margin-bottom: 0.4rem;
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--accent);
}
.hero h1 { margin: 0 0 0.3rem; font-size: 1.5rem; font-weight: 700; }
.hero p { margin: 0; color: var(--muted); max-width: 60ch; }

.section-head { display: flex; align-items: center; gap: 0.5rem; margin: 1.75rem 0 0.85rem; }
.section-title { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; color: var(--muted); margin: 0; }
.section-count {
    font-size: 0.7rem; font-weight: 700; color: var(--muted);
    background: var(--surface-2); border: 1px solid var(--border); padding: 0.05rem 0.45rem; border-radius: 999px;
}

/* ---------- Feature cards ---------- */
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--gap); }
.feature {
    display: flex; align-items: center; gap: 0.85rem; padding: 0.95rem 1rem;
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); color: inherit;
    transition: border-color 0.14s ease, box-shadow 0.15s ease, transform 0.12s ease;
}
.feature:hover {
    text-decoration: none; transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); box-shadow: var(--shadow-md);
}
.feature-ic { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 11px; background: var(--accent-soft); color: var(--accent); }
.feature-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.feature-title { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.feature-desc { font-size: 0.78rem; color: var(--muted); line-height: 1.4; margin-top: 0.1rem; }
.feature-meta { font-size: 0.72rem; color: var(--accent); font-weight: 600; margin-top: 0.3rem; }
.feature-arrow { color: var(--faint); flex: none; transition: color 0.14s ease, transform 0.14s ease; }
.feature:hover .feature-arrow { color: var(--accent); transform: translate(2px, -2px); }

/* ---------- Tool page chrome ---------- */
.tool-head { margin-bottom: 1.5rem; }
.back-link { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; font-weight: 600; color: var(--muted); margin-bottom: 0.9rem; }
.back-link:hover { color: var(--accent); text-decoration: none; }
.tool-head-main { display: flex; align-items: center; gap: 0.85rem; }
.tool-head-ic { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.tool-head h1 { margin: 0 0 0.15rem; font-size: 1.3rem; font-weight: 700; }
.tool-head p { margin: 0; font-size: 0.86rem; }

.tool-layout { display: grid; grid-template-columns: minmax(280px, 400px) 1fr; gap: var(--gap); align-items: start; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.result-empty { display: grid; place-items: center; gap: 0.6rem; min-height: 260px; color: var(--faint); text-align: center; }
.result-empty .icon { color: var(--border-strong); }
.field-hint { font-size: 0.76rem; margin: 0.2rem 0 0; }

/* ---------- Forms ---------- */
.qr-form { display: flex; flex-direction: column; gap: 0.85rem; }
.qr-form label { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.84rem; font-weight: 600; color: var(--text); }
.qr-form textarea, .qr-form select, .qr-form input[type="text"] {
    padding: 0.7rem 0.85rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font: inherit; color: var(--text); background: var(--panel); resize: vertical;
}
.qr-form textarea:focus, .qr-form select:focus, .qr-form input[type="text"]:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft);
}
.qr-form input[type="range"] { width: 100%; accent-color: var(--accent); }
.toggle { flex-direction: row !important; align-items: center; gap: 0.5rem !important; font-weight: 500 !important; font-size: 0.86rem; }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0.3rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.25rem; }
.seg-btn { display: flex; align-items: center; justify-content: center; padding: 0.5rem; color: var(--muted); font-weight: 600; border-radius: 7px; cursor: pointer; font-size: 0.86rem; }
.seg-btn.active { background: var(--panel); color: var(--accent); box-shadow: var(--shadow); }

/* ---------- QR result ---------- */
.qr-result { display: grid; place-items: center; gap: 1rem; min-height: 300px; text-align: center; }
.qr-output img, .qr-svg { width: 256px; height: 256px; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 8px; }
.qr-svg :is(svg) { width: 100%; height: 100%; display: block; }
.qr-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; }

/* ---------- Password result ---------- */
.pw-result { display: flex; flex-direction: column; gap: 1rem; min-height: 200px; justify-content: center; }
.pw-value { font-family: ui-monospace, "SFMono-Regular", "Consolas", monospace; font-size: 1.15rem; word-break: break-all; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; text-align: center; }
.pw-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; }
.pw-strength { font-weight: 700; text-transform: capitalize; }
.pw-strength[data-strength="weak"] { color: var(--danger); }
.pw-strength[data-strength="fair"] { color: #d97706; }
.pw-strength[data-strength="strong"] { color: var(--success); }
.pw-strength[data-strength="very strong"] { color: var(--accent); }

/* ---------- Text size result ---------- */
.ts-result { display: flex; flex-direction: column; gap: 1rem; min-height: 280px; justify-content: center; }
.ts-output { margin: 0; width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; white-space: pre-wrap; word-break: break-word; font-size: 1.6rem; line-height: 1.3; text-align: center; color: var(--text); font-family: inherit; }
.ts-output.banner { font-family: ui-monospace, "SFMono-Regular", "Consolas", monospace; font-size: 0.78rem; line-height: 1; white-space: pre; word-break: normal; text-align: left; overflow-x: auto; }

/* ---------- Color result ---------- */
.color-input { -webkit-appearance: none; appearance: none; width: 100%; height: 60px; padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: none; cursor: pointer; }
.color-input::-webkit-color-swatch-wrapper { padding: 4px; }
.color-input::-webkit-color-swatch { border: none; border-radius: 6px; }
.cp-result { display: flex; flex-direction: column; gap: 1.25rem; min-height: 280px; }
.cp-preview { height: 110px; border-radius: 12px; border: 1px solid var(--border); display: grid; place-items: center; font-family: ui-monospace, "Consolas", monospace; font-size: 1.4rem; font-weight: 700; letter-spacing: 0.05em; }
.cp-conversions { display: flex; flex-direction: column; gap: 0.5rem; }
.cp-row { display: flex; align-items: center; gap: 0.75rem; }
.cp-label { width: 42px; font-size: 0.75rem; font-weight: 700; color: var(--muted); }
.cp-val { flex: 1; font-family: ui-monospace, "Consolas", monospace; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.7rem; font-size: 0.88rem; color: var(--text); }
.cp-palettes { display: flex; flex-direction: column; gap: 1rem; }
.palette h3 { margin: 0 0 0.4rem; font-size: 0.9rem; }
.palette-row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0.4rem; }
.swatch { height: 54px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; display: flex; align-items: flex-end; justify-content: center; padding: 0.35rem; }
.swatch:hover { outline: 2px solid var(--accent); }
.swatch-hex { font-family: ui-monospace, "Consolas", monospace; font-size: 0.62rem; font-weight: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
    .tool-layout { grid-template-columns: 1fr; }
    .site-nav-link span { display: none; }
    .site-nav-link { padding: 0.45rem; }
}
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
