/* CONNECT_LIVE_OPERATIONS_V1 — the #lifecycle operating theatre.
 *
 * One canvas, three reading levels: work arriving on the left, Connect
 * deciding and one relationship progressing in the centre, and what the
 * business gets back on the right, with quieter concurrent jobs along the
 * bottom. Nothing here invents a colour, a radius or an easing curve: every
 * value below resolves to a landing-page token, so the section inherits Day
 * and Dark without a second palette.
 *
 * Motion is CSS transition only, driven by classes the controller toggles on a
 * single beat. There is no animation library, no requestAnimationFrame loop,
 * and nothing animates a layout property.
 */

.lops {
  --lops-gap: 18px;
  --lops-ink-soft: color-mix(in srgb, var(--ink) 62%, transparent);
  --lops-face: color-mix(in srgb, var(--surface-2) 74%, transparent);
  --lops-hair: color-mix(in srgb, var(--line) 82%, transparent);
  --lops-live: var(--green);
  --lops-wait: var(--amber);
  margin-top: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 90% at 50% -20%, color-mix(in srgb, var(--accent) 6%, transparent), transparent 62%),
    var(--surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

/* ------------------------------------------------------------- status bar */

.lops-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 15px 22px;
  border-bottom: 1px solid var(--lops-hair);
  background: color-mix(in srgb, var(--surface-2) 52%, transparent);
}
.lops-state {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--ink);
}
.lops-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lops-live);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--lops-live) 44%, transparent);
  transition: box-shadow .9s var(--ease), background .3s var(--ease);
}
.lops.is-beating .lops-pulse { box-shadow: 0 0 0 6px color-mix(in srgb, var(--lops-live) 0%, transparent); }
.lops.is-paused .lops-pulse { background: var(--muted); }
.lops-note {
  margin: 0 auto 0 0;
  font-size: 10.5px;
  font-weight: 650;
  color: var(--muted);
  letter-spacing: .01em;
}
.lops-toggle {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--surface) 76%, transparent);
  color: var(--ink);
  font: inherit;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.lops-toggle:hover { background: var(--surface-2); border-color: var(--accent); }
.lops-toggle-glyph {
  width: 9px;
  height: 10px;
  flex: none;
  background: currentColor;
  /* two bars = pause; the controller swaps the clip for a play triangle. */
  clip-path: polygon(0 0, 33% 0, 33% 100%, 0 100%, 0 0, 67% 0, 100% 0, 100% 100%, 67% 100%, 67% 0);
}
.lops.is-paused .lops-toggle-glyph { clip-path: polygon(0 0, 100% 50%, 0 100%); }

/* ------------------------------------------------------------ the canvas */

.lops-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.36fr) minmax(0, 0.82fr);
  gap: var(--lops-gap);
  padding: 22px;
}
.lops-col { min-width: 0; display: grid; gap: 12px; align-content: start; }
.lops-col-head {
  margin: 0;
  font-size: 9.5px;
  font-weight: 850;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------------------------------------------------- left: arriving work */

.lops-lanes { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.lops-lane {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--lops-hair);
  border-radius: 14px;
  background: var(--lops-face);
  transition: border-color .32s var(--ease), background .32s var(--ease), transform .32s var(--ease);
}
.lops-lane.is-active {
  border-color: color-mix(in srgb, var(--accent) 52%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  transform: translateX(2px);
}
.lops-lane-icon {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  color: var(--lops-ink-soft);
  transition: background .32s var(--ease), color .32s var(--ease);
}
.lops-lane.is-active .lops-lane-icon { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.lops-lane-icon svg { width: 15px; height: 15px; }
.lops-lane-body { display: grid; gap: 2px; min-width: 0; }
.lops-lane-body b { font-size: 12px; font-weight: 800; letter-spacing: -.01em; }
.lops-lane-body span {
  font-size: 10px;
  color: var(--muted);
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .32s var(--ease);
}
.lops-lane.is-active .lops-lane-body span { color: var(--ink); }
.lops-lane-pip {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ink) 18%, transparent);
  transition: background .32s var(--ease), transform .32s var(--ease);
}
.lops-lane.is-active .lops-lane-pip { background: var(--lops-live); transform: scale(1.25); }

/* --------------------------------------------------- centre: Connect core */

.lops-core {
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--line));
  border-radius: 18px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, var(--surface)), var(--surface));
  padding: 14px 16px 15px;
  display: grid;
  gap: 11px;
}
.lops-core-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lops-core-name { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 850; letter-spacing: -.015em; }
.lops-core-name img { width: 20px; height: 20px; }
.lops-core-badge {
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--green);
  padding: 4px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--green) 12%, transparent);
  transition: color .3s var(--ease), background .3s var(--ease);
}
.lops.is-holding .lops-core-badge { color: var(--lops-wait); background: color-mix(in srgb, var(--lops-wait) 14%, transparent); }

