/* SoManyTools — shared design tokens and tool-page chrome.
   Cool neutrals: off-white → slate → deep navy. */

:root {
    --bg: oklch(98.5% 0.005 240);
    --bg-soft: oklch(96.5% 0.006 240);
    --bg-deeper: oklch(93% 0.008 240);
    --surface: oklch(100% 0 0);
    --surface-tint: oklch(99% 0.004 240);

    --line: oklch(89% 0.01 240);
    --line-soft: oklch(93% 0.008 240);
    --line-strong: oklch(80% 0.015 240);

    --ink: oklch(20% 0.025 250);
    --ink-soft: oklch(38% 0.025 250);
    --ink-muted: oklch(55% 0.02 245);
    --ink-faint: oklch(70% 0.015 240);

    --accent: oklch(48% 0.11 248);
    --accent-soft: oklch(94% 0.025 248);
    --accent-line: oklch(82% 0.05 248);

    --ok: oklch(58% 0.09 155);
    --ok-soft: oklch(94% 0.04 155);
    --warn: oklch(65% 0.12 70);
    --warn-soft: oklch(94% 0.05 70);
    --err: oklch(58% 0.16 25);
    --err-soft: oklch(96% 0.04 25);

    --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

    --r-sm: 4px;
    --r: 8px;
    --r-lg: 12px;

    --shadow-card: 0 1px 0 oklch(20% 0.025 250 / 0.04), 0 8px 24px -16px oklch(20% 0.025 250 / 0.12);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--sans);
    font-feature-settings: "ss01", "cv11";
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body { display: flex; flex-direction: column; min-height: 100vh; }

::selection { background: var(--accent-soft); color: var(--ink); }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; padding: 0; }
a { color: inherit; text-decoration: none; }

.icon {
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    flex-shrink: 0;
}

.mono {
    font-family: var(--mono);
    font-feature-settings: "ss01", "cv11";
    letter-spacing: -0.01em;
}

.kbd {
    font-family: var(--mono);
    font-size: 11px;
    padding: 2px 6px;
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    border-radius: 4px;
    background: var(--surface);
    color: var(--ink-soft);
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

/* ---- Top bar ---- */
.topbar {
    height: 60px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-tint);
}
.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    height: 100%;
    padding: 0 56px;
    display: flex;
    align-items: center;
    gap: 18px;
}
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--ink-muted);
    transition: color .12s;
}
.back-link:hover { color: var(--ink); }
.topbar-divider { width: 1px; height: 20px; background: var(--line); }
.tool-id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tool-id .icon { width: 16px; height: 16px; color: var(--ink-soft); }
.tool-id .name {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tool-id .slug {
    font-size: 11px;
    color: var(--ink-faint);
}
.topbar-spacer { flex: 1; }

/* ---- Page layout ---- */
.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 56px;
    width: 100%;
}
main.page { padding-top: 32px; padding-bottom: 48px; flex: 1; }

/* ---- Title block ---- */
.title-block { margin-bottom: 28px; }
.title-block .eyebrow {
    font-size: 11px;
    color: var(--ink-faint);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 12px;
}
.title-block h1 {
    margin: 0;
    font-size: 32px;
    font-weight: 500;
    letter-spacing: -0.6px;
    line-height: 1.1;
    color: var(--ink);
}
.title-block .lede {
    margin: 10px 0 0;
    font-size: 15px;
    color: var(--ink-muted);
    max-width: 640px;
    line-height: 1.55;
}

/* ---- Panels (input/output cards) ---- */
.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel-grid.single { grid-template-columns: 1fr; }

.panel {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.panel-head {
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--bg-soft);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.panel-head .label {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ink-muted);
    letter-spacing: -0.01em;
}
.panel-head .label-divider { font-family: var(--mono); font-size: 10px; color: var(--ink-faint); }
.panel-head .spacer { flex: 1; }
.panel-head-action {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ink-muted);
    transition: color .12s;
}
.panel-head-action:hover { color: var(--ink); }
.panel-body {
    padding: 16px 18px;
    flex: 1;
    min-height: 0;
}
.panel-body.tight { padding: 12px 14px; }
.panel-foot {
    padding: 10px 14px;
    border-top: 1px solid var(--line);
    background: var(--bg-soft);
    display: flex;
    gap: 20px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ink-muted);
    flex-wrap: wrap;
}

/* ---- Inputs ---- */
.field-label {
    display: block;
    font-size: 12px;
    color: var(--ink-soft);
    margin-bottom: 8px;
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.input,
.textarea,
.select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.5;
    outline: none;
    transition: border-color .12s, box-shadow .12s;
}
.input:focus,
.textarea:focus,
.select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea {
    width: 100%;
    min-height: 280px;
    resize: vertical;
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.6;
    color: var(--ink);
}
.textarea.borderless,
.input.borderless {
    border: none;
    border-radius: 0;
    background: var(--surface);
}
.textarea.borderless:focus,
.input.borderless:focus {
    box-shadow: none;
}
.input.mono, .textarea.mono { font-family: var(--mono); }

