/* =========================================================================
   VARN LAUNCH — first-load modal + follow-up bottom bar
   -------------------------------------------------------------------------
   Markup:  template-parts/varn-launch.php
   Script:  assets/js/varn-launch.js
   Enqueue: inc/enqueue.php (global)

   Every value is a design token. Everything is namespaced `varn-` so it
   cannot reach any existing rule, and both regions are position:fixed
   overlays that never touch the normal flow — so no current layout moves.

   Visibility is driven from JS, not from here: each region ships with the
   `hidden` attribute (utilities/[hidden] wins), the script removes it and
   adds `.is-open` to run the entrance. `.varn-lock` on <html> holds the page
   still while the modal is up.
   ========================================================================= */

/* The `hidden` attribute must win. Both regions set `display` below (flex on
   the modal), which would otherwise override the browser's [hidden] rule and
   leave an invisible backdrop catching clicks over the whole page at rest.
   This attribute selector out-specifies those display rules. */
.varn-modal[hidden],
.varn-bar[hidden] {
  display: none !important;
}

/* =========================================================================
   1. CORNER POPUP CARD
   A compact promo card anchored to the bottom-right — NOT a centered
   takeover. The page stays scrollable behind a light dim; the card floats
   in the corner the way the supplied reference does.
   ========================================================================= */

.varn-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: flex-end;    /* bottom … */
  justify-content: flex-end; /* … right corner */
  padding: var(--space-5);
  pointer-events: none;      /* only the card and its dim catch clicks */
}

.varn-modal__backdrop {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  background: rgba(22, 20, 16, 0.38);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity var(--duration-slow) var(--ease-out);
}

.varn-modal.is-open .varn-modal__backdrop {
  opacity: 1;
}

.varn-modal__dialog {
  position: relative;
  z-index: 1;
  pointer-events: auto;
  display: grid;
  /* 17 Sep 2026: narrower visual column and tighter spacing, so the card is
     about a third shorter. */
  grid-template-columns: 210px 1fr;
  width: 100%;
  max-width: 580px;
  max-height: calc(100vh - (2 * var(--space-5)));
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  /* Entrance: rise into the corner. Overridden to a plain state by the
     reduced-motion block at the foot of this file. */
  opacity: 0;
  transform: translateY(24px) scale(0.98);
  transition:
    opacity var(--duration-slow) var(--ease-out),
    transform var(--duration-slow) var(--ease-spring);
}

.varn-modal.is-open .varn-modal__dialog {
  opacity: 1;
  transform: none;
}

/* ── Close button ─────────────────────────────────────────────────────── */
.varn-modal__close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--text-heading);
  background: color-mix(in srgb, var(--bg-surface) 70%, transparent);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--duration-normal) var(--ease-out),
              transform var(--duration-normal) var(--ease-out);
}

.varn-modal__close:hover,
.varn-modal__close:focus-visible {
  background: var(--bg-sunken);
  transform: rotate(90deg);
}

.varn-modal__close-icon {
  display: block;
}

/* ── Visual half ──────────────────────────────────────────────────────
   17 Sep 2026, owner's instruction: minimal and premium. No floating swatch
   dots, no colour aurora, no motion. A warm off-white panel, a fine inset
   frame, the lockup, and one quiet caption under it. */
.varn-modal__visual {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-4);
  background: linear-gradient(180deg, #fbfaf7 0%, #f3f1ec 100%);
  border-right: 1px solid var(--border-subtle);
}

/* Fine inset frame, like a mount around a print. */
.varn-modal__visual::before {
  content: "";
  position: absolute;
  inset: var(--space-3);
  border: 1px solid rgba(38, 36, 46, 0.08);
  border-radius: var(--radius-xl);
  pointer-events: none;
}

.varn-modal__logo {
  position: relative;
  width: 100%;
  max-width: 150px;
  height: auto;
}

.varn-modal__rating {
  position: relative;
  color: var(--text-muted);
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: var(--font-semibold);
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

/* ── Content half ─────────────────────────────────────────────────────── */
.varn-modal__body {
  padding: var(--space-5) var(--space-6) var(--space-5) var(--space-5);
  overflow-y: auto;
}

.varn-modal__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-2);
  color: var(--violet-600);
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: var(--font-bold);
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

/* A static status dot, not a pulse. */
.varn-modal__live {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2f9e6b;
}

.varn-modal__title {
  margin: 0;
  font-family: var(--font-body);
  font-size: clamp(24px, 3.4vw, 28px);
  font-weight: var(--font-extrabold);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text-heading);
}

.varn-modal__title span {
  color: var(--violet-600);
}

.varn-modal__kind {
  margin: var(--space-1) 0 0;
  font-size: 14px;
  font-weight: var(--font-semibold);
  color: var(--text-muted);
}

.varn-modal__desc {
  margin: var(--space-3) 0 0;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-body);
}

