/* Mycelium design tokens — dark theme, no pure black/white anywhere.
   Source: DESIGN.md (see story 1.1 Dev Notes for the authoritative list). */
:root {
  --bg-base: #070B0B;
  --bg-panel: #0A0F0E;

  --surface-moss: #0E1513;
  --surface-active: #17251F;
  --surface-search: #111C18;

  --line-default: #21332D;
  --line-divider: #20342C;

  --text-primary: #DDE7E1;
  --text-muted: #7D9188;
  --text-nav: #91A39B;
  --text-dim: #597066;

  --accent-mint: #78D7A0;

  --font-system: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

  --spacing-1: 4px;
  --spacing-2: 8px;
  --spacing-3: 12px;
  --spacing-4: 16px;
  --spacing-6: 24px;
  --spacing-8: 32px;

  --drawer-width: 250px;
  --inspection-width: 320px;
  --page-padding: 26px;
  --page-max-width: 1540px;

  --rounded-none: 0px;
  --rounded-panel: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-system);
  min-height: 100vh;
}

a, button, input {
  font-family: inherit;
}

.brand-wordmark {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--accent-mint);
  margin: 0;
}

.empty-state {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0;
}

/* Login screen — pre-triptych; the one place rounded.panel (8px) is
   permitted, per the token exception documented in DESIGN.md. */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-frame {
  width: 100%;
  max-width: 380px;
  padding: var(--page-padding);
}

.login-card {
  background: var(--bg-panel);
  border: 1px solid var(--line-default);
  border-radius: var(--rounded-panel);
  padding: var(--spacing-8);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-4);
}

.login-heading {
  font-size: 20px;
  font-weight: 400;
  color: var(--text-primary);
  margin: 0;
}

.login-error {
  font-size: 13px;
  color: var(--text-primary);
  background: var(--surface-active);
  border: 1px solid var(--line-default);
  border-radius: var(--rounded-panel);
  padding: var(--spacing-3);
  margin: 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-4);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-1);
}

.field label {
  font-size: 11px;
  color: var(--text-nav);
}

.field input {
  font-size: 16px;
  background: var(--surface-search);
  border: 1px solid var(--line-default);
  border-radius: var(--rounded-none);
  color: var(--text-primary);
  padding: var(--spacing-2) var(--spacing-3);
}

.field input:focus-visible,
.btn-primary:focus-visible,
.btn-link:focus-visible {
  outline: 2px solid var(--accent-mint);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent-mint);
  color: var(--bg-base);
  border: none;
  border-radius: var(--rounded-none);
  font-size: 16px;
  padding: var(--spacing-2) var(--spacing-4);
  cursor: pointer;
}

.btn-link {
  background: none;
  border: none;
  color: var(--text-nav);
  font-size: 11px;
  cursor: pointer;
  padding: 0;
}

/* Triptych shell — structural, desktop-only, square corners throughout. */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-3) var(--page-padding);
  border-bottom: 1px solid var(--line-divider);
  background: var(--bg-panel);
}

.triptych {
  display: grid;
  grid-template-columns: var(--drawer-width) 1fr var(--inspection-width);
  min-height: calc(100vh - 56px);
}

.drawer {
  background: var(--bg-panel);
  border-right: 1px solid var(--line-divider);
  padding: var(--spacing-4);
  border-radius: var(--rounded-none);
}

.results {
  background: var(--bg-base);
  padding: var(--spacing-4);
  border-radius: var(--rounded-none);
}

.inspection {
  background: var(--bg-panel);
  border-left: 1px solid var(--line-divider);
  padding: var(--spacing-4);
  border-radius: var(--rounded-none);
}

/* Search toolbar (Story 1.5) — Search Context chip + query input, visible
   and editable before and after submission (UX-DR5). */
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  padding: var(--spacing-3) var(--page-padding);
  border-bottom: 1px solid var(--line-divider);
  background: var(--bg-panel);
}

.chip {
  font-size: 11px;
  color: var(--text-primary);
  background: var(--surface-active);
  border: 1px solid var(--line-default);
  border-radius: var(--rounded-none);
  padding: var(--spacing-1) var(--spacing-3);
  white-space: nowrap;
}

.toolbar input[type="search"] {
  flex: 1;
  font-size: 14px;
  background: var(--surface-search);
  border: 1px solid var(--line-default);
  border-radius: var(--rounded-none);
  color: var(--text-primary);
  padding: var(--spacing-2) var(--spacing-3);
}

.toolbar input[type="search"]:focus-visible {
  outline: 2px solid var(--accent-mint);
  outline-offset: 2px;
}

.search-busy-indicator {
  opacity: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.search-busy-indicator.htmx-request {
  opacity: 1;
}

/* Results list (Story 1.5) — every row carries provenance: Source,
   location, freshness, availability, deep link (FR-3, UX-DR6). */
.result-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-4);
}

.result-row {
  border-bottom: 1px solid var(--line-divider);
  padding-bottom: var(--spacing-4);
}

.result-title-link {
  text-decoration: none;
  color: var(--text-primary);
  cursor: pointer;
}

.result-title {
  font-size: 15px;
  font-weight: 600;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-3);
  margin-top: var(--spacing-1);
  font-size: 11px;
  color: var(--text-muted);
}

.result-source {
  color: var(--accent-mint);
}

.result-snippet {
  font-size: 13px;
  color: var(--text-primary);
  margin: var(--spacing-2) 0;
}

.result-deeplink {
  font-size: 11px;
  color: var(--text-nav);
}

/* Inspection panel metrics (Story 1.5, AC6) — discrete labeled metrics,
   never color-only (UX-DR11). */
.inspection-heading {
  margin-bottom: var(--spacing-4);
  padding-bottom: var(--spacing-3);
  border-bottom: 1px solid var(--line-divider);
}

.inspection-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.inspection-source {
  font-size: 11px;
  color: var(--accent-mint);
  margin: var(--spacing-1) 0 0;
}

.inspection-metrics {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-4);
}

.metric dt {
  font-size: 11px;
  color: var(--text-nav);
}

.metric dd {
  margin: var(--spacing-1) 0 0;
  font-size: 13px;
  color: var(--text-primary);
}
