/* ============================================================
   World — interactive node-tree portfolio
   ============================================================ */

:root {
  --w-bg: #06181a;
  --w-bg-2: #0a2124;
  --w-glass: rgba(13, 34, 37, 0.78);
  --w-glass-2: rgba(10, 28, 31, 0.92);
  --w-border: rgba(148, 226, 213, 0.12);
  --w-border-soft: rgba(255, 255, 255, 0.06);
  --w-teal: #7fe0d4;
  --w-teal-dim: rgba(127, 224, 212, 0.55);
  --w-gold: #dfc08a;
  --w-gold-dim: rgba(223, 192, 138, 0.55);
  --w-purple: #b9a3ef;
  --w-text: #e8f4f2;
  --w-text-dim: #8fb0ac;
  --w-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --w-radius: 18px;
  --w-font: "IBM Plex Sans Arabic", "Inter", ui-sans-serif, system-ui, sans-serif;
}

/* ---------- LIGHT theme: a daylight version of the World ---------- */
[data-theme="light"] {
  --w-bg: #e7f1ef;
  --w-bg-2: #dceae8;
  --w-glass: rgba(255, 255, 255, 0.74);
  --w-glass-2: rgba(255, 255, 255, 0.9);
  --w-border: rgba(20, 90, 90, 0.16);
  --w-border-soft: rgba(20, 90, 90, 0.08);
  --w-teal: #0f8f83;
  --w-teal-dim: rgba(15, 143, 131, 0.55);
  --w-text: #123330;
  --w-text-dim: #4a6b68;
  --w-shadow: 0 10px 34px rgba(20, 60, 60, 0.16);
}

html.world-page, .world-page body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--w-bg);
  font-family: var(--w-font);
  color: var(--w-text);
}

#world-app {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1200px 700px at 70% 20%, rgba(20, 60, 62, 0.35), transparent 60%),
    radial-gradient(900px 600px at 20% 80%, rgba(16, 48, 52, 0.4), transparent 60%),
    var(--w-bg);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.world-page[data-theme="light"] #world-app {
  background:
    radial-gradient(1200px 700px at 70% 20%, rgba(120, 200, 195, 0.32), transparent 60%),
    radial-gradient(900px 600px at 20% 80%, rgba(150, 210, 220, 0.30), transparent 60%),
    var(--w-bg);
}

/* ---------- star canvas ---------- */
#w-stars {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---------- viewport / world ---------- */
#w-viewport {
  position: absolute;
  inset: 0;
  cursor: grab;
}
#w-viewport.dragging { cursor: grabbing; }

#w-world {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
  will-change: transform;
}
#w-world.animate { transition: transform 1.15s cubic-bezier(0.22, 1, 0.36, 1); }

#w-links {
  position: absolute;
  overflow: visible;
  left: 0;
  top: 0;
  pointer-events: none;
}
/* vines: two-layer gradient tendrils that draw themselves in
   (stroke widths set per-depth by JS) */
.vine { transition: opacity 0.25s ease; }
.vine path {
  fill: none;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0;
}
.vine .vine-glow { filter: blur(4px); }
.vine.on .vine-glow { opacity: 0.25; }
.vine.on .vine-core { opacity: 0.78; }
.vine.off { opacity: 0; }
.vine.dim { opacity: 0.3; }

/* flowing "ion" traveling along the vine */
.vine-flow {
  filter: drop-shadow(0 0 5px currentColor);
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 0.6;
}

/* Safari: filters recompute on CPU every frame while the vines redraw,
   which reads as harsh/stuttery — fall back to soft wide strokes
   (same strategy as the original site) */
.is-safari .vine .vine-glow { filter: none; }
.is-safari .vine.on .vine-glow { opacity: 0.14; }
.is-safari .vine-flow { filter: none; }

