/* ============================================================
   Format Engineer — blueprint design system
   ============================================================ */

:root {
    --bg: #f6f5f1;
    --surface: #ffffff;
    --surface-2: #fbfaf7;
    --ink: #16181d;
    --ink-soft: #3d4149;
    --muted: #6f7178;
    --line: #e3e1d9;
    --line-strong: #cfccc2;
    --accent: #2447e6;
    --accent-hover: #1c38bd;
    --accent-soft: #eef1fe;
    --accent-line: #c6d0f8;
    --accent-contrast: #ffffff;
    --ok: #177245;
    --ok-soft: #e7f4ec;
    --err: #b3261e;
    --err-soft: #fbeae9;
    --warn: #8a6d1a;
    --warn-soft: #faf3dd;
    --radius: 10px;
    --radius-lg: 16px;
    --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
    --shadow: 0 1px 2px rgba(22, 24, 29, 0.05), 0 8px 24px rgba(22, 24, 29, 0.06);
    --grid-line: rgba(36, 71, 230, 0.07);
    --header-bg: rgba(246, 245, 241, 0.85);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #101318;
        --surface: #171b22;
        --surface-2: #141820;
        --ink: #eae9e4;
        --ink-soft: #c4c6cb;
        --muted: #9aa0a8;
        --line: #272c35;
        --line-strong: #363c47;
        --accent: #8ba0f7;
        --accent-hover: #a5b6fa;
        --accent-soft: #1c2340;
        --accent-line: #33407a;
        --accent-contrast: #0e1220;
        --ok: #63c78e;
        --ok-soft: #14291d;
        --err: #f2867f;
        --err-soft: #341715;
        --warn: #d9b95c;
        --warn-soft: #2c2410;
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
        --grid-line: rgba(139, 160, 247, 0.06);
        --header-bg: rgba(16, 19, 24, 0.85);
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.6;
    font-size: 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

main {
    flex: 1;
}

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

.container-narrow {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

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

a:hover {
    text-decoration: underline;
}

code {
    font-family: var(--mono);
    font-size: 0.85em;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 1px 5px;
}

/* ---------- micro-label (mono eyebrow) ---------- */

.eyebrow {
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.eyebrow::before {
    content: "";
    width: 22px;
    height: 1px;
    background: var(--accent);
    opacity: 0.6;
}

/* ---------- header ---------- */

.site-header {
    background: var(--header-bg);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    gap: 24px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-family: var(--mono);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}

.logo:hover {
    text-decoration: none;
}

.logo-mark {
    display: inline-flex;
    width: 26px;
    height: 26px;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: var(--accent-contrast);
    border-radius: 6px;
    flex-shrink: 0;
}

.logo-mark svg {
    width: 15px;
    height: 15px;
}

.logo-text .slash {
    color: var(--accent);
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.site-nav a {
    color: var(--ink-soft);
    font-size: 0.88rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 7px;
}

.site-nav a:hover {
    color: var(--ink);
    background: var(--surface-2);
    text-decoration: none;
}

.site-nav a.active {
    color: var(--accent);
    background: var(--accent-soft);
}

@media (max-width: 640px) {
    .site-nav a.nav-optional {
        display: none;
    }
}

/* ---------- buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--sans);
    font-size: 0.92rem;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    line-height: 1.4;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: var(--accent-contrast);
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--line-strong);
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
}

.btn-ghost:hover {
    color: var(--ink);
}

.btn-small {
    padding: 5px 12px;
    font-size: 0.8rem;
    border-radius: 7px;
}

/* ---------- flash messages ---------- */

.flash-wrap {
    padding-top: 20px;
}

.status {
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 0.92rem;
    border: 1px solid var(--line);
    background: var(--surface);
    margin-bottom: 10px;
}

.status.success {
    background: var(--ok-soft);
    border-color: var(--ok);
    color: var(--ok);
}

.status.error {
    background: var(--err-soft);
    border-color: var(--err);
    color: var(--err);
}

.status.info {
    background: var(--accent-soft);
    border-color: var(--accent-line);
    color: var(--accent);
}

/* ---------- hero ---------- */

.hero {
    padding: 88px 0 72px;
    border-bottom: 1px solid var(--line);
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 36px 36px;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.1rem);
    line-height: 1.12;
    letter-spacing: -0.02em;
    font-weight: 750;
    max-width: 20ch;
    margin: 18px 0 20px;
}

.hero h1 em {
    font-style: normal;
    color: var(--accent);
}

.hero-sub {
    font-size: 1.08rem;
    color: var(--muted);
    max-width: 54ch;
    margin-bottom: 32px;
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ---------- section scaffolding ---------- */

.section {
    padding: 64px 0;
}

.section + .section {
    border-top: 1px solid var(--line);
}

.section-head {
    margin-bottom: 32px;
}

.section-head h2 {
    font-size: 1.5rem;
    letter-spacing: -0.015em;
    margin-top: 10px;
}

/* ---------- tool cards ---------- */

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.tool-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 26px 24px;
    color: var(--ink);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.tool-card:hover {
    text-decoration: none;
    border-color: var(--accent);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.tool-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tool-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tool-icon svg {
    width: 22px;
    height: 22px;
}

.tool-index {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--muted);
    letter-spacing: 0.1em;
}

.tool-card h3 {
    font-size: 1.12rem;
    letter-spacing: -0.01em;
}

.tool-card p {
    font-size: 0.92rem;
    color: var(--muted);
    flex: 1;
}

.tool-cta {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tool-card:hover .tool-cta {
    text-decoration: underline;
}

/* ---------- how it works ---------- */

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
}

.step {
    border-left: 2px solid var(--accent-line);
    padding: 4px 0 4px 18px;
}

.step-num {
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: var(--accent);
}

.step h3 {
    font-size: 1rem;
    margin: 6px 0 4px;
}

.step p {
    font-size: 0.9rem;
    color: var(--muted);
}

/* ---------- job history ---------- */

.history-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface);
}

.history-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    color: var(--ink);
    border-bottom: 1px solid var(--line);
}

.history-row:last-child {
    border-bottom: none;
}

.history-row:hover {
    background: var(--surface-2);
    text-decoration: none;
}

.history-id {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--muted);
    width: 52px;
    flex-shrink: 0;
}

