/* ══════════════════════════════════════════════════
   directory.css — ZSM Digital Directory Page
   Tree navigation, page header, branch nodes
   ══════════════════════════════════════════════════ */

/* ── Page Header ── */
.directory-header {
    padding: 140px 40px 60px;
    text-align: center;
    position: relative;
}

.directory-header::after {
    content: '';
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    height: 300px;
    background: radial-gradient(ellipse at center, rgba(255,255,255,0.03) 0%, transparent 70%);
    pointer-events: none;
}

.directory-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50px;
    font-size: 12px;
    color: #888;
    margin-bottom: 20px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 500;
}

.directory-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
}

.directory-header h1 {
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 300;
    letter-spacing: -0.03em;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.directory-header h1 strong {
    font-weight: 600;
}

.directory-header p {
    color: #666;
    font-size: 1rem;
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

/* ── Tree Container ── */
.tree-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 40px 80px;
    position: relative;
}

/* ── Root Node ── */
.tree-root {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 40px;
}

.root-node {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 28px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    text-decoration: none;
    color: #fff;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    overflow: hidden;
}

.root-node::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.06) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.root-node:hover::before { opacity: 1; }

.root-node:hover {
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.root-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.root-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: #fff;
    stroke-width: 1.5;
}

.root-label {
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.root-path {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: #555;
    margin-left: 8px;
}

/* ── Trunk line from root ── */
.trunk-line {
    width: 1px;
    height: 40px;
    background: linear-gradient(to bottom, rgba(255,255,255,0.15), rgba(255,255,255,0.06));
    margin: 0 auto;
}

/* ── Branch Groups ── */
.tree-branches {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.branch-group {
    position: relative;
    padding-left: 48px;
    margin-bottom: 8px;
}

/* Vertical connector line */
.branch-group::before {
    content: '';
    position: absolute;
    left: 23px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--tree-line);
    transition: background 0.4s ease;
}

.branch-group:hover::before {
    background: var(--tree-line-hover);
}

.branch-group:last-child::before {
    height: 24px;
}

/* ── Branch Header (folder) ── */
.branch-header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    margin-bottom: 4px;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s ease;
    user-select: none;
}

.branch-header:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Horizontal connector */
.branch-header::before {
    content: '';
    position: absolute;
    left: -25px;
    top: 50%;
    width: 25px;
    height: 1px;
    background: var(--tree-line);
}

/* Connector dot */
.branch-header::after {
    content: '';
    position: absolute;
    left: -29px;
    top: 50%;
    transform: translateY(-50%);
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--bg-color);
    border: 1.5px solid rgba(255,255,255,0.2);
    transition: all 0.3s ease;
    z-index: 1;
}

.branch-group:hover .branch-header::after {
    border-color: rgba(255,255,255,0.5);
    box-shadow: 0 0 8px rgba(255,255,255,0.1);
}

.branch-icon {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.branch-group:hover .branch-icon {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.branch-icon svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: #888;
    stroke-width: 1.5;
    transition: stroke 0.3s ease;
}

.branch-group:hover .branch-icon svg {
    stroke: #ccc;
}

.branch-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #ccc;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: color 0.3s ease;
}

.branch-group:hover .branch-name {
    color: #fff;
}

.branch-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: #444;
    background: rgba(255, 255, 255, 0.03);
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.branch-chevron {
    margin-left: auto;
    width: 16px;
    height: 16px;
    color: #444;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.branch-group.open .branch-chevron {
    transform: rotate(90deg);
    color: #888;
}

/* ── Leaf Nodes (pages) ── */
.branch-leaves {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.5s cubic-bezier(0.23, 1, 0.32, 1),
                opacity 0.4s ease;
    opacity: 0;
}

.branch-group.open .branch-leaves {
    max-height: 600px;
    opacity: 1;
}

.leaf-node {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px 10px 48px;
    text-decoration: none;
    color: #888;
    border-radius: 8px;
    transition: all 0.3s ease;
    margin-bottom: 2px;
}

.leaf-node:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.03);
}

/* Leaf vertical line */
.leaf-node::before {
    content: '';
    position: absolute;
    left: 23px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--tree-line);
}

.leaf-node:last-child::before {
    height: 50%;
}

/* Leaf horizontal connector */
.leaf-node::after {
    content: '';
    position: absolute;
    left: 23px;
    top: 50%;
    width: 16px;
    height: 1px;
    background: var(--tree-line);
}

.leaf-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.leaf-node:hover .leaf-dot {
    background: #fff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.leaf-label {
    font-size: 0.9rem;
    font-weight: 400;
    transition: transform 0.3s ease;
}

.leaf-node:hover .leaf-label {
    transform: translateX(4px);
}

.leaf-path {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: #333;
    margin-left: auto;
    transition: color 0.3s ease;
    white-space: nowrap;
}

.leaf-node:hover .leaf-path {
    color: #555;
}

.leaf-arrow {
    width: 14px;
    height: 14px;
    color: transparent;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.leaf-node:hover .leaf-arrow {
    color: #555;
    transform: translateX(3px);
}

/* ── Reveal animation ── */
.branch-group {
    opacity: 0;
    transform: translateY(20px);
    animation: branchReveal 0.6s forwards;
}

.branch-group:nth-child(1) { animation-delay: 0.1s; }
.branch-group:nth-child(2) { animation-delay: 0.2s; }
.branch-group:nth-child(3) { animation-delay: 0.3s; }
.branch-group:nth-child(4) { animation-delay: 0.4s; }
.branch-group:nth-child(5) { animation-delay: 0.5s; }
.branch-group:nth-child(6) { animation-delay: 0.6s; }
.branch-group:nth-child(7) { animation-delay: 0.7s; }
.branch-group:nth-child(8) { animation-delay: 0.8s; }

@keyframes branchReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ── Responsive ── */
@media (max-width: 900px) {
    .navbar { padding: 14px 20px; }
    .nav-links, .nav-buttons { display: none; }
    .hamburger { display: flex; }
}

@media (max-width: 768px) {
    .directory-header { padding: 120px 20px 40px; }
    .tree-container { padding: 0 20px 60px; }
    .branch-group { padding-left: 36px; }
    .branch-group::before { left: 15px; }
    .branch-header::before { left: -21px; width: 21px; }
    .branch-header::after { left: -25px; }
    .leaf-node { padding-left: 36px; }
    .leaf-node::before { left: 15px; }
    .leaf-node::after { left: 15px; }
    .leaf-path { display: none; }
    .footer-content { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .directory-header h1 { font-size: 1.6rem; }
    .branch-header { padding: 10px 12px; }
    .leaf-node { padding: 8px 12px 8px 36px; }
}
