/* SITU sign-in page.
   Left: what SITU is, shown working (dark, Carbon).
   Right: the sign-in form (light, Chalk).
   Values from situ-tokens-v5.json. SITU Red marks focus and selection only. */

:root {
  --carbon: #0b0b0b;
  --chalk: #f5f4f0;
  --situ-red: #c93a46;

  --d-surface: #111111;
  --d-raised: #171717;
  --d-raised-2: #1d1d1d;
  --d-line: #292929;
  --d-line-soft: #202020;
  --d-text: #f5f4f0;
  --d-muted: #a09d98;
  --d-focus: #e05b65;

  --l-surface: #ffffff;
  --l-raised: #eceae5;
  --l-line: #d8d5cf;
  --l-text: #0b0b0b;
  --l-muted: #66635f;
  --l-focus: #c93a46;

  --positive: #2f7a5b;
  --warning: #b47b24;
  --critical: #e15b64;
  --info: #4266d5;
  /* Text versions of the status colours, readable on the dark board */
  --t-bad: #f08a91;
  --t-warn: #e3a957;
  --t-info: #93abf2;
  /* Error text on the light panel (4.5:1 or better on Chalk) */
  --l-error: #a8323d;

  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-move: cubic-bezier(0.65, 0, 0.35, 1);
  --story-ms: 6000ms;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  background: var(--carbon);
  color: var(--d-text);
  font-size: 16px;
  line-height: 1.5;
}
button { font: inherit; cursor: pointer; }
svg { display: block; }

/* ------------------------------------------------------------ layout */
.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(420px, 1fr);
}

.showcase {
  position: relative;
  isolation: isolate;
  padding: 36px clamp(32px, 5vw, 80px) 36px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  background:
    radial-gradient(900px 520px at 0% -10%, rgba(201, 58, 70, 0.09), transparent 60%),
    radial-gradient(800px 480px at 100% 110%, rgba(245, 244, 240, 0.05), transparent 60%),
    var(--carbon);
  overflow: hidden;
}
.showcase::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(rgba(245, 244, 240, 0.07) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 70%);
  mask-image: linear-gradient(to bottom, #000 0%, transparent 70%);
}
.showcase > * { max-width: 780px; width: 100%; }

/* ------------------------------------------------------------ hero */
.logo { height: 36px; width: auto; margin-bottom: 30px; }
.eyebrow {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--d-muted);
}
.headline {
  margin: 0 0 14px;
  font-size: clamp(34px, 3.1vw, 50px);
  line-height: 1.06;
  font-weight: 650;
  letter-spacing: -0.028em;
  color: var(--d-muted);
  text-wrap: balance;
}
.headline-em { color: var(--d-text); }

/* 24 players x 5 sources -> 4 to look at */
.funnel {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  margin: 22px 0 0;
}
.funnel-item { display: flex; flex-direction: column; gap: 2px; }
.funnel-item b {
  position: relative;
  display: inline-block;
  font-size: 34px;
  line-height: 1;
  font-weight: 650;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--d-text);
}
.funnel-item > span { font-size: 13px; color: var(--d-muted); }
.funnel-op { font-size: 22px; color: var(--d-muted); padding-bottom: 20px; }
.funnel-end { gap: 8px; }
.funnel-end b { padding: 1px 8px; }
.funnel-end .fc { position: absolute; width: 9px; height: 9px; border: 0 solid var(--situ-red); }
.funnel-end .tl { top: -6px; left: -6px; border-top-width: 2px; border-left-width: 2px; border-top-left-radius: 4px; }
.funnel-end .tr { top: -6px; right: -6px; border-top-width: 2px; border-right-width: 2px; border-top-right-radius: 4px; }
.funnel-end .bl { bottom: -6px; left: -6px; border-bottom-width: 2px; border-left-width: 2px; border-bottom-left-radius: 4px; }
.funnel-end .br { bottom: -6px; right: -6px; border-bottom-width: 2px; border-right-width: 2px; border-bottom-right-radius: 4px; }
.funnel-item, .funnel-op { animation: rise 0.6s var(--ease-out) backwards; }
.funnel > :nth-child(2) { animation-delay: 0.15s; }
.funnel > :nth-child(3) { animation-delay: 0.25s; }
.funnel > :nth-child(4) { animation-delay: 0.45s; }
.funnel > :nth-child(5) { animation-delay: 0.6s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.sub {
  margin: 0;
  max-width: 600px;
  font-size: 17px;
  line-height: 1.55;
  color: var(--d-muted);
}

/* ------------------------------------------------------------ the board */
.board-wrap {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 40%), var(--d-surface);
  border: 1px solid var(--d-line);
  border-radius: 16px;
  padding: 18px 18px 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.board-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--d-muted);
}
.board-title .sep { color: var(--d-line); }
.live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px 2px 6px;
  border-radius: 999px;
  background: rgba(47, 122, 91, 0.16);
  color: #7cc5a4;
  font-weight: 600;
  font-size: 12px;
  margin-right: 4px;
}
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #4fb187;
  box-shadow: 0 0 0 0 rgba(79, 177, 135, 0.6);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(79, 177, 135, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(79, 177, 135, 0); }
  100% { box-shadow: 0 0 0 0 rgba(79, 177, 135, 0); }
}

