/* Approdorix design system tokens */
:root {
    --ink: #171513;
    --ink-2: #2a2724;
    --ink-3: #3d3934;
    --cream: #ece8df;
    --cream-2: #e3ddd0;
    --cream-3: #d8d3c6;
    --orange: #c44b1a;
    --orange-soft: #f5e6dc;
    --muted: #8a8a82;
    --muted-2: #a8a59a;
    --ok: #3a6b3a;
    --live-on: #3a6b3a;
    --live-off: #c62828;

    --sans: 'Inter', system-ui, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; background: var(--cream); color: var(--ink); }

body {
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "ss01" on, "cv11" on;
    line-height: 1.5;
}

button { font-family: inherit; }

/* Top strip */
.topstrip {
    height: 28px;
    border-bottom: 1px solid var(--ink);
    display: flex; align-items: center;
    font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
    overflow: hidden; white-space: nowrap;
}
.topstrip .tag { background: var(--ink); color: var(--cream); padding: 0 14px; height: 100%; display: flex; align-items: center; font-weight: 700; }
.topstrip .cell { padding: 0 14px; border-right: 1px solid var(--ink); height: 100%; display: flex; align-items: center; }
.topstrip .grow { flex: 1; }

@keyframes pulse { 0%, 60% { opacity: 1; } 80% { opacity: 0.2; } 100% { opacity: 1; } }

/* Connection status, state set from Rust via data-state */
.status { padding: 0 14px; color: var(--muted); font-weight: 700; }
.status::before { content: '●'; margin-right: 6px; }
.status[data-state="open"] { color: var(--live-on); }
.status[data-state="open"]::before { animation: pulse 1.6s infinite; }
.status[data-state="closed"] { color: var(--live-off); }

/* Masthead */
.masthead { padding: 48px 56px 56px; }
.masthead .eyebrow {
    display: flex; justify-content: space-between;
    font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
}
.triple-rule { display: flex; flex-direction: column; gap: 2px; padding: 14px 0 18px; }
.triple-rule > div { height: 1px; background: var(--ink); }
.triple-rule > div:last-child { height: 4px; }
.masthead h1 {
    font-weight: 800; font-size: clamp(40px, 7vw, 88px); letter-spacing: -0.045em; line-height: 0.92;
    margin: 0; text-wrap: pretty;
}
.masthead .console { padding-top: 8px; }

/* Buttons */
.btn {
    cursor: pointer; font-family: var(--mono);
    letter-spacing: 0.14em; text-transform: uppercase; font-weight: 700;
    border: 1px solid var(--ink); background: var(--ink); color: var(--cream);
    padding: 12px 18px; font-size: 11px;
    display: inline-flex; align-items: center; gap: 10px;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.btn--secondary { background: transparent; color: var(--ink); }
.btn--secondary:hover { background: var(--ink); color: var(--cream); border-color: var(--ink); }

/* Stream panel (chat log) */
.stream { background: var(--ink); color: var(--cream); border: 1px solid var(--ink); padding: 22px; }
.stream-h {
    font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--muted-2); font-weight: 700; margin-bottom: 14px;
    display: flex; justify-content: space-between; gap: 12px;
}
.stream-body { height: 320px; overflow-y: auto; }

.stream-body:empty::before {
    content: 'No messages yet';
    font-family: var(--mono); font-size: 11px; color: var(--muted);
}

.row {
    font-family: var(--mono); font-size: 11.5px; padding: 7px 0;
    border-top: 1px solid var(--ink-2);
    display: grid; grid-template-columns: 70px 56px 1fr; gap: 12px; align-items: baseline;
}
.row:first-child { border-top: none; }
.row .ts { color: var(--muted-2); }
.row .ev { font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; font-size: 10px; }
.row .det { overflow-wrap: anywhere; }
.row--out .ev { color: var(--orange); }
.row--in .ev { color: #9ed09e; }
.row--sys .ev, .row--sys .det { color: var(--muted-2); }

/* Command field */
.field { border: 1px solid var(--ink); border-top: none; background: var(--cream); display: flex; align-items: stretch; margin: 0; }
.field-label {
    width: 110px; flex-shrink: 0; border-right: 1px solid var(--ink);
    padding: 12px; font-family: var(--mono); font-size: 10px;
    letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
    font-weight: 700; display: flex; align-items: center; background: var(--cream-2);
    transition: background 0.12s, color 0.12s;
}
.field-input {
    flex: 1; border: none; background: transparent; padding: 14px;
    font-family: var(--mono); font-size: 13px; color: var(--ink);
    outline: none; min-width: 0;
}
.field-input::placeholder { color: var(--muted); opacity: 0.7; }
.field:focus-within .field-label { background: var(--ink); color: var(--cream); }
.field .btn { border-width: 0 0 0 1px; }

@media (max-width: 700px) {
    .masthead { padding: 32px 20px 24px; }
    .topstrip .cell:nth-of-type(2) { display: none; }
    .field-label { width: auto; }
    .row { grid-template-columns: 60px 1fr; }
    .row .det { grid-column: 1 / -1; }
}
