/* Deskrune launch sale — conversion layer
   Loaded after style.css and dramatic-effects.css.
   Adds countdown banner, struck-through prices, social proof, exit intent.
   2026-05-07 */

/* ─── A11Y: skip-to-content (WCAG 2.4.1) + global :focus-visible ─── */
.skip-to-content {
  position: absolute;
  /* Off-canvas via transform (compositor) instead of `top` (layout/paint).
     Keeps the link in its absolute slot so focus reveal is purely a transform. */
  top: 8px;
  left: 8px;
  z-index: 1000;
  background: #141413;
  color: #faf9f5;
  padding: 10px 16px;
  text-decoration: none;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 13px;
  border-radius: 4px;
  transform: translateY(-150%);
  transition: transform 0.18s cubic-bezier(0.2, 0, 0, 1);
}
.skip-to-content:focus {
  transform: translateY(0);
  outline: 2px solid #c9613f;
  outline-offset: 2px;
}
:focus-visible {
  outline: 2px solid #c9613f;
  outline-offset: 3px;
  border-radius: 3px;
}
:root[data-theme="dark"] :focus-visible {
  outline-color: #f08160;
}

/* ─── COUNTDOWN BANNER (sticks to top, full width) ─── */
.deskrune-sale-banner {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(90deg, #c9613f 0%, #b8542c 100%);
  color: #faf9f5;
  padding: 12px 20px;
  text-align: center;
  font-family: var(--sans, 'Inter', sans-serif);
  font-size: 14px;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: 0 1px 0 rgba(0,0,0,0.08);
}
.deskrune-sale-banner strong {
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 12px;
}
.deskrune-sale-banner .deskrune-countdown {
  font-family: 'Inter', monospace;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: rgba(0,0,0,0.18);
  padding: 4px 10px;
  border-radius: 3px;
  font-size: 13px;
  letter-spacing: 0.04em;
}
.deskrune-sale-banner a {
  color: #faf9f5;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
}

/* ─── SALE PRICE TREATMENT ─── */
.live-price.on-sale {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.live-price.on-sale .price-was {
  font-size: 0.75em;
  color: var(--muted, #6b6960);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
  font-weight: 400;
  font-style: italic;
}
.live-price.on-sale .price-now {
  color: #c9613f;
  font-weight: 700;
  position: relative;
}
.live-price.on-sale .price-now::after {
  content: '';
  position: absolute;
  inset: -2px -8px;
  border: 1.5px solid rgba(201, 97, 63, 0.18);
  border-radius: 4px;
  pointer-events: none;
}
.sale-pct-off {
  display: inline-block;
  background: #c9613f;
  color: #faf9f5;
  padding: 2px 8px;
  border-radius: 3px;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-left: 8px;
  vertical-align: middle;
}

/* ─── SOCIAL PROOF BAR (fixed bottom-left) ─── */
.deskrune-proof-toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: #fff;
  border: 1px solid var(--rule, #e8e6dc);
  border-left: 3px solid #2da44e;
  border-radius: 4px;
  padding: 12px 18px 12px 16px;
  font-family: var(--sans, 'Inter', sans-serif);
  font-size: 13px;
  color: var(--ink, #141413);
  max-width: 320px;
  box-shadow: 0 8px 24px rgba(20,20,19,0.06);
  transform: translateY(120%);
  opacity: 0;
  /* Glide curve (slower decel) for the slide; quicker linear-ish opacity so it never crossfades behind. */
  transition:
    transform 0.42s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.32s cubic-bezier(0.4, 0, 0.6, 1);
  z-index: 90;
  cursor: default;
}
.deskrune-proof-toast.show {
  transform: translateY(0);
  opacity: 1;
}
.deskrune-proof-toast strong {
  font-weight: 600;
  color: #c9613f;
}
.deskrune-proof-toast .ago {
  display: block;
  font-size: 11px;
  color: var(--muted, #6b6960);
  margin-top: 2px;
  letter-spacing: 0.02em;
}
@media (max-width: 640px) {
  .deskrune-proof-toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
  }
}

/* ─── EXIT INTENT OVERLAY ─── */
.deskrune-exit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,20,19,0.55);
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  /* Cross-fade curve (sinusoidal-ish) — explicit, not browser-default ease. */
  animation: deskrune-fade-in 0.3s cubic-bezier(0.4, 0, 0.6, 1);
}
.deskrune-exit-overlay.show {
  display: flex;
}
@keyframes deskrune-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.deskrune-exit-card {
  background: var(--bg, #faf9f5);
  border: 1px solid var(--rule, #e8e6dc);
  border-radius: 6px;
  padding: 40px 36px;
  max-width: 520px;
  text-align: center;
  position: relative;
  font-family: var(--serif, 'Fraunces', serif);
  /* Drop-in: ease-out-expo decisive arrival. Sized at 360ms so it lands AFTER the
     overlay's 300ms fade (deliberate stagger between adjacent layered elements). */
  animation: deskrune-pop-in 0.36s cubic-bezier(0.16, 1, 0.3, 1) 0.06s both;
}
@keyframes deskrune-pop-in {
  from { transform: scale(0.96) translateY(14px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
.deskrune-exit-card h2 {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  font-style: italic;
  margin: 0 0 8px;
  color: var(--ink, #141413);
}
.deskrune-exit-card p {
  font-family: var(--serif);
  color: var(--ink-soft, #2d2a26);
  font-size: 16px;
  line-height: 1.55;
  margin: 0 0 24px;
}
.deskrune-exit-card form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
  margin: 0 auto;
}
.deskrune-exit-card input[type="email"] {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 14px 16px;
  font-family: var(--sans, 'Inter', sans-serif);
  font-size: 15px;
  outline: none;
  transition: border-color 0.16s cubic-bezier(0.2, 0, 0, 1);
}
.deskrune-exit-card input[type="email"]:focus { border-color: #c9613f; }
.deskrune-exit-card button {
  background: var(--ink, #141413);
  color: var(--bg, #faf9f5);
  border: none;
  border-radius: 4px;
  padding: 14px 20px;
  font-family: var(--sans, 'Inter', sans-serif);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background-color 0.16s cubic-bezier(0.2, 0, 0, 1);
}
.deskrune-exit-card button:hover { background: #c9613f; }
.deskrune-exit-card .close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--muted, #6b6960);
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}
.deskrune-exit-card .close:hover { color: var(--ink); }
.deskrune-exit-card .small {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--muted);
  margin: 12px 0 0;
}

/* ─── BANNER STATE TRANSITION (when expired) ─── */
.deskrune-sale-banner.expired {
  background: var(--ink, #141413);
}
.deskrune-sale-banner.expired .deskrune-countdown {
  display: none;
}

/* ─── GUARANTEE BADGE BLOCK ─── */
.guarantee-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: center;
  background: rgba(45, 164, 78, 0.05);
  border: 1px solid rgba(45, 164, 78, 0.15);
  border-radius: 6px;
  padding: 14px 20px;
  margin: 24px auto 0;
  max-width: 720px;
  font-family: var(--sans, 'Inter', sans-serif);
  font-size: 13px;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}
.guarantee-bar .item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.guarantee-bar .item::before {
  content: '✓';
  color: #2da44e;
  font-weight: 700;
  font-size: 14px;
}

/* ─── LANGUAGE SWITCHER ─── */
.deskrune-lang-switcher {
  position: fixed;
  bottom: 18px;
  right: 18px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 4px;
  display: flex;
  gap: 2px;
  font-family: var(--sans, 'Inter', sans-serif);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  z-index: 60;
  box-shadow: 0 2px 8px rgba(20,20,19,0.04);
}
.deskrune-lang-switcher a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 9px;
  border-radius: 3px;
  font-weight: 600;
  /* Explicit properties — `all` was animating padding/border-radius needlessly. */
  transition:
    color 0.14s cubic-bezier(0.2, 0, 0, 1),
    background-color 0.14s cubic-bezier(0.2, 0, 0, 1);
}
.deskrune-lang-switcher a:hover { color: var(--ink); }
.deskrune-lang-switcher a.active {
  background: var(--ink);
  color: var(--bg);
}
@media (max-width: 640px) {
  .deskrune-lang-switcher {
    font-size: 10px;
    bottom: auto;
    top: auto;
    right: 12px;
    left: 12px;
    justify-content: center;
    bottom: calc(env(safe-area-inset-bottom, 0) + 12px);
  }
  .deskrune-lang-switcher a { padding: 6px 8px; }
  /* Move social-proof toast above the language switcher so they don't stack on top */
  .deskrune-proof-toast {
    bottom: 64px !important;
  }
}

/* ─── REDUCED MOTION ─── */
/* Short-circuit theatrical entrances; keep functional state changes
   (focus reveal, hover color) so the UI still communicates state. */
@media (prefers-reduced-motion: reduce) {
  .deskrune-proof-toast {
    transform: none !important;
    transition: opacity 0.2s linear !important;
  }
  .deskrune-exit-overlay { animation: none !important; }
  .deskrune-exit-card { animation: none !important; }
  .skip-to-content {
    transition: none !important;
  }
}

/* ─── MOBILE CONVERSION TIGHTENING (≤640px) ─────────────────────── */
@media (max-width: 640px) {
  /* Sale banner — preserve essential info (price + countdown), drop the parenthetical
     "(was $9.99–$49)" string on small screens to keep one tidy line. */
  .deskrune-sale-banner {
    padding: 9px 14px;
    font-size: 12.5px;
    gap: 10px;
    line-height: 1.35;
  }
  .deskrune-sale-banner strong { font-size: 11px; }
  .deskrune-sale-banner .deskrune-countdown {
    font-size: 12px;
    padding: 3px 8px;
  }
  .deskrune-sale-banner a {
    padding: 6px 10px;
    background: rgba(255,255,255,0.14);
    border-radius: 3px;
    text-decoration: none;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
  }

  /* Live-price block: vertical stack so struck-through original sits above $4.99
     instead of next to it (avoids cramped baseline on narrow viewports). */
  .live-price.on-sale {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .live-price.on-sale .price-was { font-size: 0.85em; }

  /* Guarantee bar — wrap nicely, don't overflow. */
  .guarantee-bar {
    gap: 10px 14px;
    font-size: 12px;
    padding: 12px 14px;
    margin: 18px 12px 0;
  }

  /* Exit-intent card — slim padding so it fits on a 360px viewport. */
  .deskrune-exit-card {
    padding: 28px 22px 26px;
    max-width: calc(100vw - 32px);
  }
  .deskrune-exit-card h2 { font-size: 24px; }
  .deskrune-exit-card p { font-size: 15px; }
  .deskrune-exit-card .close {
    font-size: 28px;
    padding: 8px 12px;
    top: 6px;
    right: 8px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Make every Stripe checkout button a guaranteed-tap-friendly target on mobile. */
  [data-deskrune-checkout],
  .hero-action {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    padding: 12px 18px;
  }
}
