/* =============================================================================
   ibm.css — the three.ws × IBM design system
   Single source of truth for the /ibm showcase surface.

   Why this file exists: every /ibm page had its own :root with the same IBM
   Carbon colors spelled eight different ways. That drift is why the pages looked
   like eight sites. This file consumes the canonical B01 design tokens (from
   style.css) plus the scoped --brand-blue-* accent theme defined below, and
   keeps a small set of legacy back-compat aliases so a page only has to link
   this file and delete its local :root — no var() rewrites. Tune the look here
   and it changes everywhere.

   Usage in a page <head>:
     <link rel="stylesheet" href="/ibm.css" />
   then remove that page's local `:root { ... }` token block.

   Palette is IBM Carbon: Blue 60 #0f62fe, Blue 50 #4589ff, Blue 40 #78a9ff,
   Green 50 #42be65, Red 50 #fa4d56, Yellow 30 #f1c21b.
   ============================================================================= */

:root {
	color-scheme: dark;

	/* IBM Carbon brand accent — theme layer over the canonical monochrome system.
	   Scoped visual identity for /ibm/* surfaces; everything else stays monochrome. */
	--brand-blue:        #0f62fe;
	--brand-blue-2:      #4589ff;
	--brand-blue-light:  #78a9ff;
	--brand-blue-dim:    rgba(15, 98, 254, 0.12);
	--brand-blue-glow:   rgba(15, 98, 254, 0.22);
	--brand-blue-stroke: rgba(120, 169, 255, 0.22);

	/* ---- Back-compat aliases -----------------------------------------------
	 * Every legacy spelling found across the /ibm pages maps to a canonical
	 * token above. Add a new alias here rather than re-defining a token.
	 * NOTE: --stroke maps to the canonical monochrome stroke, not
	 * --brand-blue-stroke (the IBM blue variant). Use --brand-blue-stroke
	 * explicitly where blue borders are intentional. */

	--bg:            #070707;
	--panel:         var(--surface-1);
	--panel-solid:   var(--surface-1);
	--panel-2:       var(--surface-2);
	--panel2:        var(--surface-2);
	--panel-hover:   var(--surface-3);

	--border:        var(--stroke);
	--border2:       var(--stroke-strong);
	--border-hi:     var(--stroke-strong);
	--border-strong: var(--stroke-strong);
	--line:          var(--stroke);
	--stroke:        var(--stroke-strong, rgba(255, 255, 255, 0.14)); /* monochrome — use --brand-blue-stroke for IBM blue borders */

	--text:          var(--ink);
	--ink:           #e8e8e8;
	--accent:        var(--accent, #ffffff);
	--accent2:       #cccccc;
	--muted:         var(--ink-dim);
	--muted2:        var(--ink-dim);
	--faint:         var(--ink-dim);

	--green:         var(--success);
	--up:            var(--success);
	--allow:         var(--success);
	--down:          var(--danger);
	--block:         var(--danger);
	--warn:          var(--warn);
	--review:        var(--warn);
	--amber:         var(--warn);

	--radius:        var(--radius-card);
	--radius-sm:     var(--radius-control);
	--radius-md:     var(--radius-card);
	--radius-lg:     var(--radius-card);
	--shadow:        0 20px 56px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.3);

	--font:          "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--mono:          var(--font-mono);

	/* ---- Canonical card tokens — let .card from style.css work on IBM pages */
	--card-bg:           var(--surface-1);
	--card-border:       var(--stroke);
	--card-border-hover: var(--stroke-strong);
	--card-radius:       var(--radius-card);
	--card-pad:          var(--space-lg);
	--card-shadow:       0 20px 56px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.3);
	--focus-ring-color:  var(--brand-blue-light);
	--focus-ring-width:  2px;
	--focus-ring-offset: 2px;
}

/* =============================================================================
   Base — safe defaults. Page-level inline <style> loads after this <link> and
   wins at equal specificity, so these never fight a page's own rules.
   ============================================================================= */

