/*
 * bc's tokens (@bc/ui): the Brilliant family's neutrals and type (Websites/sites/brilliantappsltd global.css) with the
 * deployment's accent. The accent defaults to Brilliant Certify's cobalt; a deployment's brand (GET /api/public/brand,
 * brand/brand.ts applyBrand, ADR 0031) replaces the five --bc-accent* / --bc-mint values at start-up, so nothing may
 * hard-code an accent colour: use these variables (or the Tailwind names in tailwind.preset.js). Imported once by each app
 * before Tailwind's layers. Also the record shell's slides (Pvb's _brand.scss timings and curves), the calendar's booking
 * tones, the frames' floating cards and the loading skeletons' shimmer.
 */
:root {
  --bc-ink: #2a2430; /* 14.5:1 on the ground */
  --bc-ink-muted: #6e6675; /* 5.3:1 on the ground */
  --bc-ground: #fdfaf8;
  --bc-card: #ffffff;
  --bc-hairline: #ece5ea; /* decorative rules only */
  --bc-line: #8f8796; /* control outlines: 3.3:1 on the ground (WCAG 1.4.11) */
  --bc-chip: #f1ecf2;
  --bc-warm: #fbf8f6;
  --bc-wordmark: #565163;
  /* Brilliant Certify's cobalt (Brilliant Cases' violet and a customer's own come from the brand, brand/brand.ts). */
  --bc-accent: #1d4ed8; /* cobalt: 6.4:1 on the ground, 6.0:1 on its wash; white on it 6.7:1 */
  --bc-accent-hover: #1e40af; /* white on it 8.7:1; on the wash 7.9:1 (chips, the current menu item) */
  --bc-accent-ink: #ffffff;
  --bc-accent-wash: #eef3ff;
  --bc-accent-line: #bfd0fa; /* decorative outlines only (1.5:1 on white) */
  --bc-ok: #1f7a3d;
  --bc-ok-wash: #eaf6ee;
  --bc-warn: #8a4b00;
  --bc-warn-wash: #fff4e2;
  --bc-warn-line: #f0c98a;
  --bc-danger: #b42318;
  --bc-danger-wash: #fdecea;
  --bc-danger-line: #f1b4ad;
  /* On ink (the sign-in screens' side panel, the portal's footer): the headers are white since 2026-12-03. */
  --bc-on-ink: #ffffff;
  --bc-on-ink-muted: #d7d2ce; /* 10:1 on ink */
  --bc-on-ink-rule: #453c4c;
  /* The accent on dark (named "mint" from the teal days; the Tailwind name stays): the mark and the focus ring on ink. */
  --bc-mint: #93b4ff; /* light cobalt: 7.3:1 on ink */
  /* The frames (ADR 0023 update 2026-12-03): from 1024px the header, side menu and record pane float as white cards inset
     from the ground; below it the header is a plain white bar. Content cards echo the radius. */
  --bc-frame-inset: 12px;
  --bc-float-radius: 16px;
  --bc-float-shadow: 0 6px 20px rgba(42, 36, 48, 0.08), 0 1px 2px rgba(42, 36, 48, 0.06);
  /* Loading skeletons: brand ink at low alpha (Pvb's), so they sit in the palette and the shimmer still shows. */
  --bc-skeleton: rgba(42, 36, 48, 0.07);
  --bc-skeleton-shine: rgba(42, 36, 48, 0.13);
  /* The record pane: 620-760px beside the list (desktop), about 600px over it (iPad), full screen on a phone. */
  --bc-pane-w: clamp(620px, 46vw, 760px);
  --bc-ios-curve: cubic-bezier(0.32, 0.72, 0, 1);
  --bc-md-curve: cubic-bezier(0.2, 0, 0, 1);
  color-scheme: light;
}

@media (max-width: 1023.98px) {
  :root {
    --bc-pane-w: min(600px, 92vw);
  }
}

@media (max-width: 767.98px) {
  :root {
    --bc-pane-w: 100vw;
  }
}

