/* =====================================================
 * SITEMAP PAGE — ZitBoard
 * Agents: UI Designer · Whimsy Injector · UX Architect
 * ===================================================== */

/* ── Accent tokens per branch ── */
[data-accent="teal"] {
  --accent:        var(--teal-500);
  --accent-soft:   rgba(87, 207, 192, 0.1);
  --accent-border: rgba(87, 207, 192, 0.35);
  --accent-glow:   rgba(87, 207, 192, 0.2);
  --accent-strip:  linear-gradient(90deg, var(--teal-500), rgba(87, 207, 192, 0.2));
}
[data-accent="purple"] {
  --accent:        var(--purple-main);
  --accent-soft:   rgba(139, 92, 246, 0.09);
  --accent-border: rgba(139, 92, 246, 0.3);
  --accent-glow:   rgba(139, 92, 246, 0.18);
  --accent-strip:  linear-gradient(90deg, var(--purple-main), rgba(139, 92, 246, 0.15));
}
[data-accent="blue"] {
  --accent:        #4f8ef7;
  --accent-soft:   rgba(79, 142, 247, 0.09);
  --accent-border: rgba(79, 142, 247, 0.3);
  --accent-glow:   rgba(79, 142, 247, 0.18);
  --accent-strip:  linear-gradient(90deg, #4f8ef7, rgba(79, 142, 247, 0.15));
}
[data-accent="slate"] {
  --accent:        #7c8ca0;
  --accent-soft:   rgba(124, 140, 160, 0.09);
  --accent-border: rgba(124, 140, 160, 0.25);
  --accent-glow:   rgba(124, 140, 160, 0.14);
  --accent-strip:  linear-gradient(90deg, #7c8ca0, rgba(124, 140, 160, 0.1));
}

/* ── Dark mode accent shifts ── */
[data-theme="dark"] [data-accent="teal"]   { --accent: var(--teal-300);   --accent-soft: rgba(87, 207, 192, 0.08);  }
[data-theme="dark"] [data-accent="purple"] { --accent: var(--purple-400); --accent-soft: rgba(167, 139, 250, 0.08); }
[data-theme="dark"] [data-accent="blue"]   { --accent: #7fb3ff;           --accent-soft: rgba(127, 179, 255, 0.08); }

/* =====================================================
 * KEYFRAMES
 * ===================================================== */
@keyframes smFadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0);    }
}
@keyframes smFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes smFlowDown {
  from { background-position: 0 0;    }
  to   { background-position: 0 52px; }
}
@keyframes smPulseGlow {
  0%, 100% { box-shadow: 0 0 0 3px rgba(87, 207, 192, 0.08), 0 6px 24px rgba(87, 207, 192, 0.12); }
  50%       { box-shadow: 0 0 0 5px rgba(87, 207, 192, 0.14), 0 10px 32px rgba(87, 207, 192, 0.2); }
}

/* =====================================================
 * HERO
 * ===================================================== */
.sm-hero {
  padding: 7rem 0 3.5rem;
  text-align: center;
}

.sm-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--teal-500);
  margin: 0 0 1rem;
}

.sm-eyebrow::before,
.sm-eyebrow::after {
  content: '';
  display: inline-block;
  width: 28px;
  height: 1px;
  background: currentColor;
  opacity: 0.4;
}

[data-theme="dark"] .sm-eyebrow { color: var(--teal-300); }

.sm-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.0;
  background: linear-gradient(135deg, var(--purple-main), var(--teal-main));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0 0 1.1rem;
}

