/*
 * JAIVIK WELLNESS TREE — QUICK COLOUR SETTINGS
 * Change only these variables later to match the website.
 */
.jwt-wrap {
  --jwt-deep: #123c2d;
  --jwt-green: #1d5a3d;
  --jwt-green-2: #397652;
  --jwt-leaf: #78a442;
  --jwt-gold: #d5a927;
  --jwt-cream: #fffdf5;
  --jwt-paper: #f7f4e9;
  --jwt-text: #163226;
  --jwt-muted: #67766e;
  --jwt-line: rgba(29, 90, 61, 0.42);
  --jwt-shadow: 0 14px 38px rgba(26, 60, 45, 0.14);

  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 44px);
  color: var(--jwt-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  box-sizing: border-box;
}

.jwt-wrap *,
.jwt-wrap *::before,
.jwt-wrap *::after {
  box-sizing: border-box;
}

.jwt-heading {
  text-align: center;
  margin-bottom: 16px;
}

.jwt-heading h2 {
  margin: 0;
  color: var(--jwt-deep);
  font-size: clamp(26px, 3vw, 44px);
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.jwt-heading p {
  margin: 9px 0 0;
  color: var(--jwt-muted);
  font-size: clamp(14px, 1.3vw, 18px);
}

.jwt-stage {
  position: relative;
  min-height: 720px;
  overflow: visible;
  border: 1px solid rgba(29, 90, 61, 0.12);
  border-radius: 30px;
  background:
    radial-gradient(circle at 50% 52%, rgba(120, 164, 66, 0.12), transparent 28%),
    linear-gradient(180deg, rgba(255,255,255,0.96), rgba(247,244,233,0.94));
  box-shadow: var(--jwt-shadow);
}

.jwt-tree-column {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(390px, 30vw);
  transform: translate(-50%, -50%);
  z-index: 1;
  pointer-events: none;
  text-align: center;
}

.jwt-tree-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 600px;
  object-fit: contain;
  filter: drop-shadow(0 18px 24px rgba(14, 43, 31, 0.14));
}

.jwt-tree-brand {
  position: absolute;
  left: 50%;
  bottom: 7%;
  transform: translateX(-50%);
  padding: 7px 16px;
  border-radius: 999px;
  color: white;
  background: rgba(18, 60, 45, 0.92);
  font-size: clamp(12px, 1vw, 16px);
  font-weight: 800;
  letter-spacing: 0.16em;
  box-shadow: 0 7px 20px rgba(18, 60, 45, 0.20);
}