.ibm-scope, body.ibm {
	background: #070707;
	color: var(--ink);
	font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	-webkit-font-smoothing: antialiased;
}

/* =============================================================================
   Components — prefixed `.ibm-` so they never collide with a page's existing
   .btn / .chip / .panel classes. Use these for new UI (states, skeletons,
   badges) and going forward as the standard primitives.
   ============================================================================= */

/* Buttons ------------------------------------------------------------------ */
.ibm-btn {
	display: inline-flex;
	align-items: center;
	gap: var(--space-sm);
	padding: 11px 18px;
	border-radius: var(--radius-card);
	border: 1px solid var(--stroke);
	background: var(--surface-2);
	color: var(--ink);
	font: 600 14px/1 "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.15s cubic-bezier(0.4, 0.14, 0.3, 1),
		border-color 0.15s cubic-bezier(0.4, 0.14, 0.3, 1),
		filter 0.15s cubic-bezier(0.4, 0.14, 0.3, 1),
		transform 0.15s cubic-bezier(0.4, 0.14, 0.3, 1);
}
.ibm-btn:hover { background: var(--surface-3); border-color: var(--stroke-strong); }
.ibm-btn:active { transform: translateY(1px); }
.ibm-btn[disabled], .ibm-btn[aria-disabled="true"] {
	opacity: 0.5; cursor: not-allowed; pointer-events: none;
}
.ibm-btn--primary {
	background: var(--brand-blue);
	border-color: transparent;
	color: #fff;
}
.ibm-btn--primary:hover { background: var(--brand-blue); filter: brightness(1.12); border-color: transparent; }
.ibm-btn--ghost { background: transparent; }
.ibm-btn--sm { padding: 7px 12px; font-size: 13px; }

/* Chip --------------------------------------------------------------------- */
.ibm-chip {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 6px 12px;
	border-radius: var(--radius-pill);
	border: 1px solid var(--stroke);
	background: var(--surface-2);
	color: var(--ink-dim);
	font: 500 12px/1 "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	cursor: pointer;
	transition: color 0.15s cubic-bezier(0.4, 0.14, 0.3, 1),
		border-color 0.15s cubic-bezier(0.4, 0.14, 0.3, 1),
		background 0.15s cubic-bezier(0.4, 0.14, 0.3, 1);
}
.ibm-chip:hover, .ibm-chip[aria-selected="true"] {
	color: var(--ink); border-color: var(--stroke-strong);
}

/* Card / panel ------------------------------------------------------------- */

/* Canonical .card primitive — mirrors style.css; IBM pages don't load style.css
   so we define it here consuming the --card-* tokens set in the :root above. */
