/*
 * styles-wild.css — Wild app surface styles.
 *
 * Scoped to projects/wild-app.html. Deliberately does NOT depend on
 * simops-shell.css or any simops-* stylesheet. The visual language is the
 * same kask family (neutral palette, hairline borders, monospace accents)
 * with one accent colour: mossy green #4a7c3f (from kask_wild manifest's
 * metadata.icon_color).
 *
 * Layout: three regions on one page — map strip + journal feed on the
 * left column, companion chat on the right. See docs/wild-ux.md §3.
 */

/* ─── Reset / app-level ────────────────────────────────────────────── */

html, body {
    height: 100%;
}

body.wild-app {
    margin: 0;
    background: #fafaf7;
    color: #1a1a1a;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden; /* the app owns its own scroll regions */
}

.wild-app * { box-sizing: border-box; }

/* ─── Top app header ───────────────────────────────────────────────── */

.wild-header {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 52px;
    padding: 0 20px;
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.wild-header-logo {
    height: 28px;
    width: auto;
}

.wild-header-title {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    letter-spacing: -0.2px;
    flex-shrink: 0;
}

.wild-header-title .wild-glyph {
    color: #4a7c3f;
    font-weight: 700;
    margin-right: 6px;
}

.wild-workspace-name {
    font-size: 12px;
    color: #555;
    border-left: 1px solid #e0e0e0;
    padding-left: 16px;
    margin-left: 4px;
    max-width: 320px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wild-header-spacer { flex: 1; }

.wild-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 12px;
    border-radius: 14px;
    background: #f0ede5;
    color: #444;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid transparent;
    text-decoration: none;
    transition: background 0.12s ease;
    cursor: pointer;
    white-space: nowrap;
}

.wild-chip:hover { background: #e6e2d6; color: #1a1a1a; }

.wild-chip-budget {
    background: #4a7c3f;
    color: #ffffff;
}
.wild-chip-budget:hover {
    background: #3a6731;
    color: #ffffff;
}

.wild-chip-creature {
    background: #fff;
    border-color: #d4a373;
    color: #5a3a1a;
}
.wild-chip-creature.wild-chip-creature-empty {
    border-style: dashed;
    color: #888;
}

.wild-chip-offline {
    background: #fff3e0;
    border-color: #d4a373;
    color: #5a3a1a;
}

.wild-chip-glyph {
    font-size: 13px;
    line-height: 1;
}

.wild-chip-user { background: #f6f3ee; }

/* ─── Main two-column grid ─────────────────────────────────────────── */

.wild-main {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    height: calc(100vh - 52px);
    overflow: hidden;
}

.wild-journal-col {
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e0e0e0;
    background: #fafaf7;
    overflow: hidden;
}

.wild-companion-col {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    overflow: hidden;
}

/* ─── Map strip (top of journal col) ───────────────────────────────── */

.wild-map-strip {
    height: 140px;
    flex-shrink: 0;
    background: #eef0e8;
    border-bottom: 1px solid #e0e0e0;
    position: relative;
    overflow: hidden;
}

.wild-map-strip.wild-map-empty {
    display: none; /* hidden until first observation */
}

.wild-map-canvas {
    position: absolute;
    inset: 0;
}

.wild-map-overlay {
    position: absolute;
    top: 10px;
    left: 12px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #4a7c3f;
    font-weight: 700;
    pointer-events: none;
    background: rgba(255,255,255,0.85);
    padding: 3px 8px;
    border-radius: 2px;
}

.wild-map-clear-filter {
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 10px;
    color: #1a1a1a;
    background: #fff;
    border: 1px solid #4a7c3f;
    padding: 3px 10px;
    border-radius: 14px;
    cursor: pointer;
    display: none;
}
.wild-map-clear-filter.active { display: inline-block; }

/* ─── Journal feed ─────────────────────────────────────────────────── */

.wild-feed {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px 80px 24px; /* bottom pad clears the composer */
}

.wild-feed-empty {
    text-align: center;
    color: #888;
    font-size: 13px;
    padding: 60px 24px;
    line-height: 1.6;
}
.wild-feed-empty strong { color: #4a7c3f; }

.wild-section-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #888;
    font-weight: 700;
    margin: 16px 0 10px 0;
}
.wild-section-label:first-child { margin-top: 0; }

.wild-obs-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    padding: 14px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: border-color 0.12s ease;
}
.wild-obs-card:hover { border-color: #4a7c3f; }
.wild-obs-card.wild-obs-offline { opacity: 0.65; border-style: dashed; }

.wild-obs-row1 {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 4px;
}

.wild-obs-binomial {
    font-family: 'Courier New', monospace;
    font-style: italic;
    font-weight: 700;
    color: #1a1a1a;
    font-size: 13px;
}
.wild-obs-common {
    font-size: 13px;
    color: #555;
}

.wild-obs-row2 {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
}

.wild-tag {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #f0ede5;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
}
.wild-tag-location {
    background: #eef0e8;
    color: #3a6731;
    font-family: monospace;
}
.wild-tag-qty-trace    { background: #f8eee0; color: #8a4a2a; }
.wild-tag-qty-sparse   { background: #eef0e8; color: #5a7a3a; }
.wild-tag-qty-moderate { background: #d4e3c8; color: #3a6731; }
.wild-tag-qty-abundant { background: #4a7c3f; color: #fff; }

.wild-obs-snippet {
    font-size: 12px;
    color: #444;
    line-height: 1.55;
}

.wild-obs-expanded {
    display: none;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #e0e0e0;
}
.wild-obs-card.wild-expanded .wild-obs-expanded { display: block; }

.wild-obs-field {
    display: flex;
    gap: 12px;
    font-size: 11px;
    margin-bottom: 4px;
}
.wild-obs-field-label {
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #888;
    font-weight: 700;
    font-size: 9px;
    width: 90px;
    flex-shrink: 0;
    padding-top: 2px;
}
.wild-obs-field-value {
    color: #1a1a1a;
    line-height: 1.55;
    word-break: break-word;
}

.wild-obs-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.wild-obs-action {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    background: transparent;
    border: 1px solid #e0e0e0;
    padding: 4px 10px;
    cursor: pointer;
    color: #555;
}
.wild-obs-action:hover { border-color: #4a7c3f; color: #4a7c3f; }
.wild-obs-action.danger:hover { border-color: #c44; color: #c44; }

/* ─── Quick-log composer (pinned bottom of journal col) ───────────── */

.wild-composer {
    flex-shrink: 0;
    border-top: 1px solid #e0e0e0;
    background: #ffffff;
    padding: 12px 16px;
}

.wild-composer-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.wild-composer-input {
    flex: 1;
    height: 38px;
    padding: 0 14px;
    border: 1px solid #d0d0d0;
    background: #fff;
    font: inherit;
    font-size: 13px;
    color: #1a1a1a;
    border-radius: 2px;
}
.wild-composer-input:focus {
    outline: none;
    border-color: #4a7c3f;
}
.wild-composer-input::placeholder { color: #888; }

.wild-composer-btn {
    height: 38px;
    padding: 0 18px;
    background: #4a7c3f;
    color: #fff;
    border: none;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    cursor: pointer;
    border-radius: 2px;
}
.wild-composer-btn:hover { background: #3a6731; }
.wild-composer-btn:disabled { background: #aaa; cursor: not-allowed; }

.wild-composer-expand {
    background: transparent;
    border: 1px solid #d0d0d0;
    color: #555;
    height: 38px;
    width: 38px;
    cursor: pointer;
    font-size: 14px;
    border-radius: 2px;
}
.wild-composer-expand:hover { color: #4a7c3f; border-color: #4a7c3f; }

.wild-composer-form {
    display: none;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #e0e0e0;
    gap: 8px;
    flex-direction: column;
}
.wild-composer.wild-composer-expanded .wild-composer-form { display: flex; }

.wild-composer-form input,
.wild-composer-form select,
.wild-composer-form textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d0d0d0;
    font: inherit;
    font-size: 12px;
    border-radius: 2px;
    background: #fff;
}
.wild-composer-form textarea { min-height: 60px; resize: vertical; }
.wild-composer-form label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #888;
    font-weight: 700;
    margin-bottom: 2px;
    display: block;
}
.wild-form-row { display: flex; gap: 8px; }
.wild-form-row > div { flex: 1; }

/* ─── Companion column ────────────────────────────────────────────── */

.wild-companion-header {
    height: 44px;
    padding: 0 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #e0e0e0;
    background: #fafaf7;
    flex-shrink: 0;
}

.wild-companion-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #4a7c3f;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
}

.wild-companion-name {
    font-size: 12px;
    font-weight: 600;
    color: #1a1a1a;
}
.wild-companion-name small {
    display: block;
    font-weight: 400;
    color: #888;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 1px;
}

.wild-companion-thread {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
}

.wild-msg {
    margin-bottom: 14px;
    font-size: 13px;
    line-height: 1.55;
    color: #1a1a1a;
}

.wild-msg-who {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #888;
    font-weight: 700;
    margin-bottom: 4px;
}
.wild-msg-who.wild-msg-who-user { color: #4a7c3f; }

.wild-msg-body { white-space: pre-wrap; word-break: break-word; }

/* Fleet-member quoted sub-message (inline reply style, faint left rule). */
.wild-msg-fleet {
    border-left: 2px solid #d4a373;
    padding: 6px 12px;
    margin: 8px 0 8px 0;
    background: #fffbf3;
    color: #444;
    font-size: 12px;
}
.wild-msg-fleet .wild-msg-who { color: #8a4a2a; }

/* Action chips proposed by the companion. */
.wild-action-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.wild-action-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #4a7c3f;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    font-family: inherit;
}
.wild-action-chip:hover { background: #3a6731; }
.wild-action-chip:disabled { background: #aaa; cursor: not-allowed; }

.wild-action-chip-glyph { font-size: 13px; line-height: 1; }

/* Inline preview of the action payload on chip hover. */
.wild-action-preview {
    margin-top: 6px;
    background: #f6f3ee;
    border-left: 2px solid #4a7c3f;
    padding: 8px 10px;
    font-family: monospace;
    font-size: 11px;
    color: #444;
    white-space: pre;
    overflow-x: auto;
    display: none;
}
.wild-action-preview.visible { display: block; }

/* ─── Companion composer (bottom of companion col) ────────────────── */

.wild-chat-composer {
    flex-shrink: 0;
    border-top: 1px solid #e0e0e0;
    background: #fff;
    padding: 12px 16px;
    display: flex;
    gap: 8px;
}
.wild-chat-input {
    flex: 1;
    border: 1px solid #d0d0d0;
    background: #fff;
    padding: 10px 12px;
    font: inherit;
    font-size: 13px;
    resize: none;
    min-height: 40px;
    max-height: 120px;
    border-radius: 2px;
}
.wild-chat-input:focus { outline: none; border-color: #4a7c3f; }

.wild-chat-send {
    background: #4a7c3f;
    color: #fff;
    border: none;
    padding: 0 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    cursor: pointer;
    border-radius: 2px;
}
.wild-chat-send:hover { background: #3a6731; }
.wild-chat-send:disabled { background: #aaa; cursor: not-allowed; }

/* ─── Action inline form (chip → form) ────────────────────────────── */

.wild-inline-form {
    margin-top: 8px;
    padding: 12px;
    background: #fafaf7;
    border: 1px solid #d4a373;
    border-radius: 2px;
}
.wild-inline-form h5 {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: #4a7c3f;
    margin: 0 0 8px 0;
    font-weight: 700;
}
.wild-inline-form .wild-form-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}
.wild-inline-form button {
    font: inherit;
    font-size: 11px;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.wild-inline-form .btn-primary {
    background: #4a7c3f;
    color: #fff;
    border: 1px solid #4a7c3f;
}
.wild-inline-form .btn-secondary {
    background: #fff;
    color: #555;
    border: 1px solid #d0d0d0;
}

/* ─── Auth gate overlay (pre-sign-in fallback) ───────────────────── */

.wild-auth-gate {
    position: fixed;
    inset: 0;
    background: rgba(250, 250, 247, 0.96);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 40px;
}
.wild-auth-gate h2 {
    font-size: 22px;
    margin-bottom: 8px;
    font-weight: 700;
}
.wild-auth-gate p {
    color: #555;
    margin-bottom: 18px;
    max-width: 420px;
    text-align: center;
}
.wild-auth-gate-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}
.wild-auth-gate-cta {
    display: inline-flex;
    align-items: center;
    background: #4a7c3f;
    color: #fff;
    border: none;
    padding: 12px 22px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0.2px;
    cursor: pointer;
    border-radius: 2px;
    text-decoration: none;
    line-height: 1;
}
.wild-auth-gate-cta:hover { background: #3a6731; color: #fff; }
.wild-auth-gate-cta-secondary {
    background: #fff;
    color: #4a7c3f;
    border: 1px solid #4a7c3f;
}
.wild-auth-gate-cta-secondary:hover {
    background: #f4f6ee;
    color: #4a7c3f;
}
.wild-auth-gate-hint {
    font-size: 11px;
    color: #888;
    margin-top: 14px;
    max-width: 380px;
    text-align: center;
}

/* ─── Responsive: collapse to one column under 880px ─────────────── */

@media (max-width: 880px) {
    .wild-main {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
    }
    .wild-journal-col { border-right: none; border-bottom: 1px solid #e0e0e0; }
    .wild-workspace-name { display: none; }
}
