/* MakeBetter components — the shared layer under the site and the design system.
   Reads the tokens as CSS custom properties (tokens.css / site.css :root). */

@import url("https://fonts.googleapis.com/css2?family=Caveat:wght@500;600&family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap");

/* ---------- Button ---------- */
.mb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: 48px; padding: 0 24px; border-radius: var(--radius-pill);
  font: 500 15px/1 var(--font-sans); letter-spacing: -0.005em; text-decoration: none;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.mb-btn:focus-visible { outline: 2px solid var(--carmine); outline-offset: 3px; }
.mb-btn--primary { background: var(--ink); color: var(--paper); }
.mb-btn--primary:hover { background: var(--ink-2); }
.mb-btn--secondary { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.mb-btn--secondary:hover { border-color: var(--ink); }
.mb-btn--on-photo { background: var(--on-photo); color: var(--photo-shade); }
.mb-btn--on-photo:hover { background: #ffffff; }
.mb-btn--sm { height: 36px; padding: 0 16px; font-size: 14px; }
.mb-btn .mb-arrow { transition: transform .15s ease; }
.mb-btn:hover .mb-arrow { transform: translateX(3px); }

/* ---------- Eyebrow ---------- */
.mb-eyebrow {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font: 500 12px/1.3 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.mb-eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--carmine); }

/* ---------- Photo ---------- */
.mb-photo {
  position: relative; margin: 0; overflow: hidden; border-radius: var(--radius-xl);
  background: var(--photo-shade); aspect-ratio: 3 / 2; isolation: isolate;
}
.mb-photo > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.mb-photo > img.is-missing { display: none; }
/* Once a real photo is there, its brief steps aside. */
.mb-photo > img:not(.is-missing) + .mb-photo__slot { display: none; }
/* The placeholder: a quiet, lit backdrop with the shot brief, shown until the real photo lands. */
.mb-photo__slot {
  position: absolute; inset: 0; display: flex; align-items: flex-end; padding: var(--space-6);
  background:
    radial-gradient(120% 90% at 78% 18%, rgba(246,245,242,.16), transparent 55%),
    radial-gradient(90% 70% at 15% 100%, rgba(180,39,28,.10), transparent 60%),
    linear-gradient(160deg, #2a2926 0%, #1a1917 55%, #121211 100%);
  color: rgba(246,245,242,.62); font: 500 12px/1.45 var(--font-mono); letter-spacing: .02em;
}
.mb-photo__slot::after {
  content: ""; position: absolute; inset: 0; opacity: .35; mix-blend-mode: overlay; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");
}
.mb-photo__brief { position: relative; z-index: 1; max-width: 34ch; }
.mb-photo__brief b { display: block; color: rgba(246,245,242,.9); font-weight: 500; margin-bottom: 2px; }
.mb-photo--bleed { border-radius: 0; }
.mb-photo--tall { aspect-ratio: 4 / 5; }
.mb-photo--wide { aspect-ratio: 21 / 9; }

/* ---------- Product window ---------- */
.mb-window {
  background: var(--surface); color: var(--ink); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-window); border: 1px solid var(--line); overflow: hidden;
  font: 400 14px/1.45 var(--font-sans); text-align: left;
}
.mb-window__bar {
  display: flex; align-items: center; gap: var(--space-3); height: 44px; padding: 0 var(--space-4);
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.mb-window__app { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; letter-spacing: -0.01em; }
.mb-window__app i { width: 18px; height: 18px; border-radius: 5px; background: var(--ink); position: relative; }
.mb-window__app i::after { content: ""; position: absolute; right: 4px; bottom: 4px; width: 4px; height: 4px; border-radius: 50%; background: var(--carmine); }
.mb-window__crumb { color: var(--muted); font-size: 13px; display: flex; gap: 6px; align-items: center; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mb-window__crumb b { color: var(--ink); font-weight: 500; }
.mb-window__crumb span[aria-hidden] { color: var(--line-strong); }
.mb-window__tools { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); }
.mb-avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-sunk); border: 1px solid var(--line); display: inline-grid; place-items: center; font: 600 10px/1 var(--font-sans); color: var(--ink-2); }
.mb-search { height: 28px; min-width: 160px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--paper); color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.mb-search kbd { margin-left: auto; font: 500 10px/1 var(--font-mono); color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 3px 4px; background: var(--surface); }
.mb-window__body { padding: var(--space-6); }

/* ---------- Status pill ---------- */
.mb-status {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px 0 8px; border-radius: var(--radius-pill);
  font: 500 12px/1 var(--font-sans); white-space: nowrap; background: var(--surface-sunk); color: var(--ink-2);
}
.mb-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.mb-status--ok { background: var(--ok-soft); color: var(--ok); }
.mb-status--warn { background: var(--warn-soft); color: var(--warn); }
.mb-status--alert { background: var(--carmine-soft); color: var(--carmine); }
.mb-status--cold { background: var(--frost); color: var(--frost-ink); }

/* ---------- Data table ---------- */
.mb-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mb-table th {
  text-align: left; font: 500 11px/1.2 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  padding: 10px var(--space-3); background: var(--surface-sunk); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.mb-table td { padding: 11px var(--space-3); border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; color: var(--ink); }
.mb-table tr:last-child td { border-bottom: 0; }
.mb-table .num, .mb-table .code { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.mb-table .num { text-align: right; }
.mb-table th.num { text-align: right; }
.mb-table .sub { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.mb-table tr.is-flagged td { background: color-mix(in srgb, var(--warn-soft) 55%, transparent); }

/* ---------- KPI ---------- */
.mb-kpi { display: flex; flex-direction: column; gap: 6px; }
.mb-kpi__label { font: 500 12px/1.2 var(--font-sans); color: var(--muted); }
.mb-kpi__value { font: 500 28px/1.1 var(--font-mono); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
.mb-kpi__value small { font-size: 14px; color: var(--muted); letter-spacing: 0; margin-left: 2px; }
.mb-kpi__value.is-cold { color: var(--frost-ink); }
.mb-kpi__delta { font: 400 12px/1.2 var(--font-sans); color: var(--muted); }

/* ---------- AI suggestion ---------- */
.mb-ai {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--space-3);
  padding: 12px 14px; border-radius: var(--radius-md); background: var(--carmine-soft); color: var(--ink);
  font-size: 13px; line-height: 1.45;
}
.mb-ai__mark { width: 24px; height: 24px; border-radius: 7px; background: var(--carmine); display: grid; place-items: center; color: var(--on-carmine); }
.mb-ai__mark svg { width: 14px; height: 14px; }
.mb-ai b { font-weight: 600; }
.mb-ai .mb-btn { height: 30px; padding: 0 12px; font-size: 12.5px; }

/* ---------- Floating card (UI over a photo) ---------- */
.mb-float {
  background: var(--surface); color: var(--ink); border-radius: var(--radius-md); box-shadow: var(--shadow-float);
  border: 1px solid var(--line); padding: var(--space-4); font: 400 13px/1.45 var(--font-sans); width: 320px;
}
.mb-float__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: 10px; }
.mb-float__title { font: 500 11px/1.2 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { .mb-btn, .mb-btn .mb-arrow { transition: none; } }

/* Narrow screens: the AI strip stacks its action under the text */
@media (max-width: 560px) {
  .mb-ai { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
  .mb-ai > .mb-btn { grid-column: 2; justify-self: start; }
  .mb-window__body { padding: var(--space-4); }
}
