/* ===== Brand Tree Section ===== */
.brand-tree-section {
    position: relative;
    padding: 60px 0 60px;
    background: linear-gradient(180deg, #fff 0%, #F8F9FA 40%, #F8F9FA 100%);
    overflow: hidden;
}
.brand-tree-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(26,60,122,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

/* Tree Container */
.tree-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.tree-canvas {
    position: relative;
    width: 100%;
    min-height: 900px;
    background: linear-gradient(180deg,
        rgba(26,60,122,0.02) 0%,
        rgba(74,124,89,0.04) 30%,
        rgba(74,124,89,0.06) 60%,
        rgba(139,90,43,0.05) 100%
    );
    border-radius: 16px;
    overflow: hidden;
}
.tree-trunk {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 55%;
    background: linear-gradient(180deg, rgba(139,90,43,0.35) 0%, rgba(139,90,43,0.6) 100%);
    border-radius: 9px 9px 0 0;
    z-index: 1;
}
.tree-trunk::after {
    content: '';
    position: absolute;
    bottom: 0; left: 50%;
    transform: translateX(-50%);
    width: 36px; height: 30px;
    background: radial-gradient(ellipse, rgba(139,90,43,0.5) 0%, transparent 70%);
    border-radius: 50%;
}
.tree-branch {
    position: absolute;
    height: 4px;
    background: linear-gradient(90deg, rgba(139,90,43,0.4), rgba(74,124,89,0.3));
    border-radius: 2px;
    z-index: 1;
    transform-origin: left center;
}
.tree-branch.left { transform-origin: right center; }
.tree-branch::after {
    content: '';
    position: absolute;
    inset: -2px -4px;
    background: radial-gradient(ellipse at center, rgba(74,124,89,0.1) 0%, transparent 70%);
    border-radius: 50%;
}
.tree-canvas::before {
    content: '';
    position: absolute;
    top: 8%;
    left: 30%;
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(200,164,92,0.06) 0%, transparent 70%);
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
}
.tree-canvas::after {
    content: '';
    position: absolute;
    top: 25%;
    right: 15%;
    width: 160px; height: 160px;
    background: radial-gradient(circle, rgba(26,60,122,0.05) 0%, transparent 70%);
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
}
.brand-nodes-layer {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 5;
}
.brand-node {
    position: absolute;
    z-index: 10;
    pointer-events: auto;
    opacity: 0;
    transform: scale(0);
    transition: opacity 0s, transform 0s;
}
.brand-node.pop {
    animation: nodePopIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
}
@keyframes nodePopIn {
    0% { opacity: 0; transform: scale(0) translateY(20px); }
    60% { opacity: 1; transform: scale(1.15) translateY(-4px); }
    80% { transform: scale(0.95) translateY(0); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}
.brand-node:hover .node-glow-ring,
.brand-node.pop:hover .node-glow-ring {
    animation: pulseGlow 1.8s ease-in-out infinite;
}
@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(200,164,92,0.35), 0 6px 24px rgba(26,60,122,0.18); }
    50% { box-shadow: 0 0 0 14px rgba(200,164,92,0), 0 10px 32px rgba(26,60,122,0.25); }
}
.brand-node.root-node .node-card {
    background: #fff;
    border-radius: 50%;
    width: 140px; height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 4px solid var(--gold);
    box-shadow: 0 8px 30px rgba(26,60,122,0.20), inset 0 0 15px rgba(200,164,92,0.06);
    position: relative;
    cursor: default;
    overflow: hidden;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.brand-node.root-node .node-card::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent, rgba(200,164,92,0.25), transparent 40%);
    animation: rootRingSpin 6s linear infinite;
    z-index: -1;
}
@keyframes rootRingSpin { to { transform: rotate(360deg); } }
.brand-node.root-node .node-card:hover { transform: scale(1.08); }
.brand-node.root-node .node-title { font-size: 18px; font-weight: 900; color: var(--primary); letter-spacing: 3px; line-height: 1.3; }
.brand-node.root-node .node-sub { font-size: 11px; color: var(--gold-dark); letter-spacing: 2px; margin-top: 3px; font-style: italic; }

