/* Behalf — Carbon & Linen
 *
 * The single source of truth for Resolve's visual identity. Every surface in
 * this service (ticket workspace, external-agent portal, website intake, ticket
 * view, component showcase) loads this file; none of them may define a local
 * palette, type scale, radius, or component language.
 *
 * Source: Behalf-Visual-Identity-Carbon-Linen.html, the section marked
 * data-look="carbon", using its final effective values. The reference board's
 * other directions and its presentation wrapper are not part of the identity.
 *
 * Character: restrained, near-monochrome cool gray, flat surfaces, crisp
 * 2px geometry, hierarchy from alignment/type/rules rather than colour or
 * shadow. The network motif is the only decoration.
 *
 * The --shared-* names keep their meaning from the earlier shared system, but
 * now resolve to Carbon & Linen values. Do not introduce a second palette.
 */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500&family=Space+Grotesk:wght@400;500&display=swap");

:root {
  /* ---- palette primitives (identity values) ---------------------------- */
  --carbon: #292929;
  --carbon-hover: #1b1c1d;
  --carbon-press: #000000;
  --paper: #e6e7e8;
  --panel: #f5f6f7;
  --panel-2: #edeef0;
  --silver: #d1d4d6;
  --soft: #b5b7ba;
  --rule: #c7c9cc;
  --on-carbon: #e6e7e8;
  --on-silver: #292929;
  --network-line: #555e66;
  --network-signal: #3d484f;

  /* Accessible supporting text. --soft is a graphic tone and is never used
   * for body copy on a light surface. */
  --ink-muted: #5a5f64;
  --ink-faint: #6c7176;

  /* ---- functional semantics (not a second brand palette) ---------------
   * Restrained, AA on paper/panel, always paired with text or an icon. */
  --ok: #2f6b4f;
  --ok-soft: #eaf0ec;
  --ok-line: #b9cbbf;
  --warn: #7a5a17;
  --warn-soft: #f3eee3;
  --warn-line: #d8c9a3;
  --bad: #8c3a32;
  --bad-soft: #f4eae8;
  --bad-line: #d9bfba;
  --info: #3d5a73;
  --info-soft: #e9eef2;
  --info-line: #bdc9d3;

  /* ---- semantic aliases used by the screens ---------------------------- */
  --bg: var(--paper);
  --line: var(--rule);
  --line-strong: var(--soft);
  --text: var(--carbon);
  --muted: var(--ink-muted);
  --faint: var(--ink-faint);
  --accent: var(--carbon);
  --accent-strong: var(--carbon-hover);
  --accent-soft: #dee0e1;
  --accent-line: var(--soft);
  --good: var(--ok);
  --good-soft: var(--ok-soft);
  --good-line: var(--ok-line);
  --violet: var(--info);
  --violet-soft: var(--info-soft);

  /* ---- shared aliases (kept for the cross-product contract) ------------ */
  --shared-bg: var(--paper);
  --shared-panel: var(--panel);
  --shared-line: var(--rule);
  --shared-text: var(--carbon);
  --shared-muted: var(--ink-muted);
  --shared-accent: var(--carbon);
  --shared-accent-ink: var(--on-carbon);
  --shared-warn: var(--warn);
  --shared-bad: var(--bad);

  /* ---- type ------------------------------------------------------------ */
  --font-display: "Space Grotesk", "Inter", Arial, sans-serif;
  --font-body: "Inter", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font: var(--font-body);
  --shared-font: var(--font-body);

  --text-display: clamp(34px, 5.5vw, 57px);
  --text-h1: clamp(28px, 4vw, 31px);
  --text-h2: 25px;
  --text-h3: 19px;
  --text-h4: 15px;
  --text-body: 15px;
  --text-small: 13px;
  --text-meta: 12px;
  --text-micro: 11px;
  --leading-body: 1.6;
  --tracking-display: -0.05em;
  --tracking-heading: -0.03em;

  /* ---- shape ----------------------------------------------------------- */
  --radius-panel: 2px;
  --radius-control: 2px;
  --radius-card: 2px;
  --shared-radius-card: 2px;
  --shared-radius-control: 2px;
  --shared-radius-pill: 2px;
  --shared-weight-control: 500;
  --control-h: 40px;
  --control-h-lg: 44px;

  /* ---- spacing scale --------------------------------------------------- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 48px;

  /* ---- elevation: overlays only ---------------------------------------- */
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-overlay: 0 24px 64px -32px rgba(41, 41, 41, 0.45);
  --shadow-lg: var(--shadow-overlay);
  --overlay-scrim: rgba(41, 41, 41, 0.42);
  --overlay-scrim-soft: rgba(41, 41, 41, 0.24);

  /* ---- interaction ----------------------------------------------------- */
  --focus: var(--carbon);
  --focus-inverse: var(--on-carbon);
  --selection: var(--silver);

  /* ---- network motif --------------------------------------------------- */
  --motif-tint: var(--network-line);
  --motif-opacity: 0.25;
}

