/* ============================================================
   shell.css — the one consistent left rail for Halcyon (paired with shell.js).
   =================================================================
   The rail markup is injected by shell.js into the page's
   <aside id="halcyon-rail"> placeholder (shell.js also adds .ti-shell-nav).
   Every page links THIS stylesheet, so the rail looks identical surface
   to surface and repaints by Datum token alone (light / dark via theme.js).

   Structure (matches shell.js):
     Overview deck   — pinned above the rail groups (entry point)
     Workspace       — Get started · Boundary · Flow (Flow is the central tool)
     Analysis        — Signals to action · Proof map · Evidence flow
     Sharing         — Shared view · Result packet (gold result glyph)
     More            — Value model · Source library (localStorage open state)

   One change from the shared chassis: Get started leads the Workspace group
   because onboarding is the centerpiece of this demo.

   Layout contract: the rail occupies the 248px column of .halcyon-shell
   (grid-template-columns: 248px minmax(0,1fr)). Under 980px the grid
   collapses to one column and the rail becomes a horizontal top strip.
   The rail is NEVER hidden — navigation stays reachable at 375px.

   All colors are Datum tokens; nothing hard-codes a hex except the avatar
   ink that must ride on the solid accent fill. Honors prefers-reduced-motion.
   ============================================================ */

/* The injected rail container (shell.js sets .ti-shell-nav on #halcyon-rail).
   The page element may also carry the legacy .halcyon-rail class; the inner
   .ti-rail owns padding + sticky, so the container resets its own so they
   don't compound (works whichever class the element carries). */
.ti-shell-nav {
  align-self: stretch;
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-sizing: border-box;
  min-width: 0;
  padding: 0;
  position: static;
  min-height: 0;
}

.ti-rail {
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 22px 16px 20px;
  box-sizing: border-box;
}

.ti-rail-brand {
  font-family: var(--display);
  font-size: 19px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
  padding: 0 8px 6px;
  border-bottom: none;
}

/* the user card shows a ROLE LABEL only — never a founder name */
.ti-rail-who {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px 14px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.ti-rail-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #06101f;                 /* dark ink rides on the solid accent fill */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.ti-rail-who-name { font-size: 14px; font-weight: 600; color: var(--text); }
.ti-rail-who-role { font-size: 11.5px; color: var(--text-dim); }

/* view-density toggle (Guided / Visual / Report) lives in the rail */
.ti-viewtoggle {
  display: flex;
  gap: 4px;
  padding: 6px 4px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.ti-viewtoggle button {
  flex: 1;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 0;
  cursor: pointer;
  transition: color .14s ease, border-color .14s ease, background .14s ease;
}
.ti-viewtoggle button.is-on {
  color: var(--accent-deep);
  background: var(--accent-pale);
  border-color: var(--border-accent);
}

/* Overview deck — pinned above the groups as the entry point */
.ti-rail-deck { margin-bottom: 10px; }
.ti-rail-deck .ti-rail-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-weight: 600;
  color: var(--text);
}
.ti-rail-deck .ti-rail-item:hover { border-color: var(--border-accent); }
.ti-rail-deck .ti-rail-item.is-active {
  background: var(--accent-pale);
  color: var(--accent-deep);
  border-color: var(--border-accent);
  box-shadow: inset 2px 0 0 var(--accent);
}

/* labeled groups (Workspace / Analysis / Sharing) */
.ti-rail-group { display: flex; flex-direction: column; gap: 2px; }
.ti-rail-group + .ti-rail-group { margin-top: 13px; }
.ti-rail-group-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--text-dimmer);
  padding: 2px 12px 5px;
}

/* one rail row */
.ti-rail-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 14.5px;
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: none;
  transition: background .14s ease, color .14s ease;
}
.ti-rail-item:hover { background: var(--surface-2); color: var(--text); border-bottom: none; }
.ti-rail-item.is-active {
  background: var(--accent-pale);
  color: var(--accent-deep);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent);
}

/* is-core glyph (the central builder) gets the single hero accent */
.ti-rail-item.is-core .ti-rail-ico { color: var(--accent); opacity: 1; }
/* is-result glyph (the deliverable) carries the one allowed gold accent */
.ti-rail-item.is-result .ti-rail-ico { color: var(--gold); opacity: 1; }

.ti-rail-ico {
  width: 22px;
  text-align: center;
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--text-dimmer);
}
.ti-rail-item.is-active .ti-rail-ico { color: var(--accent-deep); opacity: 1; }
.ti-rail-label { min-width: 0; }

/* "More" disclosure (open state persisted by shell.js in localStorage) */
.ti-rail-more { margin-top: 8px; }
.ti-rail-more-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dimmer);
  border-radius: 9px;
}
.ti-rail-more-toggle:hover { background: var(--surface-2); }
.ti-rail-chev { transition: transform .18s ease; font-family: var(--mono); font-size: 11px; }
.ti-rail-more.is-open .ti-rail-chev { transform: rotate(180deg); }
.ti-rail-more-list { display: none; flex-direction: column; gap: 2px; margin-top: 2px; }
.ti-rail-more.is-open .ti-rail-more-list { display: flex; }

/* short, in-flow rail footer (the boundary reminder) */
.ti-rail-foot {
  margin-top: auto;
  padding: 14px 12px 4px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-dim);
}
.ti-rail-foot strong {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin-bottom: 4px;
}

/* ============================================================
   Responsive: collapse the .halcyon-shell grid + rail to a top strip.
   The pages use .halcyon-shell (248px + minmax(0,1fr)). At <=980px the
   rail becomes a horizontal wrap; quiet rail furniture hides, but the
   navigation rows themselves STAY VISIBLE down to the smallest screen
   (no display:none on the rail — the earlier halcyon.css rule hid it at
   720px, which left phones with no nav; this is the corrected contract).
   ============================================================ */
@media (max-width: 980px) {
  .halcyon-shell { grid-template-columns: minmax(0, 1fr); }

  .ti-shell-nav { border-right: none; border-bottom: 1px solid var(--border); }
  .ti-rail {
    position: static;
    max-height: none;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 12px 14px;
  }
  /* hide the quiet furniture so the strip reads as a nav bar, keep the rows */
  .ti-rail-who,
  .ti-rail-foot,
  .ti-rail-group-label,
  .ti-viewtoggle { display: none; }
  .ti-rail-brand { padding: 0 8px 0 0; }
  .ti-rail-deck { margin-bottom: 0; }
  .ti-rail-group { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .ti-rail-group + .ti-rail-group { margin-top: 0; }
  .ti-rail-more { margin-top: 0; }
  .ti-rail-more-list { width: 100%; }
  .ti-rail-item { font-size: 13.5px; padding: 8px 11px; }
}

/* phone: the strip stays a wrapping nav — never hidden. Tighten only. */
@media (max-width: 560px) {
  .ti-rail { gap: 4px; padding: 10px 12px; }
  .ti-rail-item { font-size: 13px; padding: 7px 10px; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .ti-rail-item,
  .ti-rail-chev,
  .ti-rail-more-toggle,
  .ti-viewtoggle button { transition: none; }
}