.card {
	background: var(--card-bg);
	border: 1px solid var(--card-border);
	border-radius: var(--card-radius);
	padding: var(--card-pad);
	box-shadow: var(--card-shadow);
}
.card--interactive {
	cursor: pointer;
	transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.card--interactive:hover {
	border-color: var(--card-border-hover);
	transform: translateY(-2px);
}
.card--interactive:active { transform: translateY(0) scale(0.99); }
.card--interactive:focus-visible {
	outline: var(--focus-ring-width) solid var(--focus-ring-color);
	outline-offset: var(--focus-ring-offset);
}

.ibm-card {
	background: var(--surface-1);
	border: 1px solid var(--stroke);
	border-radius: var(--radius-card);
	box-shadow: 0 20px 56px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Status badge (live / allow / review / block) ----------------------------- */
.ibm-badge {
	display: inline-flex; align-items: center; gap: 7px;
	padding: 4px 11px;
	border-radius: var(--radius-pill);
	border: 1px solid var(--stroke);
	font: 600 11px/1 "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	letter-spacing: 0.04em; text-transform: uppercase;
	color: var(--ink-dim);
}
.ibm-badge .ibm-badge__dot {
	width: 7px; height: 7px; border-radius: 50%;
	background: var(--brand-blue); box-shadow: 0 0 10px var(--brand-blue);
}
.ibm-badge--live    { color: var(--brand-blue-light); border-color: var(--brand-blue-stroke); }
.ibm-badge--allow   { color: var(--success); border-color: rgba(66,190,101,0.4); }
.ibm-badge--allow   .ibm-badge__dot { background: var(--success); box-shadow: 0 0 10px var(--success); }
.ibm-badge--review  { color: var(--warn); border-color: rgba(241,194,27,0.4); }
.ibm-badge--review  .ibm-badge__dot { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.ibm-badge--block   { color: var(--danger); border-color: rgba(250,77,86,0.4); }
.ibm-badge--block   .ibm-badge__dot { background: var(--danger); box-shadow: 0 0 10px var(--danger); }

/* Spinner ------------------------------------------------------------------ */
.ibm-spinner {
	display: inline-block;
	width: 16px; height: 16px;
	border: 2px solid var(--stroke-strong);
	border-top-color: var(--brand-blue-light);
	border-radius: 50%;
	animation: ibm-spin 0.7s linear infinite;
	vertical-align: middle;
}
.ibm-spinner--lg { width: 28px; height: 28px; border-width: 3px; }
@keyframes ibm-spin { to { transform: rotate(360deg); } }

/* Skeleton (shimmer placeholder) ------------------------------------------- */
.ibm-skeleton {
	position: relative;
	overflow: hidden;
	border-radius: var(--radius-control);
	background: var(--surface-2);
}
.ibm-skeleton::after {
	content: "";
	position: absolute; inset: 0;
	transform: translateX(-100%);
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
	animation: ibm-shimmer 1.4s infinite;
}
@keyframes ibm-shimmer { 100% { transform: translateX(100%); } }
.ibm-skeleton--text { height: 0.85em; margin: 0.35em 0; }
.ibm-skeleton--line { height: 12px; }
.ibm-skeleton--block { height: 120px; border-radius: var(--radius-card); }

/* State blocks — loading / empty / error.
   The fix for "blank panel / spinner-forever on 503". One designed, accessible
   shell for every non-happy state, used identically across the surface. ------ */
.ibm-state {
	display: flex; flex-direction: column; align-items: center; justify-content: center;
	gap: var(--space-sm);
	text-align: center;
	padding: var(--space-xl) var(--space-lg);
	min-height: 160px;
	color: var(--ink-dim);
}
.ibm-state__icon {
	width: 40px; height: 40px;
	display: flex; align-items: center; justify-content: center;
	border-radius: var(--radius-card);
	background: var(--brand-blue-dim);
	border: 1px solid var(--brand-blue-stroke);
	color: var(--brand-blue-light);
}
.ibm-state__title { color: var(--ink); font-size: 15px; font-weight: 600; }
.ibm-state__body  { font-size: 14px; line-height: 1.55; max-width: 42ch; }
.ibm-state--error .ibm-state__icon {
	background: rgba(250, 77, 86, 0.12);
	border-color: rgba(250, 77, 86, 0.4);
	color: var(--danger);
}
.ibm-state__action { margin-top: var(--space-sm); }

/* Visually-hidden (screen-reader only) ------------------------------------- */
.ibm-sr-only {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0, 0, 0, 0);
	white-space: nowrap; border: 0;
}

/* =============================================================================
   Accessibility — applies to every page that links this file.
   ============================================================================= */

/* A consistent, visible focus ring for keyboard users across the surface.
   Pages that style their own :focus-visible win (loaded later); this is the
   default so nothing is ever left without a focus indicator. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible,
.ibm-btn:focus-visible,
.ibm-chip:focus-visible {
	outline: 2px solid var(--brand-blue-light);
	outline-offset: 2px;
	border-radius: 4px;
}

/* Honor reduced-motion globally — fixes every "animation ignores
   prefers-reduced-motion" finding on the surface in one place. */
@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;
	}
}