[data-theme="dark"] .sm-title {
  background: linear-gradient(135deg, var(--teal-300), var(--purple-400));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sm-subtitle {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.75;
  max-width: 46ch;
  margin: 0 auto 1.75rem;
}

.sm-stats {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.55rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: 100px;
  font-size: 0.8rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.6);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

[data-theme="dark"] .sm-stats {
  background: rgba(255, 255, 255, 0.04);
}

.sm-stats strong { color: var(--text); font-weight: 700; }

.sm-stat-divider {
  width: 1px;
  height: 12px;
  background: var(--line);
  display: inline-block;
}

/* =====================================================
 * TREE SECTION — ambient glow backdrop
 * ===================================================== */
.sm-section {
  padding: 0 0 7rem;
  position: relative;
}

.sm-section::before {
  content: '';
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  width: min(1000px, 100%);
  height: 700px;
  background: radial-gradient(
    ellipse at 50% 30%,
    rgba(87, 207, 192, 0.07)  0%,
    rgba(139, 92, 246, 0.05)  40%,
    transparent               70%
  );
  pointer-events: none;
  z-index: 0;
}

[data-theme="dark"] .sm-section::before {
  background: radial-gradient(
    ellipse at 50% 30%,
    rgba(87, 207, 192, 0.05)  0%,
    rgba(167, 139, 250, 0.04) 40%,
    transparent               70%
  );
}

.sm-section > .container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: none;
  padding-left: clamp(0.75rem, 2.5vw, 2.5rem);
  padding-right: clamp(0.75rem, 2.5vw, 2.5rem);
}

/* ── Root row ── */
.sm-root-row {
  display: flex;
  justify-content: center;
  margin-bottom: 0;
  padding-top: 1.5rem;
}

/* ── Home node ── */
.sm-home-node {
  display: inline-flex;
  align-items: center;
  gap: 1.1rem;
  padding: 1.1rem 2rem;
  background: linear-gradient(145deg, var(--bg) 60%, rgba(87, 207, 192, 0.06) 100%);
  border: 1.5px solid rgba(87, 207, 192, 0.5);
  border-radius: 20px;
  text-decoration: none;
  color: var(--text);
  position: relative;
  box-shadow:
    0 0 0 4px rgba(87, 207, 192, 0.07),
    0 6px 28px rgba(87, 207, 192, 0.14),
    0 2px 8px rgba(0, 0, 0, 0.06);
  transition:
    transform 0.25s cubic-bezier(0.34, 1.4, 0.64, 1),
    box-shadow 0.25s ease,
    border-color 0.2s ease;
  animation: smPulseGlow 3.5s ease-in-out infinite;
}

.sm-home-node:hover {
  transform: translateY(-5px) scale(1.02);
  border-color: var(--teal-main);
  box-shadow:
    0 0 0 5px rgba(87, 207, 192, 0.12),
    0 18px 44px rgba(87, 207, 192, 0.22),
    0 6px 14px rgba(0, 0, 0, 0.08);
  animation: none;
}

[data-theme="dark"] .sm-home-node {
  background: linear-gradient(145deg, rgba(255,255,255,0.05) 60%, rgba(87, 207, 192, 0.07) 100%);
  border-color: rgba(87, 207, 192, 0.35);
  box-shadow:
    0 0 0 4px rgba(87, 207, 192, 0.07),
    0 6px 28px rgba(87, 207, 192, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.3);
}

.sm-home-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  background: rgba(87, 207, 192, 0.08);
  border: 1px solid rgba(87, 207, 192, 0.2);
  border-radius: 13px;
  flex-shrink: 0;
}