.board-stats { display: flex; gap: 18px; margin: 0; }
.board-stats div { display: flex; align-items: baseline; gap: 6px; }
.board-stats dt { font-size: 12px; color: var(--d-muted); }
.board-stats dd { margin: 0; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }

.board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.tile {
  position: relative;
  min-height: 76px;
  padding: 9px 12px 9px;
  border-radius: 10px;
  background: var(--d-raised);
  border: 1px solid var(--d-line-soft);
  transition: opacity 0.35s var(--ease-out), background-color 0.35s var(--ease-out), border-color 0.35s var(--ease-out);
  animation: tile-in 0.55s var(--ease-out) backwards;
}
.tile:nth-child(1) { animation-delay: 0.10s; }
.tile:nth-child(2) { animation-delay: 0.16s; }
.tile:nth-child(3) { animation-delay: 0.22s; }
.tile:nth-child(4) { animation-delay: 0.28s; }
.tile:nth-child(5) { animation-delay: 0.34s; }
.tile:nth-child(6) { animation-delay: 0.40s; }
.tile:nth-child(7) { animation-delay: 0.46s; }
.tile:nth-child(8) { animation-delay: 0.52s; }
@keyframes tile-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
}
.tile-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.tile-name { font-size: 13px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-name b { font-weight: 500; color: var(--d-muted); margin-right: 3px; font-variant-numeric: tabular-nums; }
.tile-pos { font-size: 12px; color: var(--d-muted); }
.bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 10px; }
.bars i { display: block; height: 4px; border-radius: 2px; }
.bars .ok { background: var(--positive); }
.bars .warn { background: var(--warning); }
.bars .bad { background: var(--critical); }
.bars .info { background: var(--info); }
.chip {
  display: inline-block;
  margin-top: 8px;
  padding: 1px 7px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
}
.chip-bad { color: var(--t-bad); background: rgba(225, 91, 100, 0.14); }
.chip-warn { color: var(--t-warn); background: rgba(180, 123, 36, 0.18); }
.chip-info { color: var(--t-info); background: rgba(66, 102, 213, 0.18); }