/* ======================================================================
 * Base primitives
 * ====================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--carbon);
  letter-spacing: var(--tracking-heading);
}

h1 {
  font-size: var(--text-h1);
  line-height: 1.08;
}
h2 {
  font-size: var(--text-h2);
  line-height: 1.1;
}
h3 {
  font-size: var(--text-h3);
  line-height: 1.2;
}
h4 {
  font-family: var(--font-body);
  font-size: var(--text-h4);
  font-weight: 500;
  letter-spacing: 0;
}

a {
  color: var(--carbon);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
a:hover {
  text-decoration-thickness: 2px;
}

::selection {
  background: var(--selection);
  color: var(--on-silver);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Any element on a carbon surface flips its focus ring so it stays visible. */
[data-surface="inverse"],
.bh-inverse {
  --focus: var(--focus-inverse);
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  min-height: var(--control-h);
  padding: 0 var(--space-3);
  font-family: var(--font-body);
  font-size: var(--text-meta);
  font-weight: 500;
  line-height: 1;
  color: var(--carbon);
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: background-color 0.14s, border-color 0.14s, color 0.14s;
}

button:hover {
  background: var(--panel-2);
  border-color: var(--line-strong);
}

button:active {
  background: var(--silver);
}

button:disabled,
button[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}

button.primary {
  color: var(--on-carbon);
  background: var(--carbon);
  border-color: var(--carbon);
}

button.primary:hover {
  background: var(--carbon-hover);
  border-color: var(--carbon-hover);
}

button.primary:active {
  background: var(--carbon-press);
  border-color: var(--carbon-press);
}

button.ghost {
  background: transparent;
  border-color: transparent;
}
button.ghost:hover {
  background: var(--panel-2);
  border-color: var(--rule);
}

button.danger {
  color: var(--bad);
  background: var(--bad-soft);
  border-color: var(--bad-line);
}
button.danger:hover {
  background: #efdedb;
  border-color: var(--bad);
}

.bh-btn--lg {
  min-height: var(--control-h-lg);
  padding: 0 var(--space-4);
  font-size: var(--text-small);
}

label {
  display: block;
  margin: var(--space-2) 0 var(--space-1);
  font-family: var(--font-body);
  font-size: var(--text-meta);
  font-weight: 500;
  color: var(--ink-muted);
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--control-h);
  padding: 0 var(--space-3);
  font-family: var(--font-body);
  font-size: var(--text-small);
  color: var(--carbon);
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius-control);
}

textarea {
  padding: var(--space-2) var(--space-3);
  line-height: 1.5;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--carbon);
}

input::placeholder,
textarea::placeholder {
  color: var(--ink-faint);
}

input:disabled,
select:disabled,
textarea:disabled {
  color: var(--ink-muted);
  background: var(--panel-2);
  cursor: not-allowed;
}

[aria-invalid="true"] {
  border-color: var(--bad);
}

/* ======================================================================
 * Shared primitives
 * ====================================================================== */

.muted {
  color: var(--muted);
}
.small {
  font-size: var(--text-meta);
}
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.hidden {
  display: none !important;
}

.eyebrow {
  margin: 0 0 var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-micro);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.rule {
  height: 1px;
  border: 0;
  background: var(--rule);
  margin: var(--space-4) 0;
}

.bh-panel {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius-panel);
  padding: var(--space-4);
}

.bh-panel--rule {
  border-top: 2px solid var(--carbon);
}

/* A tag is a label, not a control: square geometry, 1px rule, no pill. */
.pill,
.bh-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 1px 6px;
  font-family: var(--font-body);
  font-size: var(--text-micro);
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.5;
  color: var(--ink-muted);
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius-control);
  white-space: nowrap;
}

.pill.good,
.bh-tag--good {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: var(--ok-line);
}
.pill.warn,
.bh-tag--warn {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: var(--warn-line);
}
.pill.bad,
.bh-tag--bad {
  color: var(--bad);
  background: var(--bad-soft);
  border-color: var(--bad-line);
}
.pill.info,
.pill.violet,
.bh-tag--info {
  color: var(--info);
  background: var(--info-soft);
  border-color: var(--info-line);
}