/* Understand -> Decide -> Act, the one sentence the core has to say. */
.lops-think { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.lops-think li {
  list-style: none;
  padding: 8px 6px;
  text-align: center;
  border-radius: 11px;
  border: 1px solid var(--lops-hair);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
  color: var(--muted);
  transition: color .3s var(--ease), border-color .3s var(--ease), background .3s var(--ease);
}
.lops-think li.is-on {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--accent) 48%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}
.lops-guards { display: flex; flex-wrap: wrap; gap: 6px; }
.lops-guard {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  transition: color .3s var(--ease), background .3s var(--ease);
}
.lops-guard.is-on { color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); }

/* The primary event: cause -> action -> result, one line each. */
.lops-focus {
  border: 1px solid var(--lops-hair);
  border-radius: 16px;
  background: var(--surface);
  padding: 15px 16px;
  display: grid;
  gap: 11px;
  min-height: 150px;
  align-content: start;
}
.lops-focus-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lops-who { display: grid; gap: 2px; min-width: 0; }
.lops-who b { font-size: 13px; font-weight: 850; letter-spacing: -.015em; }
.lops-who span { font-size: 10px; color: var(--muted); font-weight: 650; }
.lops-chan {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 9.5px;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 5px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  white-space: nowrap;
}
.lops-chan svg { width: 12px; height: 12px; }

.lops-line { margin: 0; display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.lops-line dt {
  font-size: 8.5px;
  font-weight: 850;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
}
.lops-line dd {
  margin: 0;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: -.01em;
  color: var(--ink);
  transition: opacity .28s var(--ease), transform .28s var(--ease);
}
.lops-line dd.is-swap { opacity: 0; transform: translateY(5px); }
.lops-result { color: var(--green); }
.lops.is-holding .lops-result { color: var(--lops-wait); }

/* The relationship rail: where this one story has got to. */
.lops-stages { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.lops-stage {
  flex: 1 1 0;
  min-width: 0;
  display: grid;
  gap: 6px;
  justify-items: center;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .02em;
  color: var(--muted);
  text-align: center;
  transition: color .34s var(--ease);
}
.lops-stage i {
  display: block;
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 11%, transparent);
  transition: background .34s var(--ease);
}
.lops-stage.is-done { color: var(--lops-ink-soft); }
.lops-stage.is-done i { background: color-mix(in srgb, var(--green) 52%, transparent); }
.lops-stage.is-now { color: var(--ink); }
.lops-stage.is-now i { background: var(--accent); }

/* ---------------------------------------------- right: what comes back out */

.lops-slot {
  border: 1px solid var(--lops-hair);
  border-radius: 14px;
  background: var(--lops-face);
  padding: 11px 13px;
  display: grid;
  gap: 4px;
  transition: border-color .32s var(--ease), background .32s var(--ease);
}
.lops-slot-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 8.5px;
  font-weight: 850;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
}
.lops-slot-head svg { width: 12px; height: 12px; color: var(--muted); transition: color .32s var(--ease); }
.lops-slot b {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -.01em;
  transition: opacity .28s var(--ease), transform .28s var(--ease);
}
.lops-slot b.is-swap { opacity: 0; transform: translateY(4px); }
.lops-slot small { font-size: 10px; color: var(--muted); font-weight: 650; }
.lops-slot.is-fresh { border-color: color-mix(in srgb, var(--green) 44%, transparent); background: color-mix(in srgb, var(--green) 7%, var(--surface)); }
.lops-slot.is-fresh .lops-slot-head svg { color: var(--green); }
.lops-slot.is-waiting { border-color: color-mix(in srgb, var(--lops-wait) 52%, transparent); background: color-mix(in srgb, var(--lops-wait) 9%, var(--surface)); }
.lops-slot.is-waiting .lops-slot-head svg,
.lops-slot.is-waiting b { color: var(--lops-wait); }