.board.has-focus .tile:not(.is-active) { opacity: 0.36; }
.tile.is-active { background: var(--d-raised-2); border-color: #333333; }

/* The lens: SITU's brackets, moving to whatever needs a look */
.lens {
  position: absolute;
  top: 0; left: 0;
  width: var(--lw, 0px);
  height: var(--lh, 0px);
  transform: translate(var(--lx, 0px), var(--ly, 0px));
  transition: transform 0.65s var(--ease-move), opacity 0.4s var(--ease-out);
  pointer-events: none;
  opacity: 0;
}
.lens.on { opacity: 1; }
.lens.no-anim { transition: none; }
.lens .c {
  position: absolute;
  width: 16px; height: 16px;
  border: 0 solid var(--chalk);
}
.lens .tl { top: -6px; left: -6px; border-top-width: 2.5px; border-left-width: 2.5px; border-top-left-radius: 8px; }
.lens .tr { top: -6px; right: -6px; border-top-width: 2.5px; border-right-width: 2.5px; border-top-right-radius: 8px; }
.lens .bl { bottom: -6px; left: -6px; border-bottom-width: 2.5px; border-left-width: 2.5px; border-bottom-left-radius: 8px; }
.lens .br { bottom: -6px; right: -6px; border-bottom-width: 2.5px; border-right-width: 2.5px; border-bottom-right-radius: 8px; }


/* The story under the board */
.story {
  margin-top: 14px;
  padding: 12px 16px;
  min-height: 104px;
  border-radius: 12px;
  background: var(--d-raised);
  border: 1px solid var(--d-line-soft);
  transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}
.story.is-changing { opacity: 0; transform: translateY(4px); }
.story-source { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; font-size: 12px; color: var(--d-muted); }
.story-kind {
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--t-bad);
}
.story[data-tone="warn"] .story-kind { color: var(--t-warn); }
.story[data-tone="info"] .story-kind { color: var(--t-info); }
.story-title { margin: 0 0 4px; font-size: 17px; font-weight: 600; line-height: 1.35; letter-spacing: -0.01em; }
.story-detail { margin: 0; font-size: 14px; color: var(--d-muted); line-height: 1.5; }

/* Controls: pick an example, or pause */
.controls { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; flex: 1; }
.step {
  min-height: 44px;
  padding: 8px 2px 6px;
  border: 0;
  background: none;
  color: var(--d-muted);
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 7px;
  border-radius: 6px;
}
.step:hover { color: var(--d-text); }
.step[aria-pressed="true"] { color: var(--d-text); }
.step-label { font-size: 12px; font-weight: 550; }
.step-bar { position: relative; height: 2px; border-radius: 2px; background: var(--d-line); overflow: hidden; }
.step-bar span {
  position: absolute; inset: 0;
  background: var(--situ-red);
  transform-origin: left center;
  transform: scaleX(0);
}
.step[aria-pressed="true"] .step-bar span { transform: scaleX(1); }
.js .step[aria-pressed="true"].run .step-bar span { animation: progress var(--story-ms) linear forwards; }
@keyframes progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.board-wrap.is-held .step-bar span,
.board-wrap.is-paused .step-bar span { animation-play-state: paused !important; }

.play {
  flex: none;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--d-line);
  background: transparent;
  color: var(--d-text);
}
.play:hover { background: var(--d-raised); }
.play svg { width: 14px; height: 14px; fill: currentColor; }
.play .i-play { display: none; }
.board-wrap.is-paused .play .i-play { display: block; }
.board-wrap.is-paused .play .i-pause { display: none; }
.board-note { margin: 6px 2px 0; font-size: 12px; line-height: 1.45; color: var(--d-muted); }