.checkbox-row { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-muted); cursor: pointer; }
.checkbox-row input { accent-color: var(--accent); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink-soft);
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 500;
    transition: background .12s, color .12s, border-color .12s;
    cursor: pointer;
    line-height: 1;
}
.btn:hover { color: var(--ink); border-color: var(--line-strong); background: var(--surface-tint); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--surface);
}
.btn-primary:hover {
    background: oklch(28% 0.025 250);
    border-color: oklch(28% 0.025 250);
    color: var(--surface);
}
.btn-accent {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--surface);
}
.btn-accent:hover {
    background: oklch(40% 0.13 248);
    border-color: oklch(40% 0.13 248);
    color: var(--surface);
}
.btn .icon { width: 14px; height: 14px; }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---- Status badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--mono);
    font-size: 10px;
    line-height: 1.4;
}
.badge .icon { width: 11px; height: 11px; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-err { background: var(--err-soft); color: var(--err); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-muted { background: var(--bg-soft); color: var(--ink-muted); }

/* ---- Status panels (large) ---- */
.status {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface-tint);
}
.status .icon { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; }
.status-title { font-weight: 600; font-size: 14px; color: var(--ink); }
.status-message { margin: 2px 0 0; font-size: 13px; color: var(--ink-muted); line-height: 1.5; }
.status-ok { border-color: oklch(80% 0.06 155); background: var(--ok-soft); }
.status-ok .icon, .status-ok .status-title { color: var(--ok); }
.status-err { border-color: oklch(80% 0.08 25); background: var(--err-soft); }
.status-err .icon, .status-err .status-title { color: var(--err); }
.status-warn { border-color: oklch(82% 0.06 70); background: var(--warn-soft); }
.status-warn .icon, .status-warn .status-title { color: var(--warn); }

/* ---- Info grid (key/value pairs) ---- */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}
.info-cell {
    padding: 12px 14px;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: var(--surface);
}
.info-cell .info-label {
    font-family: var(--mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--ink-faint);
    margin-bottom: 4px;
}
.info-cell .info-value {
    font-size: 14px;
    color: var(--ink);
    word-break: break-word;
}
.info-cell .info-value.mono { font-family: var(--mono); font-size: 13px; }

/* ---- Code/pre output ---- */
.code-out {
    margin: 0;
    padding: 16px 18px;
    background: var(--surface);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
}
.code-out.dim { color: var(--ink-muted); }

.empty-text {
    color: var(--ink-faint);
    font-size: 12px;
    font-family: var(--mono);
}

/* ---- About / how-to footer section ---- */
.about-section {
    margin-top: 56px;
    padding-top: 32px;
    border-top: 1px solid var(--line);
}
.about-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 32px;
}
.about-cell .about-eyebrow {
    font-family: var(--mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--ink-faint);
    margin-bottom: 10px;
}
.about-cell p {
    margin: 0;
    font-size: 13px;
    color: var(--ink-muted);
    line-height: 1.6;
}
.about-cell ul, .about-cell ol {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.about-cell li {
    font-size: 13px;
    color: var(--ink-muted);
    line-height: 1.5;
    display: flex;
    gap: 10px;
}
.about-cell li .num {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ink-faint);
    flex-shrink: 0;
    min-width: 18px;
}
.about-cell .shortcut-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--ink-muted);
}

/* ---- Section headings inside body ---- */
.section-head {
    display: flex;
    align-items: baseline;
    gap: 14px;
    margin-bottom: 16px;
}
.section-head h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.2px;
    color: var(--ink);
}
.section-head .num {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--ink-faint);
    letter-spacing: 1.2px;
}

/* ---- Footer ---- */
.site-foot {
    padding: 24px 0;
    border-top: 1px solid var(--line);
    margin-top: 48px;
}
.site-foot-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 56px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ink-faint);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .page, .topbar-inner, .site-foot-inner { padding-left: 24px; padding-right: 24px; }
    .panel-grid { grid-template-columns: 1fr; }
    .title-block h1 { font-size: 26px; }
    .tool-id .name { font-size: 13px; }
    .tool-id .slug { display: none; }
    .site-foot-inner { flex-direction: column; gap: 4px; }
}

/* Color picker / file inputs sit on white surfaces */
input[type="color"] {
    width: 44px;
    height: 36px;
    padding: 2px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    cursor: pointer;
}
input[type="file"] {
    font-family: var(--sans);
    font-size: 13px;
    color: var(--ink-soft);
}
input[type="file"]::file-selector-button {
    margin-right: 12px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink-soft);
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .12s, border-color .12s, color .12s;
}
input[type="file"]::file-selector-button:hover {
    border-color: var(--line-strong);
    color: var(--ink);
    background: var(--surface-tint);
}