/* Data views: horizontal rules only, tabular numerals for aligned numbers. */
table {
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

th {
  font-family: var(--font-body);
  font-size: var(--text-micro);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-align: left;
  padding: var(--space-2);
  border-bottom: 1px solid var(--rule);
}

td {
  padding: var(--space-2);
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

/* ======================================================================
 * Network motif
 *
 * One reusable decorative component. The geometry is a data-URI mask so the
 * same asset serves both the light and inverse surfaces: set --motif-tint and
 * --motif-opacity locally. The two gradient bands are masked by the wires, so
 * they read as short signals travelling along them.
 *
 * It is inert: no pointer events, hidden from assistive technology by the
 * markup (aria-hidden), and stopped for reduced motion and print.
 * ====================================================================== */

.bh-network {
  --motif-ink: var(--motif-tint);
  position: absolute;
  inset: 0 0 0 46%;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
  user-select: none;
  background-color: var(--motif-ink);
  opacity: var(--motif-opacity);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 440 400'%3E%3Cg fill='none' stroke='%23000' stroke-width='0.7' stroke-linecap='round'%3E%3Cpath d='M28 372 214 24'/%3E%3Cpath d='M86 400 272 52'/%3E%3Cpath d='M146 400 332 52'/%3E%3Cpath d='M206 400 392 52'/%3E%3Cpath d='M266 400 440 76'/%3E%3Cpath d='M326 400 440 176'/%3E%3Cpath d='M28 88 214 436'/%3E%3Cpath d='M88 24 274 372'/%3E%3Cpath d='M148 24 334 372'/%3E%3Cpath d='M208 24 394 372'/%3E%3Cpath d='M268 24 440 348'/%3E%3Cpath d='M328 24 440 248'/%3E%3Cpath d='M0 210 440 210' stroke-dasharray='2 10'/%3E%3C/g%3E%3Cg fill='%23000'%3E%3Ccircle cx='214' cy='196' r='3'/%3E%3Ccircle cx='300' cy='140' r='3'/%3E%3Ccircle cx='300' cy='252' r='3'/%3E%3Ccircle cx='128' cy='300' r='3'/%3E%3C/g%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 440 400'%3E%3Cg fill='none' stroke='%23000' stroke-width='0.7' stroke-linecap='round'%3E%3Cpath d='M28 372 214 24'/%3E%3Cpath d='M86 400 272 52'/%3E%3Cpath d='M146 400 332 52'/%3E%3Cpath d='M206 400 392 52'/%3E%3Cpath d='M266 400 440 76'/%3E%3Cpath d='M326 400 440 176'/%3E%3Cpath d='M28 88 214 436'/%3E%3Cpath d='M88 24 274 372'/%3E%3Cpath d='M148 24 334 372'/%3E%3Cpath d='M208 24 394 372'/%3E%3Cpath d='M268 24 440 348'/%3E%3Cpath d='M328 24 440 248'/%3E%3Cpath d='M0 210 440 210' stroke-dasharray='2 10'/%3E%3C/g%3E%3Cg fill='%23000'%3E%3Ccircle cx='214' cy='196' r='3'/%3E%3Ccircle cx='300' cy='140' r='3'/%3E%3Ccircle cx='300' cy='252' r='3'/%3E%3Ccircle cx='128' cy='300' r='3'/%3E%3C/g%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: right center;
  mask-position: right center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

/* A signal band. Two bands on unequal periods keep the motion from pulsing in
 * lockstep. Masked by the wires above, so only segments on the lines show. */
.bh-network::before,
.bh-network::after {
  content: "";
  position: absolute;
  inset: -20% -45%;
  background: linear-gradient(
    104deg,
    transparent 45%,
    var(--network-signal) 50%,
    transparent 55%
  );
}

.bh-network::before {
  animation: bh-signal 17s linear infinite;
}

.bh-network::after {
  background: linear-gradient(
    76deg,
    transparent 46%,
    var(--network-signal) 50%,
    transparent 54%
  );
  animation: bh-signal 12s linear infinite reverse;
  animation-delay: -3s;
}

.bh-network--hero {
  inset: 0 0 0 46%;
  --motif-opacity: 0.25;
}

.bh-network--inverse {
  inset: 0 0 0 40%;
  --motif-ink: var(--on-carbon);
  --motif-opacity: 0.16;
}

@keyframes bh-signal {
  from {
    transform: translateX(-46%);
  }
  to {
    transform: translateX(46%);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .bh-network::before,
  .bh-network::after {
    display: none;
  }
}

@media print {
  .bh-network {
    display: none;
  }
}
