/* ❖ Org Chart — ORBAT Military Command Chain — Averil0814 ❖ */

/* ═══════════════════════════════════════════════════════════
   SECTION WRAPPER
   ═══════════════════════════════════════════════════════════ */
#org-chart {
  padding: 80px 0 120px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%,   rgba(0,40,80,.35) 0%, transparent 70%),
    linear-gradient(180deg, #020609 0%, #050d18 40%, #030810 100%);
  position: relative;
  overflow: hidden;
}

/* tactical grid */
#org-chart::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg,   transparent, transparent 59px, rgba(0,180,220,.025) 60px),
    repeating-linear-gradient(90deg,  transparent, transparent 59px, rgba(0,180,220,.025) 60px);
  pointer-events: none;
  z-index: 0;
}

/* radar sweep */
#org-chart::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(0,210,255,.18) 30%, rgba(0,210,255,.35) 50%, rgba(0,210,255,.18) 70%, transparent 100%);
  animation: org-sweep 8s linear infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes org-sweep { 0% { top: -1px; } 100% { top: 100%; } }

/* ═══════════════════════════════════════════════════════════
   INNER / HEADER
   ═══════════════════════════════════════════════════════════ */
.org-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 2;
}

#org-chart .section-header { text-align: center; margin-bottom: 52px; }

/* ── Loading / Error ── */
.org-loading,
.org-error {
  text-align: center;
  padding: 60px 20px;
  color: #3a6a7a;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.05rem;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.org-error { color: #c0392b; }

/* ═══════════════════════════════════════════════════════════
   HQ BANNER  (top of chain)
   ═══════════════════════════════════════════════════════════ */
.org-hq-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
}

.org-hq-box {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 32px;
  background: rgba(0,20,40,.85);
  border: 1px solid rgba(0,210,255,.5);
  box-shadow:
    0 0 0 1px rgba(0,210,255,.12),
    0 0 24px rgba(0,210,255,.1),
    inset 0 0 20px rgba(0,210,255,.04);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
  position: relative;
}

.org-hq-box::before,
.org-hq-box::after {
  content: '';
  position: absolute;
  width: 8px; height: 8px;
  border-color: rgba(0,210,255,.7);
  border-style: solid;
}
.org-hq-box::before { top: 4px;  left: 4px;  border-width: 2px 0 0 2px; }
.org-hq-box::after  { bottom: 4px; right: 4px; border-width: 0 2px 2px 0; }

.org-hq-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(0,210,255,.5);
  box-shadow: 0 0 12px rgba(0,210,255,.3);
}

.org-hq-text { display: flex; flex-direction: column; gap: 2px; }

.org-hq-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.25rem;
  font-weight: 900;
  color: #e0f8ff;
  letter-spacing: .25em;
  text-transform: uppercase;
}

.org-hq-sub {
  font-family: 'Rajdhani', sans-serif;
  font-size: .8rem;
  color: rgba(0,210,255,.55);
  letter-spacing: .2em;
}

/* ═══════════════════════════════════════════════════════════
   COMMAND CHAIN
   ═══════════════════════════════════════════════════════════ */
.org-chain {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.org-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.org-connector-line {
  width: 2px;
  height: 32px;
  background: linear-gradient(180deg, rgba(0,210,255,.5) 0%, rgba(0,210,255,.2) 100%);
  position: relative;
}

.org-connector-line::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%) rotate(45deg);
  width: 6px; height: 6px;
  background: #00d2ff;
  box-shadow: 0 0 6px #00d2ff;
}

/* ═══════════════════════════════════════════════════════════
   UNIT BOX
   ═══════════════════════════════════════════════════════════ */
.org-unit {
  width: 100%;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .45s ease, transform .45s ease;
}
.org-unit.visible { opacity: 1; transform: translateY(0); }

.org-unit-frame {
  background: rgba(2,12,24,.88);
  border: 1px solid var(--uc, rgba(0,210,255,.2));
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,.4),
    0 2px 20px rgba(0,0,0,.5);
  position: relative;
  overflow: hidden;
}