.sm-home-logo-img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.sm-home-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sm-home-label {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.sm-home-url {
  font-size: 0.74rem;
  color: var(--teal-500);
  font-weight: 500;
  letter-spacing: 0.01em;
}

[data-theme="dark"] .sm-home-url { color: var(--teal-300); }

.sm-home-arrow {
  color: var(--teal-500);
  display: flex;
  align-items: center;
  opacity: 0.65;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.sm-home-node:hover .sm-home-arrow {
  transform: translate(3px, -3px);
  opacity: 1;
}

/* ── Trunk: animated flowing dashes ── */
.sm-trunk {
  width: 2px;
  height: 52px;
  margin: 0 auto;
  background: repeating-linear-gradient(
    to bottom,
    var(--teal-500)            0,
    var(--teal-500)            7px,
    rgba(87, 207, 192, 0.12)  7px,
    rgba(87, 207, 192, 0.12)  14px
  );
  background-size: 2px 14px;
}

@media (prefers-reduced-motion: no-preference) {
  .sm-trunk {
    animation: smFlowDown 0.65s linear infinite;
  }
}

/* =====================================================
 * BRANCHES (4-column grid)
 * ===================================================== */
.sm-branches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  position: relative;
  padding-top: 52px;
  align-items: start;
}

/* Gradient crossbar spanning first-to-last column center */
.sm-branches::before {
  content: '';
  position: absolute;
  top: 0;
  left: 12.5%;
  right: 12.5%;
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--teal-500)    0%,
    var(--purple-main) 33%,
    #4f8ef7            66%,
    #7c8ca0            100%
  );
  border-radius: 100px;
  opacity: 0.9;
}

/* Center dot where trunk meets crossbar */
.sm-branches::after {
  content: '';
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal-500), var(--purple-main));
  z-index: 2;
  box-shadow: 0 0 8px rgba(87, 207, 192, 0.4);
}

/* ── Single branch column ── */
.sm-branch {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Vertical stem: crossbar → category card */
.sm-branch::before {
  content: '';
  position: absolute;
  top: -52px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 52px;
  background: linear-gradient(to bottom, rgba(200, 200, 220, 0.3), var(--accent));
  border-radius: 100px;
}

/* Junction dot where each stem meets the crossbar */
.sm-branch::after {
  content: '';
  position: absolute;
  top: -55px;
  left: 50%;
  transform: translateX(-50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  z-index: 2;
  opacity: 0.8;
}

/* =====================================================
 * CATEGORY HEADER CARD — glassmorphism + gradient strip
 * ===================================================== */
.sm-category {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.4rem 1.1rem 1.2rem;
  background: linear-gradient(160deg, var(--bg) 55%, var(--accent-soft) 100%);
  border: 1px solid var(--accent-border);
  border-radius: 18px;
  text-align: center;
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition:
    transform 0.22s cubic-bezier(0.34, 1.3, 0.64, 1),
    box-shadow 0.22s ease;
}

/* Gradient accent strip at top */
.sm-category::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-strip);
  border-radius: 18px 18px 0 0;
}

/* Numbered label (data-num attr) — top right */
.sm-category::after {
  content: attr(data-num);
  position: absolute;
  top: 0.7rem;
  right: 0.8rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
  opacity: 0.55;
}

.sm-category:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow:
    0 12px 32px var(--accent-glow),
    0 2px 8px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

[data-theme="dark"] .sm-category {
  background: linear-gradient(160deg, rgba(255,255,255,0.04) 55%, var(--accent-soft) 100%);
  border-color: transparent;
  box-shadow: 0 2px 20px rgba(0,0,0,0.35);
}

[data-theme="dark"] .sm-category:hover {
  border-color: var(--accent-border);
  box-shadow: 0 12px 32px var(--accent-glow), 0 2px 8px rgba(0,0,0,0.25);
}

.sm-cat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 12px;
  color: var(--accent);
}

.sm-cat-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  letter-spacing: -0.015em;
}

.sm-cat-badge {
  font-size: 0.67rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  letter-spacing: 0.03em;
}

/* =====================================================
 * PAGE LINK LIST
 * ===================================================== */
.sm-links {
  list-style: none;
  margin: 0;
  padding: 1.5rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  position: relative;
}

/* Short stem: category card → first page link */
.sm-links::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 1.5rem;
  background: linear-gradient(to bottom, var(--accent), rgba(200, 200, 220, 0.3));
}

/* ── Individual page link ── */
.sm-link {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.68rem 0.9rem 0.68rem 1rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent-border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.83rem;
  font-weight: 500;
  z-index: 0;
  transition:
    transform 0.2s cubic-bezier(0.22, 1, 0.36, 1),
    border-left-color 0.2s ease,
    box-shadow 0.2s ease;
}