/* ---------- nodes ---------- */
.w-node {
  position: absolute;
  left: 0;
  top: 0;
  cursor: pointer;
  z-index: 2;
  will-change: transform;
  transition: opacity 0.3s ease;
}
.w-node.dim { opacity: 0.45; }
.w-node.dim:hover { opacity: 1; }
.w-node .w-pop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translate(-50%, -50%) scale(0.35);
  opacity: 0;
  /* spring-like overshoot on appear (≈ spring 210/20) */
  transition: transform 0.6s cubic-bezier(0.34, 1.3, 0.5, 1), opacity 0.35s ease;
}
.w-node.on .w-pop {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
/* orb + rings wrapper: hover / focus growth (measured: 1.12 / 1.28) */
.w-node .w-hover {
  position: relative;
  display: grid;
  place-items: center;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.w-node.on:hover .w-hover { transform: scale(1.12); }
.w-node.active .w-hover,
.w-node.active:hover .w-hover { transform: scale(1.28); }

.w-node .orb {
  position: relative;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.14), transparent 55%),
    radial-gradient(circle at 50% 120%, rgba(var(--nc), 0.22), transparent 70%),
    linear-gradient(160deg, rgba(28, 52, 54, 0.9), rgba(10, 26, 28, 0.95));
  border: 1px solid rgba(var(--nc), 0.35);
  box-shadow:
    0 6px 24px rgba(0, 0, 0, 0.5),
    inset 0 1px 1px rgba(255, 255, 255, 0.08),
    0 0 22px rgba(var(--nc), 0.14);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}
.w-node:hover .orb {
  border-color: rgba(var(--nc), 0.75);
  box-shadow:
    0 6px 24px rgba(0, 0, 0, 0.5),
    inset 0 1px 1px rgba(255, 255, 255, 0.1),
    0 0 34px rgba(var(--nc), 0.4);
}
.w-node .orb svg {
  width: 32px;
  height: 32px;
  stroke: rgb(var(--nc));
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.w-node .orb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: top center;
}

/* concentric rings around EVERY orb (measured: each node is haloed).
   They sit around the circle only — the label lives outside .w-hover. */
.w-node .ring,
.w-node .ring2 {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid rgba(var(--nc), 0.3);
  opacity: 0.55;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.w-node .ring2 {
  inset: -20px;
  border-color: rgba(var(--nc), 0.24);
  animation: w-ring-breathe 5s ease-in-out infinite;
}
.w-node .ring { animation: w-ring-breathe 4s ease-in-out infinite reverse; }
/* opacity-only twinkle — no scaling, so the ring gaps stay perfectly even */
@keyframes w-ring-breathe {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.85; }
}
.w-node.active .ring,
.w-node.active .ring2,
.w-node.root .ring,
.w-node.root .ring2 { opacity: 1; border-color: rgba(var(--nc), 0.4); }
/* root gets an extra outermost ring, breathing with the same unit */
.w-node.root .w-breathe::after {
  content: "";
  position: absolute;
  inset: -30px;
  border-radius: 50%;
  border: 1px solid rgba(var(--nc), 0.2);
  animation: w-ring-breathe 6s ease-in-out infinite;
  pointer-events: none;
}
.w-node.active .orb {
  border-color: rgba(var(--nc), 0.85);
  box-shadow:
    0 6px 24px rgba(0, 0, 0, 0.5),
    0 0 44px rgba(var(--nc), 0.45);
}

.w-node.root .orb { width: 116px; height: 116px; }
.w-node.lvl2 .orb { width: 72px; height: 72px; }
.w-node.lvl2 .orb svg { width: 25px; height: 25px; }

.w-node .lbl {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--w-text);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
  letter-spacing: 0.2px;
}
.w-node.root .lbl { font-size: 14px; }

.w-node .chip {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(var(--nc), 0.13);
  border: 1px solid rgba(var(--nc), 0.3);
  color: rgb(var(--nc));
  white-space: nowrap;
}

/* breathing: the orb AND its rings scale together as one unit,
   so the gaps between the circles stay perfectly even */
@keyframes w-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.055); }
}
.w-node .w-breathe {
  position: relative;
  display: grid;
  place-items: center;
  animation: w-breathe 4s ease-in-out infinite;
}

