/* ==========================================================================
   Home — the AOS Command Center (identity: RECORDER).

   Promoted to the default Home on 2026-07-07 after the ?dir= identity pass.
   The accent unification now lives in the global token layer (css/tokens.css,
   :root) so it reaches the whole app — page content AND shell chrome (active
   nav, Capture, FAB, focus rings). The rules below are the page-scoped
   structural / typographic identity that must NOT leak onto other routes;
   they are keyed on `.home-page`, the Home wrapper (see js/pages/home.js).

   Machine-speech typography, a per-zone freshness datum, designed null
   grammar, per-zone source provenance, and the flight-recorder liveness tape
   are all here. The two rejected directions (Ledger, Manuscript) and the
   ?dir= toggle layer live in git history — this file carries only Recorder.
   ========================================================================== */

/* ==========================================================================
   1. MACHINE-SPEECH TYPOGRAPHY
   Every machine-EMITTED field (timestamps, cron strings, counts, statuses,
   ids) is set in mono + tabular figures; human-authored text (task titles,
   prose) stays proportional. The product's two voices stop sharing one
   typeface.
   ========================================================================== */

/* Tabular figures everywhere a number can change, so digits never jitter. */
.home-page .row-meta,
.home-page .pill-mono,
.home-page .aos-caption,
.home-page .stat-tile-value,
.home-page .stat-tile-delta {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* Counts in a zone subtitle ("6 open") are machine-emitted -> mono tabular. */
.home-page .section-header-subtitle {
  font-family: var(--aos-font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

/* Status / enum pills ("past due", "job stale", command states) are
   machine-emitted labels -> mono. (Quiet human-tagged pills opt out.) */
.home-page .pill:not(.home-human) {
  font-family: var(--aos-font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

/* Fleet row primaries are job·machine IDENTIFIERS, not prose -> mono. */
.home-page [data-zone="fleet"] .row-primary {
  font-family: var(--aos-font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

/* 0.02em tracking on mono meta reads as instrument type, not code. */
.home-page .row-meta { letter-spacing: 0.02em; }

/* MUST-FIX A (blind critique, 2026-07-07): job·machine identifiers were
   clipping ("snapshot · m…") at boxed desktop widths — the mono type is
   wider than proportional, and the row's auto-width meta + trailing columns
   were squeezing the 1fr primary column below what the identifier needs. The
   trailing schedule pill is the element that yields: it's redundant on this
   row (the fleet drill-down already states Schedule as its own fact row), so
   hiding it here loses no information and hands the freed column straight to
   the primary identifier at every width. */
.home-page [data-zone="fleet"] .row-trailing { display: none; }

/* ==========================================================================
   2. FRESHNESS AS A VISIBLE DIMENSION
   Every zone carries a quiet "as of" age datum; past the stale threshold it
   shifts tone (a fact the product exists to state honestly).
   ========================================================================== */

.home-freshness {
  font-family: var(--aos-font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--aos-text-tertiary);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.home-freshness[data-fresh="stale"] { color: var(--aos-status-warning); }
.home-freshness[data-fresh="unknown"] { color: var(--aos-status-warning); }
.home-freshness .home-freshness-tick {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--aos-status-success);
  flex: 0 0 auto;
}
.home-freshness[data-fresh="stale"] .home-freshness-tick,
.home-freshness[data-fresh="unknown"] .home-freshness-tick { background: var(--aos-status-warning); }

/* ==========================================================================
   3. DESIGNED NULL GRAMMAR (Today zone)
   A null is a first-class datum with its SOURCE and REASON shown, not a
   generic gray shrug.
   ========================================================================== */

.home-null {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 14px 16px;
  border-left: 3px solid var(--aos-border-strong);
}
.home-null-mark {
  font-family: var(--aos-font-mono);
  color: var(--aos-text-disabled);
  font-size: 13px;
}
.home-null-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.home-null-reason { font-size: 13px; color: var(--aos-text-secondary); }
.home-null-source {
  font-family: var(--aos-font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--aos-text-tertiary);
}

/* ==========================================================================
   4. PER-ZONE SOURCE PROVENANCE (grafted from Manuscript)
   A quiet real vault path per zone, rendered favicon-of-origin (doc glyph +
   path), NOT a verification badge (taste-log 2026-07-04 provenance rule).
   ========================================================================== */

.home-provenance {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-family: var(--aos-font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--aos-text-tertiary);
}
.home-provenance svg { color: var(--aos-text-disabled); flex: 0 0 auto; }

/* ==========================================================================
   5. FLIGHT-RECORDER LIVENESS TAPE (Anduril-restrained)
   A tick strip of the last-N expected fire windows + a next-expected-fire
   countdown. Real run/heartbeat data only; the tape renders ONLY windows
   around fires that actually happened (js/pages/home.js buildLivenessLane).
   ========================================================================== */

.home-liveness {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 16px 8px 32px;   /* aligns under the fleet row body, past the stripe+dot */
  flex-wrap: wrap;
}
.home-ticks { display: inline-flex; gap: 3px; align-items: center; }
.home-tick {
  width: 8px; height: 14px; border-radius: 1px;
  background: var(--aos-bg-chip);          /* empty window (no fire recorded) */
}
.home-tick[data-hit="hit"]   { background: var(--aos-status-success); }   /* a landed fire */
.home-tick[data-hit="armed"] { background: var(--dir-armed); }            /* the live/armed edge */
.home-tick[data-hit="miss"]  { background: color-mix(in srgb, var(--aos-status-error) 55%, var(--aos-bg-chip)); }
.home-countdown {
  font-family: var(--aos-font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--aos-text-tertiary);
}
.home-countdown[data-armed="1"] { color: var(--dir-armed); }
.home-liveness-empty {
  font-family: var(--aos-font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--aos-text-disabled);
}

/* The armed tick is the ONLY thing allowed to move — a slow compositor-only
   breathing pulse marking "this is live". opacity only (GPU composited). */
@keyframes home-armed-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }
.home-tick[data-hit="armed"] {
  animation: home-armed-pulse 2.4s ease-in-out infinite;
}

/* Odometer: the count-up target holds a fixed min-width in ch so the reflow
   the tween would otherwise cause never happens (tabular figures + min-width). */
.home-odometer { display: inline-block; text-align: right; font-variant-numeric: tabular-nums; }

/* ==========================================================================
   6. MOBILE — keep the job·machine identifier whole
   The row primitive is `auto 1fr auto auto` (leading · body · meta · trailing).
   A degraded row's meta ("last result: failed", "overdue · N missed fires") is
   long mono text and, as its own auto grid column, claims its full width — at
   375px that starves the 1fr body and the IDENTIFIER ellipsizes ("snapshot ·
   m…"), the one thing MUST-FIX A protects. Below 767px, drop the fleet row's
   meta onto its own line under the identifier so the identifier always gets
   the full column and never truncates. Scoped to Home's fleet rows only.
   ========================================================================== */
@media (max-width: 767px) {
  .home-page [data-zone="fleet"] .row {
    grid-template-columns: auto 1fr;
    row-gap: 2px;
  }
  .home-page [data-zone="fleet"] .row .row-meta {
    grid-column: 2 / -1;
    white-space: normal;
  }
}

/* ==========================================================================
   7. REDUCED MOTION — non-negotiable
   Disables the armed-tick pulse; the odometer count-up lands on its final
   value immediately (handled in js/pages/home.js animateOdometers).
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .home-tick[data-hit="armed"] { animation: none; }
}
