/* Plumbline — shared tokens and primitives (marketing site + demo portal) */
:root {
  /* surfaces: primer white, drywall paper */
  --paper: #f1f3ef;
  --board: #e3e7e1;
  --white: #ffffff;
  --rule: #d3d8d1;
  --rule-2: #e6e9e3;

  /* graphite */
  --ink: #12161b;
  --ink-2: #3f4750;
  --ink-3: #5f6873; /* was #6c7580 (4.19:1 on paper); this meets WCAG AA 4.5:1 on paper, white and board */

  /* chalk-line blue */
  --chalk: #1f5fd6;
  --chalk-deep: #143f96;
  --chalk-ink: #0e2c6b;
  --chalk-wash: #e4ecfb;
  --chalk-tint: #c9d9f8;

  /* marking-paint orange: hold points and alerts only */
  --mark: #e8632b;
  --mark-wash: #fce9df;
  --mark-ink: #9a3a10;

  --ok: #1a9e74;
  --ok-wash: #dff3ea;
  --ok-ink: #0d6046;
  --warn: #c98500;
  --warn-wash: #fbf0d0;
  --warn-ink: #7a5200;

  --vial: #cfe94a;
  --brass: #c39a45;

  --f-display: "Big Shoulders Display", "Big Shoulders", "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --r: 6px;
  --shadow: 0 1px 0 rgba(18, 22, 27, 0.04), 0 8px 24px -12px rgba(18, 22, 27, 0.18);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p, ul, ol, figure, blockquote, dl, dd {
  margin: 0;
}
ul, ol {
  padding: 0;
  list-style: none;
}
a {
  color: inherit;
  text-decoration: none;
}
button, input, select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}
img, svg {
  display: block;
  max-width: 100%;
}
:focus-visible {
  outline: 2px solid var(--chalk);
  outline-offset: 3px;
  border-radius: 2px;
}
::selection {
  background: var(--chalk);
  color: #fff;
}

.mono {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 20px;
  border-radius: var(--r);
  font-weight: 600;
  font-size: 15px;
  line-height: 1;
  white-space: nowrap;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}
.btn svg {
  width: 16px;
  height: 16px;
  flex: none;
}
.btn--primary {
  background: var(--chalk);
  color: #fff;
  box-shadow: 0 2px 0 var(--chalk-ink);
}
.btn--primary:hover {
  background: var(--chalk-deep);
  transform: translateY(-1px);
  box-shadow: 0 3px 0 var(--chalk-ink);
}
.btn--primary:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 var(--chalk-ink);
}
.btn--ghost {
  box-shadow: inset 0 0 0 1.5px var(--ink);
}
.btn--ghost:hover {
  background: var(--ink);
  color: var(--paper);
}
.btn--light {
  background: #fff;
  color: var(--chalk-ink);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}
.btn--light:hover {
  transform: translateY(-1px);
}
.btn--sm {
  padding: 9px 13px;
  font-size: 13.5px;
}

/* ── Level vial: job health at a glance ─────────────────
   Bubble centred = on track. The further it drifts, the further the job has. */
.vial {
  --off: 0px;
  position: relative;
  display: inline-block;
  flex: none;
  width: 40px;
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(#e3f284, #c2de3c);
  box-shadow: inset 0 0 0 1.5px rgba(18, 22, 27, 0.62);
  vertical-align: middle;
}
.vial::before,
.vial::after {
  content: "";
  position: absolute;
  top: 1.5px;
  bottom: 1.5px;
  width: 1.5px;
  background: rgba(18, 22, 27, 0.62);
}
.vial::before {
  left: calc(50% - 8.5px);
}
.vial::after {
  left: calc(50% + 7px);
}
.vial i {
  position: absolute;
  top: 3px;
  left: calc(50% - 5.5px + var(--off));
  width: 11px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: inset 0 0 0 1px rgba(18, 22, 27, 0.4);
  transition: left 0.7s cubic-bezier(0.3, 1.5, 0.5, 1);
}

.health {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Status chip: job health in plain words ──────────── */
.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  background: var(--ok-wash);
  color: var(--ok-ink);
}
.status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
}
.status--watch {
  background: var(--warn-wash);
  color: var(--warn-ink);
}
.status--watch i {
  background: var(--warn);
}
.status--risk {
  background: var(--mark-wash);
  color: var(--mark-ink);
}
.status--risk i {
  background: var(--mark);
}