/* ---------- detail card (world space) ---------- */
.w-card {
  position: absolute;
  width: 320px;
  background: var(--w-glass-2);
  border: 1px solid var(--w-border);
  border-radius: var(--w-radius);
  box-shadow: var(--w-shadow), 0 0 60px rgba(127, 224, 212, 0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 18px;
  z-index: 5;
  left: 0;
  top: 0;
  /* transform is driven per-frame by JS (follows the floating node) */
  cursor: default;
}
/* entrance on the inner wrapper (measured: y+16, scale .93, spring 300/28) */
.w-card .c-in {
  opacity: 0;
  transform: translateY(16px) scale(0.93);
  transition: transform 0.5s cubic-bezier(0.3, 1.25, 0.45, 1), opacity 0.3s ease;
}
.w-card.on .c-in { opacity: 1; transform: none; }

.w-card .c-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.w-card h3 { margin: 0; font-size: 16px; font-weight: 700; color: var(--w-text); }
.w-card .c-chip {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(var(--cc), 0.13);
  border: 1px solid rgba(var(--cc), 0.35);
  color: rgb(var(--cc));
}
.w-card .c-sub { font-size: 12px; color: var(--w-text-dim); margin: 0 0 4px; }
.w-card .c-date {
  display: inline-block;
  font-size: 10.5px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--w-border);
  color: var(--w-teal);
  background: rgba(127, 224, 212, 0.06);
  margin: 2px 0 8px;
}
.w-card .c-desc { font-size: 12.5px; line-height: 1.65; color: #bdd6d2; margin: 0 0 10px; }
.w-card .c-role { font-size: 11.5px; color: var(--w-text-dim); margin: 0 0 8px; }
.w-card .c-role b { color: var(--w-text); font-weight: 600; }

.w-card .c-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.w-card .c-tags span {
  font-size: 10.5px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  padding: 3px 9px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--w-border-soft);
  color: #a8c8c4;
}

.w-card ul { margin: 0 0 12px; padding: 0; list-style: none; }
.w-card ul li {
  position: relative;
  font-size: 12px;
  line-height: 1.6;
  color: #bdd6d2;
  padding-inline-start: 16px;
  margin-bottom: 7px;
}
.w-card ul li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(var(--cc), 0.8);
  box-shadow: 0 0 8px rgba(var(--cc), 0.6);
}

.w-card .c-actions { display: flex; gap: 8px; }
.w-card .c-actions a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  padding: 9px 10px;
  border-radius: 10px;
  text-decoration: none;
  border: 1px solid rgba(var(--cc), 0.4);
  color: rgb(var(--cc));
  background: rgba(var(--cc), 0.1);
  transition: background 0.2s ease;
}
.w-card .c-actions a:hover { background: rgba(var(--cc), 0.2); }
.w-card .c-actions a.ghost {
  border-color: var(--w-border-soft);
  color: var(--w-text);
  background: rgba(255, 255, 255, 0.04);
}
.w-card .c-actions a svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; }

/* ---------- top bar ---------- */
.w-top {
  position: absolute;
  top: 18px;
  left: 22px;
  right: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 20;
  pointer-events: none;
}
.w-top > * { pointer-events: auto; }

.w-id {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 54px;
  box-sizing: border-box;
  background: var(--w-glass);
  border: 1px solid var(--w-border-soft);
  border-radius: 999px;
  padding: 7px 10px 7px 8px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--w-shadow);
}
.w-id img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top center; /* the face is at the top of the photo */
  border: 1px solid rgba(127, 224, 212, 0.35);
}
.w-id .t { line-height: 1.25; }
.w-id .t b { display: block; font-size: 14.5px; font-weight: 700; color: var(--w-text); }
.w-id .t span { font-size: 11px; color: var(--w-text-dim); }

.w-lang {
  margin-inline-start: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 34px;
  box-sizing: border-box;
  border: 1px solid rgba(127, 224, 212, 0.3);
  background: rgba(127, 224, 212, 0.07);
  color: var(--w-teal);
  border-radius: 999px;
  padding: 0 13px;
  font-size: 13px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--w-font);
  transition: background 0.2s ease;
}
.w-lang:hover { background: rgba(127, 224, 212, 0.16); }

