/*
 * ChadScales Lead Popup - styles
 * ------------------------------------------------------------------
 * Corner slide-in panel, not a centre modal.
 * Themed to 01 - Strategy/ChadScales Brand Style Guide.md (10 July 2026).
 *
 * The reference design (an orange corner card) fills the whole panel
 * with the brand colour. That does not translate to ChadScales. The
 * brand rule is a near-black base with green used as an accent and a
 * contrast split, never a full flood. So the panel stays dark, and the
 * green does the work on the border glow, the eyebrow, the headline
 * split and the CTA. Same shape, correct brand.
 *
 * All selectors namespaced .csp- so nothing on the host page is hit.
 */

:root {
  /* ---- Colour: from the brand guide ---- */
  --csp-base: #070C08;
  --csp-glow: #0D160D;
  --csp-accent: #3EFF52;
  --csp-accent-deep: #39D94A;
  --csp-card: #0D170E;
  --csp-card-border: #1E3D22;
  --csp-text: #B8C2B8;
  --csp-heading: #FFFFFF;
  --csp-badge: #C4D82E;

  /* Derived */
  --csp-accent-glow: rgba(62, 255, 82, 0.30);
  --csp-accent-text-on: #05170A;
  --csp-error: #FF6B6B;
  --csp-focus-ring: #C4D82E;
  --csp-scrim: rgba(3, 6, 4, 0.55);   /* only used if dimBackground is on */

  /* ---- Type ---- */
  --csp-font-heading: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --csp-font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --csp-font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --csp-weight-heading: 800;
  --csp-weight-body: 400;
  --csp-weight-button: 700;

  --csp-size-eyebrow: 0.6875rem;
  --csp-size-heading: 1.375rem;
  --csp-size-body: 0.875rem;
  --csp-size-small: 0.75rem;
  --csp-size-cta: 1rem;

  --csp-line-heading: 1.18;
  --csp-line-body: 1.55;
  --csp-track-eyebrow: 0.14em;

  /* ---- Space ---- */
  --csp-space-xs: 6px;
  --csp-space-sm: 10px;
  --csp-space-md: 14px;
  --csp-space-lg: 20px;
  --csp-space-xl: 24px;

  /* ---- Shape ---- */
  --csp-radius: 18px;          /* the reference card is quite round */
  --csp-radius-sm: 10px;
  --csp-border-width: 1px;
  --csp-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --csp-ring: 0 0 0 1px var(--csp-card-border), 0 0 40px rgba(62, 255, 82, 0.10);

  /* ---- Layout ---- */
  --csp-width: 380px;          /* panel width on desktop */
  --csp-offset: 22px;          /* distance from the screen edge */
  --csp-z: 2147483000;

  /* ---- Motion ---- */
  --csp-slide: 340ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* The dock is the corner anchor. It does not cover the page and does
   not swallow clicks, so the site stays usable behind it. */
.csp-dock {
  position: fixed;
  z-index: var(--csp-z);
  pointer-events: none;
  font-family: var(--csp-font-body);
  box-sizing: border-box;
}

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

.csp-dock-bottom-right { right: var(--csp-offset); bottom: var(--csp-offset); }
.csp-dock-bottom-left  { left: var(--csp-offset);  bottom: var(--csp-offset); }
.csp-dock-top-right    { right: var(--csp-offset); top: var(--csp-offset); }
.csp-dock-top-left     { left: var(--csp-offset);  top: var(--csp-offset); }

/* Optional scrim. Off by default. Turn on only if you want the panel
   to behave like an interruption rather than an offer. */
.csp-scrim {
  position: fixed;
  inset: 0;
  z-index: calc(var(--csp-z) - 1);
  background: var(--csp-scrim);
  opacity: 0;
  transition: opacity var(--csp-slide);
}

.csp-scrim.csp-visible { opacity: 1; }

.csp-panel {
  pointer-events: auto;
  position: relative;
  width: var(--csp-width);
  max-width: calc(100vw - (var(--csp-offset) * 2));
  max-height: calc(100vh - (var(--csp-offset) * 2));
  overflow-y: auto;
  padding: var(--csp-space-xl);
  background:
    radial-gradient(120% 80% at 50% 0%, var(--csp-glow) 0%, var(--csp-base) 60%);
  border: var(--csp-border-width) solid var(--csp-card-border);
  border-radius: var(--csp-radius);
  box-shadow: var(--csp-shadow), var(--csp-ring);
  color: var(--csp-text);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--csp-slide), transform var(--csp-slide);
}

