/* JMN AI — Field Manual
   Shared stylesheet for every page in docs-site/. Brand tokens are carried
   over verbatim from app/static/css/custom.css so the manual reads as part
   of the same product, not a separate docs theme. */

:root {
    --ink-deep: #062340;
    --ink: #0C3054;
    --ink-light: #1A4575;

    --gold: #C0A860;
    --gold-deep: #A08E48;
    --gold-light: #D4BE7C;

    --parchment: #FBFAF6;
    --paper: #FFFFFF;
    --paper-deep: #F5F2E9;
    --paper-mid: #EDEAE0;

    --line: #E5E0D0;
    --line-strong: #C9BFA3;

    --text: #1A1F2E;
    --muted: #4A5468;
    --faint: #8892A6;

    --radius: 5px;
    --shadow-soft: 0 18px 40px rgba(12, 48, 84, 0.08);
    --shadow-card: 0 22px 44px rgba(12, 48, 84, 0.14);

    --font-display: "IBM Plex Serif", Georgia, serif;
    --font-body: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { background: var(--parchment); }

body {
    margin: 0;
    background: var(--parchment);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

/* ── Top bar ─────────────────────────────────────────────────────── */

.manual-topbar {
    background: linear-gradient(180deg, var(--ink) 0%, var(--ink-deep) 100%);
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid rgba(192, 168, 96, 0.35);
}

.manual-topbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    height: 60px;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.manual-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
}

.manual-brand-jmn {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 19px;
    color: #F8FAFC;
    letter-spacing: 0.01em;
}

.manual-brand-bar {
    width: 2px;
    height: 18px;
    background: var(--gold);
    border-radius: 1px;
}

.manual-brand-sub {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 10px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--gold-light);
    white-space: nowrap;
}

.manual-topbar-tag {
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(212, 190, 124, 0.75);
    white-space: nowrap;
}

.manual-mobile-toggle {
    display: none;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 1px solid rgba(192, 168, 96, 0.45);
    color: var(--gold-light);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius);
    cursor: pointer;
}

/* ── Shell: sidebar + content ───────────────────────────────────── */

.manual-shell {
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    align-items: start;
}

.manual-sidebar {
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    overflow-y: auto;
    background: var(--paper-deep);
    border-right: 1px solid var(--line);
    padding: 1.75rem 1.25rem 3rem;
}

.manual-sidebar-group { margin-bottom: 1.6rem; }

.manual-sidebar-kicker {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--faint);
    margin: 0 0 0.6rem;
    padding: 0 0.6rem;
}

.manual-sidebar-link {
    display: block;
    padding: 0.5rem 0.6rem;
    margin: 0.1rem 0;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 0.875rem;
    color: var(--muted);
    line-height: 1.4;
}

.manual-sidebar-link:hover {
    background: rgba(255, 252, 247, 0.9);
    border-color: var(--line-strong);
    color: var(--text);
}

.manual-sidebar-link.active {
    background: var(--paper);
    border-color: var(--gold-deep);
    color: var(--ink);
    font-weight: 600;
    box-shadow: inset 2px 0 0 var(--gold);
}

.manual-sidebar-home {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0 0.6rem;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink);
}

.manual-sidebar-home svg { width: 14px; height: 14px; }

/* ── Content column ──────────────────────────────────────────────── */

.manual-content {
    padding: 3rem 3.5rem 6rem;
    max-width: 760px;
    animation: fade-up 360ms ease both;
}

.manual-kicker {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink);
    margin: 0 0 0.75rem;
}

.manual-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 2.6rem);
    line-height: 1.08;
    letter-spacing: -0.01em;
    color: var(--text);
    margin: 0 0 1.1rem;
}

.manual-lede {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--muted);
    max-width: 56ch;
    margin: 0 0 2.2rem;
}

.manual-content h2 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--text);
    margin: 2.6rem 0 0.9rem;
    padding-top: 1.4rem;
    border-top: 1px solid var(--line);
}

.manual-content h2:first-of-type { border-top: none; padding-top: 0; }

.manual-content h3 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.15rem;
    color: var(--text);
    margin: 1.8rem 0 0.6rem;
}

.manual-content p {
    margin: 0 0 1.1rem;
    color: var(--text);
    line-height: 1.75;
}

.manual-content ul, .manual-content ol {
    margin: 0 0 1.3rem;
    padding-left: 1.4rem;
    color: var(--text);
    line-height: 1.75;
}

.manual-content li { margin-bottom: 0.45rem; }

.manual-content code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--paper-mid);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 0.1em 0.4em;
    color: var(--ink);
}

.manual-content strong { color: var(--text); font-weight: 600; }

/* ── Figure plates (screenshot slots) ───────────────────────────── */

.figure-plate {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    margin: 1.8rem 0 0.6rem;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow-soft);
}

.figure-spine {
    background: linear-gradient(165deg, var(--ink-light), var(--ink-deep));
    color: var(--gold-light);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    padding: 0.6rem 0;
}

