@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&display=swap');

/* ==========================================================================
   Contemplative Tree Widget CSS
   ========================================================================== */

/* Layout */
.epicd-contemplative-tree {
  position: relative;
  background: #f3ecd5;
}

.epicd-contemplative-tree__svg-wrapper {
  position: relative;
  z-index: 2;
  width: 100%;
  pointer-events: none;
}

.epicd-contemplative-tree__svg-wrapper svg {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: auto;
}

/* Tree SVG color states */
.epicd-contemplative-tree .tree-color {
  fill: #46423e;
  transition: fill 0.3s ease;
}

.epicd-contemplative-tree .text-color {
  fill: #f9f2d4;
  transition: fill 0.3s ease;
}

.epicd-contemplative-tree .title-color {
  fill: #f74d41;
}

.epicd-contemplative-tree .naropa-color {
  fill: #634b78;
}

.epicd-contemplative-tree [data-root],
.epicd-contemplative-tree [data-branch] {
  cursor: pointer;
}

/* Active & Hover states (Color changes) */
.epicd-contemplative-tree [data-branch]:focus-visible .tree-color,
.epicd-contemplative-tree [data-branch]:hover .tree-color,
.epicd-contemplative-tree [data-branch].active .tree-color {
  fill: #f74d41;
}

.epicd-contemplative-tree [data-root]:focus-visible .tree-color,
.epicd-contemplative-tree [data-root]:hover .tree-color,
.epicd-contemplative-tree [data-root].active .tree-color {
  fill: #789C4A;
}

.epicd-contemplative-tree [data-root]:focus-visible .text-color,
.epicd-contemplative-tree [data-branch]:focus-visible .text-color,
.epicd-contemplative-tree [data-root]:hover .text-color,
.epicd-contemplative-tree [data-branch]:hover .text-color,
.epicd-contemplative-tree [data-root].active .text-color,
.epicd-contemplative-tree [data-branch].active .text-color {
  fill: #fff !important;
}

.epicd-contemplative-tree g.branch,
.epicd-contemplative-tree g.root,
.epicd-contemplative-tree g.branch *,
.epicd-contemplative-tree g.root * {
  pointer-events: visiblePainted;
}

/* Accessibility (a11y) focus indicators */
.epicd-contemplative-tree svg *:focus {
  outline: none;
}

.epicd-contemplative-tree [data-branch]:focus-visible,
.epicd-contemplative-tree [data-root]:focus-visible {
  outline: 3px solid #634b78;
  outline-offset: 4px;
}

/* Text Description Panel */
.epicd-contemplative-tree__panel {
  position: absolute;
  right: 3%;
  top: 62%;
  transform: translateY(-50%);
  width: 40%;
  max-height: 20rem;
  z-index: 1;
  background: #ffffff;
  padding: 2.5rem 2rem;
  box-sizing: border-box;
  overflow: hidden;
}

.epicd-contemplative-tree__panel-inner {
  display: flex;
  flex-direction: column;
  max-height: 15rem;
  overflow: hidden;
}

.epicd-contemplative-tree__panel-inner:focus-visible {
  outline: 2px solid #f74d41;
  outline-offset: 2px;
}

.epicd-contemplative-tree__panel-title {
  margin: 0 0 16px;
  font-size: 1.25rem;
  font-weight: 700;
  color: #f74d41;
  flex-shrink: 0;
}

.epicd-contemplative-tree__panel-body {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #46423e;
  overflow-y: auto;
  flex-grow: 1;
  min-height: 0;
  padding-right: .5rem;
}

.epicd-contemplative-tree__panel-body::-webkit-scrollbar {
  width: 10px;
}

.epicd-contemplative-tree__panel-body::-webkit-scrollbar-thumb {
  background-color: rgba(70, 66, 62, 0.35);
  border-radius: 10px;
  border: 3px solid transparent;
  background-clip: padding-box;
}

.epicd-contemplative-tree__panel-body::-webkit-scrollbar-thumb:hover {
  background-color: rgba(70, 66, 62, 0.7);
}

.epicd-contemplative-tree__panel-body::-webkit-scrollbar-track {
  background: transparent;
}