.jwt-category-list {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.jwt-category {
  position: absolute;
  top: var(--jwt-top);
  width: clamp(190px, 16vw, 235px);
  transform: translateY(-50%);
  z-index: 3;
}

.jwt-side-left {
  right: calc(50% + clamp(135px, 13vw, 190px));
}

.jwt-side-right {
  left: calc(50% + clamp(135px, 13vw, 190px));
}

.jwt-category::after {
  content: "";
  position: absolute;
  top: 50%;
  width: clamp(36px, 5vw, 78px);
  border-top: 3px solid var(--jwt-line);
  transform: translateY(-50%);
  z-index: -1;
}

.jwt-side-left::after {
  left: 100%;
}

.jwt-side-right::after {
  right: 100%;
}

.jwt-main-button {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 2px solid rgba(255,255,255,0.36);
  border-radius: 16px;
  color: white;
  background: linear-gradient(145deg, var(--jwt-green), var(--jwt-deep));
  box-shadow: 0 8px 22px rgba(18, 60, 45, 0.19);
  cursor: pointer;
  text-align: left;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.jwt-main-button:hover,
.jwt-main-button:focus-visible,
.jwt-category.is-open .jwt-main-button {
  transform: translateY(-2px);
  border-color: var(--jwt-gold);
  box-shadow: 0 12px 28px rgba(18, 60, 45, 0.25);
  outline: none;
}

.jwt-main-icon {
  font-size: 23px;
  line-height: 1;
  text-align: center;
}

.jwt-main-label {
  font-size: clamp(13px, 1.1vw, 16px);
  line-height: 1.18;
  font-weight: 750;
}

.jwt-chevron {
  font-size: 24px;
  line-height: 1;
  text-align: center;
  transition: transform 180ms ease;
}

.jwt-category.is-open .jwt-chevron {
  transform: rotate(45deg);
}

.jwt-submenu {
  position: absolute;
  top: 50%;
  width: clamp(220px, 20vw, 285px);
  transform: translateY(-50%);
  animation: jwtReveal 190ms ease both;
}

.jwt-side-left .jwt-submenu {
  right: calc(100% + clamp(52px, 5vw, 78px));
}

.jwt-side-right .jwt-submenu {
  left: calc(100% + clamp(52px, 5vw, 78px));
}

.jwt-submenu-branch {
  position: absolute;
  top: 50%;
  width: clamp(52px, 5vw, 78px);
  border-top: 3px solid var(--jwt-line);
}

.jwt-side-left .jwt-submenu-branch {
  left: 100%;
}

.jwt-side-right .jwt-submenu-branch {
  right: 100%;
}

.jwt-submenu-items {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(29, 90, 61, 0.18);
  border-radius: 18px;
  background: rgba(255, 253, 245, 0.97);
  box-shadow: 0 13px 32px rgba(35, 61, 48, 0.16);
  backdrop-filter: blur(6px);
}

.jwt-submenu-items::before {
  content: "";
  position: absolute;
  top: 15px;
  bottom: 15px;
  width: 2px;
  background: var(--jwt-line);
}

.jwt-side-left .jwt-submenu-items::before {
  right: -1px;
}

.jwt-side-right .jwt-submenu-items::before {
  left: -1px;
}

.jwt-sub-link {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;
  min-height: 50px;
  padding: 8px 10px;
  border: 1px solid rgba(29, 90, 61, 0.12);
  border-radius: 12px;
  color: var(--jwt-text);
  background: white;
  text-decoration: none !important;
  transition: transform 170ms ease, border-color 170ms ease, background 170ms ease;
}

.jwt-sub-link:hover,
.jwt-sub-link:focus-visible {
  transform: translateX(3px);
  border-color: var(--jwt-gold);
  background: #fffaf0;
  outline: none;
}

.jwt-side-left .jwt-sub-link:hover,
.jwt-side-left .jwt-sub-link:focus-visible {
  transform: translateX(-3px);
}

.jwt-leaf {
  color: var(--jwt-leaf);
  font-size: 13px;
}

.jwt-sub-copy {
  min-width: 0;
  display: block;
}

.jwt-sub-copy strong {
  display: block;
  font-size: clamp(12.5px, 1vw, 15px);
  line-height: 1.18;
}

.jwt-sub-copy small {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--jwt-muted);
  font-size: clamp(10px, 0.8vw, 12px);
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jwt-arrow {
  color: var(--jwt-green-2);
  font-size: 17px;
  font-weight: 800;
}

@keyframes jwtReveal {
  from { opacity: 0; transform: translateY(-50%) scale(0.96); }
  to { opacity: 1; transform: translateY(-50%) scale(1); }
}

/* Tablet: keep the same idea, with slightly smaller nodes. */
@media (max-width: 1180px) and (min-width: 781px) {
  .jwt-stage { min-height: 680px; }
  .jwt-tree-column { width: 300px; }
  .jwt-category { width: 180px; }
  .jwt-side-left { right: calc(50% + 120px); }
  .jwt-side-right { left: calc(50% + 120px); }
  .jwt-submenu { width: 220px; }
  .jwt-side-left .jwt-submenu { right: calc(100% + 36px); }
  .jwt-side-right .jwt-submenu { left: calc(100% + 36px); }
  .jwt-submenu-branch { width: 36px; }
}

/* Mobile: vertical tree on the left, expandable categories on the right. */
@media (max-width: 780px) {
  .jwt-wrap {
    padding: 14px 8px;
  }

  .jwt-heading {
    padding-inline: 8px;
    margin-bottom: 12px;
  }

  .jwt-stage {
    min-height: 0;
    display: grid;
    grid-template-columns: clamp(72px, 23vw, 108px) minmax(0, 1fr);
    align-items: stretch;
    gap: 8px;
    padding: 10px 8px;
    overflow: hidden;
    border-radius: 22px;
  }

  .jwt-tree-column {
    position: relative;
    left: auto;
    top: auto;
    width: 100%;
    min-height: 560px;
    transform: none;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(120,164,66,0.08), rgba(18,60,45,0.04));
  }

  .jwt-tree-image {
    position: sticky;
    top: 12px;
    width: 100%;
    max-height: 500px;
    margin-top: 12px;
  }

  .jwt-tree-brand {
    display: none;
  }

  .jwt-category-list {
    position: relative;
    inset: auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-block: 4px;
  }

  .jwt-category {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: 100%;
    transform: none;
    order: var(--jwt-mobile-order);
  }

  .jwt-category::after {
    left: auto;
    right: 100%;
    width: 10px;
    border-top-width: 2px;
  }

  .jwt-main-button {
    min-height: 48px;
    grid-template-columns: 26px minmax(0, 1fr) 20px;
    gap: 5px;
    padding: 8px 8px;
    border-radius: 12px;
  }

  .jwt-main-icon {
    font-size: 18px;
  }

  .jwt-main-label {
    font-size: clamp(11px, 3.2vw, 14px);
    line-height: 1.12;
  }

  .jwt-chevron {
    font-size: 19px;
  }

  .jwt-submenu,
  .jwt-side-left .jwt-submenu,
  .jwt-side-right .jwt-submenu {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: 100%;
    margin-top: 7px;
    transform: none;
    animation: jwtRevealMobile 180ms ease both;
  }

  .jwt-submenu-branch {
    display: none;
  }

  .jwt-submenu-items {
    gap: 6px;
    padding: 7px;
    border-radius: 13px;
  }

  .jwt-submenu-items::before {
    display: none;
  }

  .jwt-sub-link {
    grid-template-columns: 14px minmax(0, 1fr) 15px;
    gap: 5px;
    min-height: 44px;
    padding: 7px 7px;
    border-radius: 10px;
  }

  .jwt-sub-copy strong {
    font-size: clamp(10.5px, 3vw, 13px);
  }

  .jwt-sub-copy small {
    font-size: clamp(8.5px, 2.45vw, 10.5px);
  }

  .jwt-sub-link:hover,
  .jwt-sub-link:focus-visible,
  .jwt-side-left .jwt-sub-link:hover,
  .jwt-side-left .jwt-sub-link:focus-visible {
    transform: none;
  }

  @keyframes jwtRevealMobile {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

@media (prefers-reduced-motion: reduce) {
  .jwt-wrap *,
  .jwt-wrap *::before,
  .jwt-wrap *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* WordPress theme compatibility */
.entry-content .jwt-wrap a,
.wp-site-blocks .jwt-wrap a { text-decoration: none; }
.jwt-wrap button { font-family: inherit; }
.jwt-wrap img { max-width: 100%; }

/* Prevent clipping inside narrow theme containers on desktop. */
@media (min-width: 1181px) {
  .jwt-wrap { max-width: 1600px; }
}