.figure-frame {
    position: relative;
    background: var(--paper);
    min-height: 160px;
}

.figure-frame img {
    width: 100%;
    height: auto;
}

.figure-missing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 160px;
    padding: 1.5rem;
    text-align: center;
    background:
        repeating-linear-gradient(45deg, var(--paper-mid) 0, var(--paper-mid) 1px, var(--paper) 1px, var(--paper) 14px);
    border: 1px dashed var(--line-strong);
    margin: 6px;
    border-radius: 3px;
}

.figure-missing strong {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gold-deep);
}

.figure-missing span {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--faint);
    word-break: break-all;
}

.figure-missing em {
    font-style: normal;
    font-size: 0.78rem;
    color: var(--muted);
    max-width: 32ch;
}

.figure-caption {
    margin: 0.6rem 0 1.8rem !important;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.03em;
    color: var(--faint) !important;
    line-height: 1.5 !important;
}

.figure-caption b { color: var(--muted); font-weight: 600; }

/* ── Callouts ────────────────────────────────────────────────────── */

.callout {
    margin: 1.6rem 0;
    padding: 1rem 1.2rem;
    border-radius: var(--radius);
    border-left: 3px solid var(--gold);
    background: var(--paper-deep);
}

.callout p:last-child { margin-bottom: 0; }

.callout-kicker {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gold-deep);
    margin: 0 0 0.4rem;
}

.callout-tip { border-left-color: var(--ink); }
.callout-tip .callout-kicker { color: var(--ink); }

.callout-warning { border-left-color: #B33A3A; background: #FBF1EE; }
.callout-warning .callout-kicker { color: #B33A3A; }

/* ── Settings reference table ───────────────────────────────────── */

.settings-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.4rem 0 2rem;
    font-size: 0.9rem;
}

.settings-table th {
    text-align: left;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--faint);
    border-bottom: 1px solid var(--line-strong);
    padding: 0.5rem 0.7rem;
}

.settings-table td {
    border-bottom: 1px solid var(--line);
    padding: 0.7rem 0.7rem;
    vertical-align: top;
    color: var(--text);
    line-height: 1.55;
}

.settings-table td:first-child {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--ink);
    white-space: nowrap;
    font-weight: 600;
}

.settings-table td:nth-child(2) {
    color: var(--muted);
    font-size: 0.82rem;
    white-space: nowrap;
}

/* ── Step list (numbered, only used where order is real) ────────── */

.step-list {
    list-style: none;
    margin: 1.6rem 0 2rem;
    padding: 0;
    counter-reset: step;
}

.step-list > li {
    position: relative;
    counter-increment: step;
    padding: 0 0 1.3rem 2.6rem;
    margin: 0;
    border-left: 1px solid var(--line-strong);
}

.step-list > li:last-child { border-left-color: transparent; padding-bottom: 0; }

.step-list > li::before {
    content: counter(step);
    position: absolute;
    left: -16px;
    top: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--ink);
    color: var(--gold-light);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-list > li strong {
    display: block;
    color: var(--text);
    margin-bottom: 0.25rem;
}

/* ── Cards (used on index.html) ─────────────────────────────────── */

.manual-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0 2.5rem;
}

.manual-card {
    display: block;
    padding: 1.3rem 1.2rem;
    border-radius: var(--radius);
    border: 1px solid var(--line-strong);
    background: var(--paper);
    box-shadow: var(--shadow-soft);
}

.manual-card:hover { box-shadow: var(--shadow-card); transform: translateY(-2px); }

.manual-card-num {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    color: var(--gold-deep);
}

.manual-card h3 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    margin: 0.4rem 0 0.4rem;
    color: var(--text);
}

.manual-card p {
    font-size: 0.85rem;
    color: var(--muted);
    margin: 0;
    line-height: 1.55;
}

/* ── Pager ───────────────────────────────────────────────────────── */

.manual-pager {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 3.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
}

.manual-pager > a {
    flex: 1;
    padding: 0.9rem 1.1rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--paper);
}

.manual-pager > a:hover { border-color: var(--gold-deep); }

.manual-pager-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--faint);
    margin-bottom: 0.25rem;
}

.manual-pager-next { text-align: right; }

/* ── Responsive ──────────────────────────────────────────────────── */

@media (max-width: 920px) {
    .manual-shell { grid-template-columns: 1fr; }

    .manual-mobile-toggle { display: inline-flex; margin-bottom: 1.5rem; }

    .manual-sidebar {
        position: fixed;
        top: 60px;
        left: 0;
        bottom: 0;
        width: 270px;
        z-index: 30;
        transform: translateX(-100%);
        transition: transform 200ms ease;
        box-shadow: var(--shadow-card);
    }

    body.manual-nav-open .manual-sidebar { transform: translateX(0); }

    .manual-content { padding: 2rem 1.5rem 4rem; max-width: 100%; }

    .manual-topbar-tag { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .manual-content { animation: none; }
}

@keyframes fade-up {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