/* home button (exits the World back to the site) */
.w-home {
  margin-inline-start: 6px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  box-sizing: border-box;
  border: 1px solid rgba(127, 224, 212, 0.3);
  background: rgba(127, 224, 212, 0.07);
  border-radius: 50%;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease;
  flex-shrink: 0;
}
.w-home:hover { background: rgba(127, 224, 212, 0.16); }
.w-home svg {
  width: 17px;
  height: 17px;
  stroke: var(--w-teal);
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* theme toggle (sits next to the language button) */
.w-theme {
  margin-inline-start: 6px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(127, 224, 212, 0.3);
  background: rgba(127, 224, 212, 0.07);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s ease;
}
.w-theme:hover { background: rgba(127, 224, 212, 0.16); }
.w-theme svg {
  width: 17px;
  height: 17px;
  stroke: var(--w-teal);
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.w-theme .ic-moon { display: none; }
[data-theme="light"] .w-theme .ic-sun { display: none; }
[data-theme="light"] .w-theme .ic-moon { display: block; }

.w-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 54px;
  box-sizing: border-box;
  background: var(--w-glass);
  border: 1px solid var(--w-border-soft);
  border-radius: 999px;
  padding: 5px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--w-shadow);
}
.w-nav button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.25s ease;
}
.w-nav button svg {
  width: 19px;
  height: 19px;
  stroke: var(--w-text-dim);
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.25s ease;
}
.w-nav button:hover svg { stroke: var(--w-text); }
.w-nav button.active { background: var(--w-teal); }
.w-nav button.active svg { stroke: #06322c; }
.w-nav button.gold.active { background: var(--w-gold); }
.w-nav button.gold.active svg { stroke: #3a2c10; }

.w-search { position: relative; width: min(280px, 26vw); }
.w-search input {
  width: 100%;
  height: 54px;
  box-sizing: border-box;
  background: var(--w-glass);
  border: 1px solid var(--w-border-soft);
  border-radius: 999px;
  padding: 12px 18px 12px 42px;
  color: var(--w-text);
  font-size: 13px;
  font-family: var(--w-font);
  outline: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--w-shadow);
  transition: border-color 0.2s ease;
}
[dir="rtl"] .w-search input { padding: 12px 42px 12px 18px; }
.w-search input:focus { border-color: rgba(127, 224, 212, 0.4); }
.w-search input::placeholder { color: #5f7d79; }
.w-search .s-ico {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  inset-inline-start: 15px;
  width: 16px;
  height: 16px;
  stroke: #5f7d79;
  fill: none;
  stroke-width: 2;
  pointer-events: none;
}
.w-search .s-results {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline: 0;
  background: var(--w-glass-2);
  border: 1px solid var(--w-border);
  border-radius: 14px;
  overflow: hidden;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--w-shadow);
  display: none;
}
.w-search .s-results.on { display: block; }
.w-search .s-results button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--w-text);
  font-family: var(--w-font);
  font-size: 12.5px;
  padding: 10px 14px;
  cursor: pointer;
  text-align: start;
}
.w-search .s-results button:hover { background: rgba(127, 224, 212, 0.08); }
.w-search .s-results button small { color: var(--w-text-dim); font-size: 10.5px; }
.w-search .s-results svg { width: 14px; height: 14px; stroke: var(--w-teal); fill: none; stroke-width: 1.8; flex-shrink: 0; }

/* ---------- bottom-left controls ---------- */
.w-ctl {
  position: absolute;
  bottom: 178px;
  left: 22px;
  display: flex;
  gap: 6px;
  z-index: 20;
}
.w-ctl button {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--w-border-soft);
  background: var(--w-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s ease;
}
.w-ctl button:hover { background: rgba(127, 224, 212, 0.12); }
.w-ctl button svg { width: 17px; height: 17px; stroke: var(--w-text-dim); fill: none; stroke-width: 1.8; stroke-linecap: round; }
.w-ctl button:hover svg { stroke: var(--w-teal); }

#w-minimap {
  position: absolute;
  bottom: 22px;
  left: 22px;
  width: 160px;
  height: 140px;
  border-radius: 14px;
  border: 1px solid var(--w-border-soft);
  background: rgba(8, 22, 24, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--w-shadow);
  z-index: 20;
  cursor: pointer;
}