/* ------------------------------------------------------------ value points */
.props {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
.props li { display: flex; gap: 12px; align-items: flex-start; }
.props svg {
  flex: none;
  width: 22px; height: 22px;
  margin-top: 1px;
  fill: none;
  stroke: var(--d-text);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.props strong { display: block; font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.props span { display: block; font-size: 13px; line-height: 1.45; color: var(--d-muted); }

/* ------------------------------------------------------------ sign in */
.signin {
  align-self: start;
  position: sticky;
  top: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px clamp(28px, 4vw, 64px);
  background: var(--chalk);
  color: var(--l-text);
}
.signin-inner { width: 100%; max-width: 380px; }
.signin-mark { display: block; width: 40px; height: 40px; margin: 0 0 24px; border-radius: 10px; }
.signin-title { margin: 0 0 6px; font-size: 30px; line-height: 1.15; font-weight: 650; letter-spacing: -0.02em; }
.signin-lede { margin: 0 0 28px; font-size: 15px; color: var(--l-muted); }

.field { margin: 0 0 18px; }
.field label { display: block; margin: 0 0 6px; font-size: 14px; font-weight: 550; }
.field input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  font: inherit;
  font-size: 16px;
  color: var(--l-text);
  background: var(--l-surface);
  border: 1px solid var(--l-line);
  border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:hover { border-color: #c4c0b8; }
.field input:focus { outline: none; border-color: var(--l-focus); box-shadow: 0 0 0 4px rgba(201, 58, 70, 0.16); }

.pw { position: relative; }
.pw input { padding-right: 52px; }
.reveal {
  position: absolute; top: 2px; right: 2px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 0; border-radius: 8px;
  background: transparent;
  color: var(--l-muted);
}
.reveal:hover { color: var(--l-text); }
.reveal svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.reveal[aria-pressed="true"] { color: var(--l-text); }

.submit {
  width: 100%;
  min-height: 50px;
  margin-top: 6px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  border: 0;
  border-radius: 10px;
  background: var(--carbon);
  color: var(--chalk);
  font-size: 16px;
  font-weight: 600;
  transition: background-color 0.15s, transform 0.15s;
}
.submit svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.2s var(--ease-out); }
.submit:hover { background: #262626; }
.submit:hover svg { transform: translateX(3px); }
.submit:active { transform: translateY(1px); }
.submit[disabled] { opacity: 0.7; cursor: progress; }

.message { min-height: 22px; margin: 12px 0 0; font-size: 14px; }
.message.error { color: var(--l-error); }
.message.ok { color: var(--l-text); }

.help { margin: 8px 0 0; font-size: 14px; color: var(--l-muted); }

.trust {
  list-style: none;
  margin: 32px 0 0;
  padding: 20px 0 0;
  border-top: 1px solid var(--l-line);
  display: grid;
  gap: 10px;
}
.trust li { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--l-muted); }
.trust svg { flex: none; width: 18px; height: 18px; fill: none; stroke: var(--l-text); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------ focus */
:focus-visible { outline: 2px solid var(--d-focus); outline-offset: 2px; }
.signin :focus-visible { outline-color: var(--l-focus); }
.field input:focus-visible { outline: none; }

/* ------------------------------------------------------------ smaller screens */
@media (max-width: 1079px) {
  .layout { display: grid; grid-template-columns: 1fr; }
  .showcase { display: contents; }
  .showcase::before { display: none; }
  .hero { order: 1; padding: 28px 20px 4px; max-width: 720px; margin: 0 auto; width: 100%; }
  .signin {
    order: 2;
    position: static;
    min-height: 0;
    margin: 20px 16px 0;
    border-radius: 16px;
    padding: 28px 22px;
    max-width: 720px;
    justify-self: center;
    width: calc(100% - 32px);
  }
  .signin-inner { max-width: none; }
  .board-wrap { order: 3; margin: 28px auto 0; width: calc(100% - 32px); max-width: 720px; }
  .props { order: 4; padding: 28px 20px 48px; max-width: 720px; margin: 0 auto; width: 100%; grid-template-columns: 1fr; gap: 16px; }
  .logo { margin-bottom: 24px; height: 34px; }
  .signin-mark { display: none; }
  .headline { font-size: clamp(30px, 7vw, 42px); }
  .sub { font-size: 16px; }
}

@media (max-width: 640px) {
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile:not(.flagged) { display: none; }
  .funnel { gap: 12px; }
  .funnel-item b { font-size: 28px; }
  .board-stats { gap: 12px; }
  .steps { display: flex; justify-content: space-between; gap: 10px; }
  .step { flex: 0 1 auto; }
  .step-label { white-space: nowrap; }
  .story { min-height: 150px; }
}

/* ------------------------------------------------------------ calm mode */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Two-step sign-in: the code step (platform.client.js, askForCode). */
.remember { display: flex; align-items: center; gap: 8px; margin: 4px 0 14px; font-size: 13px; color: var(--l-muted); cursor: pointer; }
.signin [hidden] { display: none !important; }
.remember input { width: 16px; height: 16px; margin: 0; accent-color: #c93a46; }
#code-form .help a { color: inherit; }