.history-tool {
    font-weight: 600;
    font-size: 0.92rem;
    min-width: 120px;
}

.history-meta {
    font-size: 0.84rem;
    color: var(--muted);
    flex: 1;
}

.history-row .pill {
    margin-left: auto;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .history-meta {
        display: none;
    }
}

.pill {
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--muted);
    white-space: nowrap;
}

.pill-completed {
    background: var(--ok-soft);
    border-color: var(--ok);
    color: var(--ok);
}

.pill-failed {
    background: var(--err-soft);
    border-color: var(--err);
    color: var(--err);
}

.pill-pending {
    background: var(--warn-soft);
    border-color: var(--warn);
    color: var(--warn);
}

.empty-note {
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-lg);
    padding: 28px;
    text-align: center;
    color: var(--muted);
    font-size: 0.92rem;
}

/* ---------- tool pages ---------- */

.tool-hero {
    padding: 56px 0 40px;
    border-bottom: 1px solid var(--line);
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 36px 36px;
}

.tool-hero h1 {
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    letter-spacing: -0.02em;
    margin: 14px 0 10px;
}

.tool-hero p {
    color: var(--muted);
    max-width: 60ch;
}

.tool-workspace {
    padding: 44px 0 72px;
}

.tool-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.panel-title {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 14px;
}

.panel-title h2,
.panel-title h3 {
    font-size: 1rem;
    letter-spacing: -0.01em;
}

/* ---------- dropzone ---------- */

.dropzone {
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--radius-lg);
    background: var(--surface);
    padding: 44px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.is-dragover {
    border-color: var(--accent);
    background: var(--accent-soft);
    outline: none;
}

.dropzone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.dropzone-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
}

.dropzone-icon svg {
    width: 24px;
    height: 24px;
}

.dropzone-title {
    font-weight: 650;
    font-size: 1.02rem;
}

.dropzone-sub {
    color: var(--muted);
    font-size: 0.88rem;
}

.dropzone input[type="file"] {
    display: none;
}

.dropzone .btn {
    margin-top: 8px;
}

/* visible fallback for the plain single-file input */
.dropzone input[type="file"].visible-input {
    display: block;
    margin: 12px auto 0;
    font-size: 0.9rem;
    color: var(--ink-soft);
}

.dropzone input[type="file"].visible-input::file-selector-button {
    font-family: var(--sans);
    font-size: 0.88rem;
    font-weight: 600;
    padding: 8px 16px;
    margin-right: 12px;
    border-radius: var(--radius);
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.dropzone input[type="file"].visible-input::file-selector-button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ---------- file list ---------- */

.file-list-header {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 12px;
}

.file-list-header h2 {
    font-size: 1rem;
}

.file-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 0.92rem;
}

.file-item[draggable="true"] {
    cursor: grab;
}

.file-item.dragging {
    opacity: 0.45;
}

.file-item.drag-over {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.file-handle {
    color: var(--muted);
    font-size: 0.85rem;
    letter-spacing: -2px;
    user-select: none;
}

.file-index {
    font-family: var(--mono);
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    border-radius: 6px;
    min-width: 26px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.file-meta {
    font-family: var(--mono);
    font-size: 0.76rem;
    color: var(--muted);
    flex-shrink: 0;
}

.file-remove {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 1.05rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    line-height: 1;
}

.file-remove:hover {
    color: var(--err);
    background: var(--err-soft);
}

/* ---------- options ---------- */

.option-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-row {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 14px;
    cursor: pointer;
    font-size: 0.92rem;
    transition: border-color 0.15s ease, background 0.15s ease;
    background: var(--surface-2);
}

.option-row:hover {
    border-color: var(--line-strong);
}

.option-row:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.option-row input[type="radio"] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.range-input[hidden] {
    display: none;
}

.range-input {
    margin-top: 12px;
    padding: 14px;
    border: 1px solid var(--accent-line);
    background: var(--accent-soft);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.range-label {
    font-size: 0.85rem;
    font-weight: 600;
}

.range-input input[type="text"] {
    font-family: var(--mono);
    font-size: 0.92rem;
    padding: 9px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    width: 100%;
}

.range-input input[type="text"]:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
    border-color: var(--accent);
}

.range-help {
    margin: 0;
}

/* ---------- form actions ---------- */

.actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ---------- job detail ---------- */

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

@media (max-width: 760px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

.job-meta-line {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.92rem;
    margin-top: 8px;
}

.job-meta-line .mono {
    font-family: var(--mono);
    font-size: 0.82rem;
}

.detail-actions {
    margin-top: 28px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ---------- footer ---------- */

.site-footer {
    border-top: 1px solid var(--line);
    padding: 28px 0;
    margin-top: auto;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.footer-inner p {
    font-family: var(--mono);
    font-size: 0.74rem;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.footer-nav {
    display: flex;
    gap: 16px;
}

.footer-nav a {
    font-size: 0.82rem;
    color: var(--muted);
}

.footer-nav a:hover {
    color: var(--accent);
}

/* ---------- utility ---------- */

.muted {
    color: var(--muted);
}

.small {
    font-size: 0.84rem;
}