/* ---------- breadcrumb ---------- */
.w-crumbs {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--w-glass);
  border: 1px solid var(--w-border-soft);
  border-radius: 999px;
  padding: 9px 18px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--w-shadow);
  z-index: 20;
  max-width: 60vw;
  overflow: hidden;
}
.w-crumbs button {
  border: none;
  background: transparent;
  color: var(--w-text-dim);
  font-family: var(--w-font);
  font-size: 12.5px;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
  transition: color 0.2s ease;
}
.w-crumbs button:hover { color: var(--w-text); }
.w-crumbs button:last-child { color: var(--w-teal); font-weight: 600; cursor: default; }
.w-crumbs .sep { color: #4a6663; font-size: 11px; }

/* ---------- chat ---------- */
.w-chat-fab {
  position: absolute;
  bottom: 22px;
  right: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 30;
}
.w-chat-fab .hint {
  background: var(--w-glass);
  border: 1px solid var(--w-border-soft);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--w-text);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--w-shadow);
}
.w-chat-fab .fab {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid rgba(127, 224, 212, 0.35);
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.12), transparent 55%),
    linear-gradient(160deg, rgba(24, 56, 58, 0.95), rgba(10, 28, 30, 0.98));
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5), 0 0 26px rgba(127, 224, 212, 0.18);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.w-chat-fab .fab:hover { transform: scale(1.06); box-shadow: 0 8px 28px rgba(0,0,0,.5), 0 0 40px rgba(127,224,212,.35); }
.w-chat-fab .fab svg { width: 24px; height: 24px; stroke: var(--w-teal); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.w-chat {
  position: absolute;
  bottom: 90px;
  right: 22px;
  width: min(360px, calc(100vw - 44px));
  max-height: min(620px, calc(100vh - 130px));
  display: flex;
  flex-direction: column;
  background: rgba(9, 24, 26, 0.94);
  border: 1px solid var(--w-border);
  border-radius: 22px;
  box-shadow: var(--w-shadow), 0 0 80px rgba(127, 224, 212, 0.07);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 30;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.4s cubic-bezier(0.22, 1, 0.3, 1);
}
.w-chat.on { opacity: 1; transform: none; pointer-events: auto; }

.w-chat .ch-close {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  color: var(--w-text-dim);
  font-size: 15px;
  cursor: pointer;
  z-index: 2;
}
.w-chat .ch-close:hover { color: var(--w-text); }

.w-chat .ch-head { text-align: center; padding: 26px 20px 10px; }
.w-chat .ch-avatar {
  width: 74px;
  height: 74px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 1px solid rgba(127, 224, 212, 0.3);
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.1), transparent 55%),
    linear-gradient(160deg, rgba(24, 56, 58, 0.9), rgba(10, 28, 30, 0.95));
  box-shadow: 0 0 34px rgba(127, 224, 212, 0.18);
}
.w-chat .ch-avatar svg { width: 30px; height: 30px; stroke: var(--w-teal); fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.w-chat .ch-head h3 { margin: 0 0 5px; font-size: 17px; color: var(--w-text); }
.w-chat .ch-head .st {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--w-text-dim);
}
.w-chat .ch-head .st::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px #4ade80;
}

.w-chat .ch-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 18px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(127, 224, 212, 0.2) transparent;
}
.w-chat .ch-intro { text-align: center; font-size: 12.5px; color: var(--w-text-dim); line-height: 1.6; margin: 6px 0 14px; }

.w-chat .ch-topics {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}
.w-chat .ch-topics button {
  width: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: var(--w-font);
}
.w-chat .ch-topics .tico {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  border: 1px solid rgba(127, 224, 212, 0.25);
  background: rgba(127, 224, 212, 0.06);
  display: grid;
  place-items: center;
  transition: background 0.2s ease, transform 0.2s ease;
}
.w-chat .ch-topics button:hover .tico { background: rgba(127, 224, 212, 0.15); transform: translateY(-2px); }
.w-chat .ch-topics .tico svg { width: 22px; height: 22px; stroke: var(--w-teal); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.w-chat .ch-topics span { font-size: 11px; color: #a8c8c4; line-height: 1.35; }

.w-chat .msg {
  max-width: 85%;
  font-size: 12.5px;
  line-height: 1.6;
  padding: 10px 14px;
  border-radius: 16px;
  margin-bottom: 8px;
  white-space: pre-line;
}
.w-chat .msg.bot {
  background: rgba(127, 224, 212, 0.08);
  border: 1px solid rgba(127, 224, 212, 0.15);
  color: #cfe7e3;
  border-start-start-radius: 4px;
  margin-inline-end: auto;
}
.w-chat .msg.me {
  background: rgba(127, 224, 212, 0.18);
  color: var(--w-text);
  border-end-end-radius: 4px;
  margin-inline-start: auto;
}

.w-chat .ch-input {
  margin: 0 14px 14px;
  position: relative;
}
.w-chat .ch-input textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 76px;
  resize: none;
  background: rgba(14, 34, 37, 0.85);
  border: 1px solid var(--w-border-soft);
  border-radius: 16px;
  padding: 13px 44px 13px 15px;
  color: var(--w-text);
  font-size: 13px;
  font-family: var(--w-font);
  outline: none;
}
[dir="rtl"] .w-chat .ch-input textarea { padding: 13px 15px 13px 44px; }
.w-chat .ch-input textarea:focus { border-color: rgba(127, 224, 212, 0.35); }
.w-chat .ch-input textarea::placeholder { color: #567975; }
.w-chat .ch-input .send {
  position: absolute;
  bottom: 12px;
  inset-inline-end: 12px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 9px;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.w-chat .ch-input .send svg { width: 17px; height: 17px; stroke: #6b918d; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.w-chat .ch-input .send:hover svg { stroke: var(--w-teal); }

/* ---------- intro overlay ---------- */
#w-intro {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: var(--w-bg);
  transition: opacity 0.8s ease;
}
#w-intro.off { opacity: 0; pointer-events: none; }
#w-intro .box { text-align: center; }
#w-intro h1 {
  font-size: 30px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--w-text);
  letter-spacing: 0.5px;
}
#w-intro p { color: var(--w-text-dim); font-size: 13.5px; margin: 0 0 24px; }
#w-intro .dot {
  width: 10px; height: 10px; margin: 0 auto;
  border-radius: 50%;
  background: var(--w-teal);
  box-shadow: 0 0 18px var(--w-teal);
  animation: w-pulse-dot 1.2s ease-in-out infinite;
}
@keyframes w-pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.6); opacity: 0.5; }
}

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .w-search { display: none; }
  .w-id .t span { display: none; }
  .w-crumbs { bottom: 84px; max-width: 86vw; }
  .w-ctl { bottom: 130px; }
  #w-minimap { display: none; }
  .w-ctl { bottom: 22px; }
  .w-chat-fab .hint { display: none; }
  .w-card { width: 270px; }
}