.brand-node.center-node .node-card {
    background: #fff;
    border-radius: 50%;
    width: 120px; height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 3px solid var(--primary);
    box-shadow: 0 5px 22px rgba(26,60,122,0.15);
    position: relative;
    cursor: default;
    transition: all 0.35s;
}
.brand-node.center-node .node-card:hover { transform: translateY(-6px) scale(1.07); box-shadow: 0 12px 36px rgba(26,60,122,0.22); border-color: var(--gold); }
.brand-node.center-node .node-title { font-size: 16px; font-weight: 800; color: var(--primary); letter-spacing: 2px; line-height: 1.3; }
.brand-node.center-node .node-sub { font-size: 9px; color: var(--gold); letter-spacing: 1px; margin-top: 2px; }
.brand-node.center-node .node-desc { font-size: 10px; color: #888; margin-top: 2px; }

.brand-node .node-card {
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 50%;
    width: 96px; height: 96px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 2px solid rgba(255,255,255,0.85);
    box-shadow: 0 4px 18px rgba(26,60,122,0.12);
    cursor: default;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    z-index: 1;
}
.brand-node .node-card:hover {
    transform: translateY(-6px) scale(1.13);
    box-shadow: 0 10px 30px rgba(26,60,122,0.22);
    border-color: var(--gold);
    background: #fff;
}
.node-glow-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid transparent;
    pointer-events: none;
    z-index: 0;
    transition: box-shadow 0.3s;
}
.brand-node .node-title { font-size: 13px; font-weight: 700; color: var(--primary); letter-spacing: 0.5px; line-height: 1.3; padding: 0 4px; }
.brand-node .node-sub { font-size: 9px; color: var(--gold-dark); letter-spacing: 0.5px; margin-top: 2px; }

.replay-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    border: none;
    border-radius: 30px;
    font-size: 14px;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 16px rgba(26,60,122,0.25);
    position: relative;
    z-index: 20;
}
.replay-btn:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(26,60,122,0.35); }

/* Wrap */
.wrap {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px 40px;
}

/* Card Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}
.card-img {
    transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1), filter 0.42s ease;
    display: block;
    margin: 0 auto;
}
.cert-card {
    width: 100%;
    min-height: 160px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.07);
    padding: 24px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    opacity: 0;
    transform: translateY(30px) scale(0.96) translateZ(0);
    will-change: transform, opacity, box-shadow;
    transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.38s ease,
                background 0.38s ease,
                filter 0.38s ease;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}
.card-grid:has(.cert-card:hover) .cert-card:not(:hover) {
    filter: brightness(0.72) saturate(0.7);
    transform: scale(0.97) translateZ(0);
}
.cert-card:hover {
    transform: translateY(-14px) scale(1.10) translateZ(0) !important;
    background: linear-gradient(135deg, #1A3C7A 0%, #0F2955 50%, #C8A45C 100%);
    box-shadow: 0 24px 60px rgba(26,60,122,0.40), 0 0 0 3px rgba(200,164,92,0.80), 0 0 40px rgba(200,164,92,0.30), inset 0 1px 0 rgba(255,255,255,0.15);
    z-index: 10;
}
.cert-card:hover .card-img {
    transform: scale(1.12) rotate(-2deg);
    filter: drop-shadow(0 4px 16px rgba(200,164,92,0.55)) brightness(1.08);
}
.cert-card p {
    font-size: 14px;
    color: #444;
    font-weight: 600;
    letter-spacing: 1.5px;
    margin-top: 10px;
    transition: color 0.3s, text-shadow 0.3s, letter-spacing 0.3s;
}
.cert-card:hover p {
    color: #fff;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-shadow: 0 0 12px rgba(200,164,92,0.8), 0 2px 8px rgba(0,0,0,0.3);
}
.cert-card::before {
    content: "";
    position: absolute;
    top: 0; left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(105deg, transparent 20%, rgba(255,255,255,0.18) 50%, transparent 80%);
    transition: left 0s;
    z-index: 2;
    pointer-events: none;
    border-radius: 12px;
}
.cert-card:hover::before {
    left: 160%;
    transition: left 0.55s ease;
}
.cert-card::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 16px;
    border: 2px solid rgba(200,164,92,0);
    box-shadow: 0 0 0 0 rgba(200,164,92,0);
    transition: border-color 0.38s, box-shadow 0.38s;
    pointer-events: none;
    z-index: 3;
}
.cert-card:hover::after {
    border-color: rgba(200,164,92,0.9);
    box-shadow: 0 0 18px 4px rgba(200,164,92,0.35), 0 0 40px 10px rgba(26,60,122,0.20);
    animation: pulseRing 1.8s ease-in-out infinite;
}
@keyframes pulseRing {
    0%, 100% { box-shadow: 0 0 18px 4px rgba(200,164,92,0.35), 0 0 40px 10px rgba(26,60,122,0.20); }
    50%       { box-shadow: 0 0 28px 10px rgba(200,164,92,0.55), 0 0 60px 20px rgba(26,60,122,0.30); }
}
.cert-card.highlight { border: 2px solid rgba(200,164,92,0.4); }

.card-grid .cert-card:nth-child(1)  { animation: cardIn 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards 0.10s; }
.card-grid .cert-card:nth-child(2)  { animation: cardIn 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards 0.22s; }
.card-grid .cert-card:nth-child(3)  { animation: cardIn 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards 0.34s; }
.card-grid .cert-card:nth-child(4)  { animation: cardIn 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards 0.46s; }
.card-grid .cert-card:nth-child(5)  { animation: cardIn 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards 0.58s; }
.card-grid .cert-card:nth-child(6)  { animation: cardIn 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards 0.70s; }
.card-grid .cert-card:nth-child(7)  { animation: cardIn 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards 0.82s; }
.card-grid .cert-card:nth-child(8)  { animation: cardIn 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards 0.94s; }
.card-grid .cert-card:nth-child(9)  { animation: cardIn 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards 1.06s; }
.card-grid .cert-card:nth-child(10) { animation: cardIn 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards 1.18s; }
.card-grid .cert-card:nth-child(11) { animation: cardIn 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards 1.30s; }
.card-grid .cert-card:nth-child(12) { animation: cardIn 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards 1.42s; }
.card-grid .cert-card:nth-child(13) { animation: cardIn 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards 1.54s; }
.card-grid .cert-card:nth-child(14) { animation: cardIn 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards 1.66s; }
.card-grid .cert-card:nth-child(15) { animation: cardIn 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards 1.78s; }
.card-grid .cert-card:nth-child(16) { animation: cardIn 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards 1.90s; }
.card-grid .cert-card:nth-child(17) { animation: cardIn 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards 2.02s; }
@keyframes cardIn {
    0% { opacity: 0; transform: translateY(30px) scale(0.96) translateZ(0); }
    100% { opacity: 1; transform: translateY(0) scale(1) translateZ(0); }
}

/* ===== Brand Page Responsive ===== */
@media (max-width: 1200px) {
    .tree-canvas { min-height: 800px; }
    .brand-node.root-node .node-card { width: 120px; height: 120px; }
    .brand-node.center-node .node-card { width: 105px; height: 105px; }
    .brand-node .node-card { width: 84px; height: 84px; }
    .brand-node .node-title { font-size: 12px; }
}