.varn-modal__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

/* A solid near-black pill: quieter and more premium than a coloured one, and
   the violet stays in the wordmark and the title accent. */
.varn-modal__cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 42px;
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: var(--font-semibold);
  color: var(--gray-0);
  text-decoration: none;
  background: var(--gray-900);
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--duration-normal) var(--ease-out);
}

.varn-modal__cta-label {
  padding: 0;
  border: 0;
}

.varn-modal__cta-icon {
  color: currentColor;
  transition: transform var(--duration-normal) var(--ease-out);
}

a.varn-modal__cta.varn-modal__cta:hover,
a.varn-modal__cta.varn-modal__cta:focus-visible {
  background: var(--gray-800);
  color: var(--gray-0);
}

.varn-modal__cta:hover .varn-modal__cta-icon,
.varn-modal__cta:focus-visible .varn-modal__cta-icon {
  transform: translateX(3px);
}

/* =========================================================================
   2. BOTTOM BAR
   ========================================================================= */

/* Slides up from below the fold when the script (varn-launch.js) adds
   .is-open — armed after the card is closed, triggered on scroll-down. */
.varn-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-toast);
  background: var(--violet-50);
  border-top: 1px solid var(--violet-100);
  box-shadow: 0 -8px 30px rgba(38, 36, 46, 0.10);
  /* Entrance: slide up from below the fold. */
  transform: translateY(110%);
  transition: transform var(--duration-slow) var(--ease-spring);
}

.varn-bar.is-open {
  transform: none;
}

.varn-bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}

.varn-bar__lede {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
}

.varn-bar__mark {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
}

.varn-bar__text {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text-body);
}

.varn-bar__text strong {
  color: var(--text-heading);
  font-weight: var(--font-bold);
}

.varn-bar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.varn-bar__cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 9px 18px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: var(--font-semibold);
  white-space: nowrap;
  color: var(--text-inverse);
  background: var(--violet-600);
  border-radius: var(--radius-full);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--duration-normal) var(--ease-out),
              transform var(--duration-normal) var(--ease-out);
}

.varn-bar__cta:hover,
.varn-bar__cta:focus-visible {
  background: var(--violet-700);
  color: var(--text-inverse);
  transform: translateY(-2px);
}

/* 17 Sep 2026: guard against page-level `a:hover` colour rules (the blog's
   turns links brand orange), which put orange text on the violet pill. */
a.varn-bar__cta.varn-bar__cta:hover,
a.varn-bar__cta.varn-bar__cta:focus-visible {
  background: var(--violet-700);
  color: var(--text-inverse);
}

.varn-bar__cta-icon {
  color: currentColor;
}

.varn-bar__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--text-muted);
  background: none;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--duration-normal) var(--ease-out),
              color var(--duration-normal) var(--ease-out);
}

.varn-bar__close:hover,
.varn-bar__close:focus-visible {
  color: var(--text-heading);
  background: var(--violet-100);
}

/* =========================================================================
   3. RESPONSIVE
   ========================================================================= */

@media (max-width: 640px) {
  .varn-modal {
    padding: var(--space-3);
  }

  /* The visual half is decoration; stack it on top as a short banner rather
     than a column, and let the card span the width at the foot of the
     screen — a bottom sheet rather than a corner card on a phone. */
  .varn-modal__dialog {
    grid-template-columns: 1fr;
    max-width: none;
    width: 100%;
  }

  .varn-modal__visual {
    min-height: 110px;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }

  .varn-modal__logo {
    max-width: 150px;
  }

  .varn-modal__body {
    padding: var(--space-6) var(--space-5) var(--space-5);
  }

  /* Bar: mark + text + CTA read as one stack, close pinned top-right. */
  .varn-bar__inner {
    flex-wrap: wrap;
    gap: var(--space-3);
    padding-right: 44px; /* room for the close button */
    position: relative;
  }

  .varn-bar__actions {
    width: 100%;
    justify-content: flex-start;
  }

  .varn-bar__cta {
    flex: 1;
    justify-content: center;
  }

  .varn-bar__close {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    width: 32px;
    height: 32px;
  }
}

/* =========================================================================
   4. REDUCED MOTION
   Honour the OS setting: reveal both regions with no travel and no float,
   so the promos still appear but nothing animates.
   ========================================================================= */

@media (prefers-reduced-motion: reduce) {
  .varn-modal__dialog,
  .varn-modal__backdrop,
  .varn-bar {
    transition: opacity var(--duration-normal) var(--ease-out);
  }

  .varn-modal__dialog {
    transform: none;
  }

  .varn-bar {
    transform: none;
    opacity: 0;
  }

  .varn-bar.is-open {
    opacity: 1;
  }

  .varn-modal__close:hover,
  .varn-modal__close:focus-visible {
    transform: none;
  }

  .varn-modal__cta-icon {
    transition: none;
  }
}