.csp-dock.csp-visible .csp-panel {
  opacity: 1;
  transform: translateY(0);
}

/* Top rows come in from the top instead. */
.csp-dock-top-right .csp-panel,
.csp-dock-top-left .csp-panel { transform: translateY(-16px); }

/* Header row: eyebrow and headline on the left, close on the right,
   mirroring the reference layout. */
.csp-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--csp-space-sm);
  margin-bottom: var(--csp-space-md);
}

.csp-eyebrow {
  margin: 0 0 var(--csp-space-xs);
  font-family: var(--csp-font-mono);
  font-size: var(--csp-size-eyebrow);
  font-weight: 500;
  letter-spacing: var(--csp-track-eyebrow);
  text-transform: uppercase;
  color: var(--csp-accent);
}

.csp-headline {
  margin: 0;
  font-family: var(--csp-font-heading);
  font-size: var(--csp-size-heading);
  font-weight: var(--csp-weight-heading);
  line-height: var(--csp-line-heading);
  letter-spacing: -0.015em;
  color: var(--csp-heading);
}

/* The contrast split: one phrase glows green, the rest stays white. */
.csp-headline .csp-hl {
  color: var(--csp-accent);
  text-shadow: 0 0 18px var(--csp-accent-glow);
}

.csp-close {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: -4px -4px 0 0;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--csp-radius-sm);
  color: var(--csp-text);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease;
}

.csp-close:hover {
  color: var(--csp-accent);
  border-color: var(--csp-card-border);
}

/* Media block: image or muted looping video, sits under the headline
   exactly like the reference card. */
.csp-media {
  display: block;
  width: 100%;
  margin-bottom: var(--csp-space-md);
  border: var(--csp-border-width) solid var(--csp-card-border);
  border-radius: var(--csp-radius-sm);
  overflow: hidden;
  background: var(--csp-card);
}

.csp-media img,
.csp-media video {
  display: block;
  width: 100%;
  height: auto;
}

.csp-body {
  margin: 0 0 var(--csp-space-md);
  font-size: var(--csp-size-body);
  font-weight: var(--csp-weight-body);
  line-height: var(--csp-line-body);
  color: var(--csp-text);
}

/* The big CTA, like the reference. Opens the email field. */
.csp-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 15px var(--csp-space-md);
  background: var(--csp-accent);
  border: 0;
  border-radius: var(--csp-radius-sm);
  color: var(--csp-accent-text-on);
  font-family: var(--csp-font-heading);
  font-size: var(--csp-size-cta);
  font-weight: var(--csp-weight-button);
  cursor: pointer;
  transition: background 120ms ease, box-shadow 120ms ease;
}

.csp-cta:hover:not(:disabled) {
  background: var(--csp-accent-deep);
  box-shadow: 0 0 26px var(--csp-accent-glow);
}

.csp-cta:disabled { opacity: 0.55; cursor: default; }

.csp-cta .csp-arrow { transition: transform 140ms ease; }
.csp-cta:hover .csp-arrow { transform: translateX(3px); }

/* Form card, revealed on CTA click. Bordered card, per the brand. */
.csp-card {
  margin-top: var(--csp-space-md);
  padding: var(--csp-space-md);
  background: var(--csp-card);
  border: var(--csp-border-width) solid var(--csp-card-border);
  border-radius: var(--csp-radius-sm);
}

.csp-label {
  display: block;
  margin-bottom: var(--csp-space-xs);
  font-family: var(--csp-font-mono);
  font-size: var(--csp-size-small);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--csp-text);
}