/* -------------------------------------------------- bottom: quiet parallel */

.lops-rail-wrap { border-top: 1px solid var(--lops-hair); padding: 14px 22px 18px; background: color-mix(in srgb, var(--surface-2) 34%, transparent); }
.lops-rail-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.lops-rail { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.lops-job {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 9px 11px;
  border: 1px solid var(--lops-hair);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  opacity: 1;
  transition: opacity .34s var(--ease), transform .34s var(--ease), border-color .34s var(--ease);
}
.lops-job.is-entering { opacity: 0; transform: translateY(6px); }
.lops-job.is-leaving { opacity: 0; transform: translateY(-5px); }
.lops-job-icon { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--lops-ink-soft); }
.lops-job-icon svg { width: 12px; height: 12px; }
.lops-job-body { display: grid; gap: 1px; min-width: 0; }
.lops-job-body b { font-size: 11px; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lops-job-body span { font-size: 9.5px; color: var(--muted); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lops-job.is-done { border-color: color-mix(in srgb, var(--green) 40%, transparent); }
.lops-job.is-done .lops-job-icon { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.lops-job.is-wait { border-color: color-mix(in srgb, var(--lops-wait) 40%, transparent); }
.lops-job.is-wait .lops-job-icon { background: color-mix(in srgb, var(--lops-wait) 14%, transparent); color: var(--lops-wait); }

/* The narrative a screen reader gets instead of a stream of live events. */
.lops-sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------- tablet */
/* Not the desktop three-column squeezed: the journey takes the main area,
 * the core sits beside it, and the outcomes become one row underneath. */
@media (max-width: 1080px) {
  .lops-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 18px; }
  .lops-core-col { grid-column: 1 / -1; order: 1; }
  .lops-intake { order: 2; }
  .lops-ledger { order: 3; }
  .lops-ledger { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .lops-ledger .lops-col-head { grid-column: 1 / -1; }
  .lops-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lops-rail li:nth-child(3) { display: none; }
}

/*  A tablet keeps the two-column arrangement: stacking it into one column made
 *  the canvas taller than the tablet viewport, which is the very thing this
 *  layer exists to prevent. One column is for a phone. */
@media (max-width: 700px) {
  .lops-grid { grid-template-columns: minmax(0, 1fr); }
  .lops-intake, .lops-ledger { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lops-intake .lops-col-head, .lops-ledger .lops-col-head { grid-column: 1 / -1; }
}

/* ------------------------------------------------------------- mobile */
/* A vertical operating flow, not a diagram shrunk to a phone: status, the one
 * task Connect is on, where the relationship has got to, then two quiet jobs. */
@media (max-width: 640px) {
  .lops { margin-top: 26px; border-radius: var(--radius); }
  .lops-bar { padding: 12px 15px; gap: 10px; }
  .lops-note { flex: 1 1 100%; order: 3; margin: 0; }
  .lops-toggle { margin-left: auto; }
  .lops-grid { padding: 15px; gap: 13px; grid-template-columns: minmax(0, 1fr); }
  .lops-intake, .lops-ledger { grid-template-columns: minmax(0, 1fr); }
  /* Channels become a compact strip: the lane list is the one thing that does
   * not survive the narrow column as a list of rows. */
  .lops-lanes { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  .lops-lane { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; gap: 5px; padding: 9px 6px; }
  .lops-lane-pip { position: absolute; }
  .lops-lane { position: relative; }
  .lops-lane-pip { top: 8px; right: 8px; }
  .lops-lane-body span { display: none; }
  .lops-focus { min-height: 0; padding: 13px 14px; }
  .lops-line { grid-template-columns: 54px minmax(0, 1fr); gap: 8px; }
  .lops-line dd { font-size: 12.5px; }
  .lops-stage { font-size: 0; gap: 0; }
  .lops-stage i { height: 4px; }
  .lops-stage.is-now { font-size: 9px; gap: 5px; }
  .lops-ledger .lops-slot:nth-of-type(n+4) { display: none; }
  .lops-rail-wrap { padding: 12px 15px 15px; }
  .lops-rail { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .lops-rail li:nth-child(3) { display: none; }
}

/* --------------------------------------------------------- reduced motion */
/* The landing page already stops every transition globally here. What this
 * block has to do is make sure the *stopped* state is a complete one: the
 * controller renders a fully populated mid-story frame and does not schedule,
 * so nothing below may hide information that motion would otherwise reveal. */
@media (prefers-reduced-motion: reduce) {
  .lops-job.is-entering, .lops-job.is-leaving { opacity: 1; transform: none; }
  .lops-line dd.is-swap, .lops-slot b.is-swap { opacity: 1; transform: none; }
  .lops-pulse { box-shadow: none; }
}

/* ------------------------------------------------- fitting the whole canvas */
/*  The operating theatre is one composition: it only says what it is for if a
 *  visitor can see the arriving work, the core, the relationship and the
 *  outcomes at the same time. Its height was fixed, so on a 1366x768 laptop the
 *  rail fell below the fold and the page had to be zoomed out to read it.
 *
 *  Every vertical measure below is therefore the smaller of a comfortable fixed
 *  value and a share of the viewport height: tall screens keep the generous
 *  spacing, short ones tighten the padding and the gaps - never the type, which
 *  stays at its full size all the way down. Only spacing moves. */
@media (min-width: 761px) {
  .lops { margin-top: clamp(12px, 2.2vh, 34px); }
  .lops-bar { padding-block: clamp(9px, 1.5vh, 15px); }
  .lops-grid { padding: clamp(13px, 2.2vh, 22px); gap: clamp(11px, 1.8vh, 18px); }
  .lops-col { gap: clamp(8px, 1.3vh, 12px); }
  .lops-lane { padding-block: clamp(6px, 1.1vh, 10px); }
  .lops-core { padding-block: clamp(9px, 1.6vh, 15px); gap: clamp(7px, 1.3vh, 11px); }
  .lops-think li { padding-block: clamp(5px, 1vh, 8px); }
  .lops-focus { min-height: 0; padding-block: clamp(10px, 1.8vh, 15px); gap: clamp(7px, 1.3vh, 11px); }
  .lops-slot { padding-block: clamp(7px, 1.3vh, 11px); }
  .lops-rail-wrap { padding-block: clamp(10px, 1.7vh, 14px) clamp(11px, 2vh, 18px); }
  .lops-job { padding-block: clamp(6px, 1.1vh, 9px); }
}

/*  Below the three-column layout the canvas is a scrolling column by design -
 *  a phone cannot hold the whole composition at a readable size, and the brief
 *  is to reflow rather than shrink. The spacing still eases off on a short
 *  landscape phone, where the fold is only a few hundred pixels down. */
@media (max-width: 760px) and (max-height: 560px) {
  .lops-grid { padding: 12px; gap: 10px; }
  .lops-rail-wrap { padding-block: 10px 12px; }
}
