/* =====================================================================
   Extem — "we do" tree
   One root fanning into 5 curved dashed arrow-branches (drawn by JS
   into .todo-wires so curves stay docked when cards expand).
   Loads after ocean.css. Theme + RTL aware.
   ===================================================================== */

.todo-layout {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 56px;
  max-width: 1240px;
  margin: 40px auto 0;
  text-align: center;
}
/* Fade-only entrance: a translate would briefly extend the page and
   flash the scrollbar on load. The tree still arrives as one piece. */
.todo-layout.revealy {
  transform: none;
}

/* curved wires canvas — sits behind cards, drawn by home.js */
.todo-wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: visible;
}
.todo-wires path {
  fill: none;
  stroke: rgba(24, 153, 201, 0.75);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 1 10;
  animation: wireMarch 1.1s linear infinite;
  filter: drop-shadow(0 0 6px rgba(24, 153, 201, 0.45));
  transition: stroke 0.3s ease, filter 0.3s ease;
}
[data-theme="dark"] .todo-wires path {
  stroke: rgba(138, 180, 248, 0.8);
  filter: drop-shadow(0 0 6px rgba(138, 180, 248, 0.5));
}
.todo-wires path.lit {
  stroke-width: 2.6;
  filter: drop-shadow(0 0 10px rgba(24, 153, 201, 0.8));
}
[data-theme="dark"] .todo-wires path.lit {
  filter: drop-shadow(0 0 10px rgba(138, 180, 248, 0.9));
}
@keyframes wireMarch {
  to { stroke-dashoffset: -11; }
}

/* ---- Root (on top, wires drop down to the 5 cards) ---- */
.todo-trunk {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0 8px;
  min-height: 0;
}
.todo-root {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 16px 34px;
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 800;
  letter-spacing: 0.3px;
  white-space: nowrap;
  color: #04263e;
  border-radius: 999px;
  background: linear-gradient(135deg, #a5f3fc, #38d6f5 55%, #1aa3d6);
  box-shadow: 0 6px 18px rgba(56, 214, 245, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
[dir="rtl"] .todo-root {
  font-family: "Tajawal", "Montserrat", sans-serif;
  letter-spacing: 0;
}
/* port dot where the 5 wires leave the pill (bottom center now) */
.todo-root::after {
  content: "";
  position: absolute;
  top: auto;
  bottom: -7px;
  left: 50%;
  inset-inline-end: auto;
  width: 10px;
  height: 10px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #1aa3d6;
  box-shadow: 0 0 6px rgba(24, 153, 201, 0.5);
}
[data-theme="dark"] .todo-root::after {
  background: #8ab4f8;
  box-shadow: 0 0 6px rgba(138, 180, 248, 0.5);
}

/* ---- Branch cards: 5 side by side, icon + title + description ---- */
.todo-branches {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
  min-width: 0;
  align-items: stretch;
}
.todo-node {
  position: relative;
  margin: 0;
  border-radius: 18px;
  padding: 22px 18px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 0;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
/* The cards reuse .card for the glass look, but they must NOT inherit the
   old bento column-spans from home.css (.card:nth-child...) — that rule is
   what wrapped them into a 1+2+2 stagger. Every service owns exactly 1 slot. */
.todo-branches > .card.todo-node {
  grid-column: auto;
}
/* straight stub is desktop-hidden (SVG curves do the job);
   it becomes the vertical drop on mobile */
.todo-node::before {
  display: none;
}
/* arrow head where each curve docks (top center now) */
.todo-node::after {
  content: "";
  position: absolute;
  top: -13px;
  left: 50%;
  inset-inline-start: auto;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: rgba(24, 153, 201, 0.95);
  border-inline-start-color: transparent;
  filter: drop-shadow(0 0 6px rgba(24, 153, 201, 0.5));
}
[dir="rtl"] .todo-node::after {
  transform: translateX(50%);
}
[data-theme="dark"] .todo-node::after {
  border-top-color: rgba(138, 180, 248, 0.95);
  border-inline-start-color: transparent;
}
.todo-node:hover {
  transform: translateY(-3px);
}
.todo-node.open {
  border-color: rgba(24, 153, 201, 0.6);
  box-shadow: 0 12px 32px rgba(56, 214, 245, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* node head: icon on top, title under it, description always below */
.todo-head {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 6px 4px 0;
  background: none;
  border: 0;
  cursor: default;
  font: inherit;
  color: inherit;
  text-align: center;
}
.todo-ico {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border-radius: 14px;
  color: #1aa3d6;
  background: rgba(56, 214, 245, 0.14);
  border: 1px solid rgba(56, 214, 245, 0.3);
}
[data-theme="dark"] .todo-ico {
  color: #8ab4f8;
  background: rgba(138, 180, 248, 0.12);
  border-color: rgba(138, 180, 248, 0.3);
}
.todo-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 17px;
  font-weight: 800;
  color: var(--primary);
}
[data-theme="dark"] .todo-title {
  color: var(--text-primary);
}
.todo-plus {
  display: none;
}
[data-theme="dark"] .todo-plus {
  border-color: rgba(138, 180, 248, 0.35);
  color: var(--primary);
}
.todo-node.open .todo-plus {
  transform: rotate(45deg);
  background: rgba(56, 214, 245, 0.18);
}
.todo-head:focus-visible {
  outline: 2px solid #1aa3d6;
  outline-offset: 3px;
  border-radius: 12px;
}

/* description always visible under title+icon (no accordion) */
.todo-body {
  display: block;
  opacity: 1;
}
.todo-body > span {
  overflow: visible;
  min-height: 0;
  display: block;
  margin: 12px 0 0;
  padding: 12px 0 0;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--text-secondary);
  border-top: 2px solid rgba(26, 163, 214, 0.35);
  border-inline-start: 0;
}
[dir="rtl"] .todo-body > span {
  font-family: "Tajawal", "Montserrat", sans-serif;
}
.todo-node.open .todo-body {
  opacity: 1;
}
.todo-node.open .todo-body > span {
  margin-bottom: 0;
}

/* ---- Responsive: 5 across -> fewer columns, wires off on small ---- */
@media (max-width: 1100px) {
  .todo-branches {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 860px) {
  .todo-layout {
    gap: 34px;
  }
  .todo-wires {
    display: none;
  }
  .todo-trunk {
    justify-content: center;
    padding: 0 0 22px;
    min-height: 0;
  }
  .todo-root::after {
    top: auto;
    bottom: -7px;
    inset-inline-end: auto;
    left: 50%;
    transform: translateX(-50%);
  }
  .todo-root::after {
    display: none;
  }
  .todo-branches {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
  .todo-node::before,
  .todo-node::after {
    display: none;
  }
  .todo-node:hover {
    transform: none;
  }
  .todo-plus {
    display: none;
  }
  .todo-head {
    cursor: default;
  }
  /* cards always show their text */
  .todo-node .todo-body {
    opacity: 1;
  }
}
@media (max-width: 560px) {
  .todo-branches {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .todo-wires path {
    animation: none;
  }
}