.csp-input {
  width: 100%;
  padding: 12px var(--csp-space-md);
  background: var(--csp-base);
  border: var(--csp-border-width) solid var(--csp-card-border);
  border-radius: var(--csp-radius-sm);
  color: var(--csp-heading);
  font-family: var(--csp-font-body);
  font-size: var(--csp-size-body);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.csp-input:hover { border-color: var(--csp-accent-deep); }

.csp-input:focus {
  outline: none;
  border-color: var(--csp-accent);
  box-shadow: 0 0 0 3px rgba(62, 255, 82, 0.12);
}

.csp-input::placeholder { color: var(--csp-text); opacity: 0.45; }
.csp-input.csp-input-error { border-color: var(--csp-error); }

.csp-privacy {
  margin: var(--csp-space-sm) 0 0;
  font-size: var(--csp-size-small);
  line-height: var(--csp-line-body);
  color: var(--csp-text);
  opacity: 0.75;
}

.csp-error {
  margin: var(--csp-space-sm) 0 0;
  font-family: var(--csp-font-mono);
  font-size: var(--csp-size-small);
  line-height: var(--csp-line-body);
  color: var(--csp-error);
}

.csp-download {
  display: block;
  margin-top: var(--csp-space-md);
  padding: 15px var(--csp-space-md);
  background: var(--csp-accent);
  border-radius: var(--csp-radius-sm);
  color: var(--csp-accent-text-on);
  font-family: var(--csp-font-heading);
  font-size: var(--csp-size-cta);
  font-weight: var(--csp-weight-button);
  text-align: center;
  text-decoration: none;
}

.csp-download:hover {
  background: var(--csp-accent-deep);
  box-shadow: 0 0 26px var(--csp-accent-glow);
}

/* Footer: wordmark left, tagline right. Small, quiet. */
.csp-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--csp-space-sm);
  margin-top: var(--csp-space-lg);
  padding-top: var(--csp-space-sm);
  border-top: var(--csp-border-width) solid var(--csp-card-border);
}

.csp-wordmark {
  font-family: var(--csp-font-heading);
  font-weight: var(--csp-weight-heading);
  font-size: 0.8125rem;
  letter-spacing: -0.01em;
  color: var(--csp-heading);
}

.csp-wordmark span { color: var(--csp-accent); }

.csp-tagline {
  margin: 0;
  font-family: var(--csp-font-mono);
  font-size: var(--csp-size-eyebrow);
  font-weight: 500;
  letter-spacing: var(--csp-track-eyebrow);
  text-transform: uppercase;
  color: var(--csp-accent);
  opacity: 0.65;
}

/* Honeypot */
.csp-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.csp-hidden { display: none !important; }

.csp-dock :focus-visible {
  outline: 2px solid var(--csp-focus-ring);
  outline-offset: 2px;
}

/* On phones the corner panel becomes a bottom sheet, full width.
   A 380px card floating in a 390px viewport looks broken. */
@media (max-width: 520px) {
  :root {
    --csp-offset: 10px;
    --csp-size-heading: 1.25rem;
    --csp-space-xl: 18px;
  }
  .csp-dock {
    left: var(--csp-offset);
    right: var(--csp-offset);
    bottom: var(--csp-offset);
    top: auto;
  }
  .csp-panel { width: 100%; max-height: 82vh; }
}

/* Minimized tab. Shown after the panel is closed, instead of the
   popup vanishing entirely. Sits in the same corner, small, reusing
   the .csp-dock-* position classes for placement. Click reopens the
   full panel from scratch. */
.csp-mini {
  position: fixed;
  z-index: var(--csp-z);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--csp-card);
  border: var(--csp-border-width) solid var(--csp-card-border);
  border-radius: 999px;
  box-shadow: var(--csp-shadow);
  cursor: pointer;
  color: var(--csp-heading);
  font-family: var(--csp-font-body);
  font-size: var(--csp-size-small);
  font-weight: 600;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--csp-slide), transform var(--csp-slide),
              border-color 120ms ease, box-shadow 120ms ease;
}

.csp-mini.csp-visible {
  opacity: 1;
  transform: translateY(0);
}

.csp-mini:hover {
  border-color: var(--csp-accent);
  box-shadow: var(--csp-shadow), 0 0 20px var(--csp-accent-glow);
}

.csp-mini-badge {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--csp-badge);
  border-radius: 50%;
  color: var(--csp-badge);
  font-size: 15px;
  line-height: 1;
}

@media (max-width: 520px) {
  .csp-mini { padding: 9px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .csp-panel,
  .csp-scrim,
  .csp-cta,
  .csp-input,
  .csp-mini { transition: none; }
  .csp-panel { transform: none; }
}