/* Sweeping fill — slides in from left on hover */
.sm-link::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent-soft);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: -1;
  border-radius: inherit;
}

.sm-link:hover {
  transform: translateX(5px);
  border-left-color: var(--accent);
  box-shadow: 0 3px 12px var(--accent-glow);
}

.sm-link:hover::before { transform: scaleX(1); }

[data-theme="dark"] .sm-link {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.07);
  border-left-color: var(--accent-border);
}

.sm-link-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Anchor section indicator */
.sm-link--anchor .sm-link-name::before {
  content: '#';
  font-size: 0.8em;
  font-weight: 700;
  opacity: 0.45;
  margin-right: 0.2em;
  color: var(--accent);
}

.sm-link-arrow {
  color: var(--muted);
  flex-shrink: 0;
  transition: transform 0.18s ease, color 0.18s ease;
}

.sm-link:hover .sm-link-arrow {
  color: var(--accent);
  transform: translateX(3px);
}

/* =====================================================
 * LEGEND
 * ===================================================== */
.sm-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

.sm-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.32rem 0.8rem;
  border-radius: 100px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  letter-spacing: 0.01em;
  transition: transform 0.15s ease;
}

.sm-legend-item:hover { transform: scale(1.04); }

.sm-legend-item::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* =====================================================
 * ENTRANCE ANIMATIONS (self-contained, no JS)
 * ===================================================== */
@media (prefers-reduced-motion: no-preference) {
  .sm-eyebrow  { animation: smFadeUp 0.45s ease both; animation-delay: 0.05s; }
  .sm-title    { animation: smFadeUp 0.5s  ease both; animation-delay: 0.12s; }
  .sm-subtitle { animation: smFadeUp 0.45s ease both; animation-delay: 0.2s;  }
  .sm-stats    { animation: smFadeIn 0.4s  ease both; animation-delay: 0.3s;  }

  .sm-home-node {
    animation: smFadeUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) both, smPulseGlow 3.5s ease-in-out 0.7s infinite;
    animation-delay: 0.1s, 0.7s;
  }

  .sm-branch:nth-child(1) { animation: smFadeUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; animation-delay: 0.22s; }
  .sm-branch:nth-child(2) { animation: smFadeUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; animation-delay: 0.32s; }
  .sm-branch:nth-child(3) { animation: smFadeUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; animation-delay: 0.42s; }
  .sm-branch:nth-child(4) { animation: smFadeUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; animation-delay: 0.52s; }

  .sm-legend { animation: smFadeIn 0.5s ease both; animation-delay: 0.65s; }
}

/* =====================================================
 * RESPONSIVE
 * ===================================================== */

/* Tablet: 2-column, hide tree connectors */
@media (max-width: 900px) {
  .sm-branches {
    grid-template-columns: repeat(2, 1fr);
    padding-top: 0;
    margin-top: 2rem;
    gap: 1.25rem;
  }

  .sm-branches::before,
  .sm-branches::after,
  .sm-branch::before,
  .sm-branch::after,
  .sm-trunk {
    display: none;
  }

  .sm-hero { padding: 5.5rem 0 2.5rem; }
}

/* Mobile: single column */
@media (max-width: 560px) {
  .sm-branches { grid-template-columns: 1fr; }

  .sm-hero { padding: 4.5rem 0 2rem; }

  .sm-home-node {
    width: 100%;
    max-width: 100%;
    padding: 1rem 1.4rem;
    box-sizing: border-box;
  }

  .sm-title { font-size: clamp(2rem, 8vw, 2.8rem); }

  .sm-stats {
    flex-direction: column;
    gap: 0.4rem;
    border-radius: 14px;
    padding: 0.75rem 1.2rem;
    text-align: center;
  }

  .sm-stat-divider { display: none; }
  .sm-legend { gap: 0.5rem; }
}