/* ── Pills ───────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  background: var(--board);
  color: var(--ink-2);
}
.pill--ok {
  background: var(--ok-wash);
  color: var(--ok-ink);
}
.pill--warn {
  background: var(--warn-wash);
  color: var(--warn-ink);
}
.pill--mark {
  background: var(--mark-wash);
  color: var(--mark-ink);
}
.pill--chalk {
  background: var(--chalk-wash);
  color: var(--chalk-ink);
}
.pill--line {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--rule);
  color: var(--ink-3);
}

/* ── Floating tooltip (charts and marks) ─────────────── */
.tip {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  max-width: 280px;
  padding: 8px 10px;
  border-radius: 5px;
  background: var(--ink);
  color: #fff;
  font-size: 12.5px;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.tip.is-on {
  opacity: 1;
  transform: none;
}
.tip b {
  font-weight: 600;
}
.tip span {
  color: #b9c0c8;
}

/* ── Toast ───────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 300;
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.08);
  transform: translate(-50%, 24px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.toast.is-on {
  transform: translate(-50%, 0);
  opacity: 1;
}

/* ── Photos ──────────────────────────────────────────── */
.ph {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: 8px;
  overflow: hidden;
  background: var(--board);
  cursor: zoom-in;
}
.ph img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.ph:hover img {
  transform: scale(1.04);
}
.ph::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(18, 22, 27, 0.12);
  pointer-events: none;
}
.shots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
html.is-locked {
  overflow: hidden;
}
.lb {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: none;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  align-items: center;
  padding: 20px 8px;
  background: rgba(12, 15, 19, 0.94);
}
.lb.is-on {
  display: grid;
}
.lb__fig {
  display: grid;
  gap: 12px;
  justify-items: center;
  margin: 0;
  min-width: 0;
}
.lb__fig img {
  max-width: 100%;
  max-height: calc(100vh - 120px);
  max-height: calc(100dvh - 120px);
  width: auto;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.8);
}
.lb__fig figcaption {
  color: #d5dae0;
  font-size: 14px;
  text-align: center;
  white-space: pre-wrap;
}
.lb__nav,
.lb__x {
  color: #fff;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  transition: background 0.15s ease;
}
.lb__nav:hover,
.lb__x:hover {
  background: rgba(255, 255, 255, 0.22);
}
.lb__nav {
  width: 48px;
  height: 48px;
  font-size: 30px;
  line-height: 1;
  justify-self: center;
}
.lb__x {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
}
.lb.is-single .lb__nav {
  visibility: hidden;
}

/* ── Before / after ──────────────────────────────────── */
.ba {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: var(--board);
  line-height: 0;
  user-select: none;
  -webkit-user-select: none;
}
.ba > img {
  width: 100%;
  height: auto;
}
.ba__before {
  position: absolute;
  inset: 0;
  clip-path: inset(0 calc(100% - var(--pos)) 0 0);
}
.ba__before img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ba__tag {
  position: absolute;
  top: 14px;
  padding: 5px 10px;
  border-radius: 4px;
  background: rgba(18, 22, 27, 0.78);
  color: #fff;
  font-family: var(--f-mono);
  font-size: 11.5px;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
}
.ba__tag--l {
  left: 14px;
}
.ba__tag--r {
  right: 14px;
}
.ba__handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  width: 3px;
  margin-left: -1.5px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(18, 22, 27, 0.25);
  pointer-events: none;
}
.ba__handle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border-radius: 50%;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2312161b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 7l-5 5 5 5M15 7l5 5-5 5'/%3E%3C/svg%3E") center / 22px no-repeat;
  box-shadow: 0 4px 14px rgba(18, 22, 27, 0.35);
}
.ba__range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  touch-action: pan-y;
}
.ba:focus-within .ba__handle::after {
  outline: 3px solid var(--chalk);
  outline-offset: 2px;
}

/* ── Film: a looping clip with its own pause control ── */
.film {
  position: relative;
  margin: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--ink);
  line-height: 0;
}
.film video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.film__btn {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(18, 22, 27, 0.7);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.15s ease;
}
.film__btn:hover {
  background: rgba(18, 22, 27, 0.9);
}
.film__btn svg {
  width: 12px;
  height: 12px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
