/* Delve. Layout and theming for the text adventure shell.
 * Inherits the site palette from css/main.css, so light mode comes free.
 */

.delve-shell {
    max-width: 900px;
    margin: 0 auto;
    padding: 28px 20px 60px;
}

/* ---- Header --------------------------------------------------------------- */

.delve-head {
    text-align: center;
    margin-bottom: 22px;
}

.delve-title {
    font-size: clamp(2.2rem, 6vw, 3.2rem);
    color: var(--purple-light);
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.delve-sub {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 56ch;
    margin: 0 auto;
    line-height: 1.5;
}

/* ---- Seed bar ------------------------------------------------------------- */

.delve-seedbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.delve-seed-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.delve-seed-input {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 8px 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9rem;
    width: 190px;
}

.delve-seed-input:focus {
    outline: 2px solid var(--purple);
    outline-offset: 1px;
}

.delve-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 8px 14px;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: background var(--speed), border-color var(--speed), color var(--speed);
}

.delve-btn:hover,
.delve-btn:focus-visible {
    background: var(--purple-dim);
    border-color: var(--purple);
    color: var(--purple-light);
}

.delve-btn-primary {
    background: var(--purple);
    border-color: var(--purple);
    color: #fff;
    font-weight: 600;
}

.delve-btn-primary:hover,
.delve-btn-primary:focus-visible {
    background: var(--purple-light);
    border-color: var(--purple-light);
    color: #14101f;
}

.delve-btn-link {
    text-decoration: none;
    display: inline-block;
}

/* ---- Status bar ----------------------------------------------------------- */

.delve-status {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: 0.88rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.delve-status:empty {
    display: none;
}

.delve-stat {
    color: var(--text-muted);
    white-space: nowrap;
}

.delve-stat b {
    color: var(--text);
    font-weight: 600;
}

.delve-stat-hurt b { color: #e0603a; }
.delve-stat-warn b { color: #d9a441; }

/* ---- Transcript ----------------------------------------------------------- */

.delve-transcript {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
    height: min(58vh, 560px);
    overflow-y: auto;
    scroll-behavior: smooth;
    line-height: 1.62;
    font-size: 1rem;
}

.delve-transcript:focus-visible {
    outline: 2px solid var(--purple);
    outline-offset: 2px;
}

.delve-transcript p {
    margin: 0 0 0.85em;
}

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

/* Message kinds. Colour carries emphasis, but never meaning on its own:
   every line still reads correctly in monochrome. */

.dv-echo {
    color: var(--purple-light);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92rem;
    margin-top: 1.1em;
}

.dv-room-name {
    color: var(--purple-light);
    font-weight: 700;
    font-size: 1.08rem;
    margin-bottom: 0.25em;
    letter-spacing: 0.02em;
}

.dv-prose { color: var(--text); }
.dv-muted { color: var(--text-muted); font-size: 0.94rem; }
.dv-good  { color: #4fa96b; }
.dv-bad   { color: #e0603a; }
.dv-warn  { color: #d9a441; }
.dv-item  { color: #6aa9d9; }

.dv-map {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: pre;
    line-height: 1.25;
    color: var(--purple-light);
    margin: 0;
    font-size: 0.92rem;
}

.dv-speech {
    border-left: 2px solid var(--border);
    padding-left: 12px;
    font-style: italic;
    color: var(--text);
}

.dv-banner {
    border: 1px solid var(--purple);
    background: var(--purple-dim);
    border-radius: var(--radius);
    padding: 12px 16px;
    text-align: center;
    color: var(--purple-light);
    font-weight: 600;
    margin: 1em 0;
}

.dv-rule {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 1.2em 0;
}

/* New lines fade up as they arrive. Deliberately not a scripted typewriter:
   a text adventure prints paragraphs, and gating reading behind an animation
   is irritating the second time you see the same room. */
.dv-reveal {
    animation: dv-fade-in 0.18s ease-out both;
}

@keyframes dv-fade-in {
    from { opacity: 0; transform: translateY(2px); }
    to   { opacity: 1; transform: none; }
}

/* ---- Action chips --------------------------------------------------------- */

.delve-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 12px 0;
}

.delve-chips:empty {
    display: none;
}

.delve-chip {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
    padding: 5px 13px;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: background var(--speed), border-color var(--speed), color var(--speed);
}

.delve-chip:hover,
.delve-chip:focus-visible {
    background: var(--purple-dim);
    border-color: var(--purple);
    color: var(--purple-light);
}

.delve-chip-exit {
    color: var(--text);
    border-color: var(--purple-dim);
}

/* ---- Command input -------------------------------------------------------- */

.delve-inputrow {
    display: flex;
    gap: 8px;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 10px;
}

.delve-inputrow:focus-within {
    border-color: var(--purple);
}

.delve-prompt {
    color: var(--purple-light);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 700;
    padding-left: 4px;
}

.delve-input {
    flex: 1;
    background: transparent;
    border: 0;
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.95rem;
    padding: 8px 4px;
    min-width: 0;
}

.delve-input:focus {
    outline: none;
}

.delve-input::placeholder {
    color: var(--text-muted);
    opacity: 0.75;
}

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

.delve-help {
    margin-top: 18px;
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.6;
    text-align: center;
}

.delve-help code {
    background: var(--purple-dim);
    color: var(--purple-light);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.86em;
}

/* ---- Small screens -------------------------------------------------------- */

@media (max-width: 620px) {
    .delve-shell { padding: 18px 12px 44px; }
    .delve-transcript { height: 52vh; padding: 16px 15px; font-size: 0.97rem; }
    .delve-seed-input { width: 100%; }
    .delve-seedbar { justify-content: stretch; }
}

@media (prefers-reduced-motion: reduce) {
    .delve-transcript { scroll-behavior: auto; }
    .delve-btn, .delve-chip { transition: none; }
    .dv-reveal { animation: none; }
}
