/* ============================================================
   Organigrama Municipal · Municipalidad de El Monte
   Paleta verde institucional · Roboto
   ============================================================ */

:root {
  --green:        #349e60;
  --green-dark:   #2b7a4b;
  --green-deep:   #16311f;
  --green-soft:   rgba(52,158,96,0.11);
  --text:         #16311f;
  --sub:          #6b8375;
  --card-bg:      #ffffff;
  --card-border:  #e0eee5;
  --line:         #cfe3d6;
  --line-hi:      linear-gradient(180deg,#63c58c,#349e60);
  --band-bg:      #f6fbf7;
  --band-border:  #e4f0e8;
  --chip-bg:      #eef6f0;
  --shadow:       0 6px 18px rgba(31,102,64,0.08);
  --glow:         0 14px 34px rgba(52,158,96,0.24);
  --radius:       14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Roboto', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg,#f3f9f4 0%,#eaf4ed 100%);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--green-dark); }
a:hover { color: var(--green); }

/* ---------- Stage & header ---------- */
.org-stage {
  position: relative;
  padding: 34px 22px 46px;
  min-height: 100vh;
}
.org-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.org-kicker {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--green);
}
.org-title {
  font-size: 29px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.4px;
  color: var(--green-deep);
  margin: 0;
}
.org-subtitle {
  font-size: 13.5px;
  color: var(--sub);
  font-weight: 500;
  margin: 0;
}

/* ---------- Tree layout ---------- */
.org-tree-wrap {
  position: relative;
  overflow-x: auto;
  padding-bottom: 10px;
}
.org-tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 1180px;
  margin: 20px auto 0;
  min-width: 320px;
}
.org-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: orgFade .5s ease both;
}
.org-crown { width: 300px; max-width: 86vw; }

/* connector spine */
.org-spine {
  width: 2px;
  height: 34px;
  background: var(--line);
  border-radius: 2px;
  transition: background .3s ease;
}
.org-tree.is-hovering .org-spine { background: var(--green); }

/* staff rows (two side-by-side) */
.org-staff-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  animation: orgFade .5s ease both;
}
.org-staff-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 270px;
  max-width: 86vw;
}
.org-staff-tag {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--sub);
}

/* directions band */
.org-band {
  width: 100%;
  background: var(--band-bg);
  border: 1px solid var(--band-border);
  border-radius: 20px;
  padding: 22px 20px 24px;
  margin-top: 4px;
  animation: orgFade .55s ease both;
}
.org-band-label {
  text-align: center;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 20px;
}
.org-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