.epicd-contemplative-tree__panel-title,
.epicd-contemplative-tree__panel-tags,
.epicd-contemplative-tree__panel-body {
  margin-right: 2px;
}

.epicd-contemplative-tree__panel-body p {
  margin: 0 0 1em;
}

.epicd-contemplative-tree__panel-body p:last-child {
  margin-bottom: 0;
}

/* Accordions — mobile only */
.epicd-contemplative-tree__accordions {
  display: none;
}

@media (max-width: 768px) {
  .epicd-contemplative-tree__panel {
    display: none;
  }

  .epicd-contemplative-tree__accordions {
    display: block;
    margin-top: 8px;
    padding-bottom: 30px;
  }

  .epicd-contemplative-tree .title-color,
  .epicd-contemplative-tree .naropa-color,
  .epicd-contemplative-tree .text-color,
  .epicd-contemplative-tree .subtitles {
    display: none;
  }
}

.epicd-contemplative-tree__accordion {
  background: #ffffff;
  margin-bottom: 10px;
}

.epicd-contemplative-tree__accordion .epicd-contemplative-tree__accordion-btn {
  background: #ffffff !important;
}

.epicd-contemplative-tree__accordion:last-child {
  margin-bottom: 0;
}

.epicd-contemplative-tree__accordion-btn {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  white-space: normal;
  gap: 12px;
  padding: 20px 31px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-weight: 600;
  font-size: 19px;
  color: #46423e !important;
}

.epicd-contemplative-tree__accordion-btn:focus-visible {
  outline: 2px solid #f74d41;
  outline-offset: -2px;
}

.epicd-contemplative-tree__accordion-title {
  flex: 1;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* CSS chevron: a square rotated 45° */
.epicd-contemplative-tree__accordion-chevron {
  flex-shrink: 0;
  display: inline-block;
  width: 10px;
  height: 10px;
  border-right: 2px solid #694f75;
  border-bottom: 2px solid #694f75;
  transform: rotate(45deg);
  transition: transform 0.2s ease, border-color 0.2s ease;
  margin-bottom: 4px;
}

.epicd-contemplative-tree__accordion-body {
  display: none;
  padding: 18px 31px;
  color: #ffffff;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Open state */
.epicd-contemplative-tree__accordion.is-open {
  background: #46423e;
}

.epicd-contemplative-tree__accordion.is-open .epicd-contemplative-tree__accordion-btn {
  background: #46423e !important;
  color: #ffffff !important;
}

.epicd-contemplative-tree__accordion.is-open .epicd-contemplative-tree__accordion-body,
.epicd-contemplative-tree__accordion.is-open .epicd-contemplative-tree__accordion-body *:not(.epicd-contemplative-tree__accordion-tag):not(.epicd-contemplative-tree__tag) {
  color: #ffffff !important;
}

.epicd-contemplative-tree__accordion.is-open .epicd-contemplative-tree__accordion-chevron {
  border-color: #ffffff;
  transform: rotate(-135deg);
  margin-bottom: -4px;
}

.epicd-contemplative-tree__accordion.is-open .epicd-contemplative-tree__accordion-body {
  display: block;
}

/* Tags */
.epicd-contemplative-tree__accordion-tags,
.epicd-contemplative-tree__panel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.epicd-contemplative-tree__accordion-tag,
.epicd-contemplative-tree__tag {
  display: inline-block;
  padding: 5px 10px;
  background: rgba(243, 236, 213, 0.15);
  border-radius: 10px;
  color: #ffffff;
}

/* SVG Text Typography Protection Rules */
.epicd-contemplative-tree svg text,
.epicd-contemplative-tree svg tspan,
.epicd-contemplative-tree svg textPath {
  font-family: Oswald, Futura-CondensedMedium, Futura, "Helvetica Neue", Arial, sans-serif !important;
  font-weight: 500 !important;
  pointer-events: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

.epicd-contemplative-tree svg .st3 {
  font-size: 34px !important;
  fill: #46423e !important;
}

.epicd-contemplative-tree svg .st4,
.epicd-contemplative-tree svg .st5,
.epicd-contemplative-tree svg .st6 {
  font-size: 2.2rem !important;
  fill: #f9f2d4 !important;
}

#contemplative-eye-highlight {
  fill: #f9f2d4 !important;
}
