/* Jungle mode + Puma illustration.
   Adapted from the Puma Jungle Prowl artifact. Light-mode chrome stays in styles.css. */

html.jungle {
  color-scheme: dark;
  --bg: #0b1f16;
  --bg-soft: #10281c;
  --ink: #f4eddc;
  --muted: color-mix(in srgb, #f4eddc 74%, transparent);
  --muted-2: color-mix(in srgb, #f4eddc 62%, transparent);
  --dim: color-mix(in srgb, #f4eddc 50%, transparent);
  --accent: #f4eddc;
  --rule: rgba(206, 224, 178, 0.22);
  --glass-fill: rgba(15, 39, 27, 0.62);
  --glass-fill-strong: rgba(8, 28, 19, 0.78);
  --glass-fill-tint: rgba(10, 34, 23, 0.9);
  --glass-edge: rgba(232, 224, 196, 0.3);
  --glass-edge-soft: rgba(232, 224, 196, 0.16);
  --glass-highlight:
    inset 0 1px 0 rgba(255, 248, 230, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.28);
  --glass-shadow:
    0 16px 44px rgba(0, 0, 0, 0.38),
    0 2px 10px rgba(0, 0, 0, 0.28);
  --ok: #c6ecd4;
  --danger: #ffc9c9;
  --warn: #f3e2b3;
}

html.jungle,
html.jungle body {
  background-color: #0b1f16;
  background-image: none;
}

html.jungle body::before { opacity: 0; }

body,
.nav,
.hero-card,
.card,
.site-footer,
.jm .knob {
  transition:
    background-color 0.8s ease,
    color 0.8s ease,
    border-color 0.8s ease,
    box-shadow 0.8s ease;
}

/* Stage layers sit behind the waitlist, with front vines crossing the hero. */
.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: clip;
}

.jbg {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s ease;
  background:
    radial-gradient(1100px 760px at 72% 22%, #17402c 0%, rgba(23, 64, 44, 0) 62%),
    radial-gradient(900px 700px at 8% 92%, #143424 0%, rgba(20, 52, 36, 0) 60%),
    #0b1f16;
}
html.jungle .jbg { opacity: 1; }

.layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.layer.back { z-index: 0; }
.fireflies {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease;
}
html.jungle .fireflies { opacity: 1; transition-delay: 1.2s; }
.layer.front { z-index: 4; }

/* Keep the CRM drawer above vines while it is open. */
body:has(.drawer-root:not(.hidden)) .layer.front { visibility: hidden; }

.back .sway {
  transform-origin: 0 0;
  animation: vine-sway 8s ease-in-out infinite alternate;
  animation-play-state: paused;
}
html.jungle .back .sway { animation-play-state: running; }
@keyframes vine-sway {
  from { transform: rotate(-1.8deg); }
  to { transform: rotate(2deg); }
}

.fireflies i {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #f2f8b0;
  box-shadow: 0 0 8px 3px rgba(222, 240, 120, 0.5);
  animation:
    firefly-drift var(--d) ease-in-out infinite alternate,
    firefly-glow var(--g) ease-in-out infinite;
  animation-play-state: paused;
}
html.jungle .fireflies i { animation-play-state: running; }
@keyframes firefly-drift {
  from { transform: translate(0, 0); }
  to { transform: translate(var(--x), var(--y)); }
}
@keyframes firefly-glow {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 1; }
}

/* Header switch — leaf + track, same role as the artifact toggle. */
.jm {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: none;
  margin: 0 2px 0 12px;
  padding: 4px 2px 4px 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.92rem;
  line-height: 1;
  cursor: pointer;
}
.jm::before {
  content: "";
  width: 1px;
  height: 22px;
  margin-right: 4px;
  background: var(--rule);
}
.jm:hover { color: var(--ink); }
.jm .leaf {
  width: 18px;
  height: 18px;
  flex: none;
  color: #3f8f45;
  transform-origin: 20% 80%;
}
html.jungle .jm .leaf { color: #9dce86; }
.jm .track {
  width: 46px;
  height: 28px;
  border-radius: 14px;
  background: #d6dbe2;
  position: relative;
  flex: none;
  box-shadow: inset 0 0 0 1px rgba(17, 17, 17, 0.06);
  transition: background-color 0.45s ease, box-shadow 0.45s ease;
}
html.jungle .jm .track {
  background: #3d7a47;
  box-shadow: inset 0 0 0 1.5px rgba(244, 237, 220, 0.7);
}
.jm .knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  transition: transform 0.45s cubic-bezier(0.5, 1.6, 0.4, 1), background-color 0.8s ease;
}
html.jungle .jm .knob {
  transform: translateX(18px);
  background: #f5eedd;
}
.jm:focus-visible {
  outline: 2px solid #5f9d57;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: no-preference) {
  html:not(.jungle) .jm .leaf {
    animation: leaf-nudge 3.2s ease-in-out 2.6s 2;
  }
}
@keyframes leaf-nudge {
  0%, 70%, 100% { transform: rotate(0); }
  78% { transform: rotate(-16deg); }
  88% { transform: rotate(10deg); }
}

/* Landing: copy | form, with the puma under the copy on desktop. */
.landing-hero {
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.9fr);
  grid-template-areas:
    "copy form"
    "puma form";
  row-gap: 18px;
}
.landing-hero > #copy { grid-area: copy; align-self: start; }
.landing-hero > #join-form { grid-area: form; align-self: start; }
.hero-puma {
  grid-area: puma;
  width: min(460px, 100%);
  margin: -8px 0 0;
  justify-self: start;
  align-self: end;
  position: relative;
  z-index: 1;
  pointer-events: auto;
  touch-action: manipulation;
  cursor: pointer;
  color: #1c2126;
  user-select: none;
  -webkit-user-select: none;
}
html.jungle .hero-puma { color: #ecdfc2; }
html.jungle #copy {
  text-shadow: 0 1px 18px rgba(6, 22, 14, 0.55);
}
.hero-puma::before {
  content: "";
  position: absolute;
  inset: 6% -10% -4%;
  background: radial-gradient(closest-side, rgba(8, 24, 16, 0.88), rgba(8, 24, 16, 0.5) 58%, rgba(8, 24, 16, 0));
  opacity: 0;
  transition: opacity 1s ease;
}
html.jungle .hero-puma::before { opacity: 1; }
.hero-puma svg {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  pointer-events: bounding-box;
  cursor: pointer;
}
.sticker {
  pointer-events: auto;
  touch-action: manipulation;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

/* Draw, fills, and eye glow run on first paint in both themes. */
.hero-puma .pl {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: puma-draw 1.6s cubic-bezier(0.6, 0.1, 0.3, 1) forwards;
  animation-delay: calc(var(--i) * 70ms + 0.3s);
}
.hero-puma .pf {
  opacity: 0;
  animation: puma-fadein 0.6s ease 3s forwards;
}
@keyframes puma-draw { to { stroke-dashoffset: 0; } }
@keyframes puma-fadein { to { opacity: 1; } }

.hero-puma .eyefill {
  fill: rgba(214, 228, 106, 0);
  animation: puma-eye 1s ease 1.6s forwards;
}
@keyframes puma-eye { to { fill: #d4e46a; } }
.hero-puma .pupil { fill: #1c2126; transition: fill 0.8s ease; }
html.jungle .hero-puma .pupil { fill: #0b1f16; }
.hero-puma .eyes {
  transform-box: fill-box;
  transform-origin: center;
  animation: puma-blink 6s ease-in-out 3.4s infinite;
}
@keyframes puma-blink {
  0%, 93%, 100% { transform: scaleY(1); }
  96% { transform: scaleY(0.08); }
}

/* Readable glass on the dark canopy — join form, nav, footer, CRM. */
html.jungle .hero-card,
html.jungle .card {
  background: rgba(10, 32, 22, 0.9);
}
html.jungle .card::before,
html.jungle .hero-card::before {
  background: linear-gradient(135deg, rgba(255, 248, 230, 0.14) 0%, rgba(255, 248, 230, 0.04) 30%, transparent 50%);
}
html.jungle .site-footer {
  background: rgba(8, 26, 17, 0.62);
  border-color: rgba(206, 224, 178, 0.16);
}
html.jungle .nav-toggle {
  background: rgba(8, 26, 17, 0.5);
  border-color: rgba(206, 224, 178, 0.24);
  color: var(--ink);
}
html.jungle .nav-toggle:hover { background: rgba(16, 42, 29, 0.72); }
html.jungle .lang-switcher {
  background: rgba(8, 26, 17, 0.45);
  border-color: rgba(206, 224, 178, 0.22);
}
html.jungle .lang-switcher a[aria-current="true"] {
  color: #10251a;
  background: #f5eedd;
}
html.jungle .nav-cta,
html.jungle .btn,
html.jungle .primary {
  color: #10251a;
  background: #f5eedd;
  border-color: rgba(245, 238, 221, 0.45);
}
html.jungle .nav-cta:hover,
html.jungle .btn:hover,
html.jungle .primary:hover {
  color: #10251a;
  background: #fff8ea;
}
html.jungle .btn.secondary,
html.jungle .ghost {
  color: var(--ink);
  background: var(--glass-fill);
  border-color: var(--glass-edge);
}
html.jungle .pill,
html.jungle .chip {
  background: rgba(8, 26, 17, 0.4);
  border-color: rgba(206, 224, 178, 0.2);
  color: var(--muted);
}
html.jungle .pill.confirm-yes {
  color: #d7f5c8;
  background: rgba(90, 158, 74, 0.28);
  border-color: rgba(184, 220, 122, 0.45);
}
html.jungle .pill.confirm-no {
  color: #f3e2b8;
  background: rgba(184, 140, 60, 0.28);
  border-color: rgba(243, 214, 150, 0.4);
}
html.jungle .chip[aria-pressed="true"],
html.jungle .chip.on,
html.jungle .chip:hover {
  color: #10251a;
  background: #f5eedd;
  border-color: transparent;
}
html.jungle input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="button"]):not([type="submit"]),
html.jungle textarea,
html.jungle select,
html.jungle .ref-url,
html.jungle .detail,
html.jungle .table-wrap,
html.jungle .bulk-bar {
  background: rgba(6, 22, 15, 0.62);
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
  border-color: rgba(206, 224, 178, 0.24);
}
html.jungle input::placeholder,
html.jungle textarea::placeholder {
  color: rgba(244, 237, 220, 0.48);
  opacity: 1;
}
html.jungle input:hover,
html.jungle textarea:hover,
html.jungle select:hover,
html.jungle input[type="email"]:hover,
html.jungle input[type="text"]:hover,
html.jungle input[type="url"]:hover,
html.jungle input[type="password"]:hover,
html.jungle input[type="search"]:hover {
  background: rgba(6, 22, 15, 0.78);
  border-color: rgba(206, 224, 178, 0.34);
}
html.jungle input:focus,
html.jungle textarea:focus,
html.jungle select:focus,
html.jungle input[type="email"]:focus,
html.jungle input[type="text"]:focus,
html.jungle input[type="url"]:focus,
html.jungle input[type="search"]:focus,
html.jungle input:not([type]):focus {
  background: rgba(6, 22, 15, 0.86);
  border-color: rgba(212, 228, 106, 0.7);
  box-shadow: 0 0 0 3px rgba(212, 228, 106, 0.16);
}
html.jungle .crm-toolbar input,
html.jungle .crm-toolbar select,
html.jungle .bulk-bar input,
html.jungle .bulk-bar select,
html.jungle .drawer select,
html.jungle .drawer input:not([type="checkbox"]):not([type="radio"]),
html.jungle .drawer textarea {
  background-color: rgba(6, 22, 15, 0.62);
  color: var(--ink);
  border-color: rgba(206, 224, 178, 0.24);
}
html.jungle select,
html.jungle .crm-toolbar select,
html.jungle .bulk-bar select,
html.jungle .drawer select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23f4eddc' d='M1.1 1.4 6 6.3l4.9-4.9 1.1 1.1L6 8.5 0 2.5z'/%3E%3C/svg%3E");
}
html.jungle tr:hover td { background: rgba(244, 237, 220, 0.06); }
html.jungle .skeleton { background: rgba(244, 237, 220, 0.1); }
html.jungle .banner.err { background: rgba(255, 201, 201, 0.12); }
html.jungle .banner.ok { background: rgba(198, 236, 212, 0.12); }
html.jungle .banner.warn { background: rgba(243, 226, 179, 0.12); }
html.jungle .drawer,
html.jungle .drawer-top {
  background: rgba(12, 34, 24, 0.96);
}
html.jungle .drawer-backdrop { background: rgba(0, 0, 0, 0.5); }
html.jungle .nav-links a:not(.nav-cta):hover,
html.jungle .nav-links a:not(.nav-cta):focus-visible {
  background: rgba(244, 237, 220, 0.08);
}
html.jungle ::selection {
  background: rgba(212, 228, 106, 0.35);
  color: #f4eddc;
}

/* Keep the glass pill on one line. The full label fits once the bar is at its max width. */
@media (min-width: 901px) {
  .nav-links,
  .brand-links { flex-wrap: nowrap; }
}
@media (min-width: 901px) and (max-width: 1280px) {
  .nav-links { gap: 14px; }
}
@media (min-width: 901px) and (max-width: 1160px) {
  .brand-ext { display: none; }
}
@media (max-width: 1359px) {
  .jm .lbl {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .jm::before { display: none; }
  .jm { margin-left: 10px; }
}

@media (max-width: 900px) {
  .nav:not(.is-open) { flex-wrap: nowrap; }
  .brand-links { min-width: 0; }
  .logo { min-width: 0; }
  .logo span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .jm {
    order: 2;
    margin-left: 0;
    padding-left: 0;
    gap: 6px;
  }
  .jm::before { display: none; }
  .jm .track { width: 40px; height: 24px; }
  .jm .knob { width: 18px; height: 18px; }
  html.jungle .jm .knob { transform: translateX(16px); }
  .nav-cta-bar { order: 3; }
  .nav-toggle { order: 4; }
  .nav-links { order: 5; }

  .landing-hero {
    grid-template-columns: 1fr;
    grid-template-areas:
      "copy"
      "form"
      "puma";
  }
  .hero-puma {
    width: min(320px, 84vw);
    margin: 4px 0 0;
    justify-self: end;
  }
}
@media (max-width: 480px) {
  .nav-toggle-text { display: none; }
  .nav-toggle { padding-inline: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .jbg,
  .fireflies,
  .hero-puma,
  .hero-puma::before,
  .jm .knob,
  body,
  .nav,
  .hero-card,
  .card,
  .site-footer {
    transition: none !important;
  }
  .hero-puma .pl { animation: none; stroke-dashoffset: 0; }
  .hero-puma .pf { animation: none; opacity: 1; }
  .hero-puma .eyefill { animation: none; fill: #d4e46a; }
  .back .sway,
  .hero-puma .eyes,
  .fireflies i,
  .jm .leaf {
    animation: none !important;
  }
  html.jungle .fireflies { transition-delay: 0s; }
  .fireflies i { opacity: 0.45; }
}