/* ---------- Card ---------- */
.org-card {
  position: relative;
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .34s cubic-bezier(.22,1,.36,1),
              box-shadow .34s ease, filter .34s ease, border-color .2s ease;
}
.org-card__bar {
  height: 5px;
  width: 100%;
  background: var(--green);
  opacity: .85;
  transition: opacity .2s ease;
}
.org-card__inner {
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.org-card__row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.org-avatar {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg,#63c58c,#349e60);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: .5px;
  box-shadow: 0 4px 14px rgba(52,158,96,0.35);
  overflow: hidden;
}
.org-avatar img { width: 100%; height: 100%; object-fit: cover; }
/* placeholder silueta en tarjeta */
.org-avatar--ph { background: linear-gradient(135deg,#eef7f0,#d7ecdf); box-shadow: 0 4px 14px rgba(52,158,96,0.22); }
.org-avatar--ph .org-silh { width: 72%; height: 72%; }
.org-silh { display: block; }
.org-silh circle, .org-silh path { fill: #349e60; }
.org-avatar--ph .org-silh circle, .org-avatar--ph .org-silh path { fill: #349e60; }
.org-card__col { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.org-card__unit {
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1.2;
  color: var(--text);
  text-wrap: pretty;
}
.org-card__person {
  font-size: 12.5px;
  color: var(--sub);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.org-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.org-tag {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: var(--green);
  background: var(--green-soft);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 62%;
}
.org-cta {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--sub);
  white-space: nowrap;
  transition: color .2s ease;
}

/* hover: only the hovered card lifts + glows; others dim */
.org-card:hover {
  transform: translateY(-6px) scale(1.015);
  box-shadow: var(--glow);
  border-color: var(--green);
}
.org-card:hover .org-cta { color: var(--green); }
.org-tree.is-hovering .org-card:not(:hover) {
  filter: saturate(.45) opacity(.42);
}

/* ---------- Popup / modal ---------- */
.org-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(22,49,31,0.4);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 18px;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity .28s ease, visibility .28s ease;
}
.org-overlay.is-open { opacity: 1; visibility: visible; }

.org-panel {
  position: relative;
  width: min(720px, 96vw);
  background: rgba(255,255,255,0.82);
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: 24px;
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  box-shadow: 0 30px 80px rgba(20,50,32,0.32);
  padding: 30px 30px 34px;
  margin-bottom: 40px;
  transform: translateY(20px) scale(.97);
  opacity: 0;
  transition: transform .34s cubic-bezier(.22,1,.36,1), opacity .34s ease;
}
.org-overlay.is-open .org-panel { transform: translateY(0) scale(1); opacity: 1; }

.org-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--green);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(20,50,32,0.25);
}
.org-panel__head {
  display: flex;
  gap: 18px;
  align-items: center;
  padding-right: 44px;
}
.org-panel__avatar {
  flex: 0 0 auto;
  width: 200px;
  height: 200px;
  border-radius: 20px;
  background: linear-gradient(135deg,#63c58c,#349e60);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: 700;
  box-shadow: 0 12px 28px rgba(46,142,85,0.32);
  overflow: hidden;
  position: relative;
}
/* anillo verde elegante alrededor de la foto */
.org-panel__avatar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 20px;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,0.85), 0 0 0 1px var(--card-border);
  pointer-events: none;
}
.org-panel__avatar img { width: 100%; height: 100%; object-fit: cover; }
/* con foto: 200x200 */
.org-panel__avatar--photo { width: 200px; height: 270px; border-radius: 20px; font-size: 0; }
/* placeholder silueta en la ficha */
.org-panel__avatar--ph { background: linear-gradient(135deg,#eef7f0,#d7ecdf); box-shadow: 0 12px 28px rgba(46,142,85,0.18); }
.org-panel__avatar--ph .org-silh { width: 66%; height: 66%; }
.org-panel__cat {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--green);
}
.org-panel__unit {
  font-size: 23px;
  font-weight: 900;
  line-height: 1.12;
  color: var(--green-deep);
  text-wrap: pretty;
  margin: 4px 0;
}
.org-panel__person { font-size: 15px; font-weight: 500; color: var(--sub); }
/* ficha de órgano colegiado (Concejo): sin avatar, título destacado */
.org-panel__head--group { display: block; padding-right: 44px; }
.org-panel__head--group .org-panel__unit {
  font-size: 30px;
  line-height: 1.1;
  margin: 6px 0 2px;
}
.org-panel__head--group .org-panel__cat { font-size: 12.5px; }

.org-contact { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.org-chip {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: var(--chip-bg);
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
}
a.org-chip { color: var(--green); }

.org-people {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px,1fr));
  gap: 12px;
  margin-top: 20px;
}
.org-person {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--band-bg);
  border: 1px solid var(--band-border);
  border-radius: 14px;
}
.org-person__dot {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}
.org-person__name { font-size: 13.5px; font-weight: 700; line-height: 1.2; }
/* concejal con foto: mini-retrato */
.org-person__dot--photo {
  width: 108px;
  height: 136px;
  border-radius: 10px;
  overflow: hidden;
  background: #eef7f0;
}
.org-person__dot--photo img { width: 100%; height: 100%; object-fit: cover; }
.org-person__mail {
  font-size: 11.5px;
  color: var(--sub);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.org-summary {
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  margin-top: 20px;
  font-weight: 400;
  text-wrap: pretty;
}
.org-more {
  margin-top: 18px;
  background: var(--green-soft);
  color: var(--green);
  border: none;
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.org-funcs-head {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--sub);
  margin: 20px 0 10px;
}
.org-funcs {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.org-funcs li { font-size: 14px; line-height: 1.55; color: var(--text); }
.org-hidden { display: none; }

@keyframes orgFade {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Responsivo ---------- */
@media (max-width: 760px) {
  .org-stage { padding: 26px 14px 40px; }
  .org-staff-row { gap: 14px; }
  .org-staff-cell { width: 88vw; max-width: 360px; }
  .org-crown { width: 88vw; max-width: 360px; }
  .org-band { padding: 18px 14px 20px; }
  .org-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
}

@media (max-width: 560px) {
  .org-title { font-size: 23px; }
  .org-subtitle { font-size: 13px; }
  .org-grid { grid-template-columns: 1fr; }
  .org-overlay { padding: 22px 12px; }
  .org-panel { padding: 24px 18px 28px; border-radius: 20px; }
  .org-panel__unit { font-size: 20px; }
  /* ficha: avatar arriba y centrado en pantallas chicas */
  .org-panel__head { flex-direction: column; align-items: center; text-align: center; gap: 14px; padding-right: 0; }
  .org-panel__avatar,
  .org-panel__avatar--photo { width: 160px; height: 160px; }
  .org-contact { justify-content: center; }
  .org-people { grid-template-columns: 1fr; }
  .org-close { top: 12px; right: 12px; }
}
