/* Switchyard Rails — the site's OWN rules. The design system is ds/tokens.css
   + ds/bundle.css, vendored verbatim and loaded first; this sheet loads second
   and only adds what Rails needs. Never restyle a design-system class here
   except to place it. The CSP forbids inline style, so every look a template
   needs has a class in one of the three sheets (TestEveryTemplateClassIsDefined). */

.mono, code, pre { font-family: var(--font-mono); }
code { font-size: 0.85em; background: var(--page); padding: 0.1em 0.35em; border-radius: var(--radius-sm); }
.dispatch-snippet code, pre code { background: none; padding: 0; }
.muted { color: var(--ballast); }
.small { font-size: 0.82rem; }
main a { color: var(--rail-blue); }
main a:hover { color: var(--rail-blue-press); }

/* ---- public pages ---------------------------------------------------- */
.landing-brand { display: inline-flex; align-items: center; gap: 0.6rem; }
.crumb-sep { font-weight: 400; opacity: 0.5; }
.crumb-name { font-family: var(--font-sans); font-size: 0.95rem; font-weight: 600; letter-spacing: 0; }
.landing-header-link.is-current { color: #fff; }
.landing-hero-inner.hero-grid { max-width: none; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 3rem; align-items: center; }
.hero-copy { min-width: 0; }
.landing-title, .landing-lede, .landing-h2, .landing-section-sub { margin-top: 0; }
.landing-hero.is-compact { padding: 2.5rem 0 3rem; }
.landing-hero.is-compact .landing-title { font-size: 2.2rem; }
.landing-hero.is-compact .landing-lede { margin-bottom: 0; }
.landing-flow-step code, .landing-trust-point code { font-size: 0.82em; }
.landing-ai-point code { background: rgba(255, 255, 255, 0.08); color: #e2e8f0; }
.landing-ai .landing-flow-tag { color: rgba(255, 255, 255, 0.55); }
.landing-section.is-tight { padding-top: 0; }
.landing-final-sub code { font-size: 0.9em; }

.yard-figure { margin: 0; min-width: 0; background: var(--sleeper); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: var(--radius-lg); padding: 1rem 1rem 0.6rem; }
.yard-figure svg { display: block; width: 100%; height: auto; }
.yard-caption { font-family: var(--font-mono); font-size: 0.72rem; color: rgba(255, 255, 255, 0.55); margin-top: 0.5rem; letter-spacing: 0.02em; }
@keyframes rails-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.yard-signal { animation: rails-pulse 1.5s ease-in-out infinite; }

.install-card { padding: 2rem; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; align-items: start; }
.install-card .landing-h2 { font-size: 1.5rem; }
.install-card .landing-section-sub { margin-bottom: 1rem; }
.eyebrow-on-light { color: var(--signal-green); }
.install-cmd { font-size: 0.82rem; padding: 1rem; }
.install-note { font-family: var(--font-mono); font-size: 0.75rem; color: var(--ballast); margin-top: 0.5rem; }
.install-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 2rem; align-items: start; }
.install-col { display: flex; flex-direction: column; gap: 1.5rem; min-width: 0; }
.install-block { padding: 1.75rem; }
.install-block .section-title { font-size: 1.2rem; margin-bottom: 0.5rem; }
.install-block p { color: var(--ballast); margin-bottom: 1rem; }
.install-block p:last-child { margin-bottom: 0; }
.install-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.install-head .section-title { margin-bottom: 0; }
.release-table { margin-top: 1rem; }
.release-assets { font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.7; }
.release-assets a { display: block; }
.alert.is-flush { margin: 0; }

/* ---- the operator shell ------------------------------------------------ */
.nav-brand { color: var(--surface); }
.nav-links a.is-current { opacity: 1; font-weight: 600; }
.nav-right { display: flex; align-items: center; gap: 1rem; }
.nav-meta { font-family: var(--font-mono); font-size: 0.72rem; color: rgba(255, 255, 255, 0.6); white-space: nowrap; }
.nav-signout { background: none; border: 1px solid rgba(255, 255, 255, 0.3); color: var(--surface); border-radius: var(--radius); padding: 0.3rem 0.7rem; font: inherit; font-size: 0.8rem; cursor: pointer; }
.nav-signout:hover { background: rgba(255, 255, 255, 0.08); }
.page-main { flex: 1 0 auto; width: 100%; padding-bottom: 2rem; }
.page-sub { color: var(--ballast); font-size: 0.88rem; margin-top: 0.2rem; }
.page-crumbs { font-size: 0.82rem; color: var(--ballast); margin-bottom: 0.35rem; }
.page-header-bar.is-top { align-items: flex-start; }
.page-header h1.build-title { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.page-header-actions { flex-wrap: wrap; }
.page-header-actions form { display: inline; }
.site-footer.is-flush { margin-top: 0; }
.site-footer-inner { flex-wrap: wrap; row-gap: 0.25rem; }
.section-title.is-spaced { margin-top: 2rem; }

.dash-stat-num.is-run { color: var(--rail-blue); }
.dash-stat-num.is-pass { color: var(--signal-green); }
.dash-stat-num.is-fail { color: var(--signal-red); }

.pipeline-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.pipeline-card { display: flex; flex-direction: column; gap: 0.4rem; padding: 1rem 1.25rem; color: var(--steel); }
.pipeline-card:hover { text-decoration: none; box-shadow: var(--shadow-lift-sm); }
.pipeline-card-name { font-weight: 700; color: var(--steel); }
.pipeline-card-repo { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ballast); overflow-wrap: anywhere; }
.pipeline-card-latest { font-size: 0.85rem; color: var(--ballast); display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.data-table tbody tr:hover td { background: var(--coal); }
.data-table td.is-num { font-family: var(--font-mono); font-size: 0.82rem; white-space: nowrap; }
.data-table td.is-when { color: var(--ballast); white-space: nowrap; }
.cell-sub { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ballast); }
.cell-msg { color: var(--steel); }
.cell-tags { max-width: 280px; }
.empty-row { text-align: center; color: var(--ballast); padding: 1.5rem; }
.tag { display: inline-block; font-family: var(--font-mono); font-size: 0.72rem; background: var(--page); color: #475569; border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: 0.05rem 0.4rem; margin: 0.1rem 0.15rem 0.1rem 0; }
.inline-form { display: inline; }
.filters { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.filters input { height: 34px; padding: 0 0.8rem; border: 1px solid var(--border-input); border-radius: var(--radius); font: inherit; font-size: 0.85rem; }
.new-build { margin-bottom: 1.5rem; padding: 1rem 1.25rem; }
.new-build summary { cursor: pointer; font-weight: 600; }
.new-build form { max-width: 480px; margin-top: 1rem; }

/* state badges: one class per state, so colour is never the only signal —
   the word is printed in the badge */
.st-passed, .st-connected { background: var(--pill-ok-bg); color: var(--pill-ok-ink); }
.st-failed, .st-broken, .st-lost { background: var(--pill-bad-bg); color: var(--pill-bad-ink); }
.st-running, .st-assigned, .st-canceling, .st-waiting, .st-busy { background: var(--chip-new-bg); color: var(--chip-new-ink); }
.st-blocked, .st-paused, .st-soft { background: var(--pill-warn-bg); color: var(--pill-warn-ink); }
.st-scheduled, .st-pending, .st-idle { background: var(--pill-muted-bg); color: var(--pill-muted-ink); }
.st-canceled, .st-skipped, .st-disconnected { background: var(--chip-archived-bg); color: var(--chip-archived-ink); }

/* ---- build detail ------------------------------------------------------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) var(--detail-rail); gap: 1.5rem; align-items: start; max-width: none; }
.detail-main, .detail-rail { display: flex; flex-direction: column; gap: 1.5rem; min-width: 0; }
.build-msg { color: var(--ballast); font-size: 0.88rem; margin-top: 0.35rem; }
.jobs-card { overflow: hidden; }
.jobs-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 1rem; border-bottom: 1px solid #e5e7eb; }
.jobs-head .section-title { margin: 0; }
.job { border-bottom: 1px solid var(--border-soft); }
.job:last-child { border-bottom: 0; }
.job[open] { background: var(--accent-soft); }
.job-line { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; padding: 0.8rem 1rem; cursor: pointer; list-style: none; }
.job-line::-webkit-details-marker { display: none; }
.job-label { font-weight: 600; }
.job-group { color: var(--ballast); }
.job-meta { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ballast); }
.job-time { margin-left: auto; font-family: var(--font-mono); font-size: 0.82rem; }
.job-body { padding: 0 1rem 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.job-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.job-actions form { display: inline; }
.job-reason { color: var(--ballast); font-size: 0.88rem; }
.job-cmd { margin: 0; font-size: 0.78rem; }
.job-log { margin: 0; background: var(--sleeper); color: #e2e8f0; font-family: var(--font-mono); font-size: 0.78rem; line-height: 1.55; padding: 1rem; border-radius: var(--radius); max-height: 70vh; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.job-log:empty { display: none; }
.job-block { padding: 0.8rem 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.job-block form { max-width: 480px; }
.wait-line { text-align: center; font-family: var(--font-mono); font-size: 0.72rem; color: var(--ballast); padding: 0.3rem; border-bottom: 1px dashed var(--rule); }
.annotation { padding: 0.8rem 1rem; border-radius: var(--radius); border: 1px solid var(--rule); background: var(--surface); font-size: 0.9rem; }
.annotation p, .annotation ul, .annotation pre, .annotation h3, .annotation h4, .annotation h5, .annotation h6 { margin: 0.3rem 0; }
.annotation ul { padding-left: 1.2rem; }
.a-default { border-color: var(--rule); }
.a-info { background: #f0f9ff; border-color: #bae6fd; }
.a-success { background: #f0fdf4; border-color: #bbf7d0; }
.a-warning { background: var(--accent-amber-soft); border-color: #fde68a; }
.a-error { background: var(--accent-red-soft); border-color: #fecaca; }
.rail-card { padding: 1rem 1.25rem; }
.rail-card .section-title { font-size: 0.95rem; margin-bottom: 0.5rem; }
.rail-card .section-title.is-spaced { margin-top: 1rem; }
.rail-row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.45rem 0; border-bottom: 1px solid var(--border-soft); font-size: 0.85rem; }
.rail-row:last-child { border-bottom: 0; }
.rail-k { color: var(--ballast); flex: none; overflow-wrap: anywhere; }
.rail-v { text-align: right; min-width: 0; overflow-wrap: anywhere; }
.rail-note { font-size: 0.78rem; color: var(--ballast); margin-top: 0.6rem; }

/* ---- agents ------------------------------------------------------------- */
.agents-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.5rem; align-items: start; }
.upgrade-version { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.upgrade-version .mono { font-size: 1.1rem; font-weight: 700; }
.rail-card p { font-size: 0.85rem; color: var(--ballast); margin-top: 0.6rem; }

/* ---- sign-in ------------------------------------------------------------ */
.auth-logo { display: inline-flex; align-items: center; }
.auth-crumb { font-family: var(--font-sans); font-size: 1.2rem; font-weight: 600; margin-left: 0.6rem; opacity: 0.85; }
.auth-card h2 { margin-top: 0; }
.auth-card .form-group input { font-family: var(--font-mono); }

/* ---- log colours (written by app.js) ------------------------------------ */
.ansi-bold { font-weight: 700; }
.ansi-30 { color: #64748b; } .ansi-31 { color: #f87171; } .ansi-32 { color: #34d399; } .ansi-33 { color: #fbbf24; }
.ansi-34 { color: #60a5fa; } .ansi-35 { color: #c084fc; } .ansi-36 { color: #22d3ee; } .ansi-37 { color: #e2e8f0; }
.ansi-90 { color: #94a3b8; }

@media (max-width: 900px) {
  .landing-hero-inner.hero-grid, .install-grid, .install-card { grid-template-columns: 1fr; }
  .landing-flow, .landing-trust-points { grid-template-columns: repeat(2, 1fr); }
  .landing-ai-inner { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .detail-grid, .agents-grid { grid-template-columns: 1fr; }
  .nav-links { flex-wrap: wrap; }
  .nav-meta { display: none; }
}
@media (max-width: 560px) {
  .landing-flow, .landing-trust-points { grid-template-columns: 1fr; }
  .landing-title { font-size: 2rem; }
  .landing-header-nav { gap: 0.75rem; flex-wrap: wrap; justify-content: flex-end; }
  .data-table th, .data-table td { padding: 0.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  .yard-signal { animation: none; }
}