/* ============================================================
   LIGHT theme — surface overrides for the few hardcoded darks
   ============================================================ */
[data-theme="light"] .w-node .orb {
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.7), transparent 55%),
    radial-gradient(circle at 50% 120%, rgba(var(--nc), 0.28), transparent 70%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(230, 244, 242, 0.98));
  border-color: rgba(var(--nc), 0.55);
  box-shadow:
    0 6px 20px rgba(20, 60, 60, 0.14),
    inset 0 1px 1px rgba(255, 255, 255, 0.6),
    0 0 20px rgba(var(--nc), 0.1);
}
[data-theme="light"] .w-node.active .orb {
  box-shadow: 0 6px 20px rgba(20, 60, 60, 0.16), 0 0 34px rgba(var(--nc), 0.35);
}
[data-theme="light"] .w-nav button.active svg { stroke: #fff; }

/* chat + fab + avatar + input surfaces */
[data-theme="light"] .w-chat { background: rgba(255, 255, 255, 0.92); }
[data-theme="light"] .w-chat-fab .fab,
[data-theme="light"] .w-chat .ch-avatar {
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.8), transparent 55%),
    linear-gradient(160deg, rgba(240, 250, 248, 0.96), rgba(220, 238, 236, 0.98));
}
[data-theme="light"] .w-chat .ch-close,
[data-theme="light"] .w-chat .msg.bot { background: rgba(15, 143, 131, 0.08); }
[data-theme="light"] .w-chat .ch-input textarea { background: rgba(240, 248, 247, 0.9); }
[data-theme="light"] .w-search .s-results button:hover,
[data-theme="light"] .w-ctl button:hover { background: rgba(15, 143, 131, 0.1); }
[data-theme="light"] #w-minimap { background: rgba(255, 255, 255, 0.8); }
[data-theme="light"] #w-intro { background: var(--w-bg); }
[data-theme="light"] .w-node .lbl { text-shadow: 0 1px 6px rgba(255, 255, 255, 0.9); }
[data-theme="light"] .vine-flow { stroke: rgba(20, 70, 68, 0.5); }

/* light-theme: card + chat body text (were tuned for dark glass) */
[data-theme="light"] .w-card .c-desc,
[data-theme="light"] .w-card ul li { color: #2c4c48; }
[data-theme="light"] .w-card .c-tags span { color: #2c4c48; background: rgba(20, 90, 90, 0.06); }
[data-theme="light"] .w-chat .msg.bot { color: #1f403d; }
[data-theme="light"] .w-chat .ch-topics span { color: #35544f; }
[data-theme="light"] .w-chat .msg.me { color: #123330; background: rgba(15, 143, 131, 0.16); }