.org-unit-frame::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--uc, #00d2ff);
  box-shadow: 0 0 10px var(--uc, #00d2ff);
}

.org-unit-frame::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  border-top: 20px solid var(--uc, rgba(0,210,255,.4));
  border-left: 20px solid transparent;
}

/* ── Unit header ── */
.org-unit-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px 10px 18px;
  background: rgba(0,15,30,.6);
  border-bottom: 1px solid rgba(255,255,255,.05);
}

.org-unit-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--uc, #00d2ff);
  box-shadow: 0 0 8px var(--uc, #00d2ff);
  flex-shrink: 0;
}

.org-unit-name {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ddf0ff;
  letter-spacing: .14em;
  text-transform: uppercase;
  flex: 1;
}

.org-unit-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.org-unit-code {
  font-family: 'Orbitron', sans-serif;
  font-size: .62rem;
  color: var(--uc, #00d2ff);
  letter-spacing: .1em;
  padding: 2px 8px;
  border: 1px solid var(--uc, #00d2ff);
  opacity: .75;
}

.org-unit-count {
  font-family: 'Orbitron', sans-serif;
  font-size: .62rem;
  color: rgba(255,255,255,.35);
  letter-spacing: .08em;
  white-space: nowrap;
}

/* ── Roster grid ── */
.org-unit-roster {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 12px;
  padding: 18px 20px 18px 18px;
}

.org-unit-roster.collapsed .org-pilot-card:nth-child(n+13) {
  display: none;
}

/* ── Pilot card ── */
.org-pilot-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 64px;
  cursor: default;
  position: relative;
}

.org-pilot-avatar-wrap {
  position: relative;
  width: 52px; height: 52px;
}

.org-pilot-avatar-wrap::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid var(--uc, rgba(0,210,255,.3));
  transition: border-color .2s, box-shadow .2s;
}

.org-pilot-card:hover .org-pilot-avatar-wrap::before {
  border-color: var(--uc, #00d2ff);
  box-shadow: 0 0 10px var(--uc, rgba(0,210,255,.4));
}

.org-pilot-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: #0a1520;
}

.org-pilot-crown {
  position: absolute;
  top: -10px; right: -8px;
  font-size: 14px;
  line-height: 1;
  filter: drop-shadow(0 0 5px rgba(255,215,0,.7));
  user-select: none;
  pointer-events: none;
}

.org-pilot-card.is-owner .org-pilot-avatar-wrap::before {
  border-color: rgba(255,215,0,.7);
  box-shadow: 0 0 12px rgba(255,215,0,.25);
}

.org-pilot-name {
  font-family: 'Rajdhani', sans-serif;
  font-size: .7rem;
  font-weight: 600;
  color: rgba(200,230,255,.75);
  letter-spacing: .03em;
  text-align: center;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.org-pilot-card.is-owner .org-pilot-name { color: rgba(255,215,0,.85); }

/* ── Toggle ── */
.org-roster-toggle {
  width: 100%;
  padding: 7px 18px;
  background: rgba(0,210,255,.04);
  border: none;
  border-top: 1px solid rgba(0,210,255,.08);
  color: rgba(0,210,255,.5);
  font-family: 'Rajdhani', sans-serif;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .12em;
  cursor: pointer;
  text-align: center;
  transition: background .2s, color .2s;
}
.org-roster-toggle:hover {
  background: rgba(0,210,255,.08);
  color: rgba(0,210,255,.85);
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .org-hq-box { padding: 12px 20px; }
  .org-hq-name { font-size: 1rem; letter-spacing: .15em; }
  .org-unit-header { padding: 9px 14px; }
  .org-unit-roster { padding: 14px; gap: 12px 10px; }
  .org-pilot-card { width: 54px; }
  .org-pilot-avatar, .org-pilot-avatar-wrap { width: 44px; height: 44px; }
}