/* ---- The record shell's slides (class names from pane/slide.ts) ---- */
@keyframes bc-from-right { from { transform: translateX(100%); } to { transform: none; } }
@keyframes bc-to-right { from { transform: none; } to { transform: translateX(100%); } }
@keyframes bc-from-left-part { from { transform: translateX(-30%); } to { transform: none; } }
@keyframes bc-to-left-part { from { transform: none; } to { transform: translateX(-30%); } }
@keyframes bc-in-right { from { transform: translateX(32px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes bc-out-right { from { transform: none; opacity: 1; } to { transform: translateX(32px); opacity: 0; } }
@keyframes bc-in-left { from { transform: translateX(-32px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes bc-md-to-left { from { transform: none; } to { transform: translateX(-32px); } }
@keyframes bc-md-from-left { from { transform: translateX(-32px); } to { transform: none; } }
@keyframes bc-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes bc-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes bc-pop { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }

/* Desktop: the pane fades in beside the list (the page makes room in 150ms). */
.bc-slide-pane-in-desktop { animation: bc-fade-in 150ms ease both; }
.bc-slide-pane-out-desktop { animation: bc-fade-out 120ms ease both; }
/* iPad: the pane slides in from the right over the dimmed list. */
.bc-slide-pane-in-tablet { animation: bc-from-right 420ms var(--bc-ios-curve) both; }
.bc-slide-pane-out-tablet { animation: bc-to-right 360ms var(--bc-ios-curve) both; }
/* Inside the pane (desktop and iPad): a record pushed on top slides 32px and fades; Back is the mirror; a list row fades. */
.bc-slide-push-pane { animation: bc-in-right 280ms var(--bc-md-curve) both; }
.bc-slide-uncover-pane { animation: bc-in-left 280ms var(--bc-md-curve) both; }
.bc-slide-replace-pane { animation: bc-fade-in 160ms ease both; }
/* Phone, iOS: the record pushes in from the right while the list shifts 30% left; Back uncovers; Close slides it out. */
.bc-slide-pane-in-ios { animation: bc-from-right 420ms var(--bc-ios-curve) both; }
.bc-slide-pane-out-ios { animation: bc-to-right 360ms var(--bc-ios-curve) both; }
.bc-slide-push-ios { animation: bc-from-right 420ms var(--bc-ios-curve) both; }
.bc-slide-uncover-ios { animation: bc-from-left-part 360ms var(--bc-ios-curve) both; }
.bc-list-out-ios { animation: bc-to-left-part 420ms var(--bc-ios-curve) both; }
.bc-list-in-ios { animation: bc-from-left-part 360ms var(--bc-ios-curve) both; }
/* Phone, Android (Material): a 280ms slide-and-fade. */
.bc-slide-pane-in-md { animation: bc-in-right 280ms var(--bc-md-curve) both; }
.bc-slide-pane-out-md { animation: bc-out-right 200ms var(--bc-md-curve) both; }
.bc-slide-push-md { animation: bc-in-right 280ms var(--bc-md-curve) both; }
.bc-slide-uncover-md { animation: bc-in-left 280ms var(--bc-md-curve) both; }
.bc-list-out-md { animation: bc-md-to-left 280ms var(--bc-md-curve) both; }
.bc-list-in-md { animation: bc-md-from-left 280ms var(--bc-md-curve) both; }
/* The dimmed list under the pane (iPad): 300ms in, 250ms out. */
.bc-backdrop-in { animation: bc-fade-in 300ms ease both; }
.bc-backdrop-out { animation: bc-fade-out 250ms ease both; }
.bc-pop { animation: bc-pop 160ms ease both; }

/*
 * The page stack: each frame's content element (the back office's and portal's <main>, the field app's) carries
 * `bc-stack`, so the cards and sections a page renders side by side in a fragment get space between them without the
 * page adding its own: `--bc-stack-gap` (16px if unset; each frame sets its own) above every in-flow child after the first.
 * Out-of-flow children (fixed dialogs, absolute or screen-reader-only text, floats) take no space and leave the next child
 * unspaced. In :where(), so the rule weighs no more than a class: a child's own mt-* wins, and margins it already has
 * (mb-*) collapse into the gap instead of adding to it.
 */
.bc-stack > :where(:not(.fixed, .absolute, .sr-only, .float-left, .float-right, [hidden], template, script, style)
  ~ :not(.fixed, .absolute, .sr-only, .float-left, .float-right, [hidden], template, script, style)) {
  margin-top: var(--bc-stack-gap, 16px);
}

/* The page makes room for the pane from 1024px. */
.bc-makes-room { transition: padding-right 150ms ease; }

/* iOS back: chevron and the previous title, 17px weight 400, dimming to 0.3 while pressed. Material: a round 48px button. */
.bc-back--ios {
  display: inline-flex; align-items: center; gap: 3px; height: 44px; max-width: 160px; padding: 0 8px 0 2px; border: 0;
  background: transparent; color: var(--bc-accent-hover); font-family: -apple-system, BlinkMacSystemFont, 'Plus Jakarta Sans', sans-serif;
  font-size: 17px; font-weight: 400; letter-spacing: -0.02em; cursor: pointer; transition: opacity 200ms ease;
  -webkit-tap-highlight-color: transparent;
}
.bc-back--ios:active { opacity: 0.3; transition: none; }
.bc-back--md {
  display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 999px; border: 0;
  background: transparent; color: var(--bc-ink); cursor: pointer; transition: background-color 150ms ease;
}
.bc-back--md:hover { background: var(--bc-warm); }
.bc-back--md:active { background: rgba(42, 36, 48, 0.12); }

/* Calendar bars: visits in the accent, grading amber, leave hatched, Outlook busy grey. */
.bc-tone-visit { background: var(--bc-accent-wash); border: 1px solid var(--bc-accent-line); color: var(--bc-accent-hover); }
.bc-tone-grading { background: #fff4e5; border: 1px solid #f3d19c; color: #8a4b00; }
.bc-tone-leave { background: repeating-linear-gradient(135deg, #f1ecf2 0 6px, #fbf8f6 6px 12px); border: 1px solid #dcd3de; color: #6e6675; }
.bc-tone-busy { background: #f4f1f3; border: 1px solid #dcd3de; color: #6e6675; }

/*
 * ---- Safe areas (an installed web app, viewport-fit=cover: ADR 0031 "Installed web apps"). ----
 * The light frame's header clears the status bar and notch, and the header, page and tab bar clear the notch on a phone on
 * its side; the body (an iPad) and a phone's open record clear the home indicator. The element's own padding goes in
 * --bc-pad-top / --bc-pad-x / --bc-pad-bottom (not Tailwind's pt-, px- or pb- classes, which these replace); the insets are 0
 * in a browser tab and on a desktop. frameClasses and RecordPaneHost give them.
 */
.bc-safe-top { padding-top: calc(var(--bc-pad-top, 0px) + env(safe-area-inset-top, 0px)); }
.bc-safe-x {
  padding-left: calc(var(--bc-pad-x, 0px) + env(safe-area-inset-left, 0px));
  padding-right: calc(var(--bc-pad-x, 0px) + env(safe-area-inset-right, 0px));
}
.bc-safe-bottom { padding-bottom: calc(var(--bc-pad-bottom, 0px) + env(safe-area-inset-bottom, 0px)); }

/*
 * ---- The light frame's header: fixed at the top of the window (frame.tsx frameClasses, useFixedHeader). ----
 * As Pvb's admin phone shell bar (Pvb angular/src/styles/_shell.scss `.pvb-shell-bar`, `position: fixed; inset: 0 0 auto 0`, white,
 * padded by env(safe-area-inset-top)). iOS 26 (Safari and installed web apps) blurs the band under the status bar with its
 * "scroll edge effect" unless a fixed or sticky element touches the top edge; then it extends that element's colour solid
 * instead. A header in normal flow over an inner scrolling <main> is neither, and was blurred (Sean's iPhone, 2026-12-04).
 * The frame's root pads its top by the header's measured height, so the page, menu and pane start below it.
 */
.bc-header-fixed { position: fixed; top: 0; left: 0; right: 0; }
.bc-under-header { padding-top: var(--bc-header-space, 0px); }

/* ---- The frames' floating cards (1024px and up): the header, the side menu, the record pane. ---- */
.bc-float {
  background: var(--bc-card);
  border-radius: var(--bc-float-radius);
  box-shadow: var(--bc-float-shadow);
}

/* ---- Loading skeletons (skeleton/Skeleton.tsx): one shimmer, stopped under Reduce Motion. ---- */
@keyframes bc-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.bc-skeleton {
  display: block;
  max-width: 100%;
  border-radius: 6px;
  background-color: var(--bc-skeleton);
  background-image: linear-gradient(90deg, transparent 0%, var(--bc-skeleton-shine) 50%, transparent 100%);
  background-size: 200% 100%;
  background-repeat: no-repeat;
  animation: bc-shimmer 1.4s ease-in-out infinite;
}
.bc-skeleton-line { height: 1em; border-radius: 6px; }
.bc-skeleton-round { border-radius: 999px; }

/* Reduce Motion: no sliding, a 120ms fade. */
@media (prefers-reduced-motion: reduce) {
  .bc-slide-pane-in-desktop, .bc-slide-pane-in-tablet, .bc-slide-pane-in-ios, .bc-slide-pane-in-md,
  .bc-slide-push-pane, .bc-slide-uncover-pane, .bc-slide-replace-pane, .bc-slide-push-ios, .bc-slide-uncover-ios,
  .bc-slide-push-md, .bc-slide-uncover-md, .bc-backdrop-in, .bc-pop {
    animation: bc-fade-in 120ms ease both !important;
  }
  .bc-slide-pane-out-desktop, .bc-slide-pane-out-tablet, .bc-slide-pane-out-ios, .bc-slide-pane-out-md, .bc-backdrop-out {
    animation: bc-fade-out 120ms ease both !important;
  }
  .bc-list-out-ios, .bc-list-in-ios, .bc-list-out-md, .bc-list-in-md { animation: none !important; }
  .bc-makes-room { transition: none; }
  .bc-skeleton { animation: none !important; background-image: none; }
}