@media (max-width: 900px) {
    .brand-tree-section { padding: 60px 0 80px; }
    .tree-desktop-view { display: none !important; }
    .tree-mobile-grid { display: grid !important; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 700px; margin:0 auto; padding:0 20px; }
    .brand-node.root-node .node-card { width: auto; height: auto; border-radius: 50%; padding: 18px 20px; min-width: 120px; }
    .brand-node.center-node .node-card { width: auto; height: auto; border-radius: 14px; padding: 16px 18px; }
    .brand-node .node-card { width: auto; height: auto; border-radius: 10px; padding: 12px 14px; min-width: 100px; }
    .replay-btn:hover { transform: translateY(-3px); }
}

@media (max-width: 768px) {
    .brand-tree-section { padding: 40px 0 60px; }
    .tree-container { padding: 0 16px; }
    .brand-node.root-node .node-card { width: auto; height: auto; padding: 14px 18px; min-width: 100px; }
    .brand-node.center-node .node-card { width: auto; height: auto; border-radius: 12px; padding: 14px 16px; }
    .brand-node .node-card { width: auto; height: auto; border-radius: 8px; padding: 10px 10px; min-width: auto; }
    .brand-node .node-title { font-size: 11px; }
    .tree-mobile-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

    .card-grid { grid-template-columns: repeat(4, 1fr); gap: 10px; }
    .cert-card { min-height: 110px; padding: 10px 6px; }
    .card-img { width: 100px; height: 100px; margin-bottom: 6px; }
    .cert-card p { font-size: 11px; line-height: 1.3; }
    .cert-card:hover { transform: translateY(-6px) scale(1.03) translateZ(0) !important; box-shadow: 0 10px 30px rgba(26,60,122,0.25), 0 0 0 2px rgba(200,164,92,0.6); }
    .cert-card:hover .card-img { transform: scale(1.06); }
    .card-grid:has(.cert-card:hover) .cert-card:not(:hover) { filter: none; transform: scale(1) translateZ(0); }
    .cert-card { transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease; }
    .wrap { padding: 0 8px 40px; }
}

@media (max-width: 480px) {
    .tree-mobile-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .brand-node .node-card { padding: 8px 10px; min-width: auto; }
    .brand-node .node-title { font-size: 10.5px; }
}
